CR suggestions

This commit is contained in:
shilangyu 2021-04-21 16:12:18 +02:00
parent bc957ab7b4
commit 666b2cb8dd
2 changed files with 31 additions and 29 deletions

View File

@ -50,6 +50,7 @@ class ManageAccountPage extends HookWidget {
if (await ul.canLaunch(userProfileUrl)) {
await ul.launch(userProfileUrl);
Navigator.of(context).pop();
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("can't open in browser")),

View File

@ -28,6 +28,13 @@ class SettingsPage extends StatelessWidget {
),
body: ListView(
children: [
ListTile(
leading: const Icon(Icons.settings),
title: const Text('General'),
onTap: () {
goTo(context, (_) => const GeneralConfigPage());
},
),
ListTile(
leading: const Icon(Icons.person),
title: const Text('Accounts'),
@ -42,13 +49,6 @@ class SettingsPage extends StatelessWidget {
goTo(context, (_) => const AppearanceConfigPage());
},
),
ListTile(
leading: const Icon(Icons.settings),
title: const Text('General'),
onTap: () {
goTo(context, (_) => const GeneralConfigPage());
},
),
const AboutTile()
],
),
@ -118,25 +118,15 @@ class GeneralConfigPage extends HookWidget {
appBar: AppBar(title: const Text('General')),
body: ListView(
children: [
SwitchListTile.adaptive(
title: Text(L10n.of(context)!.show_nsfw),
value: configStore.showNsfw,
onChanged: (checked) {
configStore.showNsfw = checked;
},
),
ListTile(
title: Text(L10n.of(context)!.language),
title: Text(L10n.of(context)!.sort_type),
trailing: SizedBox(
width: 120,
child: RadioPicker<Locale>(
title: 'Choose language',
groupValue: configStore.locale,
values: L10n.supportedLocales,
mapValueToString: (locale) => locale.languageName,
onChanged: (selected) {
configStore.locale = selected;
},
child: RadioPicker<SortType>(
values: SortType.values,
groupValue: configStore.defaultSortType,
onChanged: (value) => configStore.defaultSortType = value,
mapValueToString: (value) => value.value,
),
),
),
@ -157,17 +147,27 @@ class GeneralConfigPage extends HookWidget {
),
),
ListTile(
title: Text(L10n.of(context)!.sort_type),
title: Text(L10n.of(context)!.language),
trailing: SizedBox(
width: 120,
child: RadioPicker<SortType>(
values: SortType.values,
groupValue: configStore.defaultSortType,
onChanged: (value) => configStore.defaultSortType = value,
mapValueToString: (value) => value.value,
child: RadioPicker<Locale>(
title: 'Choose language',
groupValue: configStore.locale,
values: L10n.supportedLocales,
mapValueToString: (locale) => locale.languageName,
onChanged: (selected) {
configStore.locale = selected;
},
),
),
),
SwitchListTile.adaptive(
title: Text(L10n.of(context)!.show_nsfw),
value: configStore.showNsfw,
onChanged: (checked) {
configStore.showNsfw = checked;
},
),
],
),
);
@ -254,6 +254,7 @@ class _AccountOptions extends HookWidget {
await configStore.importLemmyUserSettings(
accountsStore.userDataFor(instanceHost, username)!.jwt,
);
Navigator.of(context).pop();
} on SocketException {
error.value = true;
}