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 dataSize = "MB";
String dataSpeed = "MB/s"; String dataSpeed = "MB/s";
String dataDuration = "s"; String dataDuration = "s";
TextEditingController TEC1 = TextEditingController(); List<TextEditingController> tecList = [TextEditingController(), TextEditingController(), TextEditingController()];
TextEditingController TEC2 = TextEditingController();
TextEditingController TEC3 = TextEditingController();
class ToolsManager extends StatefulWidget { class ToolsManager extends StatefulWidget {
final Function openDrawer; final Function openDrawer;
@@ -25,7 +23,7 @@ class _ToolsManager extends State<ToolsManager> {
List<Widget> firstCard = new List(3); List<Widget> firstCard = new List(3);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
firstCard[0] = myListTile( firstCard[0] = MyListTile(
key: ValueKey(0), key: ValueKey(0),
selected: positions[2] == 0, selected: positions[2] == 0,
selectedLeading: Image.asset("resources/images/x.png", selectedLeading: Image.asset("resources/images/x.png",
@@ -33,14 +31,18 @@ class _ToolsManager extends State<ToolsManager> {
unselectedLeading: unselectedLeading:
Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54), Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54),
title: TextFormField( title: TextFormField(
controller: TEC1, controller: tecList[0],
enabled: positions[2] != 0, enabled: positions[2] != 0,
decoration: InputDecoration(labelText: "Data size"), decoration: InputDecoration(labelText: "Data size"),
keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false), keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false),
onChanged: (String text) { onChanged: (String text) {
if (text != "" && TEC2.text != "") { if (tecList[positions[0]].text != "" && tecList[positions[1]].text != "") {
setState(() { 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), key: ValueKey(1),
selected: positions[2] == 1, selected: positions[2] == 1,
selectedLeading: Image.asset("resources/images/x.png", selectedLeading: Image.asset("resources/images/x.png",
@@ -81,14 +83,18 @@ class _ToolsManager extends State<ToolsManager> {
unselectedLeading: unselectedLeading:
Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54), Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54),
title: TextFormField( title: TextFormField(
controller: TEC2, controller: tecList[1],
enabled: positions[2] != 1, enabled: positions[2] != 1,
decoration: InputDecoration(labelText: "Transmission speed"), decoration: InputDecoration(labelText: "Transmission speed"),
keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false), keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false),
onChanged: (String text) { onChanged: (String text) {
if (text != "" && TEC1.text != "") { if (tecList[positions[0]].text != "" && tecList[positions[1]].text != "") {
setState(() { 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), key: ValueKey(2),
selected: positions[2] == 2, selected: positions[2] == 2,
selectedLeading: Image.asset("resources/images/x.png", selectedLeading: Image.asset("resources/images/x.png",
@@ -129,10 +135,21 @@ class _ToolsManager extends State<ToolsManager> {
unselectedLeading: unselectedLeading:
Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54), Icon(Icons.expand_more, size: 40, color: MediaQuery.of(context).platformBrightness == Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54),
title: TextFormField( title: TextFormField(
controller: TEC3, controller: tecList[2],
enabled: positions[2] != 2, enabled: positions[2] != 2,
decoration: InputDecoration(labelText: "Data transfer duration"), decoration: InputDecoration(labelText: "Data transfer duration"),
keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false), 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( trailing: Container(
width: 70, width: 70,
@@ -194,7 +211,7 @@ class _ToolsManager extends State<ToolsManager> {
icon: Icon(Icons.clear, color: Colors.white), icon: Icon(Icons.clear, color: Colors.white),
onPressed: () { onPressed: () {
setState(() { 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, Icons.search,
color: Colors.white, 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 { class MyAnimatedSwitcher extends StatelessWidget {
final int duration; final int duration;
final int animationsOverlay; final int animationsOverlay;
@@ -259,13 +288,7 @@ class MyAnimatedSwitcher extends StatelessWidget {
final bool selected; final bool selected;
final int tilePosition; final int tilePosition;
MyAnimatedSwitcher({ MyAnimatedSwitcher({this.duration, this.animationsOverlay, this.child, this.selected, this.tilePosition});
this.duration,
this.animationsOverlay,
this.child,
this.selected,
this.tilePosition
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -302,7 +325,7 @@ class MyAnimatedSwitcher extends StatelessWidget {
} }
} }
class myListTile extends StatelessWidget { class MyListTile extends StatelessWidget {
final Key key; final Key key;
final Function onTap; final Function onTap;
final Widget title; final Widget title;
@@ -311,7 +334,7 @@ class myListTile extends StatelessWidget {
final Widget trailing; final Widget trailing;
final bool selected; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
+19 -19
View File
@@ -7,49 +7,49 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.2" version: "2.5.0-nullsafety"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.1.0-nullsafety"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.1.0-nullsafety.2"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.3" version: "1.2.0-nullsafety"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.1.0-nullsafety"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.14.13" version: "1.15.0-nullsafety.2"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0-nullsafety"
file: file:
dependency: transitive dependency: transitive
description: description:
@@ -104,21 +104,21 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.8" version: "0.12.10-nullsafety"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.8" version: "1.3.0-nullsafety.2"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0-nullsafety"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@@ -221,49 +221,49 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0-nullsafety"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.5" version: "1.10.0-nullsafety"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.1.0-nullsafety"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.5" version: "1.1.0-nullsafety"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.2.0-nullsafety"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.17" version: "0.2.19-nullsafety"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.3.0-nullsafety.2"
url_launcher: url_launcher:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -305,7 +305,7 @@ packages:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.1.0-nullsafety.2"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@@ -314,5 +314,5 @@ packages:
source: hosted source: hosted
version: "0.1.0" version: "0.1.0"
sdks: 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" flutter: ">=1.12.13+hotfix.5 <2.0.0"