mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-09 16:52:14 +01:00
fix: only show Material You toggle for SDK version >= 31
This commit is contained in:
parent
002f7013fd
commit
c2da8e36da
4 changed files with 33 additions and 22 deletions
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
|
@ -81,12 +81,6 @@
|
||||||
],
|
],
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": "Show upgradable dependencies",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "flutter pub outdated",
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "Validate translations",
|
"label": "Validate translations",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
|
|
@ -60,23 +60,31 @@ class SettingsView extends StatelessWidget {
|
||||||
value,
|
value,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
CustomSwitchTile(
|
FutureBuilder<int>(
|
||||||
title: I18nText(
|
future: model.getSdkVersion(),
|
||||||
'settingsView.dynamicThemeLabel',
|
builder: (context, snapshot) => Visibility(
|
||||||
child: const Text(
|
visible: snapshot.hasData &&
|
||||||
'',
|
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
||||||
style: TextStyle(
|
child: CustomSwitchTile(
|
||||||
fontSize: 20,
|
title: I18nText(
|
||||||
fontWeight: FontWeight.w500,
|
'settingsView.dynamicThemeLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle:
|
||||||
|
I18nText('settingsView.dynamicThemeHint'),
|
||||||
|
value: model.getDynamicThemeStatus(),
|
||||||
|
onTap: (value) => model.setUseDynamicTheme(
|
||||||
|
context,
|
||||||
|
value,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: I18nText('settingsView.dynamicThemeHint'),
|
|
||||||
value: model.getDynamicThemeStatus(),
|
|
||||||
onTap: (value) => model.setUseDynamicTheme(
|
|
||||||
context,
|
|
||||||
value,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// ignore_for_file: use_build_context_synchronously
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:dynamic_themes/dynamic_themes.dart';
|
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
|
@ -12,6 +13,9 @@ import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:timeago/timeago.dart';
|
import 'package:timeago/timeago.dart';
|
||||||
|
|
||||||
|
// ignore: constant_identifier_names
|
||||||
|
const int ANDROID_12_SDK_VERSION = 31;
|
||||||
|
|
||||||
class SettingsViewModel extends BaseViewModel {
|
class SettingsViewModel extends BaseViewModel {
|
||||||
final NavigationService _navigationService = locator<NavigationService>();
|
final NavigationService _navigationService = locator<NavigationService>();
|
||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
|
@ -212,4 +216,9 @@ class SettingsViewModel extends BaseViewModel {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<int> getSdkVersion() async {
|
||||||
|
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
|
||||||
|
return info.version.sdkInt ?? -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ dependencies:
|
||||||
share_extend: ^2.0.0
|
share_extend: ^2.0.0
|
||||||
shared_preferences: ^2.0.15
|
shared_preferences: ^2.0.15
|
||||||
skeletons: ^0.0.3
|
skeletons: ^0.0.3
|
||||||
stacked: ^2.3.15
|
stacked: ^3.0.0
|
||||||
stacked_generator: ^0.7.14
|
stacked_generator: ^0.8.0
|
||||||
stacked_services: ^0.9.3
|
stacked_services: ^0.9.3
|
||||||
stacked_themes: ^0.3.9
|
stacked_themes: ^0.3.9
|
||||||
timeago: ^3.2.2
|
timeago: ^3.2.2
|
||||||
|
|
Loading…
Reference in a new issue