mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
feat: dialogs correctly follows Material 3 specifications (#1560)
Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
parent
c06d15de5f
commit
f8d086a743
21 changed files with 135 additions and 333 deletions
|
@ -15,7 +15,6 @@ import 'package:revanced_manager/services/github_api.dart';
|
|||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/services/revanced_api.dart';
|
||||
import 'package:revanced_manager/services/root_api.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
|
@ -62,7 +61,8 @@ class ManagerAPI {
|
|||
Future<void> initialize() async {
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
isRooted = await _rootAPI.isRooted();
|
||||
isDynamicThemeAvailable = (await getSdkVersion()) >= 31; // ANDROID_12_SDK_VERSION = 31
|
||||
isDynamicThemeAvailable =
|
||||
(await getSdkVersion()) >= 31; // ANDROID_12_SDK_VERSION = 31
|
||||
storedPatchesFile =
|
||||
(await getApplicationDocumentsDirectory()).path + storedPatchesFile;
|
||||
}
|
||||
|
@ -585,7 +585,6 @@ class ManagerAPI {
|
|||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('warning'),
|
||||
content: ValueListenableBuilder(
|
||||
valueListenable: noShow,
|
||||
|
@ -620,12 +619,12 @@ class ManagerAPI {
|
|||
},
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
setPatchesChangeWarning(noShow.value);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -13,7 +13,6 @@ import 'package:revanced_manager/services/manager_api.dart';
|
|||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
|
@ -105,7 +104,8 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||
]) async {
|
||||
final String suggestedVersion =
|
||||
getSuggestedVersion(application.packageName);
|
||||
if (application.versionName != suggestedVersion && suggestedVersion.isNotEmpty) {
|
||||
if (application.versionName != suggestedVersion &&
|
||||
suggestedVersion.isNotEmpty) {
|
||||
_managerAPI.suggestedAppVersionSelected = false;
|
||||
if (_managerAPI.isRequireSuggestedAppVersionEnabled() &&
|
||||
context.mounted) {
|
||||
|
@ -168,7 +168,6 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('warning'),
|
||||
content: I18nText(
|
||||
'appSelectorView.requireSuggestedAppVersionDialogText',
|
||||
|
@ -185,9 +184,9 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -232,12 +231,12 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
CustomMaterialButton(
|
||||
FilledButton(
|
||||
onPressed: () async {
|
||||
Navigator.pop(innerContext);
|
||||
await selectAppFromStorage(context);
|
||||
},
|
||||
label: Row(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.sd_card),
|
||||
|
@ -247,12 +246,11 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(innerContext);
|
||||
},
|
||||
label: Row(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 10),
|
||||
|
|
|
@ -21,7 +21,6 @@ import 'package:revanced_manager/services/toast.dart';
|
|||
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/homeView/update_confirmation_dialog.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
|
@ -65,8 +64,8 @@ class HomeViewModel extends BaseViewModel {
|
|||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestNotificationsPermission();
|
||||
final bool isConnected = await Connectivity().checkConnectivity() !=
|
||||
ConnectivityResult.none;
|
||||
final bool isConnected =
|
||||
await Connectivity().checkConnectivity() != ConnectivityResult.none;
|
||||
if (!isConnected) {
|
||||
_toast.showBottom('homeView.noConnection');
|
||||
}
|
||||
|
@ -223,21 +222,20 @@ class HomeViewModel extends BaseViewModel {
|
|||
},
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
await _managerAPI.setPatchesConsent(false);
|
||||
SystemNavigator.pop();
|
||||
},
|
||||
label: I18nText('quitButton'),
|
||||
child: I18nText('quitButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
FilledButton(
|
||||
onPressed: () async {
|
||||
await _managerAPI.setPatchesConsent(true);
|
||||
await _managerAPI.setPatchesAutoUpdate(autoUpdate.value);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
label: I18nText('okButton'),
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -324,12 +322,12 @@ class HomeViewModel extends BaseViewModel {
|
|||
const SizedBox(height: 16.0),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: CustomMaterialButton(
|
||||
label: I18nText('cancelButton'),
|
||||
child: FilledButton(
|
||||
onPressed: () {
|
||||
_revancedAPI.disposeManagerUpdateProgress();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -355,24 +353,23 @@ class HomeViewModel extends BaseViewModel {
|
|||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8.0),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: CustomMaterialButton(
|
||||
label: I18nText('updateButton'),
|
||||
child: FilledButton(
|
||||
onPressed: () async {
|
||||
await InstallPlugin.installApk(
|
||||
downloadedApk!.path,
|
||||
);
|
||||
},
|
||||
child: I18nText('updateButton'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -14,7 +14,6 @@ import 'package:revanced_manager/services/patcher_api.dart';
|
|||
import 'package:revanced_manager/services/root_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/utils/about_info.dart';
|
||||
import 'package:screenshot_callback/screenshot_callback.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
@ -287,26 +286,24 @@ class InstallerViewModel extends BaseViewModel {
|
|||
title: I18nText(
|
||||
'warning',
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
icon: const Icon(Icons.warning),
|
||||
content: SingleChildScrollView(
|
||||
child: I18nText('installerView.screenshotDetected'),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
copyLogs();
|
||||
showPopupScreenshotWarning = true;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -323,7 +320,6 @@ class InstallerViewModel extends BaseViewModel {
|
|||
title: I18nText(
|
||||
'installerView.installType',
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
icon: const Icon(Icons.file_download_outlined),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 16),
|
||||
content: SingleChildScrollView(
|
||||
|
@ -377,19 +373,18 @@ class InstallerViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
label: I18nText('cancelButton'),
|
||||
isFilled: false,
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('installerView.installButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
installResult(context, installType.value == 1);
|
||||
},
|
||||
child: I18nText('installerView.installButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -4,7 +4,6 @@ import 'package:google_fonts/google_fonts.dart';
|
|||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/ui/views/patch_options/patch_options_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_options_fields.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class PatchOptionsView extends StatelessWidget {
|
||||
|
@ -82,8 +81,7 @@ class PatchOptionsView extends StatelessWidget {
|
|||
model.modifyOptions(value, option);
|
||||
},
|
||||
)
|
||||
else if (option.valueType ==
|
||||
'StringArray' ||
|
||||
else if (option.valueType == 'StringArray' ||
|
||||
option.valueType == 'IntArray' ||
|
||||
option.valueType == 'LongArray')
|
||||
IntStringLongListPatchOption(
|
||||
|
@ -104,11 +102,11 @@ class PatchOptionsView extends StatelessWidget {
|
|||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
CustomMaterialButton(
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
model.showAddOptionDialog(context);
|
||||
},
|
||||
label: Row(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.add),
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:revanced_manager/services/manager_api.dart';
|
|||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class PatchOptionsViewModel extends BaseViewModel {
|
||||
|
@ -32,13 +31,11 @@ class PatchOptionsViewModel extends BaseViewModel {
|
|||
if (savedOptions.isNotEmpty) {
|
||||
visibleOptions = [
|
||||
...savedOptions,
|
||||
...options
|
||||
.where(
|
||||
(option) =>
|
||||
option.required &&
|
||||
!savedOptions.any((sOption) => sOption.key == option.key),
|
||||
)
|
||||
,
|
||||
...options.where(
|
||||
(option) =>
|
||||
option.required &&
|
||||
!savedOptions.any((sOption) => sOption.key == option.key),
|
||||
),
|
||||
];
|
||||
} else {
|
||||
visibleOptions = [
|
||||
|
@ -136,7 +133,6 @@ class PatchOptionsViewModel extends BaseViewModel {
|
|||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
@ -154,11 +150,11 @@ class PatchOptionsViewModel extends BaseViewModel {
|
|||
],
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
label: I18nText('cancelButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
],
|
||||
contentPadding: const EdgeInsets.all(8),
|
||||
|
@ -227,14 +223,9 @@ Future<void> showRequiredOptionNullDialog(
|
|||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('notice'),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText(
|
||||
'patchOptionsView.deselectPatch',
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
if (managerAPI.isPatchesChangeEnabled()) {
|
||||
locator<PatcherViewModel>()
|
||||
|
@ -256,12 +247,13 @@ Future<void> showRequiredOptionNullDialog(
|
|||
PatchesSelectorViewModel().showPatchesChangeDialog(context);
|
||||
}
|
||||
},
|
||||
child: I18nText('patchOptionsView.deselectPatch'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
content: I18nText(
|
||||
|
|
|
@ -13,7 +13,6 @@ import 'package:revanced_manager/models/patch.dart';
|
|||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/utils/about_info.dart';
|
||||
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
@ -56,25 +55,23 @@ class PatcherViewModel extends BaseViewModel {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('notice'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
'patcherView.removedPatchesWarningDialogText',
|
||||
translationParams: {'patches': removedPatches.join('\n')},
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
showArmv7WarningDialog(context);
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -98,22 +95,20 @@ class PatcherViewModel extends BaseViewModel {
|
|||
context: context ?? ctx,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('notice'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('patcherView.requiredOptionDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
TextButton(
|
||||
onPressed: () => {
|
||||
Navigator.of(context).pop(),
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () => {
|
||||
Navigator.pop(context),
|
||||
navigateToPatchesSelector(),
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -131,20 +126,18 @@ class PatcherViewModel extends BaseViewModel {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('warning'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('patcherView.armv7WarningDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('noButton'),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
isFilled: false,
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
navigateToInstaller();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'package:revanced_manager/services/patcher_api.dart';
|
|||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
@ -94,7 +93,6 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('notice'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
'patchesSelectorView.setRequiredOption',
|
||||
translationParams: {
|
||||
|
@ -102,11 +100,11 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||
},
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () => {
|
||||
Navigator.of(context).pop(),
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -130,7 +128,6 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('warning'),
|
||||
content: I18nText(
|
||||
'patchItem.patchesChangeWarningDialogText',
|
||||
|
@ -143,18 +140,17 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('okButton'),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('patchItem.patchesChangeWarningDialogButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
..pop()
|
||||
..pop();
|
||||
},
|
||||
child: I18nText('patchItem.patchesChangeWarningDialogButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'package:revanced_manager/services/manager_api.dart';
|
|||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class SManageApiUrl extends BaseViewModel {
|
||||
|
@ -33,7 +32,6 @@ class SManageApiUrl extends BaseViewModel {
|
|||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -51,16 +49,14 @@ class SManageApiUrl extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_apiUrlController.clear();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
String apiUrl = _apiUrlController.text;
|
||||
if (!apiUrl.startsWith('https')) {
|
||||
|
@ -70,6 +66,7 @@ class SManageApiUrl extends BaseViewModel {
|
|||
_toast.showBottom('settingsView.restartAppForChanges');
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -81,16 +78,13 @@ class SManageApiUrl extends BaseViewModel {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('settingsView.sourcesResetDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('settingsView.apiURLResetDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
_managerAPI.setApiUrl('');
|
||||
_toast.showBottom('settingsView.restartAppForChanges');
|
||||
|
@ -98,6 +92,7 @@ class SManageApiUrl extends BaseViewModel {
|
|||
..pop()
|
||||
..pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:revanced_manager/app/app.locator.dart';
|
|||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class SManageKeystorePassword extends BaseViewModel {
|
||||
|
@ -33,7 +32,6 @@ class SManageKeystorePassword extends BaseViewModel {
|
|||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -47,21 +45,20 @@ class SManageKeystorePassword extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_keystorePasswordController.clear();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
final String passwd = _keystorePasswordController.text;
|
||||
_managerAPI.setKeystorePassword(passwd);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'package:revanced_manager/services/manager_api.dart';
|
|||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class SManageSources extends BaseViewModel {
|
||||
|
@ -43,7 +42,6 @@ class SManageSources extends BaseViewModel {
|
|||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -107,9 +105,7 @@ class SManageSources extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_orgPatSourceController.clear();
|
||||
_patSourceController.clear();
|
||||
|
@ -117,9 +113,9 @@ class SManageSources extends BaseViewModel {
|
|||
_intSourceController.clear();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
_managerAPI.setRepoUrl(_hostSourceController.text.trim());
|
||||
_managerAPI.setPatchesRepo(
|
||||
|
@ -133,6 +129,7 @@ class SManageSources extends BaseViewModel {
|
|||
_toast.showBottom('settingsView.restartAppForChanges');
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -144,16 +141,13 @@ class SManageSources extends BaseViewModel {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('settingsView.sourcesResetDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('settingsView.sourcesResetDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
_managerAPI.setRepoUrl('');
|
||||
_managerAPI.setPatchesRepo('');
|
||||
|
@ -165,6 +159,7 @@ class SManageSources extends BaseViewModel {
|
|||
..pop()
|
||||
..pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -51,7 +51,6 @@ class SUpdateLanguage extends BaseViewModel {
|
|||
context: parentContext,
|
||||
builder: (context) => SimpleDialog(
|
||||
title: I18nText('settingsView.languageLabel'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 500,
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'package:flutter_i18n/widgets/I18nText.dart';
|
|||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
|
||||
class SUpdateThemeUI extends StatefulWidget {
|
||||
const SUpdateThemeUI({super.key});
|
||||
|
@ -36,9 +35,9 @@ class _SUpdateThemeUIState extends State<SUpdateThemeUI> {
|
|||
),
|
||||
),
|
||||
),
|
||||
trailing: CustomMaterialButton(
|
||||
label: getThemeModeName(),
|
||||
trailing: FilledButton(
|
||||
onPressed: () => {showThemeDialog(context)},
|
||||
child: getThemeModeName(),
|
||||
),
|
||||
onTap: () => {showThemeDialog(context)},
|
||||
),
|
||||
|
@ -122,7 +121,6 @@ class _SUpdateThemeUIState extends State<SUpdateThemeUI> {
|
|||
title: I18nText('settingsView.themeModeLabel'),
|
||||
icon: const Icon(Icons.palette),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: SingleChildScrollView(
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: newTheme,
|
||||
|
@ -164,19 +162,18 @@ class _SUpdateThemeUIState extends State<SUpdateThemeUI> {
|
|||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('cancelButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
setThemeMode(context, newTheme.value);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -12,7 +12,6 @@ import 'package:revanced_manager/services/toast.dart';
|
|||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_update_language.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
@ -52,7 +51,6 @@ class SettingsViewModel extends BaseViewModel {
|
|||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('warning'),
|
||||
content: I18nText(
|
||||
'settingsView.enablePatchesSelectionWarningText',
|
||||
|
@ -65,20 +63,19 @@ class SettingsViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('yesButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_managerAPI.setChangingToggleModified(true);
|
||||
_managerAPI.setPatchesChangeEnabled(true);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('noButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -87,7 +84,6 @@ class SettingsViewModel extends BaseViewModel {
|
|||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('warning'),
|
||||
content: I18nText(
|
||||
'settingsView.disablePatchesSelectionWarningText',
|
||||
|
@ -100,21 +96,20 @@ class SettingsViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
_managerAPI.setChangingToggleModified(true);
|
||||
_patchesSelectorViewModel.selectDefaultPatches();
|
||||
_managerAPI.setPatchesChangeEnabled(false);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -145,12 +140,13 @@ class SettingsViewModel extends BaseViewModel {
|
|||
}
|
||||
|
||||
Future<void>? showRequireSuggestedAppVersionDialog(
|
||||
BuildContext context, bool value,) {
|
||||
BuildContext context,
|
||||
bool value,
|
||||
) {
|
||||
if (!value) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('warning'),
|
||||
content: I18nText(
|
||||
'settingsView.requireSuggestedAppVersionDialogText',
|
||||
|
@ -163,19 +159,18 @@ class SettingsViewModel extends BaseViewModel {
|
|||
),
|
||||
),
|
||||
actions: [
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('yesButton'),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_managerAPI.enableRequireSuggestedAppVersionStatus(false);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('noButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -210,7 +205,7 @@ class SettingsViewModel extends BaseViewModel {
|
|||
final String dateTime =
|
||||
DateTime.now().toString().replaceAll(' ', '_').split('.').first;
|
||||
await FlutterFileDialog.saveFile(
|
||||
params: SaveFileDialogParams(
|
||||
params: SaveFileDialogParams(
|
||||
sourceFilePath: outFile.path,
|
||||
fileName: 'selected_patches_$dateTime.json',
|
||||
),
|
||||
|
@ -261,7 +256,7 @@ class SettingsViewModel extends BaseViewModel {
|
|||
final String dateTime =
|
||||
DateTime.now().toString().replaceAll(' ', '_').split('.').first;
|
||||
await FlutterFileDialog.saveFile(
|
||||
params: SaveFileDialogParams(
|
||||
params: SaveFileDialogParams(
|
||||
sourceFilePath: outFile.path,
|
||||
fileName: 'keystore_$dateTime.keystore',
|
||||
),
|
||||
|
|
|
@ -12,7 +12,6 @@ import 'package:revanced_manager/services/toast.dart';
|
|||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class AppInfoViewModel extends BaseViewModel {
|
||||
|
@ -67,12 +66,11 @@ class AppInfoViewModel extends BaseViewModel {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('appInfoView.rootDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('appInfoView.rootDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -85,23 +83,21 @@ class AppInfoViewModel extends BaseViewModel {
|
|||
title: I18nText(
|
||||
'appInfoView.unpatchButton',
|
||||
),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
'appInfoView.unpatchDialogText',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
uninstallApp(context, app, onlyUnpatch);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -131,14 +127,13 @@ class AppInfoViewModel extends BaseViewModel {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('appInfoView.appliedPatchesLabel'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: SingleChildScrollView(
|
||||
child: Text(getAppliedPatchesString(app.appliedPatches)),
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
|||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
|
||||
class LatestCommitCard extends StatefulWidget {
|
||||
const LatestCommitCard({
|
||||
|
@ -58,14 +57,14 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
|||
initialData: false,
|
||||
builder: (context, snapshot) => Opacity(
|
||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||
child: CustomMaterialButton(
|
||||
label: I18nText('updateButton'),
|
||||
child: FilledButton(
|
||||
onPressed: snapshot.hasData && snapshot.data!
|
||||
? () => widget.model.showUpdateConfirmationDialog(
|
||||
widget.parentContext,
|
||||
false,
|
||||
)
|
||||
: () => {},
|
||||
child: I18nText('updateButton'),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -113,14 +112,14 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
|||
initialData: false,
|
||||
builder: (context, snapshot) => Opacity(
|
||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||
child: CustomMaterialButton(
|
||||
label: I18nText('updateButton'),
|
||||
child: FilledButton(
|
||||
onPressed: snapshot.hasData && snapshot.data!
|
||||
? () => widget.model.showUpdateConfirmationDialog(
|
||||
widget.parentContext,
|
||||
true,
|
||||
)
|
||||
: () => {},
|
||||
child: I18nText('updateButton'),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
|||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
|
||||
class UpdateConfirmationDialog extends StatelessWidget {
|
||||
const UpdateConfirmationDialog({super.key, required this.isPatches});
|
||||
|
@ -86,15 +85,14 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
isExpanded: true,
|
||||
label: I18nText('updateButton'),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
isPatches
|
||||
? model.updatePatches(context)
|
||||
: model.updateManager(context);
|
||||
},
|
||||
child: I18nText('updateButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -5,7 +5,6 @@ import 'package:revanced_manager/models/patch.dart';
|
|||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class PatchItem extends StatefulWidget {
|
||||
|
@ -216,7 +215,6 @@ class _PatchItemState extends State<PatchItem> {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('warning'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
'patchItem.unsupportedDialogText',
|
||||
translationParams: {
|
||||
|
@ -226,9 +224,9 @@ class _PatchItemState extends State<PatchItem> {
|
|||
},
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -240,14 +238,13 @@ class _PatchItemState extends State<PatchItem> {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('notice'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
'patchItem.unsupportedRequiredOption',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter_i18n/widgets/I18nText.dart';
|
|||
import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart';
|
||||
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
|
||||
final _settingsViewModel = SettingsViewModel();
|
||||
|
||||
|
@ -151,20 +150,18 @@ class SExportSection extends StatelessWidget {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText(dialogTitle),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(dialogText),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () => {
|
||||
Navigator.of(context).pop(),
|
||||
dialogAction(),
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -176,20 +173,18 @@ class SExportSection extends StatelessWidget {
|
|||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('settingsView.regenerateKeystoreDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('settingsView.regenerateKeystoreDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label: I18nText('noButton'),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
),
|
||||
CustomMaterialButton(
|
||||
label: I18nText('yesButton'),
|
||||
FilledButton(
|
||||
onPressed: () => {
|
||||
Navigator.of(context).pop(),
|
||||
_settingsViewModel.deleteKeystore(),
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'dart:typed_data';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
|
||||
class ApplicationItem extends StatefulWidget {
|
||||
|
@ -24,7 +23,6 @@ class ApplicationItem extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ApplicationItemState extends State<ApplicationItem> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -81,9 +79,9 @@ class _ApplicationItemState extends State<ApplicationItem> {
|
|||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('applicationItem.infoButton'),
|
||||
FilledButton(
|
||||
onPressed: widget.onPressed,
|
||||
child: I18nText('applicationItem.infoButton'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomMaterialButton extends StatelessWidget {
|
||||
const CustomMaterialButton({
|
||||
super.key,
|
||||
required this.label,
|
||||
this.isFilled = true,
|
||||
this.isExpanded = false,
|
||||
required this.onPressed,
|
||||
});
|
||||
final Widget label;
|
||||
final bool isFilled;
|
||||
final bool isExpanded;
|
||||
final Function()? onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(
|
||||
isExpanded
|
||||
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
|
||||
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
),
|
||||
shape: MaterialStateProperty.all(
|
||||
StadiumBorder(
|
||||
side: isFilled
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
isFilled
|
||||
? Theme.of(context).colorScheme.surface
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: label,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class TimerButton extends StatefulWidget {
|
||||
TimerButton({
|
||||
super.key,
|
||||
required this.seconds,
|
||||
required this.isRunning,
|
||||
required this.onTimerEnd,
|
||||
this.label = const Text(''),
|
||||
this.isFilled = true,
|
||||
});
|
||||
Widget label;
|
||||
bool isFilled;
|
||||
int seconds;
|
||||
final bool isRunning;
|
||||
final Function()? onTimerEnd;
|
||||
|
||||
@override
|
||||
State<TimerButton> createState() => _TimerButtonState();
|
||||
}
|
||||
|
||||
class _TimerButtonState extends State<TimerButton> {
|
||||
void timer(int seconds) {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
if (seconds > 0) {
|
||||
setState(() {
|
||||
seconds--;
|
||||
});
|
||||
timer(seconds);
|
||||
} else {
|
||||
widget.onTimerEnd!();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
//decrement seconds
|
||||
if (widget.isRunning) {
|
||||
timer(widget.seconds);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext build) {
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
StadiumBorder(
|
||||
side: widget.isFilled
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
widget.isFilled
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
widget.isFilled
|
||||
? Theme.of(context).colorScheme.surface
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
onPressed: widget.isRunning ? null : widget.onTimerEnd,
|
||||
child: Text(
|
||||
widget.isRunning ? '${widget.seconds}' : 'Install',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue