mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-22 05:59:30 +02:00
Add system theme api level check
This commit is contained in:
@@ -82,28 +82,34 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
if (settingsProvider.prefs == null) settingsProvider.initializeSettings();
|
if (settingsProvider.prefs == null) settingsProvider.initializeSettings();
|
||||||
initUpdateIntervalInterpolator();
|
initUpdateIntervalInterpolator();
|
||||||
processIntervalSliderValue(settingsProvider.updateIntervalSliderVal);
|
processIntervalSliderValue(settingsProvider.updateIntervalSliderVal);
|
||||||
var themeDropdown = DropdownButtonFormField(
|
|
||||||
decoration: InputDecoration(labelText: tr('theme')),
|
var themeDropdown = FutureBuilder(
|
||||||
value: settingsProvider.theme,
|
builder: (ctx, val) {
|
||||||
items: [
|
return DropdownButtonFormField(
|
||||||
DropdownMenuItem(
|
decoration: InputDecoration(labelText: tr('theme')),
|
||||||
value: ThemeSettings.dark,
|
value: settingsProvider.theme,
|
||||||
child: Text(tr('dark')),
|
items: [
|
||||||
),
|
DropdownMenuItem(
|
||||||
DropdownMenuItem(
|
value: ThemeSettings.light,
|
||||||
value: ThemeSettings.light,
|
child: Text(tr('light')),
|
||||||
child: Text(tr('light')),
|
),
|
||||||
),
|
DropdownMenuItem(
|
||||||
DropdownMenuItem(
|
value: ThemeSettings.dark,
|
||||||
value: ThemeSettings.system,
|
child: Text(tr('dark')),
|
||||||
child: Text(tr('followSystem')),
|
),
|
||||||
)
|
if ((val.data?.version.sdkInt ?? 0) >= 29) DropdownMenuItem(
|
||||||
],
|
value: ThemeSettings.system,
|
||||||
onChanged: (value) {
|
child: Text(tr('followSystem')),
|
||||||
if (value != null) {
|
)
|
||||||
settingsProvider.theme = value;
|
],
|
||||||
}
|
onChanged: (value) {
|
||||||
});
|
if (value != null) {
|
||||||
|
settingsProvider.theme = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
future: DeviceInfoPlugin().androidInfo
|
||||||
|
);
|
||||||
|
|
||||||
var colourDropdown = DropdownButtonFormField(
|
var colourDropdown = DropdownButtonFormField(
|
||||||
decoration: InputDecoration(labelText: tr('colour')),
|
decoration: InputDecoration(labelText: tr('colour')),
|
||||||
|
@@ -18,7 +18,7 @@ String obtainiumTempId = 'imranr98_obtainium_${GitHub().hosts[0]}';
|
|||||||
String obtainiumId = 'dev.imranr.obtainium';
|
String obtainiumId = 'dev.imranr.obtainium';
|
||||||
String obtainiumUrl = 'https://github.com/ImranR98/Obtainium';
|
String obtainiumUrl = 'https://github.com/ImranR98/Obtainium';
|
||||||
|
|
||||||
enum ThemeSettings { system, light, dark }
|
enum ThemeSettings { light, dark, system }
|
||||||
|
|
||||||
enum ColourSettings { basic, materialYou }
|
enum ColourSettings { basic, materialYou }
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class SettingsProvider with ChangeNotifier {
|
|||||||
|
|
||||||
ThemeSettings get theme {
|
ThemeSettings get theme {
|
||||||
return ThemeSettings
|
return ThemeSettings
|
||||||
.values[prefs?.getInt('theme') ?? ThemeSettings.system.index];
|
.values[prefs?.getInt('theme') ?? ThemeSettings.light.index];
|
||||||
}
|
}
|
||||||
|
|
||||||
set theme(ThemeSettings t) {
|
set theme(ThemeSettings t) {
|
||||||
|
Reference in New Issue
Block a user