Simplfied settings page code

This commit is contained in:
Damiano
2020-07-17 14:38:51 +02:00
parent 6006660234
commit 2f54126f90
3 changed files with 68 additions and 111 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.7+3\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.11\\\\","dependencies":[]}],"android":[{"name":"shared_preferences","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.7+3\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.11\\\\","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+3\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+2\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-07-17 14:00:46.514432","version":"1.19.0-4.3.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.7+3\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.11\\\\","dependencies":[]}],"android":[{"name":"shared_preferences","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.7+3\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.11\\\\","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+3\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+2\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-07-17 14:37:30.631195","version":"1.19.0-4.3.pre"}
+67 -110
View File
@@ -37,130 +37,87 @@ class SettingsPage extends StatelessWidget {
child: ListView(
reverse: true,
children: [
!kIsWeb ? ListTile(
title: Center(
child: Text(
MyLocalizations.of(context).trans('recensione'),
style: TextStyle(
fontSize: 28.0,
color: MediaQuery.of(context).platformBrightness ==
Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
onTap: () {
launchURL(
"https://play.google.com/store/apps/details?id=com.ferrarid.converterpro");
},
)
: SizedBox(),
ListTile(
title: Center(
child: Text(
MyLocalizations.of(context).trans('traduzione_app'),
style: TextStyle(
fontSize: 28.0,
color: MediaQuery.of(context).platformBrightness ==
Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
!kIsWeb? SettingsListTile(
title: MyLocalizations.of(context).trans('recensione'),
onTap: () {
launchURL("https://github.com/ferraridamiano/ConverterNOW/issues/2");
},
launchURL("https://play.google.com/store/apps/details?id=com.ferrarid.converterpro");
}
): SizedBox(),
SettingsListTile(
title: MyLocalizations.of(context).trans('traduzione_app'),
onTap: () {
launchURL(
"https://github.com/ferraridamiano/ConverterNOW/issues/2");
}
),
ListTile(
title: Center(
child: Text(
MyLocalizations.of(context).trans('repo_github'),
style: TextStyle(
fontSize: 28.0,
color: MediaQuery.of(context).platformBrightness ==
Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
SettingsListTile(
title: MyLocalizations.of(context).trans('repo_github'),
onTap: () {
launchURL("https://github.com/ferraridamiano/ConverterNOW");
},
}
),
ListTile(
title: Center(
child: Text(
MyLocalizations.of(context).trans('donazione'),
style: TextStyle(
fontSize: 28.0,
color: MediaQuery.of(context).platformBrightness ==
Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
SettingsListTile(
title: MyLocalizations.of(context).trans('donazione'),
onTap: () {
launchURL("https://www.paypal.me/DemApps");
},
),
ListTile(
title: Center(
child: Text(
MyLocalizations.of(context).trans('contatta_sviluppatore'),
style: TextStyle(
fontSize: 28.0,
color: MediaQuery.of(context).platformBrightness ==
Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
onTap: () {
launchURL("mailto:<damianoferrari1998@gmail.com>");
},
),
ListTile(
title: Center(
child: Text(
MyLocalizations.of(context).trans('about'),
style: TextStyle(
fontSize: 28.0,
color: MediaQuery.of(context).platformBrightness ==
Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
onTap: () {
showLicensePage(
context: context,
applicationName:
MyLocalizations.of(context).trans('app_name'),
applicationLegalese:
"Icons made by https://www.flaticon.com/authors/yannick Yannick from https://www.flaticon.com/ www.flaticon.com is licensed by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0 CC 3.0 BY\n" + //termometro
"Icons made by http://www.freepik.com Freepik from https://www.flaticon.com/ Flaticon www.flaticon.com is licensed by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0 CC 3.0 BY\n" + //lunghezza, velocità, pressione, area, energia, massa
"Icons made by https://www.flaticon.com/authors/bogdan-rosu Bogdan Rosu from https://www.flaticon.com/ Flaticon www.flaticon.com is licensed by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0 CC 3.0 BY"); //volume
},
),
ListTile(
title: Center(
child: Text(
MyLocalizations.of(context).trans('impostazioni'),
style: TextStyle(
fontSize: 28.0,
color: MediaQuery.of(context).platformBrightness ==
Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SettingsPage2(primaryColor, accentColor)),
);
},
),
!kIsWeb? SettingsListTile(
title: MyLocalizations.of(context).trans('contatta_sviluppatore'),
onTap: () {
launchURL("mailto:<damianoferrari1998@gmail.com>");
}) : SizedBox(),
SettingsListTile(
title: MyLocalizations.of(context).trans('about'),
onTap: () {
showLicensePage(
context: context,
applicationName:
MyLocalizations.of(context).trans('app_name'),
applicationLegalese:
"Icons made by https://www.flaticon.com/authors/yannick Yannick from https://www.flaticon.com/ www.flaticon.com is licensed by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0 CC 3.0 BY\n" + //termometro
"Icons made by http://www.freepik.com Freepik from https://www.flaticon.com/ Flaticon www.flaticon.com is licensed by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0 CC 3.0 BY\n" + //lunghezza, velocità, pressione, area, energia, massa
"Icons made by https://www.flaticon.com/authors/bogdan-rosu Bogdan Rosu from https://www.flaticon.com/ Flaticon www.flaticon.com is licensed by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0 CC 3.0 BY"); //volume
}),
SettingsListTile(
title: MyLocalizations.of(context).trans('impostazioni'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SettingsPage2(primaryColor, accentColor)),
);
}),
],
)));
}
}
class SettingsListTile extends StatelessWidget {
final String title;
final Function onTap;
SettingsListTile({this.title, this.onTap});
@override
Widget build(BuildContext context) {
return ListTile(
title: Center(
child: Text(
title,
style: TextStyle(
fontSize: 24.0,
color: MediaQuery.of(context).platformBrightness == Brightness.dark
? Color(0xFFCCCCCC)
: Colors.black54),
)),
onTap: () {
onTap();
},
);
}
}
class SettingsPage2 extends StatefulWidget {
final Color primaryColor;
final Color accentColor;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB