Update settings performance.

This commit is contained in:
stonegate 2020-08-29 05:05:37 +08:00
parent deb987d71d
commit cc0f5a4908
4 changed files with 187 additions and 249 deletions

View File

@ -37,7 +37,7 @@ class _PlayedHistoryState extends State<PlayedHistory>
bool _loadMore = false;
_loadMoreData() async {
Future<void> _loadMoreData() async {
if (mounted) {
setState(() {
_loadMore = true;

View File

@ -185,13 +185,13 @@ class _LayoutSettingState extends State<LayoutSetting> {
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
padding: const EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(s.settingsPopupMenu,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
.copyWith(color: context.accentColor)),
),
ListTile(
onTap: () => Navigator.push(

View File

@ -22,7 +22,8 @@ List<Libries> fonts = [
Libries('Libre Baskerville', font,
"https://fonts.google.com/specimen/Libre+Baskerville"),
Libries('Teko', font, "https://fonts.google.com/specimen/Teko"),
Libries('Martel', font, "https://fonts.google.com/specimen/Martel")
Libries('Martel', font, "https://fonts.google.com/specimen/Martel"),
Libries('Bitter', font, "https://fonts.google.com/specimen/Bitter")
];
List<Libries> plugins = [

View File

@ -58,264 +58,201 @@ class _SettingsState extends State<Settings> {
),
body: SafeArea(
child: SingleChildScrollView(
//physics: const AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.all(10.0),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(s.settingsPrefrence,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: context.accentColor)),
),
ListView(
physics: ClampingScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: <Widget>[
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ThemeSetting())),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.adjust_solid,
color: context.accentColor),
title: Text(s.settingsAppearance),
subtitle: Text(s.settingsAppearanceDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LayoutSetting())),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.stop_circle_solid,
color: Colors.blueAccent),
title: Text(s.settingsLayout),
subtitle: Text(s.settingsLayoutDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PlaySetting())),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.play_circle,
color: Colors.redAccent),
title: Text(s.play),
subtitle: Text(s.settingsPlayDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SyncingSetting())),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.cloud_download_alt_solid,
color: Colors.yellow[700]),
title: Text(s.settingsSyncing),
subtitle: Text(s.settingsSyncingDes)),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StorageSetting())),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading:
Icon(LineIcons.save, color: Colors.green[700]),
title: Text(s.settingStorage),
subtitle: Text(s.settingsStorageDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PlayedHistory())),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading:
Icon(Icons.update, color: Colors.indigo[700]),
title: Text(s.settingsHistory),
subtitle: Text(s.settingsHistoryDes),
),
Divider(height: 1),
ListTile(
onTap: () => generalSheet(context,
title: s.settingsLanguages,
child: LanguagesSetting())
.then((value) => setState(() {})),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.language_solid,
color: Colors.purpleAccent),
title: Text(s.settingsLanguages),
subtitle: Text(s.settingsLanguagesDes),
),
Divider(height: 1),
ListTile(
onTap: () {
//_exportOmpl(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DataBackup()));
},
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.file_code_solid,
color: Colors.lightGreen[700]),
title: Text(s.settingsBackup),
subtitle: Text(s.settingsBackupDes),
),
Divider(height: 1),
],
),
],
),
Padding(
padding: EdgeInsets.all(10.0),
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(s.settingsInfo,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
ListView(
physics: ClampingScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: <Widget>[
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Libries())),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.book_open_solid,
color: Colors.purple[700]),
title: Text(s.settingsLibraries),
subtitle: Text(s.settingsLibrariesDes),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(s.settingsPrefrence,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: context.accentColor)),
),
ListTile(
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => ThemeSetting())),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading:
Icon(LineIcons.adjust_solid, color: context.accentColor),
title: Text(s.settingsAppearance),
subtitle: Text(s.settingsAppearanceDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => LayoutSetting())),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.stop_circle_solid,
color: Colors.blueAccent),
title: Text(s.settingsLayout),
subtitle: Text(s.settingsLayoutDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => PlaySetting())),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.play_circle, color: Colors.redAccent),
title: Text(s.play),
subtitle: Text(s.settingsPlayDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SyncingSetting())),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.cloud_download_alt_solid,
color: Colors.yellow[700]),
title: Text(s.settingsSyncing),
subtitle: Text(s.settingsSyncingDes)),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StorageSetting())),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.save, color: Colors.green[700]),
title: Text(s.settingStorage),
subtitle: Text(s.settingsStorageDes),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => PlayedHistory())),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(Icons.update, color: Colors.indigo[700]),
title: Text(s.settingsHistory),
subtitle: Text(s.settingsHistoryDes),
),
Divider(height: 1),
ListTile(
onTap: () => generalSheet(context,
title: s.settingsLanguages, child: LanguagesSetting())
.then((value) => setState(() {})),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.language_solid,
color: Colors.purpleAccent),
title: Text(s.settingsLanguages),
subtitle: Text(s.settingsLanguagesDes),
),
Divider(height: 1),
ListTile(
onTap: () {
//_exportOmpl(context);
Navigator.push(context,
MaterialPageRoute(builder: (context) => DataBackup()));
},
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.file_code_solid,
color: Colors.lightGreen[700]),
title: Text(s.settingsBackup),
subtitle: Text(s.settingsBackupDes),
),
Divider(height: 1),
Padding(
padding: EdgeInsets.all(10.0),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(s.settingsInfo,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
ListTile(
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => Libries())),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.book_open_solid,
color: Colors.purple[700]),
title: Text(s.settingsLibraries),
subtitle: Text(s.settingsLibrariesDes),
),
Divider(height: 1),
ListTile(
onTap: () => generalSheet(
context,
title: s.settingsFeedback,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
_feedbackItem(LineIcons.github, s.feedbackGithub,
'https://github.com/stonega/tsacdop/issues'),
Divider(height: 1),
ListTile(
onTap: () => generalSheet(
context,
title: s.settingsFeedback,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
_feedbackItem(
LineIcons.github,
s.feedbackGithub,
'https://github.com/stonega/tsacdop/issues'),
Divider(height: 1),
_feedbackItem(
LineIcons.telegram,
s.feedbackTelegram,
'https://t.me/joinchat/Bk3LkRpTHy40QYC78PK7Qg'),
Divider(height: 1),
_feedbackItem(
LineIcons.envelope_open_text_solid,
s.feedbackEmail,
'mailto:<tsacdop.app@gmail.com>?subject=Tsacdop Feedback'),
Divider(height: 1),
_feedbackItem(
LineIcons.google_play,
s.feedbackPlay,
'https://play.google.com/store/apps/details?id=com.stonegate.tsacdop'),
Divider(height: 1),
],
),
),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.bug_solid,
color: Colors.pink[700]),
title: Text(s.settingsFeedback),
subtitle: Text(s.settingsFeedbackDes),
),
Divider(
height: 2,
),
ListTile(
onTap: () {
FeatureDiscovery.clearPreferences(
context, const <String>{
addFeature,
menuFeature,
playlistFeature,
groupsFeature,
addGroupFeature,
configureGroup,
configurePodcast,
podcastFeature
});
Fluttertoast.showToast(
msg: s.toastDiscovery,
gravity: ToastGravity.BOTTOM,
);
},
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.capsules_solid,
color: Colors.pinkAccent),
title: Text(s.settingsDiscovery),
),
_feedbackItem(LineIcons.telegram, s.feedbackTelegram,
'https://t.me/joinchat/Bk3LkRpTHy40QYC78PK7Qg'),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SlideIntro(goto: Goto.settings))),
contentPadding:
EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.columns_solid,
color: Colors.blueGrey),
title: Text(s.settingsAppIntro),
),
_feedbackItem(
LineIcons.envelope_open_text_solid,
s.feedbackEmail,
'mailto:<tsacdop.app@gmail.com>?subject=Tsacdop Feedback'),
Divider(height: 1),
_feedbackItem(LineIcons.google_play, s.feedbackPlay,
'https://play.google.com/store/apps/details?id=com.stonegate.tsacdop'),
Divider(height: 1),
],
),
Padding(
padding: EdgeInsets.all(10.0),
),
],
),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading: Icon(LineIcons.bug_solid, color: Colors.pink[700]),
title: Text(s.settingsFeedback),
subtitle: Text(s.settingsFeedbackDes),
),
Divider(
height: 2,
),
ListTile(
onTap: () {
FeatureDiscovery.clearPreferences(context, const <String>{
addFeature,
menuFeature,
playlistFeature,
groupsFeature,
addGroupFeature,
configureGroup,
configurePodcast,
podcastFeature
});
Fluttertoast.showToast(
msg: s.toastDiscovery,
gravity: ToastGravity.BOTTOM,
);
},
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading:
Icon(LineIcons.capsules_solid, color: Colors.pinkAccent),
title: Text(s.settingsDiscovery),
),
Divider(height: 1),
ListTile(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SlideIntro(goto: Goto.settings))),
contentPadding: EdgeInsets.symmetric(horizontal: 25.0),
leading:
Icon(LineIcons.columns_solid, color: Colors.blueGrey),
title: Text(s.settingsAppIntro),
),
Divider(height: 1),
Padding(
padding: EdgeInsets.all(10.0),
),
],
),