From b9dae5df88d5e731e6179efc34e37fcc38bd6931 Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Mon, 23 Dec 2024 15:09:28 -0500 Subject: [PATCH] fix deprecated and lint warnings --- lib/models/irc.dart | 4 ++-- lib/screens/channel/channel.dart | 7 ++++--- lib/screens/channel/chat/details/chat_modes.dart | 2 +- lib/screens/channel/chat/widgets/chat_message.dart | 9 ++++++--- lib/screens/channel/video/video_bar.dart | 4 ++-- lib/screens/home/stream_list/stream_card.dart | 6 +++--- lib/widgets/alert_message.dart | 2 +- lib/widgets/loading_indicator.dart | 3 ++- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/models/irc.dart b/lib/models/irc.dart index b9cbb897..81a9eb81 100644 --- a/lib/models/irc.dart +++ b/lib/models/irc.dart @@ -146,7 +146,7 @@ class IRCMessage { span.add( TextSpan( text: '${DateFormat.Hm().format(parsedTime)} ', - style: style?.copyWith(color: style.color?.withOpacity(0.5)), + style: style?.copyWith(color: style.color?.withValues(alpha: 0.5)), ), ); } @@ -155,7 +155,7 @@ class IRCMessage { span.add( TextSpan( text: '${DateFormat('h:mm').format(parsedTime)} ', - style: style?.copyWith(color: style.color?.withOpacity(0.5)), + style: style?.copyWith(color: style.color?.withValues(alpha: 0.5)), ), ); } diff --git a/lib/screens/channel/channel.dart b/lib/screens/channel/channel.dart index a4f1bfa3..62ccd60d 100644 --- a/lib/screens/channel/channel.dart +++ b/lib/screens/channel/channel.dart @@ -126,7 +126,8 @@ class _VideoChatState extends State { duration: const Duration(milliseconds: 200), child: Container( decoration: BoxDecoration( - color: Colors.black.withOpacity(settingsStore.overlayOpacity), + color: Colors.black + .withValues(alpha: settingsStore.overlayOpacity), ), child: IgnorePointer( ignoring: !_videoStore.overlayVisible, @@ -234,8 +235,8 @@ class _VideoChatState extends State { : MediaQuery.of(context).size.width * _chatStore.settings.chatWidth, color: _chatStore.settings.fullScreen - ? Colors.black.withOpacity( - _chatStore.settings.fullScreenChatOverlayOpacity, + ? Colors.black.withValues( + alpha: _chatStore.settings.fullScreenChatOverlayOpacity, ) : Theme.of(context).scaffoldBackgroundColor, child: chat, diff --git a/lib/screens/channel/chat/details/chat_modes.dart b/lib/screens/channel/chat/details/chat_modes.dart index 63384b8b..bf62bfe5 100644 --- a/lib/screens/channel/chat/details/chat_modes.dart +++ b/lib/screens/channel/chat/details/chat_modes.dart @@ -11,7 +11,7 @@ class ChatModes extends StatelessWidget { @override Widget build(BuildContext context) { final disabledColor = - Theme.of(context).colorScheme.onSurface.withOpacity(0.5); + Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5); return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/screens/channel/chat/widgets/chat_message.dart b/lib/screens/channel/chat/widgets/chat_message.dart index 37807a52..72189689 100644 --- a/lib/screens/channel/chat/widgets/chat_message.dart +++ b/lib/screens/channel/chat/widgets/chat_message.dart @@ -30,7 +30,9 @@ class ChatMessage extends StatelessWidget { // Ignore if long-pressing own username. if (ircMessage.user == null || - ircMessage.user == chatStore.auth.user.details?.login) return; + ircMessage.user == chatStore.auth.user.details?.login) { + return; + } showModalBottomSheet( isScrollControlled: true, @@ -139,7 +141,8 @@ class ChatMessage extends StatelessWidget { final defaultTextStyle = DefaultTextStyle.of(context).style; final messageHeaderIconSize = defaultBadgeSize * chatStore.settings.badgeScale; - final messageHeaderTextColor = defaultTextStyle.color?.withOpacity(0.5); + final messageHeaderTextColor = + defaultTextStyle.color?.withValues(alpha: 0.5); const messageHeaderFontWeight = FontWeight.w600; return Observer( @@ -433,7 +436,7 @@ class ChatMessage extends StatelessWidget { : Container( padding: const EdgeInsets.only(left: 8, right: 12), decoration: BoxDecoration( - color: highlightColor.withOpacity(0.1), + color: highlightColor.withValues(alpha: 0.1), border: Border( left: BorderSide(color: highlightColor, width: 4), ), diff --git a/lib/screens/channel/video/video_bar.dart b/lib/screens/channel/video/video_bar.dart index eee2fad4..f2a5e031 100644 --- a/lib/screens/channel/video/video_bar.dart +++ b/lib/screens/channel/video/video_bar.dart @@ -72,7 +72,7 @@ class VideoBar extends StatelessWidget { Theme.of(context) .colorScheme .onSurface - .withOpacity(0.8), + .withValues(alpha: 0.8), fontWeight: subtitleTextWeight, ), ), @@ -102,7 +102,7 @@ class VideoBar extends StatelessWidget { Theme.of(context) .colorScheme .onSurface - .withOpacity(0.8), + .withValues(alpha: 0.8), fontWeight: subtitleTextWeight, ), ), diff --git a/lib/screens/home/stream_list/stream_card.dart b/lib/screens/home/stream_list/stream_card.dart index e281b9a6..b8608fed 100644 --- a/lib/screens/home/stream_list/stream_card.dart +++ b/lib/screens/home/stream_list/stream_card.dart @@ -151,7 +151,7 @@ class StreamCard extends StatelessWidget { overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: subFontSize, - color: fontColor?.withOpacity(0.8), + color: fontColor?.withValues(alpha: 0.8), ), ), ), @@ -179,7 +179,7 @@ class StreamCard extends StatelessWidget { overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: subFontSize, - color: fontColor?.withOpacity(0.8), + color: fontColor?.withValues(alpha: 0.8), ), ), ), @@ -190,7 +190,7 @@ class StreamCard extends StatelessWidget { '${NumberFormat().format(streamInfo.viewerCount)} viewers', style: TextStyle( fontSize: subFontSize, - color: fontColor?.withOpacity(0.8), + color: fontColor?.withValues(alpha: 0.8), fontFeatures: const [FontFeature.tabularFigures()], ), ), diff --git a/lib/widgets/alert_message.dart b/lib/widgets/alert_message.dart index fb3226c5..2e51960e 100644 --- a/lib/widgets/alert_message.dart +++ b/lib/widgets/alert_message.dart @@ -16,7 +16,7 @@ class AlertMessage extends StatelessWidget { @override Widget build(BuildContext context) { final defaultColor = - Theme.of(context).colorScheme.onSurface.withOpacity(0.5); + Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5); return Row( mainAxisAlignment: diff --git a/lib/widgets/loading_indicator.dart b/lib/widgets/loading_indicator.dart index 88d93c21..4739af8e 100644 --- a/lib/widgets/loading_indicator.dart +++ b/lib/widgets/loading_indicator.dart @@ -19,7 +19,8 @@ class LoadingIndicator extends StatelessWidget { Text( subtitle!, style: TextStyle( - color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5), + color: + Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5), ), ), ],