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
21 changed files with 135 additions and 333 deletions

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/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',
),