Now poc works, it has to be tested

This commit is contained in:
Damiano
2020-08-23 22:01:26 +02:00
parent 963c7aa7c7
commit 5766140122
3 changed files with 67 additions and 44 deletions
+1 -1
View File
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.8\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.5.0\\\\","dependencies":[]}],"android":[{"name":"shared_preferences","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.8\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.5.0\\\\","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+10\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+7\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]},{"name":"shared_preferences_linux","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_linux-0.0.2+1\\\\","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_linux-0.0.1+1\\\\","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+7\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-08-06 13:57:10.819839","version":"1.20.0-7.4.pre"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.8\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.5.0\\\\","dependencies":[]}],"android":[{"name":"shared_preferences","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.8\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.5.0\\\\","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+10\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+7\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]},{"name":"shared_preferences_linux","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_linux-0.0.2+1\\\\","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_linux-0.0.1+1\\\\","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+7\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-08-23 21:57:48.482248","version":"1.21.0-9.1.pre"}
+47 -24
View File
@@ -8,9 +8,7 @@ List<int> positions = [0, 1, 2];
String dataSize = "MB";
String dataSpeed = "MB/s";
String dataDuration = "s";
TextEditingController TEC1 = TextEditingController();
TextEditingController TEC2 = TextEditingController();
TextEditingController TEC3 = TextEditingController();
List<TextEditingController> tecList = [TextEditingController(), TextEditingController(), TextEditingController()];
class ToolsManager extends StatefulWidget {
final Function openDrawer;
@@ -25,7 +23,7 @@ class _ToolsManager extends State<ToolsManager> {
List<Widget> firstCard = new List(3);
@override
Widget build(BuildContext context) {
firstCard[0] = myListTile(
firstCard[0] = MyListTile(
key: ValueKey(0),
selected: positions[2] == 0,
selectedLeading: Image.asset("resources/images/x.png",
@@ -33,14 +31,18 @@ class _ToolsManager extends State<ToolsManager> {
unselectedLeading:
Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54),
title: TextFormField(
controller: TEC1,
controller: tecList[0],
enabled: positions[2] != 0,
decoration: InputDecoration(labelText: "Data size"),
keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false),
onChanged: (String text) {
if (text != "" && TEC2.text != "") {
if (tecList[positions[0]].text != "" && tecList[positions[1]].text != "") {
setState(() {
TEC3.text = (double.parse(text) / double.parse(TEC2.text)).toString();
tecList[positions[2]].text = getResults(positions[2],
dataSize: double.tryParse(tecList[0].text),
transmissionSpeed: double.tryParse(tecList[1].text),
transferDuration: double.tryParse(tecList[2].text))
.toString();
});
}
},
@@ -73,7 +75,7 @@ class _ToolsManager extends State<ToolsManager> {
},
);
firstCard[1] = myListTile(
firstCard[1] = MyListTile(
key: ValueKey(1),
selected: positions[2] == 1,
selectedLeading: Image.asset("resources/images/x.png",
@@ -81,14 +83,18 @@ class _ToolsManager extends State<ToolsManager> {
unselectedLeading:
Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54),
title: TextFormField(
controller: TEC2,
controller: tecList[1],
enabled: positions[2] != 1,
decoration: InputDecoration(labelText: "Transmission speed"),
keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false),
onChanged: (String text) {
if (text != "" && TEC1.text != "") {
if (tecList[positions[0]].text != "" && tecList[positions[1]].text != "") {
setState(() {
TEC3.text = (double.parse(TEC1.text) / double.parse(text)).toString();
tecList[positions[2]].text = getResults(positions[2],
dataSize: double.tryParse(tecList[0].text),
transmissionSpeed: double.tryParse(tecList[1].text),
transferDuration: double.tryParse(tecList[2].text))
.toString();
});
}
},
@@ -121,7 +127,7 @@ class _ToolsManager extends State<ToolsManager> {
},
);
firstCard[2] = myListTile(
firstCard[2] = MyListTile(
key: ValueKey(2),
selected: positions[2] == 2,
selectedLeading: Image.asset("resources/images/x.png",
@@ -129,10 +135,21 @@ class _ToolsManager extends State<ToolsManager> {
unselectedLeading:
Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54),
title: TextFormField(
controller: TEC3,
controller: tecList[2],
enabled: positions[2] != 2,
decoration: InputDecoration(labelText: "Data transfer duration"),
keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false),
onChanged: (String text) {
if (tecList[positions[0]].text != "" && tecList[positions[1]].text != "") {
setState(() {
tecList[positions[2]].text = getResults(positions[2],
dataSize: double.tryParse(tecList[0].text),
transmissionSpeed: double.tryParse(tecList[1].text),
transferDuration: double.tryParse(tecList[2].text))
.toString();
});
}
},
),
trailing: Container(
width: 70,
@@ -194,7 +211,7 @@ class _ToolsManager extends State<ToolsManager> {
icon: Icon(Icons.clear, color: Colors.white),
onPressed: () {
setState(() {
TEC1.text = TEC2.text = TEC3.text = "";
tecList[0].text = tecList[1].text = tecList[2].text = "";
});
},
),
@@ -204,7 +221,7 @@ class _ToolsManager extends State<ToolsManager> {
Icons.search,
color: Colors.white,
),
onPressed: (){},
onPressed: () {},
),
],
)
@@ -252,6 +269,18 @@ class _ToolsManager extends State<ToolsManager> {
}
}
double getResults(int selection, {double transmissionSpeed, double transferDuration, double dataSize}) {
switch (selection) {
case 0:
return (transmissionSpeed * transferDuration);
case 1:
return (dataSize / transferDuration);
case 2:
return (dataSize / transmissionSpeed);
}
return null;
}
class MyAnimatedSwitcher extends StatelessWidget {
final int duration;
final int animationsOverlay;
@@ -259,13 +288,7 @@ class MyAnimatedSwitcher extends StatelessWidget {
final bool selected;
final int tilePosition;
MyAnimatedSwitcher({
this.duration,
this.animationsOverlay,
this.child,
this.selected,
this.tilePosition
});
MyAnimatedSwitcher({this.duration, this.animationsOverlay, this.child, this.selected, this.tilePosition});
@override
Widget build(BuildContext context) {
@@ -302,7 +325,7 @@ class MyAnimatedSwitcher extends StatelessWidget {
}
}
class myListTile extends StatelessWidget {
class MyListTile extends StatelessWidget {
final Key key;
final Function onTap;
final Widget title;
@@ -311,7 +334,7 @@ class myListTile extends StatelessWidget {
final Widget trailing;
final bool selected;
myListTile({this.key, this.onTap, this.title, this.unselectedLeading, this.selectedLeading, this.selected, this.trailing});
MyListTile({this.key, this.onTap, this.title, this.unselectedLeading, this.selectedLeading, this.selected, this.trailing});
@override
Widget build(BuildContext context) {
+19 -19
View File
@@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
version: "2.5.0-nullsafety"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0-nullsafety.2"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.2.0-nullsafety"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0-nullsafety"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
version: "1.15.0-nullsafety.2"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety"
file:
dependency: transitive
description:
@@ -104,21 +104,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
version: "0.12.10-nullsafety"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.2"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
path_provider_linux:
dependency: transitive
description:
@@ -221,49 +221,49 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
version: "1.10.0-nullsafety"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
version: "0.2.19-nullsafety"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0-nullsafety.2"
url_launcher:
dependency: "direct main"
description:
@@ -305,7 +305,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.2"
xdg_directories:
dependency: transitive
description:
@@ -314,5 +314,5 @@ packages:
source: hosted
version: "0.1.0"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.10.0-0.0.dev <2.10.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"