[flutter roll] Revert "Fix Chip.shape
's side is not used when provided in Material 3" (#133615)
Reverts flutter/flutter#132941 context: b/298110031 The rounded rectangle borders don't appear in some of the internal golden image tests.
This commit is contained in:
parent
b34955c2f4
commit
6fd42536b7
@ -19,6 +19,7 @@ class _${blockName}DefaultsM3 extends ChipThemeData {
|
|||||||
_${blockName}DefaultsM3(this.context, this.isEnabled)
|
_${blockName}DefaultsM3(this.context, this.isEnabled)
|
||||||
: super(
|
: super(
|
||||||
elevation: ${elevation("$tokenGroup$variant.container")},
|
elevation: ${elevation("$tokenGroup$variant.container")},
|
||||||
|
shape: ${shape("$tokenGroup.container")},
|
||||||
showCheckmark: true,
|
showCheckmark: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -46,13 +47,9 @@ class _${blockName}DefaultsM3 extends ChipThemeData {
|
|||||||
Color? get deleteIconColor => ${color("$tokenGroup.with-icon.selected.icon.color")};
|
Color? get deleteIconColor => ${color("$tokenGroup.with-icon.selected.icon.color")};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
OutlinedBorder? get shape {
|
BorderSide? get side => isEnabled
|
||||||
return ${shape("$tokenGroup.container")}.copyWith(
|
? ${border('$tokenGroup$variant.outline')}
|
||||||
side: isEnabled
|
: ${border('$tokenGroup$variant.disabled.outline')};
|
||||||
? ${border('$tokenGroup$variant.outline')}
|
|
||||||
: ${border('$tokenGroup$variant.disabled.outline')},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
IconThemeData? get iconTheme => IconThemeData(
|
IconThemeData? get iconTheme => IconThemeData(
|
||||||
|
@ -997,7 +997,6 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
|
|||||||
final OutlinedBorder resolvedShape = MaterialStateProperty.resolveAs<OutlinedBorder?>(widget.shape, materialStates)
|
final OutlinedBorder resolvedShape = MaterialStateProperty.resolveAs<OutlinedBorder?>(widget.shape, materialStates)
|
||||||
?? MaterialStateProperty.resolveAs<OutlinedBorder?>(chipTheme.shape, materialStates)
|
?? MaterialStateProperty.resolveAs<OutlinedBorder?>(chipTheme.shape, materialStates)
|
||||||
?? MaterialStateProperty.resolveAs<OutlinedBorder?>(chipDefaults.shape, materialStates)
|
?? MaterialStateProperty.resolveAs<OutlinedBorder?>(chipDefaults.shape, materialStates)
|
||||||
// TODO(tahatesser): Remove this fallback when Material 2 is deprecated.
|
|
||||||
?? const StadiumBorder();
|
?? const StadiumBorder();
|
||||||
return resolvedShape.copyWith(side: resolvedSide);
|
return resolvedShape.copyWith(side: resolvedSide);
|
||||||
}
|
}
|
||||||
@ -2235,6 +2234,7 @@ class _ChipDefaultsM3 extends ChipThemeData {
|
|||||||
_ChipDefaultsM3(this.context, this.isEnabled)
|
_ChipDefaultsM3(this.context, this.isEnabled)
|
||||||
: super(
|
: super(
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0))),
|
||||||
showCheckmark: true,
|
showCheckmark: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2262,13 +2262,9 @@ class _ChipDefaultsM3 extends ChipThemeData {
|
|||||||
Color? get deleteIconColor => null;
|
Color? get deleteIconColor => null;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
OutlinedBorder? get shape {
|
BorderSide? get side => isEnabled
|
||||||
return const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0))).copyWith(
|
? BorderSide(color: _colors.outline)
|
||||||
side: isEnabled
|
: BorderSide(color: _colors.onSurface.withOpacity(0.12));
|
||||||
? BorderSide(color: _colors.outline)
|
|
||||||
: BorderSide(color: _colors.onSurface.withOpacity(0.12)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
IconThemeData? get iconTheme => IconThemeData(
|
IconThemeData? get iconTheme => IconThemeData(
|
||||||
|
@ -3503,60 +3503,6 @@ void main() {
|
|||||||
expect(calledDelete, isTrue);
|
expect(calledDelete, isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets("Material3 - RawChip.shape's side is used when provided", (WidgetTester tester) async {
|
|
||||||
Widget buildChip({ OutlinedBorder? shape, BorderSide? side }) {
|
|
||||||
return MaterialApp(
|
|
||||||
theme: ThemeData(useMaterial3: true),
|
|
||||||
home: Material(
|
|
||||||
child: Center(
|
|
||||||
child: RawChip(
|
|
||||||
shape: shape,
|
|
||||||
side: side,
|
|
||||||
label: const Text('RawChip'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test [RawChip.shape] with a side.
|
|
||||||
await tester.pumpWidget(buildChip(
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xffff00ff)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Chip should have the provided shape and the side from [RawChip.shape].
|
|
||||||
expect(
|
|
||||||
getMaterial(tester).shape,
|
|
||||||
const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xffff00ff)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Test [RawChip.shape] with a side and [RawChip.side].
|
|
||||||
await tester.pumpWidget(buildChip(
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xffff00ff)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
),
|
|
||||||
side: const BorderSide(color: Color(0xfffff000))),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
// Chip use shape from [RawChip.shape] and the side from [RawChip.side].
|
|
||||||
// [RawChip.shape]'s side should be ignored.
|
|
||||||
expect(
|
|
||||||
getMaterial(tester).shape,
|
|
||||||
const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xfffff000)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Material 2', () {
|
group('Material 2', () {
|
||||||
// These tests are only relevant for Material 2. Once Material 2
|
// These tests are only relevant for Material 2. Once Material 2
|
||||||
// support is deprecated and the APIs are removed, these tests
|
// support is deprecated and the APIs are removed, these tests
|
||||||
|
@ -928,64 +928,6 @@ void main() {
|
|||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets("Material3 - RawChip.shape's side is used when provided", (WidgetTester tester) async {
|
|
||||||
Widget buildChip({ OutlinedBorder? shape, BorderSide? side }) {
|
|
||||||
return MaterialApp(
|
|
||||||
theme: ThemeData(
|
|
||||||
useMaterial3: true,
|
|
||||||
chipTheme: ChipThemeData(
|
|
||||||
shape: shape,
|
|
||||||
side: side,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
home: const Material(
|
|
||||||
child: Center(
|
|
||||||
child: RawChip(
|
|
||||||
label: Text('RawChip'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test [RawChip.shape] with a side.
|
|
||||||
await tester.pumpWidget(buildChip(
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xffff00ff)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Chip should have the provided shape and the side from [RawChip.shape].
|
|
||||||
expect(
|
|
||||||
getMaterial(tester).shape,
|
|
||||||
const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xffff00ff)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Test [RawChip.shape] with a side and [RawChip.side].
|
|
||||||
await tester.pumpWidget(buildChip(
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xffff00ff)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
),
|
|
||||||
side: const BorderSide(color: Color(0xfffff000))),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
// Chip use shape from [RawChip.shape] and the side from [RawChip.side].
|
|
||||||
// [RawChip.shape]'s side should be ignored.
|
|
||||||
expect(
|
|
||||||
getMaterial(tester).shape,
|
|
||||||
const RoundedRectangleBorder(
|
|
||||||
side: BorderSide(color: Color(0xfffff000)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7.0)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MaterialStateOutlinedBorder extends StadiumBorder implements MaterialStateOutlinedBorder {
|
class _MaterialStateOutlinedBorder extends StadiumBorder implements MaterialStateOutlinedBorder {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user