forked from cwtch.im/cwtch-ui
Fix maximum width of dropdown boxes in settings
This commit is contained in:
parent
ecdcef2192
commit
0146436cb3
|
@ -107,20 +107,22 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.settingLanguage, style: TextStyle(color: settings.current().mainTextColor)),
|
title: Text(AppLocalizations.of(context)!.settingLanguage, style: TextStyle(color: settings.current().mainTextColor)),
|
||||||
leading: Icon(CwtchIcons.change_language, color: settings.current().mainTextColor),
|
leading: Icon(CwtchIcons.change_language, color: settings.current().mainTextColor),
|
||||||
trailing: DropdownButton(
|
trailing: Container(
|
||||||
value: Provider.of<Settings>(context).locale.languageCode,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
onChanged: (String? newValue) {
|
child: DropdownButton(
|
||||||
setState(() {
|
value: Provider.of<Settings>(context).locale.languageCode,
|
||||||
settings.switchLocale(Locale(newValue!));
|
onChanged: (String? newValue) {
|
||||||
saveSettings(context);
|
setState(() {
|
||||||
});
|
settings.switchLocale(Locale(newValue!));
|
||||||
},
|
saveSettings(context);
|
||||||
items: AppLocalizations.supportedLocales.map<DropdownMenuItem<String>>((Locale value) {
|
});
|
||||||
return DropdownMenuItem<String>(
|
},
|
||||||
value: value.languageCode,
|
items: AppLocalizations.supportedLocales.map<DropdownMenuItem<String>>((Locale value) {
|
||||||
child: Text(getLanguageFull(context, value.languageCode)),
|
return DropdownMenuItem<String>(
|
||||||
);
|
value: value.languageCode,
|
||||||
}).toList())),
|
child: Text(getLanguageFull(context, value.languageCode)),
|
||||||
|
);
|
||||||
|
}).toList()))),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.settingTheme, style: TextStyle(color: settings.current().mainTextColor)),
|
title: Text(AppLocalizations.of(context)!.settingTheme, style: TextStyle(color: settings.current().mainTextColor)),
|
||||||
value: settings.current().mode == mode_light,
|
value: settings.current().mode == mode_light,
|
||||||
|
@ -140,39 +142,43 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.themeColorLabel),
|
title: Text(AppLocalizations.of(context)!.themeColorLabel),
|
||||||
trailing: DropdownButton<String>(
|
trailing: Container(
|
||||||
key: Key("DropdownTheme"),
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
isDense: true,
|
child: DropdownButton<String>(
|
||||||
value: Provider.of<Settings>(context).theme.theme,
|
key: Key("DropdownTheme"),
|
||||||
onChanged: (String? newValue) {
|
isDense: true,
|
||||||
setState(() {
|
value: Provider.of<Settings>(context).theme.theme,
|
||||||
settings.setTheme(newValue!, settings.theme.mode);
|
onChanged: (String? newValue) {
|
||||||
saveSettings(context);
|
setState(() {
|
||||||
});
|
settings.setTheme(newValue!, settings.theme.mode);
|
||||||
},
|
saveSettings(context);
|
||||||
items: themes.keys.map<DropdownMenuItem<String>>((String themeId) {
|
});
|
||||||
return DropdownMenuItem<String>(
|
},
|
||||||
value: themeId,
|
items: themes.keys.map<DropdownMenuItem<String>>((String themeId) {
|
||||||
child: Text(getThemeName(context, themeId)), //"ddi_$themeId", key: Key("ddi_$themeId")),
|
return DropdownMenuItem<String>(
|
||||||
);
|
value: themeId,
|
||||||
}).toList()),
|
child: Text(getThemeName(context, themeId)), //"ddi_$themeId", key: Key("ddi_$themeId")),
|
||||||
|
);
|
||||||
|
}).toList())),
|
||||||
leading: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),
|
leading: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.settingUIColumnPortrait, style: TextStyle(color: settings.current().mainTextColor)),
|
title: Text(AppLocalizations.of(context)!.settingUIColumnPortrait, style: TextStyle(color: settings.current().mainTextColor)),
|
||||||
leading: Icon(Icons.table_chart, color: settings.current().mainTextColor),
|
leading: Icon(Icons.table_chart, color: settings.current().mainTextColor),
|
||||||
trailing: DropdownButton(
|
trailing: Container(
|
||||||
value: settings.uiColumnModePortrait.toString(),
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
onChanged: (String? newValue) {
|
child: DropdownButton(
|
||||||
settings.uiColumnModePortrait = Settings.uiColumnModeFromString(newValue!);
|
value: settings.uiColumnModePortrait.toString(),
|
||||||
saveSettings(context);
|
onChanged: (String? newValue) {
|
||||||
},
|
settings.uiColumnModePortrait = Settings.uiColumnModeFromString(newValue!);
|
||||||
items: Settings.uiColumnModeOptions(false).map<DropdownMenuItem<String>>((DualpaneMode value) {
|
saveSettings(context);
|
||||||
return DropdownMenuItem<String>(
|
},
|
||||||
value: value.toString(),
|
items: Settings.uiColumnModeOptions(false).map<DropdownMenuItem<String>>((DualpaneMode value) {
|
||||||
child: Text(Settings.uiColumnModeToString(value, context)),
|
return DropdownMenuItem<String>(
|
||||||
);
|
value: value.toString(),
|
||||||
}).toList())),
|
child: Text(Settings.uiColumnModeToString(value, context)),
|
||||||
|
);
|
||||||
|
}).toList()))),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)!.settingUIColumnLandscape,
|
AppLocalizations.of(context)!.settingUIColumnLandscape,
|
||||||
|
@ -183,22 +189,24 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
leading: Icon(Icons.table_chart, color: settings.current().mainTextColor),
|
leading: Icon(Icons.table_chart, color: settings.current().mainTextColor),
|
||||||
trailing: Container(
|
trailing: Container(
|
||||||
width: MediaQuery.of(context).size.width / 4,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
child: DropdownButton(
|
child: Container(
|
||||||
isExpanded: true,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
value: settings.uiColumnModeLandscape.toString(),
|
child: DropdownButton(
|
||||||
onChanged: (String? newValue) {
|
isExpanded: true,
|
||||||
settings.uiColumnModeLandscape = Settings.uiColumnModeFromString(newValue!);
|
value: settings.uiColumnModeLandscape.toString(),
|
||||||
saveSettings(context);
|
onChanged: (String? newValue) {
|
||||||
},
|
settings.uiColumnModeLandscape = Settings.uiColumnModeFromString(newValue!);
|
||||||
items: Settings.uiColumnModeOptions(true).map<DropdownMenuItem<String>>((DualpaneMode value) {
|
saveSettings(context);
|
||||||
return DropdownMenuItem<String>(
|
},
|
||||||
value: value.toString(),
|
items: Settings.uiColumnModeOptions(true).map<DropdownMenuItem<String>>((DualpaneMode value) {
|
||||||
child: Text(
|
return DropdownMenuItem<String>(
|
||||||
Settings.uiColumnModeToString(value, context),
|
value: value.toString(),
|
||||||
overflow: TextOverflow.ellipsis,
|
child: Text(
|
||||||
),
|
Settings.uiColumnModeToString(value, context),
|
||||||
);
|
overflow: TextOverflow.ellipsis,
|
||||||
}).toList()))),
|
),
|
||||||
|
);
|
||||||
|
}).toList())))),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.streamerModeLabel, style: TextStyle(color: settings.current().mainTextColor)),
|
title: Text(AppLocalizations.of(context)!.streamerModeLabel, style: TextStyle(color: settings.current().mainTextColor)),
|
||||||
subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode),
|
subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode),
|
||||||
|
@ -238,21 +246,23 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.notificationPolicySettingLabel),
|
title: Text(AppLocalizations.of(context)!.notificationPolicySettingLabel),
|
||||||
subtitle: Text(AppLocalizations.of(context)!.notificationPolicySettingDescription),
|
subtitle: Text(AppLocalizations.of(context)!.notificationPolicySettingDescription),
|
||||||
trailing: DropdownButton(
|
trailing: Container(
|
||||||
value: settings.notificationPolicy,
|
width: MediaQuery.of(context).size.width / 4,
|
||||||
onChanged: (NotificationPolicy? newValue) {
|
child: DropdownButton(
|
||||||
settings.notificationPolicy = newValue!;
|
value: settings.notificationPolicy,
|
||||||
saveSettings(context);
|
onChanged: (NotificationPolicy? newValue) {
|
||||||
},
|
settings.notificationPolicy = newValue!;
|
||||||
items: NotificationPolicy.values.map<DropdownMenuItem<NotificationPolicy>>((NotificationPolicy value) {
|
saveSettings(context);
|
||||||
return DropdownMenuItem<NotificationPolicy>(
|
},
|
||||||
value: value,
|
items: NotificationPolicy.values.map<DropdownMenuItem<NotificationPolicy>>((NotificationPolicy value) {
|
||||||
child: Text(
|
return DropdownMenuItem<NotificationPolicy>(
|
||||||
Settings.notificationPolicyToString(value, context),
|
value: value,
|
||||||
overflow: TextOverflow.ellipsis,
|
child: Text(
|
||||||
),
|
Settings.notificationPolicyToString(value, context),
|
||||||
);
|
overflow: TextOverflow.ellipsis,
|
||||||
}).toList()),
|
),
|
||||||
|
);
|
||||||
|
}).toList())),
|
||||||
leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor),
|
leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
Loading…
Reference in New Issue