@@ -270,8 +270,9 @@ class _HourMinuteControl extends StatelessWidget {
270270 final Color backgroundColor = timePickerTheme.hourMinuteColor ??
271271 WidgetStateColor .resolveWith ((Set <WidgetState > states) {
272272 return states.contains (WidgetState .selected)
273- ? themeData.colorScheme.primary.withOpacity (isDark ? 0.24 : 0.12 )
274- : themeData.colorScheme.onSurface.withOpacity (0.12 );
273+ ? themeData.colorScheme.primary
274+ .withValues (alpha: isDark ? 0.24 : 0.12 )
275+ : themeData.colorScheme.onSurface.withValues (alpha: 0.12 );
275276 });
276277 final TextStyle style = timePickerTheme.hourMinuteTextStyle ??
277278 themeData.textTheme.displayMedium! ;
@@ -542,7 +543,7 @@ class _DayPeriodControl extends StatelessWidget {
542543 WidgetStateColor .resolveWith ((Set <WidgetState > states) {
543544 return states.contains (WidgetState .selected)
544545 ? colorScheme.primary
545- : colorScheme.onSurface.withOpacity ( 0.60 );
546+ : colorScheme.onSurface.withValues (alpha : 0.60 );
546547 });
547548 final Color backgroundColor = timePickerTheme.dayPeriodColor ??
548549 WidgetStateColor .resolveWith ((Set <WidgetState > states) {
@@ -551,7 +552,7 @@ class _DayPeriodControl extends StatelessWidget {
551552 // and allows the optional elevation overlay for dark mode to be
552553 // visible.
553554 return states.contains (WidgetState .selected)
554- ? colorScheme.primary.withOpacity ( isDark ? 0.24 : 0.12 )
555+ ? colorScheme.primary.withValues (alpha : isDark ? 0.24 : 0.12 )
555556 : Colors .transparent;
556557 });
557558 final bool amSelected = selectedTime.period == DayPeriod .am;
@@ -572,8 +573,8 @@ class _DayPeriodControl extends StatelessWidget {
572573 const RoundedRectangleBorder (borderRadius: _kDefaultBorderRadius);
573574 final BorderSide borderSide = timePickerTheme.dayPeriodBorderSide ??
574575 BorderSide (
575- color: Color .alphaBlend (
576- colorScheme.onSurface. withOpacity ( 0.38 ), colorScheme. surface),
576+ color: Color .alphaBlend (colorScheme.onSurface. withValues (alpha : 0.38 ),
577+ colorScheme.surface),
577578 );
578579 // Apply the custom borderSide.
579580 shape = shape.copyWith (
@@ -1270,7 +1271,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
12701271 final ThemeData theme = Theme .of (context);
12711272 final TimePickerThemeData pickerTheme = TimePickerTheme .of (context);
12721273 final Color backgroundColor = pickerTheme.dialBackgroundColor ??
1273- themeData.colorScheme.onSurface.withOpacity ( 0.12 );
1274+ themeData.colorScheme.onSurface.withValues (alpha : 0.12 );
12741275 final Color accentColor =
12751276 pickerTheme.dialHandColor ?? themeData.colorScheme.primary;
12761277 final Color primaryLabelColor = WidgetStateProperty .resolveAs (
@@ -1715,8 +1716,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> {
17151716 final TimePickerThemeData timePickerTheme = TimePickerTheme .of (context);
17161717 final ColorScheme colorScheme = theme.colorScheme;
17171718
1718- final InputDecorationThemeData ? inputDecorationTheme =
1719- timePickerTheme.inputDecorationTheme;
1719+ final inputDecorationTheme = timePickerTheme.inputDecorationTheme;
17201720 InputDecoration inputDecoration;
17211721 if (inputDecorationTheme != null ) {
17221722 inputDecoration =
@@ -1738,14 +1738,14 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> {
17381738 borderSide: BorderSide (color: colorScheme.error, width: 2.0 ),
17391739 ),
17401740 hintStyle: widget.style
1741- .copyWith (color: colorScheme.onSurface.withOpacity ( 0.36 )),
1741+ .copyWith (color: colorScheme.onSurface.withValues (alpha : 0.36 )),
17421742 errorStyle: const TextStyle (
17431743 fontSize: 0.0 ,
17441744 height: 0.0 ), // Prevent the error text from appearing.
17451745 );
17461746 }
17471747 final Color unfocusedFillColor = timePickerTheme.hourMinuteColor ??
1748- colorScheme.onSurface.withOpacity ( 0.12 );
1748+ colorScheme.onSurface.withValues (alpha : 0.12 );
17491749 // If screen reader is in use, make the hint text say hours/minutes.
17501750 // Otherwise, remove the hint text when focused because the centered cursor
17511751 // appears odd above the hint text.
@@ -2031,8 +2031,9 @@ class _TimePickerWidgetState extends State<TimePickerWidget> {
20312031 const SizedBox (width: 10.0 ),
20322032 IconButton (
20332033 color: TimePickerTheme .of (context).entryModeIconColor ??
2034- theme.colorScheme.onSurface.withOpacity (
2035- theme.colorScheme.brightness == Brightness .dark ? 1.0 : 0.6 ,
2034+ theme.colorScheme.onSurface.withValues (
2035+ alpha:
2036+ theme.colorScheme.brightness == Brightness .dark ? 1.0 : 0.6 ,
20362037 ),
20372038 onPressed: _handleEntryModeToggle,
20382039 icon: Icon (_entryMode == TimePickerEntryMode .dial
0 commit comments