Implement switch expressions in examples/ and animation/ (#139882)
Thanks so much for approving the previous PR (#139048) a couple weeks ago! This one is the same, except it's covering files in `examples/` and `packages/flutter/lib/src/animation/`. (solving issue #136139)
This commit is contained in:
@@ -366,12 +366,10 @@ class ColorChip extends StatelessWidget {
|
||||
|
||||
static Color contrastColor(Color color) {
|
||||
final Brightness brightness = ThemeData.estimateBrightnessForColor(color);
|
||||
switch (brightness) {
|
||||
case Brightness.dark:
|
||||
return Colors.white;
|
||||
case Brightness.light:
|
||||
return Colors.black;
|
||||
}
|
||||
return switch (brightness) {
|
||||
Brightness.dark => Colors.white,
|
||||
Brightness.light => Colors.black,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -33,12 +33,10 @@ class Diagonal extends SlottedMultiChildRenderObjectWidget<DiagonalSlot, RenderB
|
||||
|
||||
@override
|
||||
Widget? childForSlot(DiagonalSlot slot) {
|
||||
switch (slot) {
|
||||
case DiagonalSlot.topLeft:
|
||||
return topLeft;
|
||||
case DiagonalSlot.bottomRight:
|
||||
return bottomRight;
|
||||
}
|
||||
return switch (slot) {
|
||||
DiagonalSlot.topLeft => topLeft,
|
||||
DiagonalSlot.bottomRight => bottomRight,
|
||||
};
|
||||
}
|
||||
|
||||
// The [createRenderObject] and [updateRenderObject] methods configure the
|
||||
|
||||
Reference in New Issue
Block a user