Implemented navigation between tools & conversions

This commit is contained in:
Damiano
2020-07-29 11:35:23 +02:00
parent 103116b609
commit 1e22e3312e
4 changed files with 62 additions and 49 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":"/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-07-28 17:10:31.355579","version":"1.21.0-1.0.pre"}
{"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-07-29 11:22:56.042169","version":"1.21.0-1.0.pre"}
+5 -5
View File
@@ -1,12 +1,12 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\Damia\Desktop\ConverterNOW"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_ROOT=/home/damiano/flutter"
export "FLUTTER_APPLICATION_PATH=/home/damiano/Scrivania/converterpro"
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=C:\flutter\bin\cache\artifacts\engine\ios"
export "FLUTTER_FRAMEWORK_DIR=/home/damiano/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=2.3.1"
export "FLUTTER_BUILD_NUMBER=20"
export "DART_OBFUSCATION=false"
+55 -38
View File
@@ -13,7 +13,8 @@ import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import "dart:convert";
int currentPage=0;
int currentPage=0; //page of a topic (e.g. length)
int currentTopic=1; //topic (e.g. conversions)
const MAX_CONVERSION_UNITS=19;
const MAX_TOOLS_NUMBER=1;
@@ -124,27 +125,29 @@ class _AppManagerState extends State<AppManager> {
void initializeTiles(){
listaDrawerConversions[listaOrderDrawer[0]]=ListTileDrawer(listaTitoli[0],"resources/images/lunghezza.png",currentPage==0,(){_onSelectItem(0);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[1]]=ListTileDrawer(listaTitoli[1],"resources/images/area.png",currentPage==1,(){_onSelectItem(1);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[2]]=ListTileDrawer(listaTitoli[2],"resources/images/volume.png",currentPage==2,(){_onSelectItem(2);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[3]]=ListTileDrawer(listaTitoli[3],"resources/images/tempo.png",currentPage==3,(){_onSelectItem(3);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[4]]=ListTileDrawer(listaTitoli[4],"resources/images/temperatura.png",currentPage==4,(){_onSelectItem(4);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[5]]=ListTileDrawer(listaTitoli[5],"resources/images/velocita.png",currentPage==5,(){_onSelectItem(5);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[6]]=ListTileDrawer(listaTitoli[6],"resources/images/prefissi.png",currentPage==6,(){_onSelectItem(6);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[7]]=ListTileDrawer(listaTitoli[7],"resources/images/massa.png",currentPage==7,(){_onSelectItem(7);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[8]]=ListTileDrawer(listaTitoli[8],"resources/images/pressione.png",currentPage==8,(){_onSelectItem(8);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[9]]=ListTileDrawer(listaTitoli[9],"resources/images/energia.png",currentPage==9,(){_onSelectItem(9);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[10]]=ListTileDrawer(listaTitoli[10],"resources/images/angoli.png",currentPage==10,(){_onSelectItem(10);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[11]]=ListTileDrawer(listaTitoli[11],"resources/images/valuta.png",currentPage==11,(){_onSelectItem(11);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[12]]=ListTileDrawer(listaTitoli[12],"resources/images/scarpe.png",currentPage==12,(){_onSelectItem(12);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[13]]=ListTileDrawer(listaTitoli[13],"resources/images/dati.png",currentPage==13,(){_onSelectItem(13);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[14]]=ListTileDrawer(listaTitoli[14],"resources/images/potenza.png",currentPage==14,(){_onSelectItem(14);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[15]]=ListTileDrawer(listaTitoli[15],"resources/images/forza.png",currentPage==15,(){_onSelectItem(15);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[16]]=ListTileDrawer(listaTitoli[16],"resources/images/torque.png",currentPage==16,(){_onSelectItem(16);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[17]]=ListTileDrawer(listaTitoli[17],"resources/images/consumo.png",currentPage==17,(){_onSelectItem(17);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[18]]=ListTileDrawer(listaTitoli[18],"resources/images/conversione_base.png",currentPage==18,(){_onSelectItem(18);Navigator.of(context).pop();});
listDrawerTools[0] = ListTileDrawer("Tool 1","resources/images/lunghezza.png",currentTopic==0 && currentPage==0,(){_onSelectItem(0,0);Navigator.of(context).pop();});
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
listaDrawerConversions[listaOrderDrawer[0]]=ListTileDrawer(listaTitoli[0],"resources/images/lunghezza.png",currentTopic==1 && currentPage==0,(){_onSelectItem(1,0);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[1]]=ListTileDrawer(listaTitoli[1],"resources/images/area.png",currentTopic==1 && currentPage==1,(){_onSelectItem(1,1);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[2]]=ListTileDrawer(listaTitoli[2],"resources/images/volume.png",currentTopic==1 && currentPage==2,(){_onSelectItem(1,2);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[3]]=ListTileDrawer(listaTitoli[3],"resources/images/tempo.png",currentTopic==1 && currentPage==3,(){_onSelectItem(1,3);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[4]]=ListTileDrawer(listaTitoli[4],"resources/images/temperatura.png",currentTopic==1 && currentPage==4,(){_onSelectItem(1,4);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[5]]=ListTileDrawer(listaTitoli[5],"resources/images/velocita.png",currentTopic==1 && currentPage==5,(){_onSelectItem(1,5);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[6]]=ListTileDrawer(listaTitoli[6],"resources/images/prefissi.png",currentTopic==1 && currentPage==6,(){_onSelectItem(1,6);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[7]]=ListTileDrawer(listaTitoli[7],"resources/images/massa.png",currentTopic==1 && currentPage==7,(){_onSelectItem(1,7);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[8]]=ListTileDrawer(listaTitoli[8],"resources/images/pressione.png",currentTopic==1 && currentPage==8,(){_onSelectItem(1,8);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[9]]=ListTileDrawer(listaTitoli[9],"resources/images/energia.png",currentTopic==1 && currentPage==9,(){_onSelectItem(1,9);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[10]]=ListTileDrawer(listaTitoli[10],"resources/images/angoli.png",currentTopic==1 && currentPage==10,(){_onSelectItem(1,10);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[11]]=ListTileDrawer(listaTitoli[11],"resources/images/valuta.png",currentTopic==1 && currentPage==11,(){_onSelectItem(1,11);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[12]]=ListTileDrawer(listaTitoli[12],"resources/images/scarpe.png",currentTopic==1 && currentPage==12,(){_onSelectItem(1,12);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[13]]=ListTileDrawer(listaTitoli[13],"resources/images/dati.png",currentTopic==1 && currentPage==13,(){_onSelectItem(1,13);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[14]]=ListTileDrawer(listaTitoli[14],"resources/images/potenza.png",currentTopic==1 && currentPage==14,(){_onSelectItem(1,14);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[15]]=ListTileDrawer(listaTitoli[15],"resources/images/forza.png",currentTopic==1 && currentPage==15,(){_onSelectItem(1,15);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[16]]=ListTileDrawer(listaTitoli[16],"resources/images/torque.png",currentTopic==1 && currentPage==16,(){_onSelectItem(1,16);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[17]]=ListTileDrawer(listaTitoli[17],"resources/images/consumo.png",currentTopic==1 && currentPage==17,(){_onSelectItem(1,17);Navigator.of(context).pop();});
listaDrawerConversions[listaOrderDrawer[18]]=ListTileDrawer(listaTitoli[18],"resources/images/conversione_base.png",currentTopic==1 && currentPage==18,(){_onSelectItem(1,18);Navigator.of(context).pop();});
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
listDrawerTools[0] = ListTileDrawer("Tool 1","resources/images/lunghezza.png",currentPage==0,(){});
Color boxColor=Theme.of(context).primaryColor;
listaDrawer[0]=
@@ -225,6 +228,7 @@ class _AppManagerState extends State<AppManager> {
selectedColor: Theme.of(context).accentColor,
unSelectedColor: MediaQuery.of(context).platformBrightness==Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54,
children: listDrawerTools,
selected: currentTopic==0,
);
listaDrawer[2]=myExpansionTile(
title: "Conversions",
@@ -232,6 +236,7 @@ class _AppManagerState extends State<AppManager> {
selectedColor: Theme.of(context).accentColor,
unSelectedColor: MediaQuery.of(context).platformBrightness==Brightness.dark ? Color(0xFFCCCCCC) : Colors.black54,
children: listaDrawerConversions,
selected: currentTopic==1,
);
}
@@ -266,9 +271,10 @@ class _AppManagerState extends State<AppManager> {
}
_onSelectItem(int index) {
if(currentPage!=index){
_onSelectItem(int topic, int index) {
if(!(currentTopic==topic && currentPage==index)){
setState(() {
currentTopic = topic;
currentPage = index;
});
}
@@ -321,6 +327,31 @@ class _AppManagerState extends State<AppManager> {
}
}
Builder _getCurrentBody(){
if(currentTopic == 0){ //tools
return Builder(
builder: (context) =>
ToolsManager(
() { Scaffold.of(context).openDrawer();},//open Drawer
),
);
}
return Builder( //conversions
builder: (context) =>
ConversionManager(
() { Scaffold.of(context).openDrawer(); },//open Drawer
currentPage, //first page
_onSelectItem, //change page
listaTitoli,
showRateSnackBar,
listaConversioni,
listaOrder,
lastUpdateCurrency,
currencyValues
),
);
}
@override
Widget build(BuildContext context) {
@@ -343,21 +374,7 @@ class _AppManagerState extends State<AppManager> {
children: listaDrawer,
),
),
body:
Builder(
builder: (context) =>
ConversionManager(
() { Scaffold.of(context).openDrawer(); }, //open Drawer
currentPage, //first page
_onSelectItem, //change page
listaTitoli,
showRateSnackBar,
listaConversioni,
listaOrder,
lastUpdateCurrency,
currencyValues
),
)
body: _getCurrentBody()
);
}
}
+1 -5
View File
@@ -470,11 +470,7 @@ class _myExpansionTile extends State<myExpansionTile>{
style: TextStyle(fontSize: 20, color: widget.selected ? widget.selectedColor : widget.unSelectedColor, fontWeight: FontWeight.bold),
),
leading: Image.asset(widget.leadingImageAsset, width: 30, color: widget.selected ? widget.selectedColor : widget.unSelectedColor),
onExpansionChanged: (bool expansion){
setState(() {
widget.selected=expansion;
});
},
initiallyExpanded: widget.selected,
children: widget.children,
),
);