deprecation: opacity

This commit is contained in:
Thibault Deckers 2024-10-26 00:10:40 +02:00
parent e039798463
commit 884baae602
35 changed files with 59 additions and 59 deletions

@ -1 +1 @@
Subproject commit 603104015dd692ea3403755b55d07813d5cf8965 Subproject commit b1c77b7ed32346fe829c0ca97bd85d19290d54ae

View file

@ -41,11 +41,11 @@ class Themes {
static Color _schemeThirdLayer(ColorScheme colors) => _isDarkTheme(colors) ? colors.surfaceContainerHighest : colors.surfaceContainerHigh; static Color _schemeThirdLayer(ColorScheme colors) => _isDarkTheme(colors) ? colors.surfaceContainerHighest : colors.surfaceContainerHigh;
static Color _unselectedWidgetColor(ColorScheme colors) => colors.onSurface.withOpacity(0.6); static Color _unselectedWidgetColor(ColorScheme colors) => colors.onSurface.withAlpha((255.0 * .6).round());
static Color backgroundTextColor(BuildContext context) { static Color backgroundTextColor(BuildContext context) {
final colors = Theme.of(context).colorScheme; final colors = Theme.of(context).colorScheme;
return Color.alphaBlend(colors.surfaceTint, colors.onSurface).withOpacity(.5); return Color.alphaBlend(colors.surfaceTint, colors.onSurface).withAlpha((255.0 * .5).round());
} }
static final _typography = Typography.material2021(platform: TargetPlatform.android); static final _typography = Typography.material2021(platform: TargetPlatform.android);
@ -98,7 +98,7 @@ class Themes {
// adapted from M3 defaults // adapted from M3 defaults
final TextStyle style = textTheme.labelLarge!; final TextStyle style = textTheme.labelLarge!;
if (states.contains(WidgetState.disabled)) { if (states.contains(WidgetState.disabled)) {
return style.apply(color: colors.onSurface.withOpacity(0.38)); return style.apply(color: colors.onSurface.withAlpha((255.0 * .38).round()));
} }
return style.apply(color: colors.onSurface); return style.apply(color: colors.onSurface);
}), }),
@ -118,12 +118,12 @@ class Themes {
fillColor: WidgetStateProperty.resolveWith<Color>((states) { fillColor: WidgetStateProperty.resolveWith<Color>((states) {
if (states.contains(WidgetState.selected)) { if (states.contains(WidgetState.selected)) {
if (states.contains(WidgetState.disabled)) { if (states.contains(WidgetState.disabled)) {
return colors.onSurface.withOpacity(0.38); return colors.onSurface.withAlpha((255.0 * .38).round());
} }
return colors.primary; return colors.primary;
} }
if (states.contains(WidgetState.disabled)) { if (states.contains(WidgetState.disabled)) {
return colors.onSurface.withOpacity(0.38); return colors.onSurface.withAlpha((255.0 * .38).round());
} }
if (states.contains(WidgetState.pressed)) { if (states.contains(WidgetState.pressed)) {
return colors.onSurface; return colors.onSurface;
@ -139,7 +139,7 @@ class Themes {
); );
static SliderThemeData _sliderTheme(ColorScheme colors) => SliderThemeData( static SliderThemeData _sliderTheme(ColorScheme colors) => SliderThemeData(
inactiveTrackColor: colors.primary.withOpacity(0.24), inactiveTrackColor: colors.primary.withAlpha((255.0 * .24).round()),
); );
static SnackBarThemeData _snackBarTheme(ColorScheme colors) => SnackBarThemeData( static SnackBarThemeData _snackBarTheme(ColorScheme colors) => SnackBarThemeData(

View file

@ -103,7 +103,7 @@ class _ContentState extends State<_Content> {
return ListTile( return ListTile(
title: DefaultTextStyle( title: DefaultTextStyle(
style: theme.textTheme.bodyLarge!.copyWith( style: theme.textTheme.bodyLarge!.copyWith(
color: isSelected ? colors.primary : colors.onSurface.withOpacity(0.64), color: isSelected ? colors.primary : colors.onSurface.withAlpha((255.0 * .64).round()),
), ),
child: _getTitle(_Section.values[index]), child: _getTitle(_Section.values[index]),
), ),

View file

@ -62,19 +62,19 @@ class _RandomTextSpanHighlighterState extends State<_RandomTextSpanHighlighter>
final color = widget.color; final color = widget.color;
_baseStyle = TextStyle( _baseStyle = TextStyle(
color: color.withOpacity(.7), color: color.withAlpha((255.0 * .7).round()),
shadows: [ shadows: [
Shadow( Shadow(
color: color.withOpacity(0), color: color.withAlpha(0),
blurRadius: 0, blurRadius: 0,
) )
], ],
); );
final highlightStyle = TextStyle( final highlightStyle = TextStyle(
color: color.withOpacity(1), color: color.withAlpha(255),
shadows: [ shadows: [
Shadow( Shadow(
color: color.withOpacity(1), color: color.withAlpha(255),
blurRadius: 3, blurRadius: 3,
) )
], ],

View file

@ -421,7 +421,7 @@ class _CollectionScaler extends StatelessWidget {
), ),
mosaicItemBuilder: (index, targetExtent) => DecoratedBox( mosaicItemBuilder: (index, targetExtent) => DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
color: ThumbnailImage.computeLoadingBackgroundColor(index * 10, brightness).withOpacity(.9), color: ThumbnailImage.computeLoadingBackgroundColor(index * 10, brightness).withAlpha((255.0 * .9).round()),
border: Border.all( border: Border.all(
color: borderColor, color: borderColor,
width: borderWidth, width: borderWidth,

View file

@ -257,7 +257,7 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
percent: percent, percent: percent,
lineWidth: strokeWidth, lineWidth: strokeWidth,
radius: diameter / 2, radius: diameter / 2,
backgroundColor: colorScheme.onSurface.withOpacity(.2), backgroundColor: colorScheme.onSurface.withAlpha((255.0 * .2).round()),
progressColor: progressColor, progressColor: progressColor,
animation: animate, animation: animate,
center: total != null center: total != null
@ -314,7 +314,7 @@ class ReportProgressIndicator extends StatelessWidget {
height: diameter, height: diameter,
padding: const EdgeInsets.all(strokeWidth / 2), padding: const EdgeInsets.all(strokeWidth / 2),
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: progressColor.withOpacity(opacity), color: progressColor.withAlpha((255.0 * opacity).round()),
strokeWidth: strokeWidth, strokeWidth: strokeWidth,
), ),
); );
@ -422,7 +422,7 @@ class _FeedbackMessageState extends State<_FeedbackMessage> with SingleTickerPro
style: contentTextStyle.copyWith( style: contentTextStyle.copyWith(
shadows: [ shadows: [
Shadow( Shadow(
color: timerChangeShadowColor.withOpacity(0), color: timerChangeShadowColor.withAlpha(0),
blurRadius: 0, blurRadius: 0,
) )
], ],

View file

@ -16,7 +16,7 @@ class SliverAppBarTitleWrapper extends StatelessWidget {
final toolbarOpacity = context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>()!.toolbarOpacity; final toolbarOpacity = context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>()!.toolbarOpacity;
final baseColor = (DefaultTextStyle.of(context).style.color ?? Theme.of(context).textTheme.titleLarge!.color!); final baseColor = (DefaultTextStyle.of(context).style.color ?? Theme.of(context).textTheme.titleLarge!.color!);
return DefaultTextStyle.merge( return DefaultTextStyle.merge(
style: TextStyle(color: baseColor.withOpacity(toolbarOpacity)), style: TextStyle(color: baseColor.withAlpha((255.0 * toolbarOpacity).round())),
child: child, child: child,
); );
} }

View file

@ -81,7 +81,7 @@ class _WheelSelectorState<T> extends State<WheelSelector<T>> {
height: itemSize.height, height: itemSize.height,
duration: transitionDuration, duration: transitionDuration,
decoration: BoxDecoration( decoration: BoxDecoration(
color: foreground.withOpacity(focused ? .2 : 0), color: foreground.withAlpha((255.0 * (focused ? .2 : 0)).round()),
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
), ),
); );

View file

@ -31,7 +31,7 @@ class GridItemSelectionOverlay<T> extends StatelessWidget {
alignment: AlignmentDirectional.topEnd, alignment: AlignmentDirectional.topEnd,
padding: padding, padding: padding,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected ? Theme.of(context).colorScheme.primary.withOpacity(.6) : Colors.transparent, color: isSelected ? Theme.of(context).colorScheme.primary.withAlpha((255.0 * .6).round()) : Colors.transparent,
borderRadius: borderRadius, borderRadius: borderRadius,
), ),
duration: duration, duration: duration,

View file

@ -77,7 +77,7 @@ class FixedExtentGridPainter extends CustomPainter {
..shader = strokeShader; ..shader = strokeShader;
final fillPaint = Paint() final fillPaint = Paint()
..style = PaintingStyle.fill ..style = PaintingStyle.fill
..color = color.withOpacity(.25); ..color = color.withAlpha((255.0 * .25).round());
final chipWidth = chipSize.width; final chipWidth = chipSize.width;
final chipHeight = chipSize.height; final chipHeight = chipSize.height;

View file

@ -51,7 +51,7 @@ class MosaicScaleOverlay extends StatelessWidget {
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
_buildBar(extentMax, colorScheme.onSurface.withOpacity(.2)), _buildBar(extentMax, colorScheme.onSurface.withAlpha((255.0 * .2).round())),
_buildBar(scaledSize.width, colorScheme.primary), _buildBar(scaledSize.width, colorScheme.primary),
], ],
), ),

View file

@ -270,7 +270,7 @@ class _AvesFloatingBarState extends State<AvesFloatingBar> with RouteAware {
borderRadius: AvesFloatingBar.borderRadius, borderRadius: AvesFloatingBar.borderRadius,
child: widget.builder( child: widget.builder(
context, context,
blurred ? backgroundColor.withOpacity(.85) : backgroundColor, blurred ? backgroundColor.withAlpha((255.0 * .85).round()) : backgroundColor,
widget.child, widget.child,
), ),
), ),

View file

@ -23,7 +23,7 @@ class AvesCaption extends StatelessWidget {
style: subtitleStyle.copyWith( style: subtitleStyle.copyWith(
shadows: [ shadows: [
Shadow( Shadow(
color: subtitleChangeShadowColor.withOpacity(0), color: subtitleChangeShadowColor.withAlpha(0),
blurRadius: 0, blurRadius: 0,
) )
], ],

View file

@ -164,7 +164,7 @@ class CaptionedButtonText extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var style = DefaultTextStyle.of(context).style; var style = DefaultTextStyle.of(context).style;
if (!enabled) { if (!enabled) {
style = style.copyWith(color: style.color!.withOpacity(.2)); style = style.copyWith(color: style.color!.withAlpha((255.0 * .2).round()));
} }
return Text( return Text(

View file

@ -175,7 +175,7 @@ class OverlayTextButton extends StatelessWidget {
style: ButtonStyle( style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(Themes.overlayBackgroundColor(brightness: theme.brightness, blurred: blurred)), backgroundColor: WidgetStateProperty.all<Color>(Themes.overlayBackgroundColor(brightness: theme.brightness, blurred: blurred)),
foregroundColor: WidgetStateProperty.all<Color>(theme.colorScheme.onSurface), foregroundColor: WidgetStateProperty.all<Color>(theme.colorScheme.onSurface),
overlayColor: theme.isDark ? WidgetStateProperty.all<Color>(Colors.white.withOpacity(0.12)) : null, overlayColor: theme.isDark ? WidgetStateProperty.all<Color>(Colors.white.withAlpha((255.0 * .12).round())) : null,
minimumSize: _minSize, minimumSize: _minSize,
side: WidgetStateProperty.all<BorderSide>(AvesBorder.curvedSide(context)), side: WidgetStateProperty.all<BorderSide>(AvesBorder.curvedSide(context)),
shape: WidgetStateProperty.all<OutlinedBorder>(const RoundedRectangleBorder( shape: WidgetStateProperty.all<OutlinedBorder>(const RoundedRectangleBorder(

View file

@ -25,7 +25,7 @@ class EmptyContent extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final color = Theme.of(context).colorScheme.primary.withOpacity(.5); final color = Theme.of(context).colorScheme.primary.withAlpha((255.0 * .5).round());
final durations = context.watch<DurationsData>(); final durations = context.watch<DurationsData>();
return Padding( return Padding(
padding: safeBottom padding: safeBottom

View file

@ -26,7 +26,7 @@ class CompassPainter extends CustomPainter {
final fillPaint = Paint() final fillPaint = Paint()
..style = PaintingStyle.fill ..style = PaintingStyle.fill
..color = color.withOpacity(.6); ..color = color.withAlpha((255.0 * .6).round());
final strokePaint = Paint() final strokePaint = Paint()
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
..color = color ..color = color

View file

@ -188,7 +188,7 @@ class _ConvertEntryDialogState extends State<ConvertEntryDialog> {
// used by the drop down to match input decoration // used by the drop down to match input decoration
final textFieldDecorationBorder = Border( final textFieldDecorationBorder = Border(
bottom: BorderSide( bottom: BorderSide(
color: colorScheme.onSurface.withOpacity(0.38), color: colorScheme.onSurface.withAlpha((255.0 * .38).round()),
width: 1.0, width: 1.0,
), ),
); );
@ -309,7 +309,7 @@ class _ConvertEntryDialogState extends State<ConvertEntryDialog> {
style: trailingStyle.copyWith( style: trailingStyle.copyWith(
shadows: [ shadows: [
Shadow( Shadow(
color: trailingChangeShadowColor.withOpacity(0), color: trailingChangeShadowColor.withAlpha(0),
blurRadius: 0, blurRadius: 0,
) )
], ],

View file

@ -19,8 +19,8 @@ class CropperPainter extends CustomPainter {
static const double gridWidth = 1; static const double gridWidth = 1;
static const cornerColor = Colors.white; static const cornerColor = Colors.white;
static final borderColor = Colors.white.withOpacity(.5); static final borderColor = Colors.white.withAlpha((255.0 * .5).round());
static final gridColor = Colors.white.withOpacity(.5); static final gridColor = Colors.white.withAlpha((255.0 * .5).round());
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
@ -32,7 +32,7 @@ class CropperPainter extends CustomPainter {
final gridPaint = Paint() final gridPaint = Paint()
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = gridWidth ..strokeWidth = gridWidth
..color = gridColor.withOpacity(gridColor.opacity * gridOpacity); ..color = gridColor.withAlpha((255.0 * gridColor.opacity * gridOpacity).round());
final xLeft = rect.left; final xLeft = rect.left;
final yTop = rect.top; final yTop = rect.top;
@ -118,7 +118,7 @@ class ScrimPainter extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
final scrimPaint = Paint() final scrimPaint = Paint()
..style = PaintingStyle.fill ..style = PaintingStyle.fill
..color = scrimColor.withOpacity(opacity); ..color = scrimColor.withAlpha((255.0 * opacity).round());
final outside = Path() final outside = Path()
..addRect(Rect.fromLTWH(0, 0, size.width, size.height).inflate(.5)) ..addRect(Rect.fromLTWH(0, 0, size.width, size.height).inflate(.5))

View file

@ -592,7 +592,7 @@ class _FilterScaler<T extends CollectionFilter> extends StatelessWidget {
), ),
mosaicItemBuilder: (index, targetExtent) => DecoratedBox( mosaicItemBuilder: (index, targetExtent) => DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
color: ThumbnailImage.computeLoadingBackgroundColor(index * 10, brightness).withOpacity(.9), color: ThumbnailImage.computeLoadingBackgroundColor(index * 10, brightness).withAlpha((255.0 * .9).round()),
border: Border.all( border: Border.all(
color: context.read<AvesColorsData>().neutral, color: context.read<AvesColorsData>().neutral,
width: AvesFilterChip.outlineWidth, width: AvesFilterChip.outlineWidth,

View file

@ -175,8 +175,8 @@ class _AppDrawerState extends State<AppDrawer> with WidgetsBindingObserver {
data: OutlinedButtonThemeData( data: OutlinedButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
foregroundColor: WidgetStateProperty.all<Color>(onPrimary), foregroundColor: WidgetStateProperty.all<Color>(onPrimary),
overlayColor: WidgetStateProperty.all<Color>(onPrimary.withOpacity(.12)), overlayColor: WidgetStateProperty.all<Color>(onPrimary.withAlpha((255.0 * .12).round())),
side: WidgetStateProperty.all<BorderSide>(BorderSide(width: 1, color: onPrimary.withOpacity(.24))), side: WidgetStateProperty.all<BorderSide>(BorderSide(width: 1, color: onPrimary.withAlpha((255.0 * .24).round()))),
), ),
), ),
child: Column( child: Column(

View file

@ -36,7 +36,7 @@ class CollectionNavTile extends StatelessWidget {
trailing: trailing != null trailing: trailing != null
? Builder( ? Builder(
builder: (context) { builder: (context) {
final trailingColor = IconTheme.of(context).color!.withOpacity(.6); final trailingColor = IconTheme.of(context).color!.withAlpha((255.0 * .6).round());
return IconTheme.merge( return IconTheme.merge(
data: IconThemeData(color: trailingColor), data: IconThemeData(color: trailingColor),
child: DefaultTextStyle.merge( child: DefaultTextStyle.merge(

View file

@ -43,7 +43,7 @@ class PageNavTile extends StatelessWidget {
? Builder( ? Builder(
builder: (context) => DefaultTextStyle.merge( builder: (context) => DefaultTextStyle.merge(
style: TextStyle( style: TextStyle(
color: IconTheme.of(context).color!.withOpacity(.6), color: IconTheme.of(context).color!.withAlpha((255.0 * .6).round()),
), ),
child: trailing!, child: trailing!,
), ),

View file

@ -15,10 +15,10 @@ class ActionPanel extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
final color = highlight ? theme.colorScheme.primary : Color.alphaBlend(theme.colorScheme.surfaceTint.withOpacity(.2), Themes.secondLayerColor(context)); final color = highlight ? theme.colorScheme.primary : Color.alphaBlend(theme.colorScheme.surfaceTint.withAlpha((255.0 * .2).round()), Themes.secondLayerColor(context));
return AnimatedContainer( return AnimatedContainer(
foregroundDecoration: BoxDecoration( foregroundDecoration: BoxDecoration(
color: color.withOpacity(.2), color: color.withAlpha((255.0 * .2).round()),
border: Border.fromBorderSide(BorderSide( border: Border.fromBorderSide(BorderSide(
color: color, color: color,
width: highlight ? 2 : 1, width: highlight ? 2 : 1,

View file

@ -287,7 +287,7 @@ class _QuickActionEditorBodyState<T extends Object> extends State<QuickActionEdi
effect: WormEffect( effect: WormEffect(
dotWidth: 8, dotWidth: 8,
dotHeight: 8, dotHeight: 8,
dotColor: colorScheme.onSurface.withOpacity(.2), dotColor: colorScheme.onSurface.withAlpha((255.0 * .2).round()),
activeDotColor: colorScheme.primary, activeDotColor: colorScheme.primary,
), ),
), ),

View file

@ -141,7 +141,7 @@ class _FilePickerPageState extends State<FilePickerPage> {
height: kMinInteractiveDimension, height: kMinInteractiveDimension,
child: DefaultTextStyle( child: DefaultTextStyle(
style: crumbStyle.copyWith( style: crumbStyle.copyWith(
color: crumbStyle.color!.withOpacity(.4), color: crumbStyle.color!.withAlpha((255.0 * .4).round()),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
child: CrumbLine( child: CrumbLine(

View file

@ -121,7 +121,7 @@ class ThumbnailOverlayPage extends StatelessWidget {
icon, icon,
key: ValueKey(key), key: ValueKey(key),
size: _getIconSize(context), size: _getIconSize(context),
color: _getIconColor(context).withOpacity(disabled ? SettingsSwitchListTile.disabledOpacity : 1.0), color: _getIconColor(context).withAlpha((255.0 * (disabled ? SettingsSwitchListTile.disabledOpacity : 1.0)).round()),
), ),
), ),
); );

View file

@ -22,7 +22,7 @@ class SubtitleSample extends StatelessWidget {
builder: (context, settings, child) { builder: (context, settings, child) {
final textAlign = settings.subtitleTextAlignment; final textAlign = settings.subtitleTextAlignment;
final textPosition = settings.subtitleTextPosition; final textPosition = settings.subtitleTextPosition;
final outlineColor = Colors.black.withOpacity(settings.subtitleTextColor.opacity); final outlineColor = Colors.black.withAlpha((255.0 * settings.subtitleTextColor.opacity).round());
final shadows = [ final shadows = [
Shadow( Shadow(
color: outlineColor, color: outlineColor,

View file

@ -62,23 +62,23 @@ class SubtitleThemePage extends StatelessWidget {
), ),
ColorListTile( ColorListTile(
title: context.l10n.settingsSubtitleThemeTextColor, title: context.l10n.settingsSubtitleThemeTextColor,
value: settings.subtitleTextColor.withOpacity(1), value: settings.subtitleTextColor.withAlpha(255),
onChanged: (v) => settings.subtitleTextColor = v.withOpacity(settings.subtitleTextColor.opacity), onChanged: (v) => settings.subtitleTextColor = v.withAlpha((255.0 * settings.subtitleTextColor.opacity).round()),
), ),
SliderListTile( SliderListTile(
title: context.l10n.settingsSubtitleThemeTextOpacity, title: context.l10n.settingsSubtitleThemeTextOpacity,
value: settings.subtitleTextColor.opacity, value: settings.subtitleTextColor.opacity,
onChanged: (v) => settings.subtitleTextColor = settings.subtitleTextColor.withOpacity(v), onChanged: (v) => settings.subtitleTextColor = settings.subtitleTextColor.withAlpha((255.0 * v).round()),
), ),
ColorListTile( ColorListTile(
title: context.l10n.settingsSubtitleThemeBackgroundColor, title: context.l10n.settingsSubtitleThemeBackgroundColor,
value: settings.subtitleBackgroundColor.withOpacity(1), value: settings.subtitleBackgroundColor.withAlpha(255),
onChanged: (v) => settings.subtitleBackgroundColor = v.withOpacity(settings.subtitleBackgroundColor.opacity), onChanged: (v) => settings.subtitleBackgroundColor = v.withAlpha((255.0 * settings.subtitleBackgroundColor.opacity).round()),
), ),
SliderListTile( SliderListTile(
title: context.l10n.settingsSubtitleThemeBackgroundOpacity, title: context.l10n.settingsSubtitleThemeBackgroundOpacity,
value: settings.subtitleBackgroundColor.opacity, value: settings.subtitleBackgroundColor.opacity,
onChanged: (v) => settings.subtitleBackgroundColor = settings.subtitleBackgroundColor.withOpacity(v), onChanged: (v) => settings.subtitleBackgroundColor = settings.subtitleBackgroundColor.withAlpha((255.0 * v).round()),
), ),
SettingsSwitchListTile( SettingsSwitchListTile(
selector: (context, s) => s.subtitleShowOutline, selector: (context, s) => s.subtitleShowOutline,

View file

@ -198,7 +198,7 @@ class _HistogramState extends State<Histogram> with AutomaticKeepAliveClientMixi
final colorScheme = Theme.of(context).colorScheme; final colorScheme = Theme.of(context).colorScheme;
final accentColor = colorScheme.primary; final accentColor = colorScheme.primary;
final axisColor = charts.ColorUtil.fromDartColor(drawPoints ? colorScheme.onSurface : Colors.transparent); final axisColor = charts.ColorUtil.fromDartColor(drawPoints ? colorScheme.onSurface : Colors.transparent);
final measureLineColor = charts.ColorUtil.fromDartColor(drawPoints ? colorScheme.onSurface.withOpacity(.1) : Colors.transparent); final measureLineColor = charts.ColorUtil.fromDartColor(drawPoints ? colorScheme.onSurface.withAlpha((255.0 * .1).round()) : Colors.transparent);
final histogramLineColor = charts.ColorUtil.fromDartColor(drawLine ? accentColor : Colors.white); final histogramLineColor = charts.ColorUtil.fromDartColor(drawLine ? accentColor : Colors.white);
final histogramPointStrikeColor = charts.ColorUtil.fromDartColor(drawPoints ? colorScheme.onSurface : Colors.transparent); final histogramPointStrikeColor = charts.ColorUtil.fromDartColor(drawPoints ? colorScheme.onSurface : Colors.transparent);
final histogramPointFillColor = charts.ColorUtil.fromDartColor(Themes.firstLayerColor(context)); final histogramPointFillColor = charts.ColorUtil.fromDartColor(Themes.firstLayerColor(context));
@ -292,7 +292,7 @@ class _HistogramState extends State<Histogram> with AutomaticKeepAliveClientMixi
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
accentColor.withOpacity(0), accentColor.withAlpha(0),
accentColor, accentColor,
], ],
).createShader, ).createShader,

View file

@ -178,7 +178,7 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
builder: (context, overlayOpacity, child) { builder: (context, overlayOpacity, child) {
final background = Theme.of(context).isDark ? Colors.black : Color.lerp(Colors.black, Colors.white, overlayOpacity)!; final background = Theme.of(context).isDark ? Colors.black : Color.lerp(Colors.black, Colors.white, overlayOpacity)!;
return Container( return Container(
color: background.withOpacity(backgroundOpacity), color: background.withAlpha((255.0 * backgroundOpacity).round()),
child: child, child: child,
); );
}, },

View file

@ -138,7 +138,7 @@ class _HistogramPainter extends CustomPainter {
Path()..addPolygon(polyline, true), Path()..addPolygon(polyline, true),
Paint() Paint()
..style = PaintingStyle.fill ..style = PaintingStyle.fill
..color = color.withOpacity(.5)); ..color = color.withAlpha((255.0 * .5).round()));
} }
Color _getChannelColor(HistogramChannel channel) { Color _getChannelColor(HistogramChannel channel) {

View file

@ -119,7 +119,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
if (!progress.isFinite) progress = 0.0; if (!progress.isFinite) progress = 0.0;
return LinearProgressIndicator( return LinearProgressIndicator(
value: progress, value: progress,
backgroundColor: theme.colorScheme.onSurface.withOpacity(.2), backgroundColor: theme.colorScheme.onSurface.withAlpha((255.0 * .2).round()),
); );
}), }),
), ),

View file

@ -44,7 +44,7 @@ class VideoSubtitles extends StatelessWidget {
final baseTextAlign = settings.subtitleTextAlignment; final baseTextAlign = settings.subtitleTextAlignment;
final baseTextAlignY = settings.subtitleTextPosition.toTextAlignVertical(); final baseTextAlignY = settings.subtitleTextPosition.toTextAlignVertical();
final baseOutlineWidth = settings.subtitleShowOutline ? 1 : 0; final baseOutlineWidth = settings.subtitleShowOutline ? 1 : 0;
final baseOutlineColor = Colors.black.withOpacity(settings.subtitleTextColor.opacity); final baseOutlineColor = Colors.black.withAlpha((255.0 * settings.subtitleTextColor.opacity).round());
final baseShadows = [ final baseShadows = [
Shadow( Shadow(
color: baseOutlineColor, color: baseOutlineColor,

View file

@ -43,9 +43,9 @@ class SwipeActionFeedback extends StatelessWidget {
static const Radius radius = Radius.circular(width / 2); static const Radius radius = Radius.circular(width / 2);
static const double borderWidth = 2; static const double borderWidth = 2;
static const Color borderColor = Colors.white; static const Color borderColor = Colors.white;
static final Color fillColor = Colors.white.withOpacity(.8); static final Color fillColor = Colors.white.withAlpha((255.0 * .8).round());
static final Color backgroundColor = Colors.black.withOpacity(.2); static final Color backgroundColor = Colors.black.withAlpha((255.0 * .2).round());
static final Color innerBorderColor = Colors.black.withOpacity(.5); static final Color innerBorderColor = Colors.black.withAlpha((255.0 * .5).round());
static const Color iconColor = Colors.white; static const Color iconColor = Colors.white;
static const Color shadowColor = Colors.black; static const Color shadowColor = Colors.black;