From c6f9e36f4b9db8d6c41383c8d2930054d5807757 Mon Sep 17 00:00:00 2001 From: validcube Date: Sat, 13 Jul 2024 17:32:34 +0700 Subject: [PATCH] refactor: Migrate deprecated member --- lib/theme.dart | 4 +-- lib/ui/theme/dynamic_theme_builder.dart | 5 ++-- lib/ui/views/home/home_view.dart | 29 +++++++++---------- .../patchesSelectorView/patch_item.dart | 8 ++--- .../widgets/shared/custom_sliver_app_bar.dart | 4 +-- 5 files changed, 23 insertions(+), 27 deletions(-) diff --git a/lib/theme.dart b/lib/theme.dart index 99883b4a..471d2345 100644 --- a/lib/theme.dart +++ b/lib/theme.dart @@ -10,7 +10,7 @@ var lightCustomTheme = ThemeData( useMaterial3: true, colorScheme: lightCustomColorScheme, navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( + labelTextStyle: WidgetStateProperty.all( TextStyle( color: lightCustomColorScheme.onSurface, fontWeight: FontWeight.w500, @@ -31,7 +31,7 @@ var darkCustomTheme = ThemeData( useMaterial3: true, colorScheme: darkCustomColorScheme, navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( + labelTextStyle: WidgetStateProperty.all( TextStyle( color: darkCustomColorScheme.onSurface, fontWeight: FontWeight.w500, diff --git a/lib/ui/theme/dynamic_theme_builder.dart b/lib/ui/theme/dynamic_theme_builder.dart index c7047617..f66afb81 100644 --- a/lib/ui/theme/dynamic_theme_builder.dart +++ b/lib/ui/theme/dynamic_theme_builder.dart @@ -2,7 +2,6 @@ import 'dart:ui'; import 'package:dynamic_color/dynamic_color.dart'; import 'package:dynamic_themes/dynamic_themes.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:revanced_manager/app/app.router.dart'; @@ -52,7 +51,7 @@ class _DynamicThemeBuilderState extends State final ThemeData lightDynamicTheme = ThemeData( useMaterial3: true, navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( + labelTextStyle: WidgetStateProperty.all( GoogleFonts.roboto( color: lightColorScheme?.onSurface, fontWeight: FontWeight.w500, @@ -66,7 +65,7 @@ class _DynamicThemeBuilderState extends State brightness: Brightness.dark, useMaterial3: true, navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( + labelTextStyle: WidgetStateProperty.all( GoogleFonts.roboto( color: darkColorScheme?.onSurface, fontWeight: FontWeight.w500, diff --git a/lib/ui/views/home/home_view.dart b/lib/ui/views/home/home_view.dart index c9770861..03d07563 100644 --- a/lib/ui/views/home/home_view.dart +++ b/lib/ui/views/home/home_view.dart @@ -4,8 +4,8 @@ import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/gen/strings.g.dart'; import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; import 'package:revanced_manager/ui/widgets/homeView/installed_apps_card.dart'; -import 'package:revanced_manager/ui/widgets/homeView/latest_commit_card.dart'; import 'package:revanced_manager/ui/widgets/homeView/last_patched_app_card.dart'; +import 'package:revanced_manager/ui/widgets/homeView/latest_commit_card.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart'; import 'package:stacked/stacked.dart'; @@ -48,20 +48,19 @@ class HomeView extends StatelessWidget { LatestCommitCard(model: model, parentContext: context), const SizedBox(height: 23), Visibility( - visible: model.isLastPatchedAppEnabled(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - t.homeView.lastPatchedAppSubtitle, - style: Theme.of(context).textTheme.titleLarge, - ), - const SizedBox(height: 10), - LastPatchedAppCard(), - const SizedBox(height: 10), - - ], - ), + visible: model.isLastPatchedAppEnabled(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + t.homeView.lastPatchedAppSubtitle, + style: Theme.of(context).textTheme.titleLarge, + ), + const SizedBox(height: 10), + LastPatchedAppCard(), + const SizedBox(height: 10), + ], + ), ), Text( t.homeView.patchedSubtitle, diff --git a/lib/ui/widgets/patchesSelectorView/patch_item.dart b/lib/ui/widgets/patchesSelectorView/patch_item.dart index 2eba6722..d66903fb 100644 --- a/lib/ui/widgets/patchesSelectorView/patch_item.dart +++ b/lib/ui/widgets/patchesSelectorView/patch_item.dart @@ -170,7 +170,7 @@ class _PatchItemState extends State { onPressed: () => _showUnsupportedWarningDialog(), style: ButtonStyle( - shape: MaterialStateProperty.all( + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), @@ -181,12 +181,10 @@ class _PatchItemState extends State { ), ), ), - backgroundColor: - MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( Colors.transparent, ), - foregroundColor: - MaterialStateProperty.all( + foregroundColor: WidgetStateProperty.all( Theme.of(context).colorScheme.secondary, ), ), diff --git a/lib/ui/widgets/shared/custom_sliver_app_bar.dart b/lib/ui/widgets/shared/custom_sliver_app_bar.dart index 08b75af2..cf105f19 100644 --- a/lib/ui/widgets/shared/custom_sliver_app_bar.dart +++ b/lib/ui/widgets/shared/custom_sliver_app_bar.dart @@ -38,8 +38,8 @@ class CustomSliverAppBar extends StatelessWidget { onPressed: onBackButtonPressed ?? () => Navigator.of(context).pop(), ), - backgroundColor: MaterialStateColor.resolveWith( - (states) => states.contains(MaterialState.scrolledUnder) + backgroundColor: WidgetStateColor.resolveWith( + (states) => states.contains(WidgetState.scrolledUnder) ? Theme.of(context).colorScheme.surface : Theme.of(context).canvasColor, ),