feat: dialogs correctly follows Material 3 specifications (#1560)

Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
Pun Butrach 2023-12-22 20:34:03 +07:00 committed by GitHub
parent c06d15de5f
commit f8d086a743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 135 additions and 333 deletions

View File

@ -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/patcher_api.dart';
import 'package:revanced_manager/services/revanced_api.dart'; import 'package:revanced_manager/services/revanced_api.dart';
import 'package:revanced_manager/services/root_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:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:timeago/timeago.dart'; import 'package:timeago/timeago.dart';
@ -62,7 +61,8 @@ class ManagerAPI {
Future<void> initialize() async { Future<void> initialize() async {
_prefs = await SharedPreferences.getInstance(); _prefs = await SharedPreferences.getInstance();
isRooted = await _rootAPI.isRooted(); isRooted = await _rootAPI.isRooted();
isDynamicThemeAvailable = (await getSdkVersion()) >= 31; // ANDROID_12_SDK_VERSION = 31 isDynamicThemeAvailable =
(await getSdkVersion()) >= 31; // ANDROID_12_SDK_VERSION = 31
storedPatchesFile = storedPatchesFile =
(await getApplicationDocumentsDirectory()).path + storedPatchesFile; (await getApplicationDocumentsDirectory()).path + storedPatchesFile;
} }
@ -585,7 +585,6 @@ class ManagerAPI {
builder: (context) => WillPopScope( builder: (context) => WillPopScope(
onWillPop: () async => false, onWillPop: () async => false,
child: AlertDialog( child: AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'), title: I18nText('warning'),
content: ValueListenableBuilder( content: ValueListenableBuilder(
valueListenable: noShow, valueListenable: noShow,
@ -620,12 +619,12 @@ class ManagerAPI {
}, },
), ),
actions: [ actions: [
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () { onPressed: () {
setPatchesChangeWarning(noShow.value); setPatchesChangeWarning(noShow.value);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('okButton'),
), ),
], ],
), ),

View File

@ -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/patcher_api.dart';
import 'package:revanced_manager/services/toast.dart'; import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_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:revanced_manager/utils/check_for_supported_patch.dart'; import 'package:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
@ -105,7 +104,8 @@ class AppSelectorViewModel extends BaseViewModel {
]) async { ]) async {
final String suggestedVersion = final String suggestedVersion =
getSuggestedVersion(application.packageName); getSuggestedVersion(application.packageName);
if (application.versionName != suggestedVersion && suggestedVersion.isNotEmpty) { if (application.versionName != suggestedVersion &&
suggestedVersion.isNotEmpty) {
_managerAPI.suggestedAppVersionSelected = false; _managerAPI.suggestedAppVersionSelected = false;
if (_managerAPI.isRequireSuggestedAppVersionEnabled() && if (_managerAPI.isRequireSuggestedAppVersionEnabled() &&
context.mounted) { context.mounted) {
@ -168,7 +168,6 @@ class AppSelectorViewModel extends BaseViewModel {
return showDialog( return showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'), title: I18nText('warning'),
content: I18nText( content: I18nText(
'appSelectorView.requireSuggestedAppVersionDialogText', 'appSelectorView.requireSuggestedAppVersionDialogText',
@ -185,9 +184,9 @@ class AppSelectorViewModel extends BaseViewModel {
), ),
), ),
actions: [ actions: [
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('okButton'),
), ),
], ],
), ),
@ -232,12 +231,12 @@ class AppSelectorViewModel extends BaseViewModel {
), ),
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
CustomMaterialButton( FilledButton(
onPressed: () async { onPressed: () async {
Navigator.pop(innerContext); Navigator.pop(innerContext);
await selectAppFromStorage(context); await selectAppFromStorage(context);
}, },
label: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const Icon(Icons.sd_card), const Icon(Icons.sd_card),
@ -247,12 +246,11 @@ class AppSelectorViewModel extends BaseViewModel {
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
CustomMaterialButton( TextButton(
isFilled: false,
onPressed: () { onPressed: () {
Navigator.pop(innerContext); Navigator.pop(innerContext);
}, },
label: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const SizedBox(width: 10), const SizedBox(width: 10),

View File

@ -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/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_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/homeView/update_confirmation_dialog.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
@ -65,8 +64,8 @@ class HomeViewModel extends BaseViewModel {
.resolvePlatformSpecificImplementation< .resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>() AndroidFlutterLocalNotificationsPlugin>()
?.requestNotificationsPermission(); ?.requestNotificationsPermission();
final bool isConnected = await Connectivity().checkConnectivity() != final bool isConnected =
ConnectivityResult.none; await Connectivity().checkConnectivity() != ConnectivityResult.none;
if (!isConnected) { if (!isConnected) {
_toast.showBottom('homeView.noConnection'); _toast.showBottom('homeView.noConnection');
} }
@ -223,21 +222,20 @@ class HomeViewModel extends BaseViewModel {
}, },
), ),
actions: [ actions: [
CustomMaterialButton( TextButton(
isFilled: false,
onPressed: () async { onPressed: () async {
await _managerAPI.setPatchesConsent(false); await _managerAPI.setPatchesConsent(false);
SystemNavigator.pop(); SystemNavigator.pop();
}, },
label: I18nText('quitButton'), child: I18nText('quitButton'),
), ),
CustomMaterialButton( FilledButton(
onPressed: () async { onPressed: () async {
await _managerAPI.setPatchesConsent(true); await _managerAPI.setPatchesConsent(true);
await _managerAPI.setPatchesAutoUpdate(autoUpdate.value); await _managerAPI.setPatchesAutoUpdate(autoUpdate.value);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
label: I18nText('okButton'), child: I18nText('okButton'),
), ),
], ],
), ),
@ -324,12 +322,12 @@ class HomeViewModel extends BaseViewModel {
const SizedBox(height: 16.0), const SizedBox(height: 16.0),
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: CustomMaterialButton( child: FilledButton(
label: I18nText('cancelButton'),
onPressed: () { onPressed: () {
_revancedAPI.disposeManagerUpdateProgress(); _revancedAPI.disposeManagerUpdateProgress();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
), ),
], ],
@ -355,24 +353,23 @@ class HomeViewModel extends BaseViewModel {
children: [ children: [
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: CustomMaterialButton( child: TextButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
), ),
const SizedBox(width: 8.0), const SizedBox(width: 8.0),
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: CustomMaterialButton( child: FilledButton(
label: I18nText('updateButton'),
onPressed: () async { onPressed: () async {
await InstallPlugin.installApk( await InstallPlugin.installApk(
downloadedApk!.path, downloadedApk!.path,
); );
}, },
child: I18nText('updateButton'),
), ),
), ),
], ],

View File

@ -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/root_api.dart';
import 'package:revanced_manager/services/toast.dart'; import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_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:revanced_manager/utils/about_info.dart'; import 'package:revanced_manager/utils/about_info.dart';
import 'package:screenshot_callback/screenshot_callback.dart'; import 'package:screenshot_callback/screenshot_callback.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
@ -287,26 +286,24 @@ class InstallerViewModel extends BaseViewModel {
title: I18nText( title: I18nText(
'warning', 'warning',
), ),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
icon: const Icon(Icons.warning), icon: const Icon(Icons.warning),
content: SingleChildScrollView( content: SingleChildScrollView(
child: I18nText('installerView.screenshotDetected'), child: I18nText('installerView.screenshotDetected'),
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
copyLogs(); copyLogs();
showPopupScreenshotWarning = true; showPopupScreenshotWarning = true;
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),
@ -323,7 +320,6 @@ class InstallerViewModel extends BaseViewModel {
title: I18nText( title: I18nText(
'installerView.installType', 'installerView.installType',
), ),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
icon: const Icon(Icons.file_download_outlined), icon: const Icon(Icons.file_download_outlined),
contentPadding: const EdgeInsets.symmetric(vertical: 16), contentPadding: const EdgeInsets.symmetric(vertical: 16),
content: SingleChildScrollView( content: SingleChildScrollView(
@ -377,19 +373,18 @@ class InstallerViewModel extends BaseViewModel {
), ),
), ),
actions: [ actions: [
CustomMaterialButton( TextButton(
label: I18nText('cancelButton'),
isFilled: false,
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('installerView.installButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
installResult(context, installType.value == 1); installResult(context, installType.value == 1);
}, },
child: I18nText('installerView.installButton'),
), ),
], ],
), ),

View File

@ -4,7 +4,6 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/models/patch.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/views/patch_options/patch_options_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_options_fields.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'; import 'package:stacked/stacked.dart';
class PatchOptionsView extends StatelessWidget { class PatchOptionsView extends StatelessWidget {
@ -82,8 +81,7 @@ class PatchOptionsView extends StatelessWidget {
model.modifyOptions(value, option); model.modifyOptions(value, option);
}, },
) )
else if (option.valueType == else if (option.valueType == 'StringArray' ||
'StringArray' ||
option.valueType == 'IntArray' || option.valueType == 'IntArray' ||
option.valueType == 'LongArray') option.valueType == 'LongArray')
IntStringLongListPatchOption( IntStringLongListPatchOption(
@ -104,11 +102,11 @@ class PatchOptionsView extends StatelessWidget {
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
CustomMaterialButton( FilledButton(
onPressed: () { onPressed: () {
model.showAddOptionDialog(context); model.showAddOptionDialog(context);
}, },
label: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon(Icons.add), const Icon(Icons.add),

View File

@ -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/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_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_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class PatchOptionsViewModel extends BaseViewModel { class PatchOptionsViewModel extends BaseViewModel {
@ -32,13 +31,11 @@ class PatchOptionsViewModel extends BaseViewModel {
if (savedOptions.isNotEmpty) { if (savedOptions.isNotEmpty) {
visibleOptions = [ visibleOptions = [
...savedOptions, ...savedOptions,
...options ...options.where(
.where(
(option) => (option) =>
option.required && option.required &&
!savedOptions.any((sOption) => sOption.key == option.key), !savedOptions.any((sOption) => sOption.key == option.key),
) ),
,
]; ];
} else { } else {
visibleOptions = [ visibleOptions = [
@ -136,7 +133,6 @@ class PatchOptionsViewModel extends BaseViewModel {
await showDialog( await showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: Column( title: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -154,11 +150,11 @@ class PatchOptionsViewModel extends BaseViewModel {
], ],
), ),
actions: [ actions: [
CustomMaterialButton( FilledButton(
label: I18nText('cancelButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
], ],
contentPadding: const EdgeInsets.all(8), contentPadding: const EdgeInsets.all(8),
@ -227,14 +223,9 @@ Future<void> showRequiredOptionNullDialog(
await showDialog( await showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('notice'), title: I18nText('notice'),
actions: [ actions: [
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText(
'patchOptionsView.deselectPatch',
),
onPressed: () async { onPressed: () async {
if (managerAPI.isPatchesChangeEnabled()) { if (managerAPI.isPatchesChangeEnabled()) {
locator<PatcherViewModel>() locator<PatcherViewModel>()
@ -256,12 +247,13 @@ Future<void> showRequiredOptionNullDialog(
PatchesSelectorViewModel().showPatchesChangeDialog(context); PatchesSelectorViewModel().showPatchesChangeDialog(context);
} }
}, },
child: I18nText('patchOptionsView.deselectPatch'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('okButton'),
), ),
], ],
content: I18nText( content: I18nText(

View File

@ -13,7 +13,6 @@ import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart'; import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart'; import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_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/about_info.dart';
import 'package:revanced_manager/utils/check_for_supported_patch.dart'; import 'package:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
@ -56,25 +55,23 @@ class PatcherViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('notice'), title: I18nText('notice'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText( content: I18nText(
'patcherView.removedPatchesWarningDialogText', 'patcherView.removedPatchesWarningDialogText',
translationParams: {'patches': removedPatches.join('\n')}, translationParams: {'patches': removedPatches.join('\n')},
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
showArmv7WarningDialog(context); showArmv7WarningDialog(context);
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),
@ -98,22 +95,20 @@ class PatcherViewModel extends BaseViewModel {
context: context ?? ctx, context: context ?? ctx,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('notice'), title: I18nText('notice'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patcherView.requiredOptionDialogText'), content: I18nText('patcherView.requiredOptionDialogText'),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () => { onPressed: () => {
Navigator.of(context).pop(), Navigator.of(context).pop(),
}, },
child: I18nText('cancelButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () => { onPressed: () => {
Navigator.pop(context), Navigator.pop(context),
navigateToPatchesSelector(), navigateToPatchesSelector(),
}, },
child: I18nText('okButton'),
), ),
], ],
), ),
@ -131,20 +126,18 @@ class PatcherViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('warning'), title: I18nText('warning'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patcherView.armv7WarningDialogText'), content: I18nText('patcherView.armv7WarningDialogText'),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( FilledButton(
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('noButton'),
), ),
CustomMaterialButton( TextButton(
label: I18nText('yesButton'),
isFilled: false,
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
navigateToInstaller(); navigateToInstaller();
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),

View File

@ -10,7 +10,6 @@ import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/toast.dart'; import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.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/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:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
@ -94,7 +93,6 @@ class PatchesSelectorViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('notice'), title: I18nText('notice'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText( content: I18nText(
'patchesSelectorView.setRequiredOption', 'patchesSelectorView.setRequiredOption',
translationParams: { translationParams: {
@ -102,11 +100,11 @@ class PatchesSelectorViewModel extends BaseViewModel {
}, },
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () => { onPressed: () => {
Navigator.of(context).pop(), Navigator.of(context).pop(),
}, },
child: I18nText('okButton'),
), ),
], ],
), ),
@ -130,7 +128,6 @@ class PatchesSelectorViewModel extends BaseViewModel {
return showDialog( return showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'), title: I18nText('warning'),
content: I18nText( content: I18nText(
'patchItem.patchesChangeWarningDialogText', 'patchItem.patchesChangeWarningDialogText',
@ -143,18 +140,17 @@ class PatchesSelectorViewModel extends BaseViewModel {
), ),
), ),
actions: [ actions: [
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('okButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('patchItem.patchesChangeWarningDialogButton'),
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(context)
..pop() ..pop()
..pop(); ..pop();
}, },
child: I18nText('patchItem.patchesChangeWarningDialogButton'),
), ),
], ],
), ),

View File

@ -7,7 +7,6 @@ import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/toast.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/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.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'; import 'package:stacked/stacked.dart';
class SManageApiUrl extends BaseViewModel { class SManageApiUrl extends BaseViewModel {
@ -33,7 +32,6 @@ class SManageApiUrl extends BaseViewModel {
), ),
], ],
), ),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView( content: SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -51,16 +49,14 @@ class SManageApiUrl extends BaseViewModel {
), ),
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () { onPressed: () {
_apiUrlController.clear(); _apiUrlController.clear();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () { onPressed: () {
String apiUrl = _apiUrlController.text; String apiUrl = _apiUrlController.text;
if (!apiUrl.startsWith('https')) { if (!apiUrl.startsWith('https')) {
@ -70,6 +66,7 @@ class SManageApiUrl extends BaseViewModel {
_toast.showBottom('settingsView.restartAppForChanges'); _toast.showBottom('settingsView.restartAppForChanges');
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('okButton'),
), ),
], ],
), ),
@ -81,16 +78,13 @@ class SManageApiUrl extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('settingsView.sourcesResetDialogTitle'), title: I18nText('settingsView.sourcesResetDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('settingsView.apiURLResetDialogText'), content: I18nText('settingsView.apiURLResetDialogText'),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
_managerAPI.setApiUrl(''); _managerAPI.setApiUrl('');
_toast.showBottom('settingsView.restartAppForChanges'); _toast.showBottom('settingsView.restartAppForChanges');
@ -98,6 +92,7 @@ class SManageApiUrl extends BaseViewModel {
..pop() ..pop()
..pop(); ..pop();
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),

View File

@ -6,7 +6,6 @@ import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.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/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.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'; import 'package:stacked/stacked.dart';
class SManageKeystorePassword extends BaseViewModel { class SManageKeystorePassword extends BaseViewModel {
@ -33,7 +32,6 @@ class SManageKeystorePassword extends BaseViewModel {
), ),
], ],
), ),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView( content: SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -47,21 +45,20 @@ class SManageKeystorePassword extends BaseViewModel {
), ),
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () { onPressed: () {
_keystorePasswordController.clear(); _keystorePasswordController.clear();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () { onPressed: () {
final String passwd = _keystorePasswordController.text; final String passwd = _keystorePasswordController.text;
_managerAPI.setKeystorePassword(passwd); _managerAPI.setKeystorePassword(passwd);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('okButton'),
), ),
], ],
), ),

View File

@ -7,7 +7,6 @@ import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/toast.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/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.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'; import 'package:stacked/stacked.dart';
class SManageSources extends BaseViewModel { class SManageSources extends BaseViewModel {
@ -43,7 +42,6 @@ class SManageSources extends BaseViewModel {
), ),
], ],
), ),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView( content: SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -107,9 +105,7 @@ class SManageSources extends BaseViewModel {
), ),
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () { onPressed: () {
_orgPatSourceController.clear(); _orgPatSourceController.clear();
_patSourceController.clear(); _patSourceController.clear();
@ -117,9 +113,9 @@ class SManageSources extends BaseViewModel {
_intSourceController.clear(); _intSourceController.clear();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () { onPressed: () {
_managerAPI.setRepoUrl(_hostSourceController.text.trim()); _managerAPI.setRepoUrl(_hostSourceController.text.trim());
_managerAPI.setPatchesRepo( _managerAPI.setPatchesRepo(
@ -133,6 +129,7 @@ class SManageSources extends BaseViewModel {
_toast.showBottom('settingsView.restartAppForChanges'); _toast.showBottom('settingsView.restartAppForChanges');
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('okButton'),
), ),
], ],
), ),
@ -144,16 +141,13 @@ class SManageSources extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('settingsView.sourcesResetDialogTitle'), title: I18nText('settingsView.sourcesResetDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('settingsView.sourcesResetDialogText'), content: I18nText('settingsView.sourcesResetDialogText'),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
_managerAPI.setRepoUrl(''); _managerAPI.setRepoUrl('');
_managerAPI.setPatchesRepo(''); _managerAPI.setPatchesRepo('');
@ -165,6 +159,7 @@ class SManageSources extends BaseViewModel {
..pop() ..pop()
..pop(); ..pop();
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),

View File

@ -51,7 +51,6 @@ class SUpdateLanguage extends BaseViewModel {
context: parentContext, context: parentContext,
builder: (context) => SimpleDialog( builder: (context) => SimpleDialog(
title: I18nText('settingsView.languageLabel'), title: I18nText('settingsView.languageLabel'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
children: [ children: [
SizedBox( SizedBox(
height: 500, height: 500,

View File

@ -7,7 +7,6 @@ import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.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/settingsView/settings_section.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
class SUpdateThemeUI extends StatefulWidget { class SUpdateThemeUI extends StatefulWidget {
const SUpdateThemeUI({super.key}); const SUpdateThemeUI({super.key});
@ -36,9 +35,9 @@ class _SUpdateThemeUIState extends State<SUpdateThemeUI> {
), ),
), ),
), ),
trailing: CustomMaterialButton( trailing: FilledButton(
label: getThemeModeName(),
onPressed: () => {showThemeDialog(context)}, onPressed: () => {showThemeDialog(context)},
child: getThemeModeName(),
), ),
onTap: () => {showThemeDialog(context)}, onTap: () => {showThemeDialog(context)},
), ),
@ -122,7 +121,6 @@ class _SUpdateThemeUIState extends State<SUpdateThemeUI> {
title: I18nText('settingsView.themeModeLabel'), title: I18nText('settingsView.themeModeLabel'),
icon: const Icon(Icons.palette), icon: const Icon(Icons.palette),
contentPadding: const EdgeInsets.symmetric(vertical: 16), contentPadding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView( content: SingleChildScrollView(
child: ValueListenableBuilder( child: ValueListenableBuilder(
valueListenable: newTheme, valueListenable: newTheme,
@ -164,19 +162,18 @@ class _SUpdateThemeUIState extends State<SUpdateThemeUI> {
), ),
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('cancelButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () { onPressed: () {
setThemeMode(context, newTheme.value); setThemeMode(context, newTheme.value);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('okButton'),
), ),
], ],
), ),

View File

@ -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/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_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/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:share_plus/share_plus.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
@ -52,7 +51,6 @@ class SettingsViewModel extends BaseViewModel {
return showDialog( return showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'), title: I18nText('warning'),
content: I18nText( content: I18nText(
'settingsView.enablePatchesSelectionWarningText', 'settingsView.enablePatchesSelectionWarningText',
@ -65,20 +63,19 @@ class SettingsViewModel extends BaseViewModel {
), ),
), ),
actions: [ actions: [
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
_managerAPI.setChangingToggleModified(true); _managerAPI.setChangingToggleModified(true);
_managerAPI.setPatchesChangeEnabled(true); _managerAPI.setPatchesChangeEnabled(true);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('yesButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('noButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('noButton'),
), ),
], ],
), ),
@ -87,7 +84,6 @@ class SettingsViewModel extends BaseViewModel {
return showDialog( return showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'), title: I18nText('warning'),
content: I18nText( content: I18nText(
'settingsView.disablePatchesSelectionWarningText', 'settingsView.disablePatchesSelectionWarningText',
@ -100,21 +96,20 @@ class SettingsViewModel extends BaseViewModel {
), ),
), ),
actions: [ actions: [
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
_managerAPI.setChangingToggleModified(true); _managerAPI.setChangingToggleModified(true);
_patchesSelectorViewModel.selectDefaultPatches(); _patchesSelectorViewModel.selectDefaultPatches();
_managerAPI.setPatchesChangeEnabled(false); _managerAPI.setPatchesChangeEnabled(false);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),
@ -145,12 +140,13 @@ class SettingsViewModel extends BaseViewModel {
} }
Future<void>? showRequireSuggestedAppVersionDialog( Future<void>? showRequireSuggestedAppVersionDialog(
BuildContext context, bool value,) { BuildContext context,
bool value,
) {
if (!value) { if (!value) {
return showDialog( return showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'), title: I18nText('warning'),
content: I18nText( content: I18nText(
'settingsView.requireSuggestedAppVersionDialogText', 'settingsView.requireSuggestedAppVersionDialogText',
@ -163,19 +159,18 @@ class SettingsViewModel extends BaseViewModel {
), ),
), ),
actions: [ actions: [
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
_managerAPI.enableRequireSuggestedAppVersionStatus(false); _managerAPI.enableRequireSuggestedAppVersionStatus(false);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('yesButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('noButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('noButton'),
), ),
], ],
), ),

View File

@ -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/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_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/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class AppInfoViewModel extends BaseViewModel { class AppInfoViewModel extends BaseViewModel {
@ -67,12 +66,11 @@ class AppInfoViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('appInfoView.rootDialogTitle'), title: I18nText('appInfoView.rootDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('appInfoView.rootDialogText'), content: I18nText('appInfoView.rootDialogText'),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('okButton'),
), ),
], ],
), ),
@ -85,23 +83,21 @@ class AppInfoViewModel extends BaseViewModel {
title: I18nText( title: I18nText(
'appInfoView.unpatchButton', 'appInfoView.unpatchButton',
), ),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText( content: I18nText(
'appInfoView.unpatchDialogText', 'appInfoView.unpatchDialogText',
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () { onPressed: () {
uninstallApp(context, app, onlyUnpatch); uninstallApp(context, app, onlyUnpatch);
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),
@ -131,14 +127,13 @@ class AppInfoViewModel extends BaseViewModel {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('appInfoView.appliedPatchesLabel'), title: I18nText('appInfoView.appliedPatchesLabel'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView( content: SingleChildScrollView(
child: Text(getAppliedPatchesString(app.appliedPatches)), child: Text(getAppliedPatchesString(app.appliedPatches)),
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('okButton'),
), ),
], ],
), ),

View File

@ -3,7 +3,6 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.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_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
class LatestCommitCard extends StatefulWidget { class LatestCommitCard extends StatefulWidget {
const LatestCommitCard({ const LatestCommitCard({
@ -58,14 +57,14 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
initialData: false, initialData: false,
builder: (context, snapshot) => Opacity( builder: (context, snapshot) => Opacity(
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25, opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
child: CustomMaterialButton( child: FilledButton(
label: I18nText('updateButton'),
onPressed: snapshot.hasData && snapshot.data! onPressed: snapshot.hasData && snapshot.data!
? () => widget.model.showUpdateConfirmationDialog( ? () => widget.model.showUpdateConfirmationDialog(
widget.parentContext, widget.parentContext,
false, false,
) )
: () => {}, : () => {},
child: I18nText('updateButton'),
), ),
), ),
), ),
@ -113,14 +112,14 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
initialData: false, initialData: false,
builder: (context, snapshot) => Opacity( builder: (context, snapshot) => Opacity(
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25, opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
child: CustomMaterialButton( child: FilledButton(
label: I18nText('updateButton'),
onPressed: snapshot.hasData && snapshot.data! onPressed: snapshot.hasData && snapshot.data!
? () => widget.model.showUpdateConfirmationDialog( ? () => widget.model.showUpdateConfirmationDialog(
widget.parentContext, widget.parentContext,
true, true,
) )
: () => {}, : () => {},
child: I18nText('updateButton'),
), ),
), ),
), ),

View File

@ -3,7 +3,6 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.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 { class UpdateConfirmationDialog extends StatelessWidget {
const UpdateConfirmationDialog({super.key, required this.isPatches}); const UpdateConfirmationDialog({super.key, required this.isPatches});
@ -86,15 +85,14 @@ class UpdateConfirmationDialog extends StatelessWidget {
], ],
), ),
), ),
CustomMaterialButton( FilledButton(
isExpanded: true,
label: I18nText('updateButton'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
isPatches isPatches
? model.updatePatches(context) ? model.updatePatches(context)
: model.updateManager(context); : model.updateManager(context);
}, },
child: I18nText('updateButton'),
), ),
], ],
), ),

