refactor: Migrate deprecated member

This commit is contained in:
validcube 2024-07-13 17:32:34 +07:00
parent e9cee0abe2
commit c6f9e36f4b
No known key found for this signature in database
GPG key ID: DBA94253E1D3F267
5 changed files with 23 additions and 27 deletions

View file

@ -10,7 +10,7 @@ var lightCustomTheme = ThemeData(
useMaterial3: true, useMaterial3: true,
colorScheme: lightCustomColorScheme, colorScheme: lightCustomColorScheme,
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all( labelTextStyle: WidgetStateProperty.all(
TextStyle( TextStyle(
color: lightCustomColorScheme.onSurface, color: lightCustomColorScheme.onSurface,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -31,7 +31,7 @@ var darkCustomTheme = ThemeData(
useMaterial3: true, useMaterial3: true,
colorScheme: darkCustomColorScheme, colorScheme: darkCustomColorScheme,
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all( labelTextStyle: WidgetStateProperty.all(
TextStyle( TextStyle(
color: darkCustomColorScheme.onSurface, color: darkCustomColorScheme.onSurface,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,

View file

@ -2,7 +2,6 @@ import 'dart:ui';
import 'package:dynamic_color/dynamic_color.dart'; import 'package:dynamic_color/dynamic_color.dart';
import 'package:dynamic_themes/dynamic_themes.dart'; import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.router.dart'; import 'package:revanced_manager/app/app.router.dart';
@ -52,7 +51,7 @@ class _DynamicThemeBuilderState extends State<DynamicThemeBuilder>
final ThemeData lightDynamicTheme = ThemeData( final ThemeData lightDynamicTheme = ThemeData(
useMaterial3: true, useMaterial3: true,
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all( labelTextStyle: WidgetStateProperty.all(
GoogleFonts.roboto( GoogleFonts.roboto(
color: lightColorScheme?.onSurface, color: lightColorScheme?.onSurface,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -66,7 +65,7 @@ class _DynamicThemeBuilderState extends State<DynamicThemeBuilder>
brightness: Brightness.dark, brightness: Brightness.dark,
useMaterial3: true, useMaterial3: true,
navigationBarTheme: NavigationBarThemeData( navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all( labelTextStyle: WidgetStateProperty.all(
GoogleFonts.roboto( GoogleFonts.roboto(
color: darkColorScheme?.onSurface, color: darkColorScheme?.onSurface,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,

View file

@ -4,8 +4,8 @@ import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/gen/strings.g.dart'; import 'package:revanced_manager/gen/strings.g.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/homeView/installed_apps_card.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/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:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
@ -48,20 +48,19 @@ class HomeView extends StatelessWidget {
LatestCommitCard(model: model, parentContext: context), LatestCommitCard(model: model, parentContext: context),
const SizedBox(height: 23), const SizedBox(height: 23),
Visibility( Visibility(
visible: model.isLastPatchedAppEnabled(), visible: model.isLastPatchedAppEnabled(),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
t.homeView.lastPatchedAppSubtitle, t.homeView.lastPatchedAppSubtitle,
style: Theme.of(context).textTheme.titleLarge, style: Theme.of(context).textTheme.titleLarge,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
LastPatchedAppCard(), LastPatchedAppCard(),
const SizedBox(height: 10), const SizedBox(height: 10),
],
], ),
),
), ),
Text( Text(
t.homeView.patchedSubtitle, t.homeView.patchedSubtitle,

View file

@ -170,7 +170,7 @@ class _PatchItemState extends State<PatchItem> {
onPressed: () => onPressed: () =>
_showUnsupportedWarningDialog(), _showUnsupportedWarningDialog(),
style: ButtonStyle( style: ButtonStyle(
shape: MaterialStateProperty.all( shape: WidgetStateProperty.all(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(8), BorderRadius.circular(8),
@ -181,12 +181,10 @@ class _PatchItemState extends State<PatchItem> {
), ),
), ),
), ),
backgroundColor: backgroundColor: WidgetStateProperty.all(
MaterialStateProperty.all(
Colors.transparent, Colors.transparent,
), ),
foregroundColor: foregroundColor: WidgetStateProperty.all(
MaterialStateProperty.all(
Theme.of(context).colorScheme.secondary, Theme.of(context).colorScheme.secondary,
), ),
), ),

View file

@ -38,8 +38,8 @@ class CustomSliverAppBar extends StatelessWidget {
onPressed: onPressed:
onBackButtonPressed ?? () => Navigator.of(context).pop(), onBackButtonPressed ?? () => Navigator.of(context).pop(),
), ),
backgroundColor: MaterialStateColor.resolveWith( backgroundColor: WidgetStateColor.resolveWith(
(states) => states.contains(MaterialState.scrolledUnder) (states) => states.contains(WidgetState.scrolledUnder)
? Theme.of(context).colorScheme.surface ? Theme.of(context).colorScheme.surface
: Theme.of(context).canvasColor, : Theme.of(context).canvasColor,
), ),