mod: color alpha

`withOpacity` -> `withValues`

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-19 20:21:01 +08:00
parent 45b4f9570b
commit a7ffc3b05f
62 changed files with 193 additions and 164 deletions

View File

@@ -13,7 +13,7 @@ class DynamicCardSkeleton extends StatelessWidget {
border: Border(
bottom: BorderSide(
width: 8,
color: Theme.of(context).dividerColor.withOpacity(0.05),
color: Theme.of(context).dividerColor.withValues(alpha: 0.05),
),
),
),
@@ -102,7 +102,7 @@ class DynamicCardSkeleton extends StatelessWidget {
foregroundColor: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.2),
.withValues(alpha: 0.2),
),
label: Text(
i == 0

View File

@@ -50,7 +50,7 @@ class AnimatedDialogState extends State<AnimatedDialog>
@override
Widget build(BuildContext context) {
return Material(
color: Colors.black.withOpacity(opacityAnimation.value),
color: Colors.black.withValues(alpha: opacityAnimation.value),
child: InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,

View File

@@ -267,9 +267,10 @@ class ProgressBar extends LeafRenderObjectWidget {
onDragUpdate: onDragUpdate,
onDragEnd: onDragEnd,
barHeight: barHeight,
baseBarColor: baseBarColor ?? primaryColor.withOpacity(0.24),
baseBarColor: baseBarColor ?? primaryColor.withValues(alpha: 0.24),
progressBarColor: progressBarColor ?? primaryColor,
bufferedBarColor: bufferedBarColor ?? primaryColor.withOpacity(0.24),
bufferedBarColor:
bufferedBarColor ?? primaryColor.withValues(alpha: 0.24),
barCapShape: barCapShape,
thumbRadius: thumbRadius,
thumbColor: thumbColor ?? primaryColor,
@@ -300,9 +301,10 @@ class ProgressBar extends LeafRenderObjectWidget {
..onDragUpdate = onDragUpdate
..onDragEnd = onDragEnd
..barHeight = barHeight
..baseBarColor = baseBarColor ?? primaryColor.withOpacity(0.24)
..baseBarColor = baseBarColor ?? primaryColor.withValues(alpha: 0.24)
..progressBarColor = progressBarColor ?? primaryColor
..bufferedBarColor = bufferedBarColor ?? primaryColor.withOpacity(0.24)
..bufferedBarColor =
bufferedBarColor ?? primaryColor.withValues(alpha: 0.24)
..barCapShape = barCapShape
..thumbRadius = thumbRadius
..thumbColor = thumbColor ?? primaryColor

View File

@@ -38,11 +38,11 @@ class PBadge extends StatelessWidget {
// 边框色
Color borderColor = Colors.transparent;
if (type == 'gray') {
bgColor = Colors.black54.withOpacity(0.4);
bgColor = Colors.black54.withValues(alpha: 0.4);
color = Colors.white;
}
if (type == 'color') {
bgColor = t.secondaryContainer.withOpacity(0.5);
bgColor = t.secondaryContainer.withValues(alpha: 0.5);
color = t.onSecondaryContainer;
}
if (type == 'line') {

View File

@@ -21,7 +21,7 @@ class CustomToast extends StatelessWidget {
color: Theme.of(context)
.colorScheme
.primaryContainer
.withOpacity(toastOpacity),
.withValues(alpha: toastOpacity),
borderRadius: BorderRadius.circular(20),
),
child: Text(

View File

@@ -282,7 +282,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black.withOpacity(0.3)
Colors.black.withValues(alpha: 0.3)
],
),
)

View File

@@ -334,7 +334,7 @@ class _ListSheetContentState extends State<ListSheetContent>
),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
color: Theme.of(context).dividerColor.withValues(alpha: 0.1),
),
if (_isList)
Material(
@@ -346,7 +346,8 @@ class _ListSheetContentState extends State<ListSheetContent>
.map((item) => Tab(text: item.title))
.toList(),
dividerHeight: 1,
dividerColor: Theme.of(context).dividerColor.withOpacity(0.1),
dividerColor:
Theme.of(context).dividerColor.withValues(alpha: 0.1),
),
),
Expanded(
@@ -407,7 +408,7 @@ class _ListSheetContentState extends State<ListSheetContent>
itemScrollController: itemScrollController[i ?? 0],
separatorBuilder: (context, index) => Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
color: Theme.of(context).dividerColor.withValues(alpha: 0.1),
),
),
);

View File

@@ -21,7 +21,7 @@ class LiveCard extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
side: BorderSide(
color: Theme.of(context).dividerColor.withOpacity(0.08),
color: Theme.of(context).dividerColor.withValues(alpha: 0.08),
),
),
margin: EdgeInsets.zero,

View File

@@ -114,7 +114,10 @@ class NetworkImgLayer extends StatelessWidget {
height: height,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.4),
color: Theme.of(context)
.colorScheme
.onInverseSurface
.withValues(alpha: 0.4),
borderRadius: BorderRadius.circular(type == 'avatar'
? 50
: type == 'emote'

View File

@@ -45,7 +45,7 @@ class OverlayPop extends StatelessWidget {
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.3),
color: Colors.black.withValues(alpha: 0.3),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: IconButton(

View File

@@ -77,7 +77,7 @@ class SegmentProgressBar extends CustomPainter {
size.width,
0,
),
Paint()..color = Colors.grey[600]!.withOpacity(0.45),
Paint()..color = Colors.grey[600]!.withValues(alpha: 0.45),
);
}

View File

@@ -9,8 +9,8 @@ Widget statDanMu({
}) {
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
'gray': Theme.of(context).colorScheme.outline.withValues(alpha: 0.8),
'black': Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
};
Color color = colorObject[theme]!;
return Row(

View File

@@ -10,8 +10,8 @@ Widget statView({
}) {
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
'gray': Theme.of(context).colorScheme.outline.withValues(alpha: 0.8),
'black': Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
};
Color color = colorObject[theme]!;
return Row(

View File

@@ -327,7 +327,7 @@ class VideoCardV extends StatelessWidget {
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.8),
.withValues(alpha: 0.8),
),
text:
Utils.formatTimestampToRelativeTime(videoItem.pubdate)),
@@ -349,7 +349,7 @@ class VideoCardV extends StatelessWidget {
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.8),
.withValues(alpha: 0.8),
),
text: Utils.shortenChineseDateString(
videoItem.desc.split(' · ').last)),

View File

@@ -308,7 +308,7 @@ Widget videoContent(BuildContext context, Item videoItem) {
// style: TextStyle(
// fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
// color:
// Theme.of(context).colorScheme.outline.withOpacity(0.8),
// Theme.of(context).colorScheme.outline.withValues(alpha: 0.8),
// ),
// text: Utils.formatTimestampToRelativeTime(videoItem.pubdate)),
// )),
@@ -326,7 +326,7 @@ Widget videoContent(BuildContext context, Item videoItem) {
// style: TextStyle(
// fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
// color:
// Theme.of(context).colorScheme.outline.withOpacity(0.8),
// Theme.of(context).colorScheme.outline.withValues(alpha: 0.8),
// ),
// text: Utils.shortenChineseDateString(
// videoItem.desc.split(' · ').last)),