View File

@ -5,7 +5,6 @@ import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/services/manager_api.dart'; import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/toast.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_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class PatchItem extends StatefulWidget { class PatchItem extends StatefulWidget {
@ -216,7 +215,6 @@ class _PatchItemState extends State<PatchItem> {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('warning'), title: I18nText('warning'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText( content: I18nText(
'patchItem.unsupportedDialogText', 'patchItem.unsupportedDialogText',
translationParams: { translationParams: {
@ -226,9 +224,9 @@ class _PatchItemState extends State<PatchItem> {
}, },
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('okButton'),
), ),
], ],
), ),
@ -240,14 +238,13 @@ class _PatchItemState extends State<PatchItem> {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('notice'), title: I18nText('notice'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText( content: I18nText(
'patchItem.unsupportedRequiredOption', 'patchItem.unsupportedRequiredOption',
), ),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( FilledButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('okButton'),
), ),
], ],
), ),

View File

@ -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/settingsFragment/settings_manage_keystore_password.dart';
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.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/settingsView/settings_section.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
final _settingsViewModel = SettingsViewModel(); final _settingsViewModel = SettingsViewModel();
@ -151,20 +150,18 @@ class SExportSection extends StatelessWidget {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText(dialogTitle), title: I18nText(dialogTitle),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText(dialogText), content: I18nText(dialogText),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () => { onPressed: () => {
Navigator.of(context).pop(), Navigator.of(context).pop(),
dialogAction(), dialogAction(),
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),
@ -176,20 +173,18 @@ class SExportSection extends StatelessWidget {
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: I18nText('settingsView.regenerateKeystoreDialogTitle'), title: I18nText('settingsView.regenerateKeystoreDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('settingsView.regenerateKeystoreDialogText'), content: I18nText('settingsView.regenerateKeystoreDialogText'),
actions: <Widget>[ actions: <Widget>[
CustomMaterialButton( TextButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: I18nText('noButton'),
), ),
CustomMaterialButton( FilledButton(
label: I18nText('yesButton'),
onPressed: () => { onPressed: () => {
Navigator.of(context).pop(), Navigator.of(context).pop(),
_settingsViewModel.deleteKeystore(), _settingsViewModel.deleteKeystore(),
}, },
child: I18nText('yesButton'),
), ),
], ],
), ),

View File

@ -3,7 +3,6 @@ import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.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_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:timeago/timeago.dart'; import 'package:timeago/timeago.dart';
class ApplicationItem extends StatefulWidget { class ApplicationItem extends StatefulWidget {
@ -24,7 +23,6 @@ class ApplicationItem extends StatefulWidget {
} }
class _ApplicationItemState extends State<ApplicationItem> { class _ApplicationItemState extends State<ApplicationItem> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -81,9 +79,9 @@ class _ApplicationItemState extends State<ApplicationItem> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CustomMaterialButton( FilledButton(
label: I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed, onPressed: widget.onPressed,
child: I18nText('applicationItem.infoButton'),
), ),
], ],
), ),

View File

@ -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,
),
),
);
}
}