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

@ -27,6 +27,7 @@ Future<void> showDefaultAlertDialog(
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.errorContainer,
foregroundColor: Theme.of(context).colorScheme.onErrorContainer,
iconColor: Theme.of(context).colorScheme.onErrorContainer,
),
onPressed: () => accept.call(context),
child: Text(acceptTitle ?? "Accept"),
@ -61,6 +62,7 @@ Future<void> showDefaultActionDialog(
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
foregroundColor: Theme.of(context).colorScheme.onPrimaryContainer,
iconColor: Theme.of(context).colorScheme.onPrimaryContainer,
),
onPressed: () => accept.call(context),
child: Text(acceptTitle ?? "Accept"),

View file

@ -33,12 +33,13 @@ class _DefaultTitleBarState extends ConsumerState<DefaultTitleBar> with WindowLi
final brightness = widget.brightness ?? Theme.of(context).brightness;
final shadows = brightness == Brightness.dark
? [
BoxShadow(blurRadius: 1, spreadRadius: 1, color: Theme.of(context).colorScheme.surface.withOpacity(1)),
BoxShadow(blurRadius: 8, spreadRadius: 2, color: Colors.black.withOpacity(0.2)),
BoxShadow(blurRadius: 3, spreadRadius: 2, color: Colors.black.withOpacity(0.3)),
BoxShadow(
blurRadius: 1, spreadRadius: 1, color: Theme.of(context).colorScheme.surface.withValues(alpha: 1)),
BoxShadow(blurRadius: 8, spreadRadius: 2, color: Colors.black.withValues(alpha: 0.2)),
BoxShadow(blurRadius: 3, spreadRadius: 2, color: Colors.black.withValues(alpha: 0.3)),
]
: <BoxShadow>[];
final iconColor = Theme.of(context).colorScheme.onSurface.withOpacity(0.65);
final iconColor = Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.65);
return SizedBox(
height: widget.height,
child: switch (AdaptiveLayout.of(context).platform) {
@ -47,7 +48,7 @@ class _DefaultTitleBarState extends ConsumerState<DefaultTitleBar> with WindowLi
children: [
Expanded(
child: Container(
color: Colors.black.withOpacity(0),
color: Colors.black.withValues(alpha: 0),
child: DragToMoveArea(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
@ -77,8 +78,8 @@ class _DefaultTitleBarState extends ConsumerState<DefaultTitleBar> with WindowLi
return IconButton(
style: IconButton.styleFrom(
hoverColor: brightness == Brightness.light
? Colors.black.withOpacity(0.1)
: Colors.white.withOpacity(0.2),
? Colors.black.withValues(alpha: 0.1)
: Colors.white.withValues(alpha: 0.2),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2))),
onPressed: () async {
if (isMinimized) {
@ -110,8 +111,8 @@ class _DefaultTitleBarState extends ConsumerState<DefaultTitleBar> with WindowLi
return IconButton(
style: IconButton.styleFrom(
hoverColor: brightness == Brightness.light
? Colors.black.withOpacity(0.1)
: Colors.white.withOpacity(0.2),
? Colors.black.withValues(alpha: 0.1)
: Colors.white.withValues(alpha: 0.2),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
),
onPressed: () async {

View file

@ -62,7 +62,7 @@ class _DetailScaffoldState extends ConsumerState<DetailScaffold> {
@override
Widget build(BuildContext context) {
final padding = EdgeInsets.symmetric(horizontal: MediaQuery.sizeOf(context).width / 25);
final backGroundColor = Theme.of(context).colorScheme.surface.withOpacity(0.8);
final backGroundColor = Theme.of(context).colorScheme.surface.withValues(alpha: 0.8);
final playerState = ref.watch(mediaPlaybackProvider.select((value) => value.state));
final minHeight = 450.0.clamp(0, MediaQuery.sizeOf(context).height).toDouble();
final maxHeight = MediaQuery.sizeOf(context).height - 10;
@ -114,7 +114,7 @@ class _DetailScaffoldState extends ConsumerState<DetailScaffold> {
Colors.white,
Colors.white,
Colors.white,
Colors.white.withOpacity(0),
Colors.white.withValues(alpha: 0),
],
).createShader(bounds),
child: ConstrainedBox(
@ -145,10 +145,10 @@ class _DetailScaffoldState extends ConsumerState<DetailScaffold> {
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Theme.of(context).colorScheme.surface.withOpacity(0),
Theme.of(context).colorScheme.surface.withOpacity(0.10),
Theme.of(context).colorScheme.surface.withOpacity(0.35),
Theme.of(context).colorScheme.surface.withOpacity(0.85),
Theme.of(context).colorScheme.surface.withValues(alpha: 0),
Theme.of(context).colorScheme.surface.withValues(alpha: 0.10),
Theme.of(context).colorScheme.surface.withValues(alpha: 0.35),
Theme.of(context).colorScheme.surface.withValues(alpha: 0.85),
Theme.of(context).colorScheme.surface,
],
),

View file

@ -59,7 +59,7 @@ class _FilePickerBarState extends ConsumerState<FilePickerBar> {
@override
Widget build(BuildContext context) {
final offColor = Theme.of(context).colorScheme.secondaryContainer;
final onColor = Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.7);
final onColor = Theme.of(context).colorScheme.secondaryContainer.withValues(alpha: 0.7);
final contentColor = Theme.of(context).colorScheme.onSecondaryContainer;
return DropTarget(
enable: !inputField,

View file

@ -47,7 +47,7 @@ class FlatButton extends ConsumerWidget {
onDoubleTap: onDoubleTap,
onSecondaryTapDown: onSecondaryTapDown,
borderRadius: borderRadiusGeometry ?? BorderRadius.circular(10),
splashColor: splashColor ?? Theme.of(context).colorScheme.primary.withOpacity(0.5),
splashColor: splashColor ?? Theme.of(context).colorScheme.primary.withValues(alpha: 0.5),
hoverColor: showFeedback ? null : Colors.transparent,
splashFactory: InkSparkle.splashFactory,
),

View file

@ -20,7 +20,7 @@ class IntInputField extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Card(
color: Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.25),
color: Theme.of(context).colorScheme.secondaryContainer.withValues(alpha: 0.25),
elevation: 0,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 6),

View file

@ -69,7 +69,7 @@ class _CarouselBannerState extends ConsumerState<CarouselBanner> {
begin: Alignment.bottomLeft,
end: Alignment.topCenter,
colors: [
ThemesData.of(context).dark.colorScheme.primaryContainer.withOpacity(0.85),
ThemesData.of(context).dark.colorScheme.primaryContainer.withValues(alpha: 0.85),
Colors.transparent,
],
),
@ -144,7 +144,7 @@ class _CarouselBannerState extends ConsumerState<CarouselBanner> {
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.white.withOpacity(0.1),
color: Colors.white.withValues(alpha: 0.1),
width: 1.0,
),
borderRadius: border),

View file

@ -52,7 +52,7 @@ class ChapterRow extends ConsumerWidget {
child: Card(
elevation: 0,
shadowColor: Colors.transparent,
color: Theme.of(context).cardColor.withOpacity(0.4),
color: Theme.of(context).cardColor.withValues(alpha: 0.4),
child: Padding(
padding: const EdgeInsets.all(5),
child: Text(

View file

@ -12,7 +12,7 @@ class ChipButton extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Card(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.15),
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.15),
shadowColor: Colors.transparent,
child: FlatButton(
onTap: onPressed,

View file

@ -35,7 +35,7 @@ class MediaHeader extends ConsumerWidget {
child: Material(
elevation: 30,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(150)),
shadowColor: Colors.black.withOpacity(0.3),
shadowColor: Colors.black.withValues(alpha: 0.3),
color: Colors.transparent,
child: ConstrainedBox(
constraints: BoxConstraints(

View file

@ -67,6 +67,7 @@ class MediaPlayButton extends ConsumerWidget {
ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.primary),
foregroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.onPrimary),
iconColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.onPrimary),
),
Theme.of(context).colorScheme.onPrimary,
),

View file

@ -99,7 +99,7 @@ class _PosterImageState extends ConsumerState<PosterImage> {
shape: RoundedRectangleBorder(
side: BorderSide(
width: 1.0,
color: Colors.white.withOpacity(0.10),
color: Colors.white.withValues(alpha: 0.10),
),
borderRadius: FladderTheme.defaultShape.borderRadius,
),
@ -133,7 +133,7 @@ class _PosterImageState extends ConsumerState<PosterImage> {
if (widget.selected == true)
Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.15),
color: Colors.black.withValues(alpha: 0.15),
border: Border.all(width: 3, color: Theme.of(context).colorScheme.primary),
borderRadius: FladderTheme.defaultShape.borderRadius,
),
@ -191,7 +191,7 @@ class _PosterImageState extends ConsumerState<PosterImage> {
shadowColor: Colors.transparent,
child: LinearProgressIndicator(
minHeight: 7.5,
backgroundColor: Theme.of(context).colorScheme.onPrimary.withOpacity(0.5),
backgroundColor: Theme.of(context).colorScheme.onPrimary.withValues(alpha: 0.5),
value: poster.userData.progress / 100,
borderRadius: BorderRadius.circular(2),
),
@ -213,7 +213,7 @@ class _PosterImageState extends ConsumerState<PosterImage> {
//Hover color overlay
Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.55),
color: Colors.black.withValues(alpha: 0.55),
border: Border.all(width: 3, color: Theme.of(context).colorScheme.primary),
borderRadius: FladderTheme.defaultShape.borderRadius,
)),

View file

@ -231,7 +231,7 @@ class EpisodePoster extends ConsumerWidget {
alignment: Alignment.bottomCenter,
child: LinearProgressIndicator(
minHeight: 6,
backgroundColor: Colors.black.withOpacity(0.75),
backgroundColor: Colors.black.withValues(alpha: 0.75),
value: episode.userData.progress / 100,
),
),
@ -260,7 +260,7 @@ class EpisodePoster extends ConsumerWidget {
Icons.more_vert,
color: Colors.white,
shadows: [
Shadow(color: Colors.black.withOpacity(0.45), blurRadius: 8.0),
Shadow(color: Colors.black.withValues(alpha: 0.45), blurRadius: 8.0),
const Shadow(color: Colors.black, blurRadius: 16.0),
const Shadow(color: Colors.black, blurRadius: 32.0),
const Shadow(color: Colors.black, blurRadius: 64.0),

View file

@ -44,11 +44,12 @@ class _ExpandingOverviewState extends ConsumerState<ExpandingOverview> {
stops: const [0, 1],
colors: [
color,
color.withOpacity(!canExpand
? 1
: expanded
color.withValues(
alpha: !canExpand
? 1
: 0),
: expanded
? 1
: 0),
],
).createShader(bounds),
child: HtmlWidget(

View file

@ -141,12 +141,13 @@ class _MediaBannerState extends ConsumerState<MediaBanner> {
foregroundDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: Colors.white.withOpacity(0.10), strokeAlign: BorderSide.strokeAlignInside),
color: Colors.white.withValues(alpha: 0.10),
strokeAlign: BorderSide.strokeAlignInside),
gradient: LinearGradient(
begin: Alignment.bottomLeft,
end: Alignment.topCenter,
colors: [
overlayColor.withOpacity(0.85),
overlayColor.withValues(alpha: 0.85),
Colors.transparent,
],
),
@ -238,7 +239,7 @@ class _MediaBannerState extends ConsumerState<MediaBanner> {
maxLines: 2,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
shadows: shadows,
color: Colors.white.withOpacity(0.75),
color: Colors.white.withValues(alpha: 0.75),
),
),
),

View file

@ -61,7 +61,7 @@ class PosterListItem extends ConsumerWidget {
height: 75 * ref.read(clientSettingsProvider.select((value) => value.posterSize)),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary.withOpacity(selected == true ? 0.25 : 0),
color: Theme.of(context).colorScheme.primary.withValues(alpha: selected == true ? 0.25 : 0),
borderRadius: BorderRadius.circular(6),
),
child: FlatButton(

View file

@ -60,7 +60,7 @@ class SeasonPoster extends ConsumerWidget {
padding: const EdgeInsets.all(4),
child: Container(
child: Card(
color: Theme.of(context).colorScheme.surface.withOpacity(0.65),
color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.65),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
child: Text(
@ -159,7 +159,7 @@ class SeasonPoster extends ConsumerWidget {
Icons.more_vert,
color: Colors.white,
shadows: [
Shadow(color: Colors.black.withOpacity(0.45), blurRadius: 8.0),
Shadow(color: Colors.black.withValues(alpha: 0.45), blurRadius: 8.0),
const Shadow(color: Colors.black, blurRadius: 16.0),
const Shadow(color: Colors.black, blurRadius: 32.0),
const Shadow(color: Colors.black, blurRadius: 64.0),

View file

@ -63,7 +63,7 @@ class _OutlinedTextFieldState extends ConsumerState<OutlinedTextField> {
Color getColor() {
if (widget.errorText != null) return Theme.of(context).colorScheme.errorContainer;
return Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.25);
return Theme.of(context).colorScheme.secondaryContainer.withValues(alpha: 0.25);
}
@override
@ -112,31 +112,31 @@ class _OutlinedTextFieldState extends ConsumerState<OutlinedTextField> {
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary.withOpacity(0),
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0),
width: widget.borderWidth,
),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary.withOpacity(0),
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0),
width: widget.borderWidth,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary.withOpacity(0),
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0),
width: widget.borderWidth,
),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary.withOpacity(0),
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0),
width: widget.borderWidth,
),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary.withOpacity(0),
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0),
width: widget.borderWidth,
),
),