chore: Fix dart deprecation messages

This commit is contained in:
PartyDonut 2025-01-05 13:53:59 +01:00
parent 607dea3de1
commit 39a7537116
81 changed files with 258 additions and 195 deletions

View file

@ -43,7 +43,7 @@ class FladderAppBar extends StatelessWidget implements PreferredSize {
} else {
return AppBar(
toolbarHeight: 0,
backgroundColor: Theme.of(context).colorScheme.surface.withOpacity(0),
backgroundColor: Theme.of(context).colorScheme.surface.withValues(alpha: 0),
scrolledUnderElevation: 0,
elevation: 0,
systemOverlayStyle: const SystemUiOverlayStyle(),

View file

@ -116,7 +116,7 @@ class _CurrentlyPlayingBarState extends ConsumerState<FloatingPlayerBar> {
opacity: showExpandButton ? 1 : 0,
duration: const Duration(milliseconds: 125),
child: Container(
color: Colors.black.withOpacity(0.6),
color: Colors.black.withValues(alpha: 0.6),
child: FlatButton(
onTap: () async => openFullScreenPlayer(),
child: const Icon(Icons.keyboard_arrow_up_rounded),
@ -191,7 +191,7 @@ class _CurrentlyPlayingBarState extends ConsumerState<FloatingPlayerBar> {
),
LinearProgressIndicator(
minHeight: 6,
backgroundColor: Colors.black.withOpacity(0.25),
backgroundColor: Colors.black.withValues(alpha: 0.25),
color: Theme.of(context).colorScheme.primary,
value: progress.clamp(0, 1),
),

View file

@ -1,7 +1,9 @@
import 'package:fladder/util/widget_extensions.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fladder/util/widget_extensions.dart';
class NavigationButton extends ConsumerStatefulWidget {
final String? label;
final Widget selectedIcon;
@ -58,10 +60,15 @@ class _NavigationButtonState extends ConsumerState<NavigationButton> {
elevation: const WidgetStatePropertyAll(0),
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
backgroundColor: const WidgetStatePropertyAll(Colors.transparent),
iconColor: WidgetStateProperty.resolveWith((states) {
return widget.selected
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.45);
}),
foregroundColor: WidgetStateProperty.resolveWith((states) {
return widget.selected
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurface.withOpacity(0.45);
: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.45);
})),
onPressed: widget.onPressed,
child: AnimatedContainer(
@ -94,7 +101,7 @@ class _NavigationButtonState extends ConsumerState<NavigationButton> {
width: widget.selected ? 14 : 0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Theme.of(context).colorScheme.primary.withOpacity(widget.selected ? 1 : 0),
color: Theme.of(context).colorScheme.primary.withValues(alpha: widget.selected ? 1 : 0),
),
),
],

View file

@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'package:chopper/chopper.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fladder/models/item_base_model.dart';
import 'package:fladder/providers/api_provider.dart';
import 'package:fladder/util/localization_helper.dart';
import 'package:fladder/widgets/shared/filled_button_await.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Future<Response<dynamic>?> showDeleteDialog(BuildContext context, ItemBaseModel item, WidgetRef ref) async {
Response<dynamic>? response;
@ -23,6 +25,7 @@ Future<Response<dynamic>?> showDeleteDialog(BuildContext context, ItemBaseModel
style: FilledButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.errorContainer,
foregroundColor: Theme.of(context).colorScheme.onErrorContainer,
iconColor: Theme.of(context).colorScheme.onErrorContainer,
),
onPressed: () async {
response = await ref.read(jellyApiProvider).deleteItem(item.id);

View file

@ -72,7 +72,7 @@ class AnimatedVisibilityIconState extends State<AnimatedVisibilityIcon> {
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
decoration: BoxDecoration(
color: (_currentFilledState ? widget.filledColor : widget.outlinedColor)?.withOpacity(0.2),
color: (_currentFilledState ? widget.filledColor : widget.outlinedColor)?.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: Padding(

View file

@ -20,9 +20,9 @@ IconData getBackIcon(BuildContext context) {
}
final _shadows = [
BoxShadow(blurRadius: 1, spreadRadius: 1, color: Colors.black.withOpacity(0.2)),
BoxShadow(blurRadius: 4, spreadRadius: 4, color: Colors.black.withOpacity(0.1)),
BoxShadow(blurRadius: 16, spreadRadius: 6, color: Colors.black.withOpacity(0.2)),
BoxShadow(blurRadius: 1, spreadRadius: 1, color: Colors.black.withValues(alpha: 0.2)),
BoxShadow(blurRadius: 4, spreadRadius: 4, color: Colors.black.withValues(alpha: 0.1)),
BoxShadow(blurRadius: 16, spreadRadius: 6, color: Colors.black.withValues(alpha: 0.2)),
];
class ElevatedIconButton extends ConsumerWidget {
@ -36,7 +36,7 @@ class ElevatedIconButton extends ConsumerWidget {
return IconButton(
onPressed: onPressed,
style: IconButtonTheme.of(context).style?.copyWith(
backgroundColor: WidgetStatePropertyAll(color?.withOpacity(0.15)),
backgroundColor: WidgetStatePropertyAll(color?.withValues(alpha: 0.15)),
),
color: color,
icon: Icon(

View file

@ -295,13 +295,13 @@ class _CarouselViewState extends State<FladderCarousel> {
overlayColor: widget.overlayColor ??
WidgetStateProperty.resolveWith((Set<WidgetState> states) {
if (states.contains(WidgetState.pressed)) {
return theme.colorScheme.onSurface.withOpacity(0.1);
return theme.colorScheme.onSurface.withValues(alpha: 0.1);
}
if (states.contains(WidgetState.hovered)) {
return theme.colorScheme.onSurface.withOpacity(0.08);
return theme.colorScheme.onSurface.withValues(alpha: 0.08);
}
if (states.contains(WidgetState.focused)) {
return theme.colorScheme.onSurface.withOpacity(0.1);
return theme.colorScheme.onSurface.withValues(alpha: 0.1);
}
return null;
}),

View file

@ -28,7 +28,7 @@ class FladderScrollbar extends ConsumerWidget {
borderRadius: BorderRadius.circular(5),
color: info.isDragging
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.75),
: Theme.of(context).colorScheme.secondaryContainer.withValues(alpha: 0.75),
),
duration: const Duration(milliseconds: 250),
);

View file

@ -95,6 +95,7 @@ class ItemActionButton extends ItemAction {
minimumSize: const WidgetStatePropertyAll(Size(50, 50)),
elevation: const WidgetStatePropertyAll(0),
foregroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.onSurface),
iconColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.onSurface),
),
onPressed: () {
if (shouldPop) {

View file

@ -16,7 +16,7 @@ Future<void> showModalSideSheet(
context: context,
transitionDuration: transitionDuration ?? const Duration(milliseconds: 200),
barrierDismissible: barrierDismissible,
barrierColor: Theme.of(context).colorScheme.scrim.withOpacity(0.3),
barrierColor: Theme.of(context).colorScheme.scrim.withValues(alpha: 0.3),
barrierLabel: 'Material 3 side sheet',
useRootNavigator: false,
transitionBuilder: (context, animation, secondaryAnimation, child) {

View file

@ -1,10 +1,12 @@
import 'dart:async';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fladder/screens/shared/animated_fade_size.dart';
import 'package:fladder/util/refresh_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class SelectableIconButton extends ConsumerStatefulWidget {
final FutureOr<dynamic> Function() onPressed;
@ -36,6 +38,7 @@ class _SelectableIconButtonState extends ConsumerState<SelectableIconButton> {
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: widget.selected ? WidgetStatePropertyAll(Theme.of(context).colorScheme.primary) : null,
iconColor: widget.selected ? WidgetStatePropertyAll(Theme.of(context).colorScheme.onPrimary) : null,
foregroundColor: widget.selected ? WidgetStatePropertyAll(Theme.of(context).colorScheme.onPrimary) : null,
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
),