refactor: migrate deprecated warnings

This commit is contained in:
Kingkor Roy Tirtho 2024-06-02 21:15:11 +06:00
parent 71341ec0bd
commit 56241f773a
27 changed files with 74 additions and 96 deletions

View File

@ -35,6 +35,10 @@ class ArtistCard extends HookConsumerWidget {
final radius = BorderRadius.circular(15); final radius = BorderRadius.circular(15);
final bgColor = useBrightnessValue(
theme.colorScheme.surface,
theme.colorScheme.surfaceContainerHigh,
);
final double size = useBreakpointValue<double>( final double size = useBreakpointValue<double>(
xs: 130, xs: 130,
sm: 130, sm: 130,
@ -46,12 +50,8 @@ class ArtistCard extends HookConsumerWidget {
width: size, width: size,
margin: const EdgeInsets.symmetric(vertical: 5), margin: const EdgeInsets.symmetric(vertical: 5),
child: Material( child: Material(
shadowColor: theme.colorScheme.background, shadowColor: theme.colorScheme.surface,
color: Color.lerp( color: bgColor,
theme.colorScheme.surfaceVariant,
theme.colorScheme.surface,
useBrightnessValue(.9, .7),
),
elevation: 3, elevation: 3,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: radius, borderRadius: radius,

View File

@ -30,7 +30,7 @@ class FriendItem extends HookConsumerWidget {
return Container( return Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: colorScheme.surfaceVariant.withOpacity(0.3), color: colorScheme.surfaceContainer,
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
constraints: const BoxConstraints( constraints: const BoxConstraints(

View File

@ -134,7 +134,7 @@ class HomeGenresSection extends HookConsumerWidget {
child: Ink( child: Ink(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
color: colorScheme.surfaceVariant, color: colorScheme.surfaceContainerHighest,
gradient: categoriesQuery.isLoading ? null : gradient, gradient: categoriesQuery.isLoading ? null : gradient,
), ),
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),

View File

@ -71,7 +71,7 @@ class LocalFolderItem extends HookConsumerWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
color: Color.lerp( color: Color.lerp(
colorScheme.surfaceVariant, colorScheme.surfaceContainerHighest,
colorScheme.surface, colorScheme.surface,
lerpValue, lerpValue,
), ),

View File

@ -71,7 +71,7 @@ class MultiSelectField<T> extends HookWidget {
: theme.colorScheme.onSurface.withOpacity(0.1), : theme.colorScheme.onSurface.withOpacity(0.1),
), ),
), ),
mouseCursor: MaterialStateMouseCursor.textable, mouseCursor: WidgetStateMouseCursor.textable,
onPressed: !enabled onPressed: !enabled
? null ? null
: () async { : () async {

View File

@ -122,7 +122,8 @@ class PlayerQueue extends HookConsumerWidget {
top: 5.0, top: 5.0,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.colorScheme.surfaceVariant.withOpacity(0.5), color:
theme.colorScheme.surfaceContainerHighest.withOpacity(0.5),
borderRadius: borderRadius, borderRadius: borderRadius,
), ),
child: CallbackShortcuts( child: CallbackShortcuts(

View File

@ -208,7 +208,8 @@ class SiblingTracksSheet extends HookConsumerWidget {
: mediaQuery.size.height * .6, : mediaQuery.size.height * .6,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius, borderRadius: borderRadius,
color: theme.colorScheme.surfaceVariant.withOpacity(.5), color:
theme.colorScheme.surfaceContainerHighest.withOpacity(.5),
), ),
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,

View File

@ -14,7 +14,6 @@ import 'package:spotube/components/player/volume_slider.dart';
import 'package:spotube/extensions/constrains.dart'; import 'package:spotube/extensions/constrains.dart';
import 'package:spotube/extensions/context.dart'; import 'package:spotube/extensions/context.dart';
import 'package:spotube/extensions/image.dart'; import 'package:spotube/extensions/image.dart';
import 'package:spotube/hooks/utils/use_brightness_value.dart';
import 'package:spotube/models/logger.dart'; import 'package:spotube/models/logger.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:spotube/provider/authentication_provider.dart'; import 'package:spotube/provider/authentication_provider.dart';
@ -49,12 +48,6 @@ class BottomPlayer extends HookConsumerWidget {
); );
final theme = Theme.of(context); final theme = Theme.of(context);
final bg = theme.colorScheme.surfaceVariant;
final bgColor = useBrightnessValue(
Color.lerp(bg, Colors.white, 0.7),
Color.lerp(bg, Colors.black, 0.45)!,
);
// returning an empty non spacious Container as the overlay will take // returning an empty non spacious Container as the overlay will take
// place in the global overlay stack aka [_entries] // place in the global overlay stack aka [_entries]
@ -67,7 +60,9 @@ class BottomPlayer extends HookConsumerWidget {
child: BackdropFilter( child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15), filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
child: DecoratedBox( child: DecoratedBox(
decoration: BoxDecoration(color: bgColor?.withOpacity(0.8)), decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainer.withOpacity(.8),
),
child: Material( child: Material(
type: MaterialType.transparency, type: MaterialType.transparency,
textStyle: theme.textTheme.bodyMedium!, textStyle: theme.textTheme.bodyMedium!,

View File

@ -14,7 +14,6 @@ import 'package:spotube/components/shared/image/universal_image.dart';
import 'package:spotube/extensions/constrains.dart'; import 'package:spotube/extensions/constrains.dart';
import 'package:spotube/extensions/context.dart'; import 'package:spotube/extensions/context.dart';
import 'package:spotube/extensions/image.dart'; import 'package:spotube/extensions/image.dart';
import 'package:spotube/hooks/utils/use_brightness_value.dart';
import 'package:spotube/hooks/controllers/use_sidebarx_controller.dart'; import 'package:spotube/hooks/controllers/use_sidebarx_controller.dart';
import 'package:spotube/pages/profile/profile.dart'; import 'package:spotube/pages/profile/profile.dart';
import 'package:spotube/pages/settings/settings.dart'; import 'package:spotube/pages/settings/settings.dart';
@ -70,12 +69,7 @@ class Sidebar extends HookConsumerWidget {
); );
final theme = Theme.of(context); final theme = Theme.of(context);
final bg = theme.colorScheme.surfaceVariant; final bg = theme.colorScheme.surfaceContainer;
final bgColor = useBrightnessValue(
Color.lerp(bg, Colors.white, 0.7),
Color.lerp(bg, Colors.black, 0.45)!,
);
useEffect(() { useEffect(() {
if (!context.mounted) return; if (!context.mounted) return;
@ -159,7 +153,7 @@ class Sidebar extends HookConsumerWidget {
), ),
padding: const EdgeInsets.symmetric(horizontal: 6), padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration( decoration: BoxDecoration(
color: bgColor?.withOpacity(0.8), color: bg,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topRight: Radius.circular(10), topRight: Radius.circular(10),
bottomRight: Radius.circular(10), bottomRight: Radius.circular(10),

View File

@ -68,7 +68,7 @@ class SpotubeNavigationBar extends HookConsumerWidget {
backgroundColor: backgroundColor:
theme.colorScheme.secondaryContainer.withOpacity(0.72), theme.colorScheme.secondaryContainer.withOpacity(0.72),
buttonBackgroundColor: buttonColor, buttonBackgroundColor: buttonColor,
color: theme.colorScheme.background, color: theme.colorScheme.surface,
height: panelHeight, height: panelHeight,
animationDuration: const Duration(milliseconds: 350), animationDuration: const Duration(milliseconds: 350),
items: navbarTileList.map( items: navbarTileList.map(

View File

@ -179,9 +179,9 @@ class ColorTile extends StatelessWidget {
colorScheme.primaryContainer, colorScheme.primaryContainer,
colorScheme.secondary, colorScheme.secondary,
colorScheme.secondaryContainer, colorScheme.secondaryContainer,
colorScheme.background,
colorScheme.surface, colorScheme.surface,
colorScheme.surfaceVariant, colorScheme.surface,
colorScheme.surfaceContainerHighest,
colorScheme.onPrimary, colorScheme.onPrimary,
colorScheme.onSurface, colorScheme.onSurface,
]; ];

View File

@ -187,7 +187,7 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
icon: icon ?? const Icon(SpotubeIcons.moreVertical), icon: icon ?? const Icon(SpotubeIcons.moreVertical),
tooltip: tooltip, tooltip: tooltip,
style: theme.iconButtonTheme.style?.copyWith( style: theme.iconButtonTheme.style?.copyWith(
shape: MaterialStatePropertyAll( shape: WidgetStatePropertyAll(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: borderRadius, borderRadius: borderRadius,
), ),

View File

@ -29,7 +29,7 @@ class AnchorButton<T> extends HookWidget {
onTapUp: (event) => tap.value = false, onTapUp: (event) => tap.value = false,
onTap: onTap, onTap: onTap,
child: MouseRegion( child: MouseRegion(
cursor: MaterialStateMouseCursor.clickable, cursor: WidgetStateMouseCursor.clickable,
child: Text( child: Text(
text, text,
style: style.copyWith( style: style.copyWith(

View File

@ -206,16 +206,16 @@ class WindowTitleBarButtons extends HookConsumerWidget {
final theme = Theme.of(context); final theme = Theme.of(context);
final colors = WindowButtonColors( final colors = WindowButtonColors(
normal: Colors.transparent, normal: Colors.transparent,
iconNormal: foregroundColor ?? theme.colorScheme.onBackground, iconNormal: foregroundColor ?? theme.colorScheme.onSurface,
mouseOver: theme.colorScheme.onBackground.withOpacity(0.1), mouseOver: theme.colorScheme.onSurface.withOpacity(0.1),
mouseDown: theme.colorScheme.onBackground.withOpacity(0.2), mouseDown: theme.colorScheme.onSurface.withOpacity(0.2),
iconMouseOver: theme.colorScheme.onBackground, iconMouseOver: theme.colorScheme.onSurface,
iconMouseDown: theme.colorScheme.onBackground, iconMouseDown: theme.colorScheme.onSurface,
); );
final closeColors = WindowButtonColors( final closeColors = WindowButtonColors(
normal: Colors.transparent, normal: Colors.transparent,
iconNormal: foregroundColor ?? theme.colorScheme.onBackground, iconNormal: foregroundColor ?? theme.colorScheme.onSurface,
mouseOver: Colors.red, mouseOver: Colors.red,
mouseDown: Colors.red[800]!, mouseDown: Colors.red[800]!,
iconMouseOver: Colors.white, iconMouseOver: Colors.white,

View File

@ -53,6 +53,10 @@ class PlaybuttonCard extends HookWidget {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
final radius = BorderRadius.circular(15); final radius = BorderRadius.circular(15);
final bgColor = useBrightnessValue(
theme.colorScheme.surface,
theme.colorScheme.surfaceContainerHigh,
);
final double size = useBreakpointValue<double>( final double size = useBreakpointValue<double>(
xs: 130, xs: 130,
sm: 130, sm: 130,
@ -72,13 +76,9 @@ class PlaybuttonCard extends HookWidget {
constraints: BoxConstraints(maxWidth: size), constraints: BoxConstraints(maxWidth: size),
margin: margin, margin: margin,
child: Material( child: Material(
color: Color.lerp( color: bgColor,
theme.colorScheme.surfaceVariant,
theme.colorScheme.surface,
useBrightnessValue(.9, .7),
),
borderRadius: radius, borderRadius: radius,
shadowColor: theme.colorScheme.background, shadowColor: theme.colorScheme.surface,
elevation: 3, elevation: 3,
child: InkWell( child: InkWell(
mouseCursor: SystemMouseCursors.click, mouseCursor: SystemMouseCursors.click,
@ -158,7 +158,7 @@ class PlaybuttonCard extends HookWidget {
Skeleton.keep( Skeleton.keep(
child: IconButton( child: IconButton(
style: IconButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: theme.colorScheme.background, backgroundColor: theme.colorScheme.surface,
foregroundColor: theme.colorScheme.primary, foregroundColor: theme.colorScheme.primary,
minimumSize: const Size.square(10), minimumSize: const Size.square(10),
), ),

View File

@ -34,7 +34,7 @@ class ThemedButtonsTabBar extends HookWidget implements PreferredSizeWidget {
), ),
borderWidth: 0, borderWidth: 0,
unselectedDecoration: BoxDecoration( unselectedDecoration: BoxDecoration(
color: theme.colorScheme.background, color: theme.colorScheme.surface,
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
unselectedLabelStyle: theme.textTheme.labelLarge?.copyWith( unselectedLabelStyle: theme.textTheme.labelLarge?.copyWith(

View File

@ -33,7 +33,7 @@ class StatsAlbumItem extends StatelessWidget {
Text("${album.albumType?.formatted}"), Text("${album.albumType?.formatted}"),
Flexible( Flexible(
child: ArtistLink( child: ArtistLink(
artists: album.artists!, artists: album.artists ?? [],
mainAxisAlignment: WrapAlignment.start, mainAxisAlignment: WrapAlignment.start,
), ),
), ),

View File

@ -10,7 +10,6 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:local_notifier/local_notifier.dart'; import 'package:local_notifier/local_notifier.dart';
import 'package:media_kit/media_kit.dart'; import 'package:media_kit/media_kit.dart';
import 'package:metadata_god/metadata_god.dart'; import 'package:metadata_god/metadata_god.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:spotube/collections/initializers.dart'; import 'package:spotube/collections/initializers.dart';
import 'package:spotube/collections/routes.dart'; import 'package:spotube/collections/routes.dart';
import 'package:spotube/collections/intents.dart'; import 'package:spotube/collections/intents.dart';
@ -139,28 +138,11 @@ Future<void> main(List<String> rawArgs) async {
); );
} }
class Spotube extends StatefulHookConsumerWidget { class Spotube extends HookConsumerWidget {
const Spotube({super.key}); const Spotube({super.key});
@override @override
SpotubeState createState() => SpotubeState(); Widget build(BuildContext context, ref) {
static SpotubeState of(BuildContext context) =>
context.findAncestorStateOfType<SpotubeState>()!;
}
class SpotubeState extends ConsumerState<Spotube> {
final logger = getLogger(Spotube);
SharedPreferences? localStorage;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then(((value) => localStorage = value));
}
@override
Widget build(BuildContext context) {
final themeMode = final themeMode =
ref.watch(userPreferencesProvider.select((s) => s.themeMode)); ref.watch(userPreferencesProvider.select((s) => s.themeMode));
final accentMaterialColor = final accentMaterialColor =
@ -195,6 +177,7 @@ class SpotubeState extends ConsumerState<Spotube> {
() => theme(paletteColor ?? accentMaterialColor, Brightness.light, false), () => theme(paletteColor ?? accentMaterialColor, Brightness.light, false),
[paletteColor, accentMaterialColor], [paletteColor, accentMaterialColor],
); );
final darkTheme = useMemoized( final darkTheme = useMemoized(
() => theme( () => theme(
paletteColor ?? accentMaterialColor, paletteColor ?? accentMaterialColor,

View File

@ -17,7 +17,7 @@ class DesktopLoginPage extends HookConsumerWidget {
Widget build(BuildContext context, ref) { Widget build(BuildContext context, ref) {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
final theme = Theme.of(context); final theme = Theme.of(context);
final color = theme.colorScheme.surfaceVariant.withOpacity(.3); final color = theme.colorScheme.surfaceContainerHighest.withOpacity(.3);
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(

View File

@ -100,7 +100,7 @@ class LyricsPage extends HookConsumerWidget {
child: Container( child: Container(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background.withOpacity(.4), color: Theme.of(context).colorScheme.surface.withOpacity(.4),
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10), topLeft: Radius.circular(10),
topRight: Radius.circular(10), topRight: Radius.circular(10),

View File

@ -107,8 +107,7 @@ class MiniLyricsPage extends HookConsumerWidget {
: const Icon(SpotubeIcons.lyricsOff), : const Icon(SpotubeIcons.lyricsOff),
style: ButtonStyle( style: ButtonStyle(
foregroundColor: showLyrics.value foregroundColor: showLyrics.value
? MaterialStateProperty.all( ? WidgetStateProperty.all(theme.colorScheme.primary)
theme.colorScheme.primary)
: null, : null,
), ),
onPressed: () async { onPressed: () async {
@ -132,8 +131,7 @@ class MiniLyricsPage extends HookConsumerWidget {
: const Icon(SpotubeIcons.hoverOff), : const Icon(SpotubeIcons.hoverOff),
style: ButtonStyle( style: ButtonStyle(
foregroundColor: hoverMode.value foregroundColor: hoverMode.value
? MaterialStateProperty.all( ? WidgetStateProperty.all(theme.colorScheme.primary)
theme.colorScheme.primary)
: null, : null,
), ),
onPressed: () async { onPressed: () async {
@ -154,7 +152,7 @@ class MiniLyricsPage extends HookConsumerWidget {
), ),
style: ButtonStyle( style: ButtonStyle(
foregroundColor: snapshot.data == true foregroundColor: snapshot.data == true
? MaterialStateProperty.all( ? WidgetStateProperty.all(
theme.colorScheme.primary) theme.colorScheme.primary)
: null, : null,
), ),
@ -186,12 +184,12 @@ class MiniLyricsPage extends HookConsumerWidget {
child: TabBarView( child: TabBarView(
children: [ children: [
SyncedLyrics( SyncedLyrics(
palette: PaletteColor(theme.colorScheme.background, 0), palette: PaletteColor(theme.colorScheme.surface, 0),
isModal: true, isModal: true,
defaultTextZoom: 65, defaultTextZoom: 65,
), ),
PlainLyrics( PlainLyrics(
palette: PaletteColor(theme.colorScheme.background, 0), palette: PaletteColor(theme.colorScheme.surface, 0),
isModal: true, isModal: true,
defaultTextZoom: 65, defaultTextZoom: 65,
), ),

View File

@ -212,7 +212,7 @@ class SearchPage extends HookConsumerWidget {
Icon( Icon(
SpotubeIcons.web, SpotubeIcons.web,
size: 120, size: 120,
color: theme.colorScheme.onBackground color: theme.colorScheme.onSurface
.withOpacity(0.7), .withOpacity(0.7),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@ -220,7 +220,7 @@ class SearchPage extends HookConsumerWidget {
context.l10n.search_to_get_results, context.l10n.search_to_get_results,
style: theme.textTheme.titleLarge?.copyWith( style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
color: theme.colorScheme.onBackground color: theme.colorScheme.onSurface
.withOpacity(0.5), .withOpacity(0.5),
), ),
), ),
@ -246,7 +246,7 @@ class SearchPage extends HookConsumerWidget {
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
color: theme.colorScheme.onBackground color: theme.colorScheme.onSurface
.withOpacity(0.7), .withOpacity(0.7),
), ),
), ),

View File

@ -20,7 +20,6 @@ class BlackListPage extends HookConsumerWidget {
final controller = useScrollController(); final controller = useScrollController();
final blacklist = ref.watch(blacklistProvider); final blacklist = ref.watch(blacklistProvider);
final searchText = useState(""); final searchText = useState("");
final filteredBlacklist = useMemoized( final filteredBlacklist = useMemoized(
() { () {
if (searchText.value.isEmpty) { if (searchText.value.isEmpty) {

View File

@ -43,10 +43,9 @@ class SettingsAboutSection extends HookConsumerWidget {
), ),
trailing: (context, update) => FilledButton( trailing: (context, update) => FilledButton(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.red[100]), backgroundColor: WidgetStatePropertyAll(Colors.red[100]),
foregroundColor: foregroundColor: const WidgetStatePropertyAll(Colors.pinkAccent),
const MaterialStatePropertyAll(Colors.pinkAccent), padding: const WidgetStatePropertyAll(EdgeInsets.all(15)),
padding: const MaterialStatePropertyAll(EdgeInsets.all(15)),
), ),
onPressed: () { onPressed: () {
launchUrlString( launchUrlString(

View File

@ -82,7 +82,7 @@ class SettingsAccountSection extends HookConsumerWidget {
router.push("/login"); router.push("/login");
}, },
style: ButtonStyle( style: ButtonStyle(
shape: MaterialStateProperty.all( shape: WidgetStateProperty.all(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(25.0),
), ),

View File

@ -3,7 +3,6 @@ import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:spotube/collections/spotube_icons.dart'; import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/settings/section_card_with_heading.dart'; import 'package:spotube/components/settings/section_card_with_heading.dart';
import 'package:spotube/extensions/context.dart'; import 'package:spotube/extensions/context.dart';

View File

@ -4,13 +4,22 @@ ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
final scheme = ColorScheme.fromSeed( final scheme = ColorScheme.fromSeed(
seedColor: seed, seedColor: seed,
shadow: Colors.black12, shadow: Colors.black12,
background: isAmoled ? Colors.black : null,
surface: isAmoled ? Colors.black : null, surface: isAmoled ? Colors.black : null,
surfaceContainer: isAmoled ? const Color(0xFF090909) : null,
surfaceContainerHigh: isAmoled ? const Color(0xFF181818) : null,
surfaceContainerHighest: isAmoled ? const Color(0xFF282828) : null,
brightness: brightness, brightness: brightness,
); );
return ThemeData( return ThemeData(
useMaterial3: true, useMaterial3: true,
colorScheme: scheme, colorScheme: scheme,
scaffoldBackgroundColor: isAmoled ? Colors.black : null,
cardTheme: CardTheme(
color: scheme.surfaceContainer,
shadowColor: scheme.shadow,
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
),
listTileTheme: ListTileThemeData( listTileTheme: ListTileThemeData(
horizontalTitleGap: 5, horizontalTitleGap: 5,
iconColor: scheme.onSurface, iconColor: scheme.onSurface,
@ -25,7 +34,7 @@ ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
navigationBarTheme: const NavigationBarThemeData( navigationBarTheme: const NavigationBarThemeData(
labelBehavior: NavigationDestinationLabelBehavior.alwaysHide, labelBehavior: NavigationDestinationLabelBehavior.alwaysHide,
height: 50, height: 50,
iconTheme: MaterialStatePropertyAll( iconTheme: WidgetStatePropertyAll(
IconThemeData(size: 18), IconThemeData(size: 18),
), ),
), ),
@ -52,25 +61,25 @@ ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
), ),
sliderTheme: SliderThemeData(overlayShape: SliderComponentShape.noOverlay), sliderTheme: SliderThemeData(overlayShape: SliderComponentShape.noOverlay),
searchBarTheme: SearchBarThemeData( searchBarTheme: SearchBarThemeData(
textStyle: const MaterialStatePropertyAll(TextStyle(fontSize: 15)), textStyle: const WidgetStatePropertyAll(TextStyle(fontSize: 15)),
constraints: const BoxConstraints(maxWidth: double.infinity), constraints: const BoxConstraints(maxWidth: double.infinity),
padding: const MaterialStatePropertyAll(EdgeInsets.all(8)), padding: const WidgetStatePropertyAll(EdgeInsets.all(8)),
backgroundColor: MaterialStatePropertyAll( backgroundColor: WidgetStatePropertyAll(
Color.lerp( Color.lerp(
scheme.surfaceVariant, scheme.surfaceContainerHighest,
scheme.surface, scheme.surface,
brightness == Brightness.light ? .9 : .7, brightness == Brightness.light ? .9 : .7,
), ),
), ),
elevation: const MaterialStatePropertyAll(0), elevation: const WidgetStatePropertyAll(0),
shape: MaterialStatePropertyAll( shape: WidgetStatePropertyAll(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
), ),
), ),
scrollbarTheme: const ScrollbarThemeData( scrollbarTheme: const ScrollbarThemeData(
thickness: MaterialStatePropertyAll(14), thickness: WidgetStatePropertyAll(14),
), ),
checkboxTheme: CheckboxThemeData( checkboxTheme: CheckboxThemeData(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),