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": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": "Show upgradable dependencies",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "flutter pub outdated",
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "Validate translations",
|
"label": "Validate translations",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
@ -60,7 +60,12 @@ class SettingsView extends StatelessWidget {
|
|||||||
value,
|
value,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
CustomSwitchTile(
|
FutureBuilder<int>(
|
||||||
|
future: model.getSdkVersion(),
|
||||||
|
builder: (context, snapshot) => Visibility(
|
||||||
|
visible: snapshot.hasData &&
|
||||||
|
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
||||||
|
child: CustomSwitchTile(
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'settingsView.dynamicThemeLabel',
|
'settingsView.dynamicThemeLabel',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
@ -71,13 +76,16 @@ class SettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: I18nText('settingsView.dynamicThemeHint'),
|
subtitle:
|
||||||
|
I18nText('settingsView.dynamicThemeHint'),
|
||||||
value: model.getDynamicThemeStatus(),
|
value: model.getDynamicThemeStatus(),
|
||||||
onTap: (value) => model.setUseDynamicTheme(
|
onTap: (value) => model.setUseDynamicTheme(
|
||||||
context,
|
context,
|
||||||
value,
|
value,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SettingsTileDialog(
|
SettingsTileDialog(
|
||||||
|
@ -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 New Issue
Block a user