Unverified Commit 38879dae authored by Nate's avatar Nate Committed by GitHub

Implementing `switch` expressions in `foundation/` and `material/` (#142279)

This PR is the fourth step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591)

This one is covering files in `packages/flutter/lib/src/foundation/` and `packages/flutter/lib/src/material/`.  
The `material/` directory is pretty big though, so for now I just did the files that start with `a`, `b`, and `c`.
parent 5ee1460b
...@@ -585,14 +585,11 @@ abstract class BindingBase { ...@@ -585,14 +585,11 @@ abstract class BindingBase {
name: FoundationServiceExtensions.brightnessOverride.name, name: FoundationServiceExtensions.brightnessOverride.name,
callback: (Map<String, String> parameters) async { callback: (Map<String, String> parameters) async {
if (parameters.containsKey('value')) { if (parameters.containsKey('value')) {
switch (parameters['value']) { debugBrightnessOverride = switch (parameters['value']) {
case 'Brightness.light': 'Brightness.light' => ui.Brightness.light,
debugBrightnessOverride = ui.Brightness.light; 'Brightness.dark' => ui.Brightness.dark,
case 'Brightness.dark': _ => null,
debugBrightnessOverride = ui.Brightness.dark; };
default:
debugBrightnessOverride = null;
}
_postExtensionStateChangedEvent( _postExtensionStateChangedEvent(
FoundationServiceExtensions.brightnessOverride.name, FoundationServiceExtensions.brightnessOverride.name,
(debugBrightnessOverride ?? platformDispatcher.platformBrightness).toString(), (debugBrightnessOverride ?? platformDispatcher.platformBrightness).toString(),
......
...@@ -1718,34 +1718,23 @@ abstract class DiagnosticsNode { ...@@ -1718,34 +1718,23 @@ abstract class DiagnosticsNode {
@protected @protected
TextTreeConfiguration? get textTreeConfiguration { TextTreeConfiguration? get textTreeConfiguration {
assert(style != null); assert(style != null);
switch (style!) { return switch (style!) {
case DiagnosticsTreeStyle.none: DiagnosticsTreeStyle.none => null,
return null; DiagnosticsTreeStyle.dense => denseTextConfiguration,
case DiagnosticsTreeStyle.dense: DiagnosticsTreeStyle.sparse => sparseTextConfiguration,
return denseTextConfiguration; DiagnosticsTreeStyle.offstage => dashedTextConfiguration,
case DiagnosticsTreeStyle.sparse: DiagnosticsTreeStyle.whitespace => whitespaceTextConfiguration,
return sparseTextConfiguration; DiagnosticsTreeStyle.transition => transitionTextConfiguration,
case DiagnosticsTreeStyle.offstage: DiagnosticsTreeStyle.singleLine => singleLineTextConfiguration,
return dashedTextConfiguration; DiagnosticsTreeStyle.errorProperty => errorPropertyTextConfiguration,
case DiagnosticsTreeStyle.whitespace: DiagnosticsTreeStyle.shallow => shallowTextConfiguration,
return whitespaceTextConfiguration; DiagnosticsTreeStyle.error => errorTextConfiguration,
case DiagnosticsTreeStyle.transition: DiagnosticsTreeStyle.flat => flatTextConfiguration,
return transitionTextConfiguration;
case DiagnosticsTreeStyle.singleLine: // Truncate children doesn't really need its own text style as the
return singleLineTextConfiguration; // rendering is quite custom.
case DiagnosticsTreeStyle.errorProperty: DiagnosticsTreeStyle.truncateChildren => whitespaceTextConfiguration,
return errorPropertyTextConfiguration; };
case DiagnosticsTreeStyle.shallow:
return shallowTextConfiguration;
case DiagnosticsTreeStyle.error:
return errorTextConfiguration;
case DiagnosticsTreeStyle.truncateChildren:
// Truncate children doesn't really need its own text style as the
// rendering is quite custom.
return whitespaceTextConfiguration;
case DiagnosticsTreeStyle.flat:
return flatTextConfiguration;
}
} }
/// Returns a string representation of this node and its descendants. /// Returns a string representation of this node and its descendants.
......
...@@ -1187,15 +1187,10 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp ...@@ -1187,15 +1187,10 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp
key: _navigatorKey, key: _navigatorKey,
initialRoute: 'initial', initialRoute: 'initial',
onGenerateInitialRoutes: (NavigatorState navigator, String initialRoute) { onGenerateInitialRoutes: (NavigatorState navigator, String initialRoute) {
switch (focus) { return switch (focus) {
case _Focus.master: _Focus.master => <Route<void>>[masterPageRoute],
return <Route<void>>[masterPageRoute]; _Focus.detail => <Route<void>>[masterPageRoute, _detailPageRoute(_cachedDetailArguments)],
case _Focus.detail: };
return <Route<void>>[
masterPageRoute,
_detailPageRoute(_cachedDetailArguments),
];
}
}, },
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
switch (settings.name) { switch (settings.name) {
......
...@@ -212,28 +212,18 @@ class AdaptiveTextSelectionToolbar extends StatelessWidget { ...@@ -212,28 +212,18 @@ class AdaptiveTextSelectionToolbar extends StatelessWidget {
case TargetPlatform.windows: case TargetPlatform.windows:
assert(debugCheckHasMaterialLocalizations(context)); assert(debugCheckHasMaterialLocalizations(context));
final MaterialLocalizations localizations = MaterialLocalizations.of(context); final MaterialLocalizations localizations = MaterialLocalizations.of(context);
switch (buttonItem.type) { return switch (buttonItem.type) {
case ContextMenuButtonType.cut: ContextMenuButtonType.cut => localizations.cutButtonLabel,
return localizations.cutButtonLabel; ContextMenuButtonType.copy => localizations.copyButtonLabel,
case ContextMenuButtonType.copy: ContextMenuButtonType.paste => localizations.pasteButtonLabel,
return localizations.copyButtonLabel; ContextMenuButtonType.selectAll => localizations.selectAllButtonLabel,
case ContextMenuButtonType.paste: ContextMenuButtonType.delete => localizations.deleteButtonTooltip.toUpperCase(),
return localizations.pasteButtonLabel; ContextMenuButtonType.lookUp => localizations.lookUpButtonLabel,
case ContextMenuButtonType.selectAll: ContextMenuButtonType.searchWeb => localizations.searchWebButtonLabel,
return localizations.selectAllButtonLabel; ContextMenuButtonType.share => localizations.shareButtonLabel,
case ContextMenuButtonType.delete: ContextMenuButtonType.liveTextInput => localizations.scanTextButtonLabel,
return localizations.deleteButtonTooltip.toUpperCase(); ContextMenuButtonType.custom => '',
case ContextMenuButtonType.lookUp: };
return localizations.lookUpButtonLabel;
case ContextMenuButtonType.searchWeb:
return localizations.searchWebButtonLabel;
case ContextMenuButtonType.share:
return localizations.shareButtonLabel;
case ContextMenuButtonType.liveTextInput:
return localizations.scanTextButtonLabel;
case ContextMenuButtonType.custom:
return '';
}
} }
} }
......
...@@ -279,12 +279,12 @@ class MaterialRectArcTween extends RectTween { ...@@ -279,12 +279,12 @@ class MaterialRectArcTween extends RectTween {
} }
Offset _cornerFor(Rect rect, _CornerId id) { Offset _cornerFor(Rect rect, _CornerId id) {
switch (id) { return switch (id) {
case _CornerId.topLeft: return rect.topLeft; _CornerId.topLeft => rect.topLeft,
case _CornerId.topRight: return rect.topRight; _CornerId.topRight => rect.topRight,
case _CornerId.bottomLeft: return rect.bottomLeft; _CornerId.bottomLeft => rect.bottomLeft,
case _CornerId.bottomRight: return rect.bottomRight; _CornerId.bottomRight => rect.bottomRight,
} };
} }
/// The path of the corresponding [begin], [end] rectangle corners that lead /// The path of the corresponding [begin], [end] rectangle corners that lead
......
...@@ -558,12 +558,10 @@ class _BottomNavigationTile extends StatelessWidget { ...@@ -558,12 +558,10 @@ class _BottomNavigationTile extends StatelessWidget {
).evaluate(animation); ).evaluate(animation);
} }
switch (type) { size = switch (type) {
case BottomNavigationBarType.fixed: BottomNavigationBarType.fixed => 1,
size = 1; BottomNavigationBarType.shifting => (flex! * 1000.0).round(),
case BottomNavigationBarType.shifting: };
size = (flex! * 1000.0).round();
}
Widget result = InkResponse( Widget result = InkResponse(
onTap: onTap, onTap: onTap,
...@@ -858,12 +856,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -858,12 +856,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
// Unselected labels are shown by default for [BottomNavigationBarType.fixed], // Unselected labels are shown by default for [BottomNavigationBarType.fixed],
// and hidden by default for [BottomNavigationBarType.shifting]. // and hidden by default for [BottomNavigationBarType.shifting].
bool get _defaultShowUnselected { bool get _defaultShowUnselected {
switch (_effectiveType) { return switch (_effectiveType) {
case BottomNavigationBarType.shifting: BottomNavigationBarType.shifting => false,
return false; BottomNavigationBarType.fixed => true,
case BottomNavigationBarType.fixed: };
return true;
}
} }
@override @override
...@@ -969,13 +965,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -969,13 +965,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
final BottomNavigationBarThemeData bottomTheme = BottomNavigationBarTheme.of(context); final BottomNavigationBarThemeData bottomTheme = BottomNavigationBarTheme.of(context);
final Color themeColor; final Color themeColor = switch (themeData.brightness) {
switch (themeData.brightness) { Brightness.light => themeData.colorScheme.primary,
case Brightness.light: Brightness.dark => themeData.colorScheme.secondary,
themeColor = themeData.colorScheme.primary; };
case Brightness.dark:
themeColor = themeData.colorScheme.secondary;
}
final TextStyle effectiveSelectedLabelStyle = final TextStyle effectiveSelectedLabelStyle =
_effectiveTextStyle( _effectiveTextStyle(
...@@ -1138,13 +1131,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -1138,13 +1131,10 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
?? BottomNavigationBarLandscapeLayout.spread; ?? BottomNavigationBarLandscapeLayout.spread;
final double additionalBottomPadding = MediaQuery.viewPaddingOf(context).bottom; final double additionalBottomPadding = MediaQuery.viewPaddingOf(context).bottom;
Color? backgroundColor; final Color? backgroundColor = switch (_effectiveType) {
switch (_effectiveType) { BottomNavigationBarType.fixed => widget.backgroundColor ?? bottomTheme.backgroundColor,
case BottomNavigationBarType.fixed: BottomNavigationBarType.shifting => _backgroundColor,
backgroundColor = widget.backgroundColor ?? bottomTheme.backgroundColor; };
case BottomNavigationBarType.shifting:
backgroundColor = _backgroundColor;
}
return Semantics( return Semantics(
explicitChildNodes: true, explicitChildNodes: true,
...@@ -1298,8 +1288,8 @@ class _RadialPainter extends CustomPainter { ...@@ -1298,8 +1288,8 @@ class _RadialPainter extends CustomPainter {
for (int i = 0; i < circles.length; i += 1) { for (int i = 0; i < circles.length; i += 1) {
if (circles[i] != oldPainter.circles[i]) { if (circles[i] != oldPainter.circles[i]) {
return true; return true;
}
} }
}
return false; return false;
} }
...@@ -1309,13 +1299,10 @@ class _RadialPainter extends CustomPainter { ...@@ -1309,13 +1299,10 @@ class _RadialPainter extends CustomPainter {
final Paint paint = Paint()..color = circle.color; final Paint paint = Paint()..color = circle.color;
final Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.height); final Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.height);
canvas.clipRect(rect); canvas.clipRect(rect);
final double leftFraction; final double leftFraction = switch (textDirection) {
switch (textDirection) { TextDirection.rtl => 1.0 - circle.horizontalLeadingOffset,
case TextDirection.rtl: TextDirection.ltr => circle.horizontalLeadingOffset,
leftFraction = 1.0 - circle.horizontalLeadingOffset; };
case TextDirection.ltr:
leftFraction = circle.horizontalLeadingOffset;
}
final Offset center = Offset(leftFraction * size.width, size.height / 2.0); final Offset center = Offset(leftFraction * size.width, size.height / 2.0);
final Tween<double> radiusTween = Tween<double>( final Tween<double> radiusTween = Tween<double>(
begin: 0.0, begin: 0.0,
......
...@@ -383,14 +383,11 @@ class _RenderButtonBarRow extends RenderFlex { ...@@ -383,14 +383,11 @@ class _RenderButtonBarRow extends RenderFlex {
super.performLayout(); super.performLayout();
} else { } else {
final BoxConstraints childConstraints = constraints.copyWith(minWidth: 0.0); final BoxConstraints childConstraints = constraints.copyWith(minWidth: 0.0);
RenderBox? child;
double currentHeight = 0.0; double currentHeight = 0.0;
switch (verticalDirection) { RenderBox? child = switch (verticalDirection) {
case VerticalDirection.down: VerticalDirection.down => firstChild,
child = firstChild; VerticalDirection.up => lastChild,
case VerticalDirection.up: };
child = lastChild;
}
while (child != null) { while (child != null) {
final FlexParentData childParentData = child.parentData! as FlexParentData; final FlexParentData childParentData = child.parentData! as FlexParentData;
......
...@@ -241,16 +241,11 @@ class ButtonThemeData with Diagnosticable { ...@@ -241,16 +241,11 @@ class ButtonThemeData with Diagnosticable {
/// * [getPadding], which is used to calculate padding for the [button]'s /// * [getPadding], which is used to calculate padding for the [button]'s
/// child (typically the button's label). /// child (typically the button's label).
EdgeInsetsGeometry get padding { EdgeInsetsGeometry get padding {
if (_padding != null) { return _padding ?? switch (textTheme) {
return _padding; ButtonTextTheme.normal => const EdgeInsets.symmetric(horizontal: 16.0),
} ButtonTextTheme.accent => const EdgeInsets.symmetric(horizontal: 16.0),
switch (textTheme) { ButtonTextTheme.primary => const EdgeInsets.symmetric(horizontal: 24.0),
case ButtonTextTheme.normal: };
case ButtonTextTheme.accent:
return const EdgeInsets.symmetric(horizontal: 16.0);
case ButtonTextTheme.primary:
return const EdgeInsets.symmetric(horizontal: 24.0);
}
} }
final EdgeInsetsGeometry? _padding; final EdgeInsetsGeometry? _padding;
...@@ -269,20 +264,12 @@ class ButtonThemeData with Diagnosticable { ...@@ -269,20 +264,12 @@ class ButtonThemeData with Diagnosticable {
/// * [getShape], which is used to calculate the shape of the [button]'s /// * [getShape], which is used to calculate the shape of the [button]'s
/// [Material]. /// [Material].
ShapeBorder get shape { ShapeBorder get shape {
if (_shape != null) { return _shape ?? switch (textTheme) {
return _shape; ButtonTextTheme.normal || ButtonTextTheme.accent =>
} const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(2.0))),
switch (textTheme) { ButtonTextTheme.primary =>
case ButtonTextTheme.normal: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4.0))),
case ButtonTextTheme.accent: };
return const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(2.0)),
);
case ButtonTextTheme.primary:
return const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
);
}
} }
final ShapeBorder? _shape; final ShapeBorder? _shape;
......
...@@ -508,13 +508,10 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin, Togg ...@@ -508,13 +508,10 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin, Togg
final VisualDensity effectiveVisualDensity = widget.visualDensity final VisualDensity effectiveVisualDensity = widget.visualDensity
?? checkboxTheme.visualDensity ?? checkboxTheme.visualDensity
?? defaults.visualDensity!; ?? defaults.visualDensity!;
Size size; Size size = switch (effectiveMaterialTapTargetSize) {
switch (effectiveMaterialTapTargetSize) { MaterialTapTargetSize.padded => const Size(kMinInteractiveDimension, kMinInteractiveDimension),
case MaterialTapTargetSize.padded: MaterialTapTargetSize.shrinkWrap => const Size(kMinInteractiveDimension - 8.0, kMinInteractiveDimension - 8.0),
size = const Size(kMinInteractiveDimension, kMinInteractiveDimension); };
case MaterialTapTargetSize.shrinkWrap:
size = const Size(kMinInteractiveDimension - 8.0, kMinInteractiveDimension - 8.0);
}
size += effectiveVisualDensity.baseSizeAdjustment; size += effectiveVisualDensity.baseSizeAdjustment;
final MaterialStateProperty<MouseCursor> effectiveMouseCursor = MaterialStateProperty.resolveWith<MouseCursor>((Set<MaterialState> states) { final MaterialStateProperty<MouseCursor> effectiveMouseCursor = MaterialStateProperty.resolveWith<MouseCursor>((Set<MaterialState> states) {
......
...@@ -1439,14 +1439,11 @@ class _ChipRenderWidget extends SlottedMultiChildRenderObjectWidget<_ChipSlot, R ...@@ -1439,14 +1439,11 @@ class _ChipRenderWidget extends SlottedMultiChildRenderObjectWidget<_ChipSlot, R
@override @override
Widget? childForSlot(_ChipSlot slot) { Widget? childForSlot(_ChipSlot slot) {
switch (slot) { return switch (slot) {
case _ChipSlot.label: _ChipSlot.label => theme.label,
return theme.label; _ChipSlot.avatar => theme.avatar,
case _ChipSlot.avatar: _ChipSlot.deleteIcon => theme.deleteIcon,
return theme.avatar; };
case _ChipSlot.deleteIcon:
return theme.deleteIcon;
}
} }
@override @override
...@@ -1971,17 +1968,12 @@ class _RenderChip extends RenderBox with SlottedContainerRenderObjectMixin<_Chip ...@@ -1971,17 +1968,12 @@ class _RenderChip extends RenderBox with SlottedContainerRenderObjectMixin<_Chip
} }
void _paintCheck(Canvas canvas, Offset origin, double size) { void _paintCheck(Canvas canvas, Offset origin, double size) {
Color? paintColor; Color? paintColor = theme.checkmarkColor ?? switch ((theme.brightness, theme.showAvatar)) {
if (theme.checkmarkColor != null) { (Brightness.light, true ) => Colors.white,
paintColor = theme.checkmarkColor; (Brightness.light, false) => Colors.black.withAlpha(_kCheckmarkAlpha),
} else { (Brightness.dark, true ) => Colors.black,
switch (theme.brightness) { (Brightness.dark, false) => Colors.white.withAlpha(_kCheckmarkAlpha),
case Brightness.light: };
paintColor = theme.showAvatar ? Colors.white : Colors.black.withAlpha(_kCheckmarkAlpha);
case Brightness.dark:
paintColor = theme.showAvatar ? Colors.black : Colors.white.withAlpha(_kCheckmarkAlpha);
}
}
final ColorTween fadeTween = ColorTween(begin: Colors.transparent, end: paintColor); final ColorTween fadeTween = ColorTween(begin: Colors.transparent, end: paintColor);
...@@ -2260,12 +2252,10 @@ bool _hitIsOnDeleteIcon({ ...@@ -2260,12 +2252,10 @@ bool _hitIsOnDeleteIcon({
deflatedSize.width * 0.499, deflatedSize.width * 0.499,
math.min(labelPadding.resolve(textDirection).right + deleteButtonSize.width, 24.0 + deleteButtonSize.width / 2.0), math.min(labelPadding.resolve(textDirection).right + deleteButtonSize.width, 24.0 + deleteButtonSize.width / 2.0),
); );
switch (textDirection) { return switch (textDirection) {
case TextDirection.ltr: TextDirection.ltr => adjustedPosition.dx >= deflatedSize.width - accessibleDeleteButtonWidth,
return adjustedPosition.dx >= deflatedSize.width - accessibleDeleteButtonWidth; TextDirection.rtl => adjustedPosition.dx <= accessibleDeleteButtonWidth,
case TextDirection.rtl: };
return adjustedPosition.dx <= accessibleDeleteButtonWidth;
}
} }
// BEGIN GENERATED TOKEN PROPERTIES - Chip // BEGIN GENERATED TOKEN PROPERTIES - Chip
......
...@@ -204,19 +204,15 @@ class CircleAvatar extends StatelessWidget { ...@@ -204,19 +204,15 @@ class CircleAvatar extends StatelessWidget {
Color? effectiveBackgroundColor = backgroundColor Color? effectiveBackgroundColor = backgroundColor
?? (theme.useMaterial3 ? theme.colorScheme.primaryContainer : null); ?? (theme.useMaterial3 ? theme.colorScheme.primaryContainer : null);
if (effectiveBackgroundColor == null) { if (effectiveBackgroundColor == null) {
switch (ThemeData.estimateBrightnessForColor(textStyle.color!)) { effectiveBackgroundColor = switch (ThemeData.estimateBrightnessForColor(textStyle.color!)) {
case Brightness.dark: Brightness.dark => theme.primaryColorLight,
effectiveBackgroundColor = theme.primaryColorLight; Brightness.light => theme.primaryColorDark,
case Brightness.light: };
effectiveBackgroundColor = theme.primaryColorDark;
}
} else if (effectiveForegroundColor == null) { } else if (effectiveForegroundColor == null) {
switch (ThemeData.estimateBrightnessForColor(backgroundColor!)) { textStyle = switch (ThemeData.estimateBrightnessForColor(backgroundColor!)) {
case Brightness.dark: Brightness.dark => textStyle.copyWith(color: theme.primaryColorLight),
textStyle = textStyle.copyWith(color: theme.primaryColorLight); Brightness.light => textStyle.copyWith(color: theme.primaryColorDark),
case Brightness.light: };
textStyle = textStyle.copyWith(color: theme.primaryColorDark);
}
} }
final double minDiameter = _minDiameter; final double minDiameter = _minDiameter;
final double maxDiameter = _maxDiameter; final double maxDiameter = _maxDiameter;
......
...@@ -193,13 +193,10 @@ class ColorScheme with Diagnosticable { ...@@ -193,13 +193,10 @@ class ColorScheme with Diagnosticable {
Color? scrim, Color? scrim,
Color? surfaceTint, Color? surfaceTint,
}) { }) {
final Scheme scheme; final Scheme scheme = switch (brightness) {
switch (brightness) { Brightness.light => Scheme.light(seedColor.value),
case Brightness.light: Brightness.dark => Scheme.dark(seedColor.value),
scheme = Scheme.light(seedColor.value); };
case Brightness.dark:
scheme = Scheme.dark(seedColor.value);
}
return ColorScheme( return ColorScheme(
primary: primary ?? Color(scheme.primary), primary: primary ?? Color(scheme.primary),
onPrimary: onPrimary ?? Color(scheme.onPrimary), onPrimary: onPrimary ?? Color(scheme.onPrimary),
...@@ -1073,13 +1070,10 @@ class ColorScheme with Diagnosticable { ...@@ -1073,13 +1070,10 @@ class ColorScheme with Diagnosticable {
final List<int> scoredResults = Score.score(colorToCount, desired: 1); final List<int> scoredResults = Score.score(colorToCount, desired: 1);
final ui.Color baseColor = Color(scoredResults.first); final ui.Color baseColor = Color(scoredResults.first);
final Scheme scheme; final Scheme scheme = switch (brightness) {
switch (brightness) { Brightness.light => Scheme.light(baseColor.value),
case Brightness.light: Brightness.dark => Scheme.dark(baseColor.value),
scheme = Scheme.light(baseColor.value); };
case Brightness.dark:
scheme = Scheme.dark(baseColor.value);
}
return ColorScheme(primary: primary ?? Color(scheme.primary), return ColorScheme(primary: primary ?? Color(scheme.primary),
onPrimary: onPrimary ?? Color(scheme.onPrimary), onPrimary: onPrimary ?? Color(scheme.onPrimary),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment