diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 564e1be..da6c254 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"url_launcher","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"android":[{"name":"shared_preferences","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"url_launcher","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/damiano/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/home/damiano/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-01 13:28:33.903859","version":"1.20.0-7.3.pre"} \ No newline at end of file +{"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-04 19:54:08.462134","version":"1.20.0-7.4.pre"} \ No newline at end of file diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index d5ddecc..ddac2e2 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -1,12 +1,12 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/home/damiano/flutter" -export "FLUTTER_APPLICATION_PATH=/home/damiano/Scrivania/converterpro" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_ROOT=C:\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\Damia\Desktop\ConverterNOW" +export "FLUTTER_TARGET=lib\main.dart" export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "SYMROOT=${SOURCE_ROOT}/../build\ios" export "OTHER_LDFLAGS=$(inherited) -framework Flutter" -export "FLUTTER_FRAMEWORK_DIR=/home/damiano/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_FRAMEWORK_DIR=C:\flutter\bin\cache\artifacts\engine\ios" export "FLUTTER_BUILD_NAME=2.3.1" export "FLUTTER_BUILD_NUMBER=20" export "DART_OBFUSCATION=false" diff --git a/lib/managers/ToolsManager.dart b/lib/managers/ToolsManager.dart index f6046de..3f43b0b 100644 --- a/lib/managers/ToolsManager.dart +++ b/lib/managers/ToolsManager.dart @@ -2,7 +2,11 @@ import 'package:converterpro/utils/Localization.dart'; import 'package:flutter/material.dart'; import 'package:converterpro/utils/Utils.dart'; -int groupValue = 0; +const int ANIMATION_DURATION = 3000; //milliseconds +const int ANIMATIONS_OVERLAY = 10; //percentage (0-100) +int currentSelection = 0; +List positions = [0, 1]; +int ciao = 2; String dataSize = "MB"; String dataSpeed = "MB/s"; String dataDuration = "s"; @@ -10,7 +14,6 @@ TextEditingController TEC1 = TextEditingController(); TextEditingController TEC2 = TextEditingController(); TextEditingController TEC3 = TextEditingController(); - class ToolsManager extends StatefulWidget { final Function openDrawer; @@ -21,131 +24,162 @@ class ToolsManager extends StatefulWidget { } class _ToolsManager extends State { - List firstCard = new List(3); - @override Widget build(BuildContext context) { + firstCard[0] = myListTile( + key: ValueKey(0), + selected: currentSelection == 0, + selectedLeading: Image.asset("resources/images/x.png", + width: 40, + color: MediaQuery.of(context).platformBrightness == Brightness.dark + ? Color(0xFFCCCCCC) + : Colors.black54), + unselectedLeading: Icon(Icons.expand_more, + size: 40, + color: MediaQuery.of(context).platformBrightness == Brightness.dark + ? Color(0xFFCCCCCC) + : Colors.black54), + title: TextFormField( + controller: TEC1, + enabled: currentSelection != 0, + decoration: InputDecoration(labelText: "Data size"), + keyboardType: + TextInputType.numberWithOptions(decimal: true, signed: false), + onChanged: (String text) { + if (text != "" && TEC2.text != "") { + setState(() { + TEC3.text = + (double.parse(text) / double.parse(TEC2.text)).toString(); + }); + } + }, + ), + trailing: Container( + width: 70, + alignment: Alignment.centerRight, + child: DropdownButton( + value: dataSize, + underline: SizedBox(), + items: ['GB', 'MB', 'kB', 'B'].map((String value) { + return new DropdownMenuItem( + value: value, + child: new Text(value), + ); + }).toList(), + onChanged: (String val) { + setState(() { + dataSize = val; + }); + }, + ), + ), + onTap: () { + setState(() { + currentSelection = 0; + }); + }, + ); - firstCard[0]=(RadioListTile( - key: ValueKey(0), - value: 0, - groupValue: groupValue, - title: TextFormField( - controller: TEC1, - enabled: groupValue != 0, - decoration: InputDecoration(labelText: "Data size"), - keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false), - onChanged: (String text){ - if(text!="" && TEC2.text!=""){ - setState(() { - TEC3.text = (double.parse(text)/double.parse(TEC2.text)).toString(); - }); - } - }, - ), - secondary: Container( - width: 70, - alignment: Alignment.centerRight, - child: DropdownButton( - value: dataSize, - underline: SizedBox(), - items: ['GB','MB', 'kB', 'B'].map((String value) { - return new DropdownMenuItem( - value: value, - child: new Text(value), - ); - }).toList(), - onChanged: (String val){ - setState(() { - dataSize = val; - }); - }, - ), - ), - onChanged: (int val) { - setState(() { - groupValue = val; - }); - }, - )); - firstCard[1]=(RadioListTile( - key: ValueKey(1), - value: 1, - groupValue: groupValue, - title: TextFormField( - controller: TEC2, - enabled: groupValue != 1, - decoration: InputDecoration(labelText: "Transmission speed"), - keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false), - onChanged: (String text){ - if(text!="" && TEC1.text!=""){ - setState(() { - TEC3.text = (double.parse(TEC1.text)/double.parse(text)).toString(); - }); - } - }, - ), - secondary: Container( - width: 70, - alignment: Alignment.centerRight, - child: DropdownButton( - value: dataSpeed, - underline: SizedBox(), - items: ['GB/s','MB/s', 'kB/s', 'B/s'].map((String value) { - return new DropdownMenuItem( - value: value, - child: new Text(value), - ); - }).toList(), - onChanged: (String val){ - setState(() { - dataSpeed = val; - }); - }, - ), - ), - onChanged: (int val) { - setState(() { - groupValue = val; - }); - }, - )); - firstCard[2]=(RadioListTile( - key: ValueKey(2), - value: 2, - groupValue: groupValue, - title: TextFormField( - controller: TEC3, - enabled: groupValue != 2, - decoration:InputDecoration(labelText: "Data transfer duration"), - keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false), - ), - secondary: Container( - width: 70, - alignment: Alignment.centerRight, - child: DropdownButton( - value: dataDuration, - underline: SizedBox(), - items: ['s','min', 'h', 'd'].map((String value) { - return new DropdownMenuItem( - value: value, - child: new Text(value), - ); - }).toList(), - onChanged: (String val){ - setState(() { - dataDuration = val; - }); - }, - ), - ), - onChanged: (int val) { - setState(() { - groupValue = val; - }); - }, - )); + firstCard[1] = myListTile( + key: ValueKey(1), + selected: currentSelection == 1, + selectedLeading: Image.asset("resources/images/x.png", + width: 40, + color: MediaQuery.of(context).platformBrightness == Brightness.dark + ? Color(0xFFCCCCCC) + : Colors.black54), + unselectedLeading: Icon(Icons.expand_more, + size: 40, + color: MediaQuery.of(context).platformBrightness == Brightness.dark + ? Color(0xFFCCCCCC) + : Colors.black54), + title: TextFormField( + controller: TEC2, + enabled: currentSelection != 1, + decoration: InputDecoration(labelText: "Transmission speed"), + keyboardType: + TextInputType.numberWithOptions(decimal: true, signed: false), + onChanged: (String text) { + if (text != "" && TEC1.text != "") { + setState(() { + TEC3.text = + (double.parse(TEC1.text) / double.parse(text)).toString(); + }); + } + }, + ), + trailing: Container( + width: 70, + alignment: Alignment.centerRight, + child: DropdownButton( + value: dataSpeed, + underline: SizedBox(), + items: ['GB/s', 'MB/s', 'kB/s', 'B/s'].map((String value) { + return new DropdownMenuItem( + value: value, + child: new Text(value), + ); + }).toList(), + onChanged: (String val) { + setState(() { + dataSpeed = val; + }); + }, + ), + ), + onTap: () { + setState(() { + currentSelection = 1; + }); + }, + ); + + firstCard[2] = myListTile( + key: ValueKey(2), + selected: currentSelection == 2, + selectedLeading: Image.asset("resources/images/x.png", + width: 40, + color: MediaQuery.of(context).platformBrightness == Brightness.dark + ? Color(0xFFCCCCCC) + : Colors.black54), + unselectedLeading: Icon(Icons.expand_more, + size: 40, + color: MediaQuery.of(context).platformBrightness == Brightness.dark + ? Color(0xFFCCCCCC) + : Colors.black54), + title: TextFormField( + controller: TEC3, + enabled: currentSelection != 2, + decoration: InputDecoration(labelText: "Data transfer duration"), + keyboardType: + TextInputType.numberWithOptions(decimal: true, signed: false), + ), + trailing: Container( + width: 70, + alignment: Alignment.centerRight, + child: DropdownButton( + value: dataDuration, + underline: SizedBox(), + items: ['s', 'min', 'h', 'd'].map((String value) { + return new DropdownMenuItem( + value: value, + child: new Text(value), + ); + }).toList(), + onChanged: (String val) { + setState(() { + dataDuration = val; + }); + }, + ), + ), + onTap: () { + setState(() { + currentSelection = 2; + }); + }, + ); return Scaffold( floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, @@ -179,7 +213,7 @@ class _ToolsManager extends State { icon: Icon(Icons.clear, color: Colors.white), onPressed: () { setState(() { - TEC1.text=TEC2.text=TEC3.text=""; + TEC1.text = TEC2.text = TEC3.text = ""; }); }, ), @@ -189,11 +223,6 @@ class _ToolsManager extends State { Icons.search, color: Colors.white, ), - /*onPressed: () async { - final int paginaReindirizzamento=await showSearch(context: context,delegate: _searchDelegate); - if(paginaReindirizzamento!=null) - _onSelectItem(paginaReindirizzamento); - },*/ ), ], ) @@ -212,48 +241,127 @@ class _ToolsManager extends State { body: Column( children: [ AnimatedSwitcher( - child: getfirstTwoTiles(firstCard, groupValue)[0], - duration: Duration(milliseconds: 600,), - transitionBuilder: (child, animation) { - final offsetAnimation = - Tween(begin: Offset(0.0, 1), end: Offset(0.0, 0.0)).animate(animation); + child: getfirstTwoTiles(firstCard, currentSelection)[0], + duration: Duration( + milliseconds: ANIMATION_DURATION, + ), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, + transitionBuilder: + (Widget child, Animation animation) { + final outAnimation = Tween( + begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)) + .animate(animation); + final inAnimation = Tween( + begin: Offset(0.0, -1.0), end: Offset(0.0, 0.0)) + .animate(animation); + + if (child.key == ValueKey(positions[0])) { return ClipRect( child: SlideTransition( - position: offsetAnimation, - child: child, + position: inAnimation, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: child, + ), ), ); - }, - ), + } else { + return ClipRect( + child: SlideTransition( + position: outAnimation, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: child, + ), + ), + ); + } + }, + ), AnimatedSwitcher( - child: getfirstTwoTiles(firstCard, groupValue)[1], - duration: Duration(milliseconds: 600,), - transitionBuilder: (child, animation) { - final offsetAnimation = - Tween(begin: Offset(0.0, 1), end: Offset(0.0, 0.0)).animate(animation); + child: getfirstTwoTiles(firstCard, currentSelection)[1], + duration: Duration( + milliseconds: ANIMATION_DURATION, + ), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, + transitionBuilder: + (Widget child, Animation animation) { + final outAnimation = Tween( + begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)) + .animate(animation); + final inAnimation = Tween( + begin: Offset(0.0, -1.0), end: Offset(0.0, 0.0)) + .animate(animation); + + if (child.key == ValueKey(positions[1])) { return ClipRect( child: SlideTransition( - position: offsetAnimation, - child: child, + position: inAnimation, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: child, + ), ), ); - }, - ), - Divider(thickness: 1,), + } else { + return ClipRect( + child: SlideTransition( + position: outAnimation, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: child, + ), + ), + ); + } + }, + ), + Divider( + thickness: 1, + ), Container( height: 70.0, child: AnimatedSwitcher( - child: firstCard[groupValue], - duration: Duration(milliseconds: 600,), - transitionBuilder: (child, animation) { - final offsetAnimation = - Tween(begin: Offset(0.0, -1), end: Offset(0.0, 0.0)).animate(animation); - return ClipRect( - child: SlideTransition( - position: offsetAnimation, - child: child, - ), - ); + child: firstCard[currentSelection], + duration: Duration( + milliseconds: (ANIMATION_DURATION*200 / (ANIMATIONS_OVERLAY+100)).round(), + ), + switchInCurve: Interval((100-ANIMATIONS_OVERLAY)/200, 1, + curve: Curves.linear), //Curves.elasticIn, + switchOutCurve: Interval(0, (ANIMATIONS_OVERLAY+100)/200, + curve: Curves.linear), //Curves.elasticOut, + transitionBuilder: + (Widget child, Animation animation) { + final outAnimation = Tween( + begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)) + .animate(animation); + final inAnimation = Tween( + begin: Offset(0.0, -1.0), end: Offset(0.0, 0.0)) + .animate(animation); + + if (child.key == ValueKey(currentSelection)) { + return ClipRect( + child: SlideTransition( + position: inAnimation, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: child, + ), + ), + ); + } else { + return ClipRect( + child: SlideTransition( + position: outAnimation, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: child, + ), + ), + ); + } }, ), ) @@ -265,40 +373,49 @@ class _ToolsManager extends State { } } -List getfirstTwoTiles(List tiles, selectedTile){ - +List getfirstTwoTiles(List tiles, selectedTile) { List returnTiles = new List(); - - for(int i=0; i animation) { - final offsetAnimation = - Tween(begin: Offset(0.0, 0.0), end: Offset(0.0, -1.0)).animate(animation); - return SlideTransition( - position: offsetAnimation, - child: child, - ); -} - -class myRadioListTile extends StatelessWidget { - final Function onChanged; - final int value; - final int groupValue; +class myListTile extends StatelessWidget { + final Key key; + final Function onTap; final Widget title; + final Widget selectedLeading; + final Widget unselectedLeading; + final Widget trailing; + final bool selected; - myRadioListTile({this.onChanged, this.value, this.groupValue, this.title}); + myListTile( + {this.key, + this.onTap, + this.title, + this.unselectedLeading, + this.selectedLeading, + this.selected, + this.trailing}); @override Widget build(BuildContext context) { - return Row(children: [ - Radio(onChanged: onChanged, value: value, groupValue: groupValue), - title - ]); + return Theme( + data: Theme.of(context).copyWith( + splashColor: Colors.transparent, highlightColor: Colors.transparent), + child: ListTile( + key: key, + leading: selected ? selectedLeading : unselectedLeading, + trailing: trailing, + title: title, + onTap: onTap, + ), + ); } } diff --git a/pubspec.lock b/pubspec.lock index 59233cd..8a5a1b7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,7 +21,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.0.0" charcode: dependency: transitive description: @@ -42,7 +42,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety" + version: "1.14.13" fake_async: dependency: transitive description: @@ -111,7 +111,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety" + version: "1.1.8" path: dependency: transitive description: @@ -263,7 +263,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety" + version: "1.2.0" url_launcher: dependency: "direct main" description: @@ -305,7 +305,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety" + version: "2.0.8" xdg_directories: dependency: transitive description: @@ -314,5 +314,5 @@ packages: source: hosted version: "0.1.0" sdks: - dart: ">=2.9.0-18.0 <2.9.0" + dart: ">=2.9.0-14.0.dev <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 10bcaca..d918f2b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -76,3 +76,4 @@ flutter: - resources/images/conversione_base.png - resources/images/conversion.png - resources/images/tools.png + - resources/images/x.png diff --git a/resources/images/x.png b/resources/images/x.png new file mode 100644 index 0000000..06490df Binary files /dev/null and b/resources/images/x.png differ