Merge pull request #1556 from re7gog/re7gog

Fixes
This commit is contained in:
Imran
2024-04-23 14:15:47 -04:00
committed by GitHub
5 changed files with 43 additions and 33 deletions

View File

@@ -113,6 +113,7 @@
"dark": "Dark", "dark": "Dark",
"light": "Light", "light": "Light",
"followSystem": "Follow System", "followSystem": "Follow System",
"followSystemThemeExplanation": "Following system theme is possible only by using third-party applications",
"useBlackTheme": "Use pure black dark theme", "useBlackTheme": "Use pure black dark theme",
"appSortBy": "App Sort By", "appSortBy": "App Sort By",
"authorName": "Author/Name", "authorName": "Author/Name",

View File

@@ -113,6 +113,7 @@
"dark": "Тёмная", "dark": "Тёмная",
"light": "Светлая", "light": "Светлая",
"followSystem": "Системная", "followSystem": "Системная",
"followSystemThemeExplanation": "Следование системной теме возможно только при использовании сторонних приложений",
"useBlackTheme": "Использовать чёрную тему", "useBlackTheme": "Использовать чёрную тему",
"appSortBy": "Сортировка приложений", "appSortBy": "Сортировка приложений",
"authorName": "Автор/Название", "authorName": "Автор/Название",

View File

@@ -84,7 +84,7 @@ class HuaweiAppGallery extends AppSource {
} }
var relDate = relDateStrAdj == null var relDate = relDateStrAdj == null
? null ? null
: DateFormat('yy-MM-dd-HH-mm').parse(relDateStrAdj.join('')); : DateFormat('yy-MM-dd-HH-mm', 'en_US').parse(relDateStrAdj.join(''));
if (relDateStr == null) { if (relDateStr == null) {
throw NoVersionError(); throw NoVersionError();
} }

View File

@@ -88,30 +88,12 @@ class _SettingsPageState extends State<SettingsPage> {
initUpdateIntervalInterpolator(); initUpdateIntervalInterpolator();
processIntervalSliderValue(settingsProvider.updateIntervalSliderVal); processIntervalSliderValue(settingsProvider.updateIntervalSliderVal);
var themeDropdown = FutureBuilder( var followSystemThemeExplanation = FutureBuilder(
builder: (ctx, val) { builder: (ctx, val) {
return DropdownButtonFormField( return ((val.data?.version.sdkInt ?? 30) < 29) ?
decoration: InputDecoration(labelText: tr('theme')), Text(tr('followSystemThemeExplanation'),
value: settingsProvider.theme, style: Theme.of(context).textTheme.labelSmall)
items: [ : const SizedBox.shrink();
DropdownMenuItem(
value: ThemeSettings.light,
child: Text(tr('light')),
),
DropdownMenuItem(
value: ThemeSettings.dark,
child: Text(tr('dark')),
),
if ((val.data?.version.sdkInt ?? 0) >= 29) DropdownMenuItem(
value: ThemeSettings.system,
child: Text(tr('followSystem')),
)
],
onChanged: (value) {
if (value != null) {
settingsProvider.theme = value;
}
});
}, },
future: DeviceInfoPlugin().androidInfo future: DeviceInfoPlugin().androidInfo
); );
@@ -367,7 +349,7 @@ class _SettingsPageState extends State<SettingsPage> {
intervalSlider, intervalSlider,
FutureBuilder( FutureBuilder(
builder: (ctx, val) { builder: (ctx, val) {
return ((val.data?.version.sdkInt ?? 0) >= 30) || settingsProvider.useShizuku return (settingsProvider.updateInterval > 0) && (((val.data?.version.sdkInt ?? 0) >= 30) || settingsProvider.useShizuku)
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
@@ -583,9 +565,34 @@ class _SettingsPageState extends State<SettingsPage> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary), color: Theme.of(context).colorScheme.primary),
), ),
themeDropdown, DropdownButtonFormField(
decoration: InputDecoration(labelText: tr('theme')),
value: settingsProvider.theme,
items: [
DropdownMenuItem(
value: ThemeSettings.system,
child: Text(tr('followSystem')),
),
DropdownMenuItem(
value: ThemeSettings.light,
child: Text(tr('light')),
),
DropdownMenuItem(
value: ThemeSettings.dark,
child: Text(tr('dark')),
)
],
onChanged: (value) {
if (value != null) {
settingsProvider.theme = value;
}
}),
height8,
if (settingsProvider.theme == ThemeSettings.system)
followSystemThemeExplanation,
height16, height16,
Row( if (settingsProvider.theme != ThemeSettings.light)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Flexible(child: Text(tr('useBlackTheme'))), Flexible(child: Text(tr('useBlackTheme'))),
@@ -593,10 +600,11 @@ class _SettingsPageState extends State<SettingsPage> {
value: settingsProvider.useBlackTheme, value: settingsProvider.useBlackTheme,
onChanged: (value) { onChanged: (value) {
settingsProvider.useBlackTheme = value; settingsProvider.useBlackTheme = value;
}) }
], )
), ]
height16, ),
height8,
useMaterialThemeSwitch, useMaterialThemeSwitch,
if (!settingsProvider.useMaterialYou) colorPicker, if (!settingsProvider.useMaterialYou) colorPicker,
Row( Row(

View File

@@ -19,7 +19,7 @@ String obtainiumId = 'dev.imranr.obtainium';
String obtainiumUrl = 'https://github.com/ImranR98/Obtainium'; String obtainiumUrl = 'https://github.com/ImranR98/Obtainium';
Color obtainiumThemeColor = const Color(0xFF6438B5); Color obtainiumThemeColor = const Color(0xFF6438B5);
enum ThemeSettings { light, dark, system } enum ThemeSettings { system, light, dark }
enum SortColumnSettings { added, nameAuthor, authorName, releaseDate } enum SortColumnSettings { added, nameAuthor, authorName, releaseDate }
@@ -59,7 +59,7 @@ class SettingsProvider with ChangeNotifier {
ThemeSettings get theme { ThemeSettings get theme {
return ThemeSettings return ThemeSettings
.values[prefs?.getInt('theme') ?? ThemeSettings.light.index]; .values[prefs?.getInt('theme') ?? ThemeSettings.system.index];
} }
set theme(ThemeSettings t) { set theme(ThemeSettings t) {