diff --git a/README.md b/README.md index 6db2ff9bf1..c4484d9810 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ ReVanced Manager is an Android application that uses ReVanced Patcher to add, re ## 💪 Features -We provide the some of the features are: +Some of the features we provide are: * 📱 **Portable**: ReVanced Patcher that fit in your pocket; * 🤗 **Intuitive UI**: Help you manage your patched applications with easy-to-use interface; diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 744c64d127..db8c3baafe 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/docs/3_troubleshooting.md b/docs/3_troubleshooting.md index 3c1fe03be2..1573e50868 100644 --- a/docs/3_troubleshooting.md +++ b/docs/3_troubleshooting.md @@ -5,14 +5,16 @@ In case you encounter any issues while using ReVanced Manager, please refer to t - 💉 Patching fails with an error Make sure ReVanced Manager is up to date by following [🔄 Updating ReVanced Manager](2_3_updating.md) and select the **Default** button when choosing patches. - + - 🚫 App not installed as package conflicts with an existing package - An existing installation of the app you're trying to patch is conflicting with the patched app. Uninstall the existing app before installing the patched app. + An existing installation of the app you're trying to patch conflicts with the patched app (i.e., signature mismatch or downgrade). Uninstall the existing app before installing the patched app. - ❗️ Error code `135`, `139` or `1` when patching the app - Your device is not supported. Refer to the [Prerequisites](0_prerequisites.md) page for supported devices. + You may be trying to patch a split APK[^1]. This may not work under certain circumstances. In such a case, patch a full APK. + + Your device may otherwise be unsupported. Please look at the [Prerequisites](0_prerequisites.md) page for supported devices. Alternatively, you can use [ReVanced CLI](https://github.com/revanced/revanced-cli) to patch the app. @@ -25,3 +27,5 @@ In case you encounter any issues while using ReVanced Manager, please refer to t The next page will teach you how to build ReVanced Manager from source. Continue: [🔨 Building from source](4_building.md) + +[^1]: https://developer.android.com/guide/app-bundle/app-bundle-format diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart index 7a9e091d56..06d87f4344 100644 --- a/lib/services/manager_api.dart +++ b/lib/services/manager_api.dart @@ -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 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'), ), ], ), diff --git a/lib/ui/views/app_selector/app_selector_viewmodel.dart b/lib/ui/views/app_selector/app_selector_viewmodel.dart index 7961ceb9ed..5b94eee7d8 100644 --- a/lib/ui/views/app_selector/app_selector_viewmodel.dart +++ b/lib/ui/views/app_selector/app_selector_viewmodel.dart @@ -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), diff --git a/lib/ui/views/home/home_viewmodel.dart b/lib/ui/views/home/home_viewmodel.dart index b2bdad09e4..a93fb16feb 100644 --- a/lib/ui/views/home/home_viewmodel.dart +++ b/lib/ui/views/home/home_viewmodel.dart @@ -20,7 +20,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'; @@ -64,8 +63,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'), ), ], ), @@ -325,12 +323,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'), ), ), ], @@ -356,22 +354,21 @@ 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 _patcherAPI.installApk(context, downloadedApk!.path); }, + child: I18nText('updateButton'), ), ), ], diff --git a/lib/ui/views/installer/installer_viewmodel.dart b/lib/ui/views/installer/installer_viewmodel.dart index 79a713d57a..0826a9c74a 100644 --- a/lib/ui/views/installer/installer_viewmodel.dart +++ b/lib/ui/views/installer/installer_viewmodel.dart @@ -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: [ - 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,8 +320,6 @@ class InstallerViewModel extends BaseViewModel { title: I18nText( 'installerView.installType', ), - backgroundColor: - Theme.of(innerContext).colorScheme.secondaryContainer, icon: const Icon(Icons.file_download_outlined), contentPadding: const EdgeInsets.symmetric(vertical: 16), content: SingleChildScrollView( @@ -391,19 +386,18 @@ class InstallerViewModel extends BaseViewModel { ), ), actions: [ - CustomMaterialButton( - label: I18nText('cancelButton'), - isFilled: false, + TextButton( onPressed: () { Navigator.of(innerContext).pop(); }, + child: I18nText('cancelButton'), ), - CustomMaterialButton( - label: I18nText('installerView.installButton'), + FilledButton( onPressed: () { Navigator.of(innerContext).pop(); installResult(context, installType.value == 1); }, + child: I18nText('installerView.installButton'), ), ], ), diff --git a/lib/ui/views/patch_options/patch_options_view.dart b/lib/ui/views/patch_options/patch_options_view.dart index e35b849da3..e6ac1bb280 100644 --- a/lib/ui/views/patch_options/patch_options_view.dart +++ b/lib/ui/views/patch_options/patch_options_view.dart @@ -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), diff --git a/lib/ui/views/patch_options/patch_options_viewmodel.dart b/lib/ui/views/patch_options/patch_options_viewmodel.dart index 520fd9c68e..2dbaef7b28 100644 --- a/lib/ui/views/patch_options/patch_options_viewmodel.dart +++ b/lib/ui/views/patch_options/patch_options_viewmodel.dart @@ -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 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() @@ -256,12 +247,13 @@ Future showRequiredOptionNullDialog( PatchesSelectorViewModel().showPatchesChangeDialog(context); } }, + child: I18nText('patchOptionsView.deselectPatch'), ), - CustomMaterialButton( - label: I18nText('okButton'), + FilledButton( onPressed: () { Navigator.of(context).pop(); }, + child: I18nText('okButton'), ), ], content: I18nText( diff --git a/lib/ui/views/patcher/patcher_viewmodel.dart b/lib/ui/views/patcher/patcher_viewmodel.dart index 616c5fc2bd..2c3940fdc8 100644 --- a/lib/ui/views/patcher/patcher_viewmodel.dart +++ b/lib/ui/views/patcher/patcher_viewmodel.dart @@ -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'; @@ -24,6 +23,7 @@ class PatcherViewModel extends BaseViewModel { final NavigationService _navigationService = locator(); final ManagerAPI _managerAPI = locator(); final PatcherAPI _patcherAPI = locator(); + Set savedPatchNames = {}; PatchedApplication? selectedApp; BuildContext? ctx; List selectedPatches = []; @@ -55,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: [ - 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'), ), ], ), @@ -97,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: [ - 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'), ), ], ), @@ -130,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: [ - 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'), ), ], ), @@ -217,6 +211,20 @@ class PatcherViewModel extends BaseViewModel { } } + bool isPatchNew(Patch patch) { + if (savedPatchNames.isEmpty) { + savedPatchNames = _managerAPI + .getSavedPatches(selectedApp!.packageName) + .map((p) => p.name) + .toSet(); + } + if (savedPatchNames.isEmpty) { + return false; + } else { + return !savedPatchNames.contains(patch.name); + } + } + Future loadLastSelectedPatches() async { this.selectedPatches.clear(); removedPatches.clear(); @@ -239,6 +247,14 @@ class PatcherViewModel extends BaseViewModel { .selectedPatches .removeWhere((patch) => patch.compatiblePackages.isEmpty); } + this.selectedPatches.addAll( + patches.where( + (patch) => + isPatchNew(patch) && + !patch.excluded && + !this.selectedPatches.contains(patch), + ), + ); final usedPatches = _managerAPI.getUsedPatches(selectedApp!.packageName); for (final patch in usedPatches) { if (!patches.any((p) => p.name == patch.name)) { diff --git a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart index 0470e4e7a5..82f330b5ba 100644 --- a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart +++ b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart @@ -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'; @@ -25,6 +24,7 @@ class PatchesSelectorViewModel extends BaseViewModel { locator().selectedPatches; PatchedApplication? selectedApp = locator().selectedApp; String? patchesVersion = ''; + bool isDefaultPatchesRepo() { return _managerAPI.getPatchesRepo() == 'revanced/revanced-patches'; } @@ -48,6 +48,7 @@ class PatchesSelectorViewModel extends BaseViewModel { }); currentSelection.clear(); currentSelection.addAll(selectedPatches); + notifyListeners(); } @@ -92,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: { @@ -100,11 +100,11 @@ class PatchesSelectorViewModel extends BaseViewModel { }, ), actions: [ - CustomMaterialButton( - label: I18nText('okButton'), + FilledButton( onPressed: () => { Navigator.of(context).pop(), }, + child: I18nText('okButton'), ), ], ), @@ -128,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', @@ -141,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'), ), ], ), @@ -277,14 +275,7 @@ class PatchesSelectorViewModel extends BaseViewModel { } bool isPatchNew(Patch patch) { - final List savedPatches = - _managerAPI.getSavedPatches(selectedApp!.packageName); - if (savedPatches.isEmpty) { - return false; - } else { - return !savedPatches - .any((p) => p.getSimpleName() == patch.getSimpleName()); - } + return locator().isPatchNew(patch); } List getSupportedVersions(Patch patch) { diff --git a/lib/ui/views/settings/settingsFragment/settings_manage_api_url.dart b/lib/ui/views/settings/settingsFragment/settings_manage_api_url.dart index 6fa1ccc1dd..5669a07303 100644 --- a/lib/ui/views/settings/settingsFragment/settings_manage_api_url.dart +++ b/lib/ui/views/settings/settingsFragment/settings_manage_api_url.dart @@ -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: [ @@ -51,16 +49,14 @@ class SManageApiUrl extends BaseViewModel { ), ), actions: [ - 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: [ - 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'), ), ], ), diff --git a/lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart b/lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart index 4ac4689bde..fb717f64bb 100644 --- a/lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart +++ b/lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart @@ -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: [ @@ -47,21 +45,20 @@ class SManageKeystorePassword extends BaseViewModel { ), ), actions: [ - 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'), ), ], ), diff --git a/lib/ui/views/settings/settingsFragment/settings_manage_sources.dart b/lib/ui/views/settings/settingsFragment/settings_manage_sources.dart index 76e3171b1f..52c30ff043 100644 --- a/lib/ui/views/settings/settingsFragment/settings_manage_sources.dart +++ b/lib/ui/views/settings/settingsFragment/settings_manage_sources.dart @@ -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: [ @@ -107,9 +105,7 @@ class SManageSources extends BaseViewModel { ), ), actions: [ - 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: [ - 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'), ), ], ), diff --git a/lib/ui/views/settings/settingsFragment/settings_update_language.dart b/lib/ui/views/settings/settingsFragment/settings_update_language.dart index 66bb2c3e7f..1e7b4a721e 100644 --- a/lib/ui/views/settings/settingsFragment/settings_update_language.dart +++ b/lib/ui/views/settings/settingsFragment/settings_update_language.dart @@ -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, diff --git a/lib/ui/views/settings/settingsFragment/settings_update_theme.dart b/lib/ui/views/settings/settingsFragment/settings_update_theme.dart index 66fa683094..09c1b28b19 100644 --- a/lib/ui/views/settings/settingsFragment/settings_update_theme.dart +++ b/lib/ui/views/settings/settingsFragment/settings_update_theme.dart @@ -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 { ), ), ), - trailing: CustomMaterialButton( - label: getThemeModeName(), + trailing: FilledButton( onPressed: () => {showThemeDialog(context)}, + child: getThemeModeName(), ), onTap: () => {showThemeDialog(context)}, ), @@ -122,7 +121,6 @@ class _SUpdateThemeUIState extends State { 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 { ), ), actions: [ - 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'), ), ], ), diff --git a/lib/ui/views/settings/settings_viewmodel.dart b/lib/ui/views/settings/settings_viewmodel.dart index e51b13827c..6fa85730e3 100644 --- a/lib/ui/views/settings/settings_viewmodel.dart +++ b/lib/ui/views/settings/settings_viewmodel.dart @@ -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? 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', ), diff --git a/lib/ui/widgets/appInfoView/app_info_viewmodel.dart b/lib/ui/widgets/appInfoView/app_info_viewmodel.dart index d186016843..d4652f445e 100644 --- a/lib/ui/widgets/appInfoView/app_info_viewmodel.dart +++ b/lib/ui/widgets/appInfoView/app_info_viewmodel.dart @@ -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 { @@ -69,12 +68,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: [ - CustomMaterialButton( - label: I18nText('okButton'), + FilledButton( onPressed: () => Navigator.of(context).pop(), + child: I18nText('okButton'), ), ], ), @@ -87,23 +85,21 @@ class AppInfoViewModel extends BaseViewModel { title: I18nText( 'appInfoView.unpatchButton', ), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, content: I18nText( 'appInfoView.unpatchDialogText', ), actions: [ - 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'), ), ], ), @@ -133,14 +129,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: [ - CustomMaterialButton( - label: I18nText('okButton'), + FilledButton( onPressed: () => Navigator.of(context).pop(), + child: I18nText('okButton'), ), ], ), diff --git a/lib/ui/widgets/homeView/latest_commit_card.dart b/lib/ui/widgets/homeView/latest_commit_card.dart index 9d0625ce53..5525269881 100644 --- a/lib/ui/widgets/homeView/latest_commit_card.dart +++ b/lib/ui/widgets/homeView/latest_commit_card.dart @@ -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 { 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 { 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'), ), ), ), diff --git a/lib/ui/widgets/homeView/update_confirmation_dialog.dart b/lib/ui/widgets/homeView/update_confirmation_dialog.dart index 7839536ad5..de5b72a047 100644 --- a/lib/ui/widgets/homeView/update_confirmation_dialog.dart +++ b/lib/ui/widgets/homeView/update_confirmation_dialog.dart @@ -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'), ), ], ), diff --git a/lib/ui/widgets/patchesSelectorView/patch_item.dart b/lib/ui/widgets/patchesSelectorView/patch_item.dart index 11fd08392f..70692ab2e8 100644 --- a/lib/ui/widgets/patchesSelectorView/patch_item.dart +++ b/lib/ui/widgets/patchesSelectorView/patch_item.dart @@ -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 { 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 { }, ), actions: [ - CustomMaterialButton( - label: I18nText('okButton'), + FilledButton( onPressed: () => Navigator.of(context).pop(), + child: I18nText('okButton'), ), ], ), @@ -240,14 +238,13 @@ class _PatchItemState extends State { context: context, builder: (context) => AlertDialog( title: I18nText('notice'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, content: I18nText( 'patchItem.unsupportedRequiredOption', ), actions: [ - CustomMaterialButton( - label: I18nText('okButton'), + FilledButton( onPressed: () => Navigator.of(context).pop(), + child: I18nText('okButton'), ), ], ), diff --git a/lib/ui/widgets/settingsView/settings_export_section.dart b/lib/ui/widgets/settingsView/settings_export_section.dart index 70aaf9b035..2f7e4aa7ab 100644 --- a/lib/ui/widgets/settingsView/settings_export_section.dart +++ b/lib/ui/widgets/settingsView/settings_export_section.dart @@ -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: [ - 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: [ - 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'), ), ], ), diff --git a/lib/ui/widgets/shared/application_item.dart b/lib/ui/widgets/shared/application_item.dart index 5f527eb14a..ce432138b6 100644 --- a/lib/ui/widgets/shared/application_item.dart +++ b/lib/ui/widgets/shared/application_item.dart @@ -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 { - @override void initState() { super.initState(); @@ -81,9 +79,9 @@ class _ApplicationItemState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [ - CustomMaterialButton( - label: I18nText('applicationItem.infoButton'), + FilledButton( onPressed: widget.onPressed, + child: I18nText('applicationItem.infoButton'), ), ], ), diff --git a/lib/ui/widgets/shared/custom_material_button.dart b/lib/ui/widgets/shared/custom_material_button.dart deleted file mode 100644 index c861a709ea..0000000000 --- a/lib/ui/widgets/shared/custom_material_button.dart +++ /dev/null @@ -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 createState() => _TimerButtonState(); -} - -class _TimerButtonState extends State { - 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, - ), - ), - ); - } -} diff --git a/pubspec.yaml b/pubspec.yaml index aa45fea14a..9b1af65023 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/ReVanced/revanced-manager publish_to: 'none' -version: 1.17.1+101700100 +version: 1.17.3+101700300 environment: sdk: '>=3.0.0 <4.0.0'