mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: only show Material You toggle for SDK version >= 31
This commit is contained in:
parent
002f7013fd
commit
c2da8e36da
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
@ -81,12 +81,6 @@
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Show upgradable dependencies",
|
||||
"type": "shell",
|
||||
"command": "flutter pub outdated",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Validate translations",
|
||||
"type": "shell",
|
||||
|
@ -60,23 +60,31 @@ class SettingsView extends StatelessWidget {
|
||||
value,
|
||||
),
|
||||
),
|
||||
CustomSwitchTile(
|
||||
title: I18nText(
|
||||
'settingsView.dynamicThemeLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
FutureBuilder<int>(
|
||||
future: model.getSdkVersion(),
|
||||
builder: (context, snapshot) => Visibility(
|
||||
visible: snapshot.hasData &&
|
||||
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
||||
child: CustomSwitchTile(
|
||||
title: I18nText(
|
||||
'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
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||
import 'package:flutter/material.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:timeago/timeago.dart';
|
||||
|
||||
// ignore: constant_identifier_names
|
||||
const int ANDROID_12_SDK_VERSION = 31;
|
||||
|
||||
class SettingsViewModel extends BaseViewModel {
|
||||
final NavigationService _navigationService = locator<NavigationService>();
|
||||
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
|
||||
shared_preferences: ^2.0.15
|
||||
skeletons: ^0.0.3
|
||||
stacked: ^2.3.15
|
||||
stacked_generator: ^0.7.14
|
||||
stacked: ^3.0.0
|
||||
stacked_generator: ^0.8.0
|
||||
stacked_services: ^0.9.3
|
||||
stacked_themes: ^0.3.9
|
||||
timeago: ^3.2.2
|
||||
|
Loading…
Reference in New Issue
Block a user