Unverified Commit 0b216f7a authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

Refactor `ToggleButtons` (remove `RawMaterialButton`) (#99493)

parent 0e20a701
......@@ -142,15 +142,15 @@ void main() {
TextStyle textStyle;
textStyle = tester.widget<DefaultTextStyle>(find.descendant(
of: find.widgetWithText(RawMaterialButton, 'First child'),
matching: find.byType(DefaultTextStyle),
of: find.widgetWithText(TextButton, 'First child'),
matching: find.byType(DefaultTextStyle),
)).style;
expect(textStyle.textBaseline, TextBaseline.ideographic);
expect(textStyle.fontSize, 20.0);
expect(textStyle.color, isNot(Colors.orange));
textStyle = tester.widget<DefaultTextStyle>(find.descendant(
of: find.widgetWithText(RawMaterialButton, 'Second child'),
of: find.widgetWithText(TextButton, 'Second child'),
matching: find.byType(DefaultTextStyle),
)).style;
expect(textStyle.textBaseline, TextBaseline.ideographic);
......@@ -171,6 +171,7 @@ void main() {
),
),
child: ToggleButtons(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
isSelected: const <bool>[false, false, false],
onPressed: (int index) {},
children: const <Widget>[
......@@ -184,13 +185,13 @@ void main() {
),
);
Rect firstRect = tester.getRect(find.byType(RawMaterialButton).at(0));
Rect firstRect = tester.getRect(find.byType(TextButton).at(0));
expect(firstRect.width, 50.0);
expect(firstRect.height, 60.0);
Rect secondRect = tester.getRect(find.byType(RawMaterialButton).at(1));
Rect secondRect = tester.getRect(find.byType(TextButton).at(1));
expect(secondRect.width, 50.0);
expect(secondRect.height, 60.0);
Rect thirdRect = tester.getRect(find.byType(RawMaterialButton).at(2));
Rect thirdRect = tester.getRect(find.byType(TextButton).at(2));
expect(thirdRect.width, 50.0);
expect(thirdRect.height, 60.0);
......@@ -206,6 +207,7 @@ void main() {
),
),
child: ToggleButtons(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
isSelected: const <bool>[false, false, false],
onPressed: (int index) {},
children: const <Widget>[
......@@ -219,13 +221,13 @@ void main() {
),
);
firstRect = tester.getRect(find.byType(RawMaterialButton).at(0));
firstRect = tester.getRect(find.byType(TextButton).at(0));
expect(firstRect.width, 20.0);
expect(firstRect.height, 10.0);
secondRect = tester.getRect(find.byType(RawMaterialButton).at(1));
secondRect = tester.getRect(find.byType(TextButton).at(1));
expect(secondRect.width, 20.0);
expect(secondRect.height, 10.0);
thirdRect = tester.getRect(find.byType(RawMaterialButton).at(2));
thirdRect = tester.getRect(find.byType(TextButton).at(2));
expect(thirdRect.width, 20.0);
expect(thirdRect.height, 10.0);
});
......@@ -235,13 +237,13 @@ void main() {
(WidgetTester tester) async {
TextStyle buttonTextStyle(String text) {
return tester.widget<DefaultTextStyle>(find.descendant(
of: find.widgetWithText(RawMaterialButton, text),
of: find.widgetWithText(TextButton, text),
matching: find.byType(DefaultTextStyle),
)).style;
}
IconTheme iconTheme(IconData icon) {
return tester.widget(find.descendant(
of: find.widgetWithIcon(RawMaterialButton, icon),
of: find.widgetWithIcon(TextButton, icon),
matching: find.byType(IconTheme),
));
}
......@@ -356,7 +358,7 @@ void main() {
);
final Material material = tester.widget<Material>(find.descendant(
of: find.byType(RawMaterialButton),
of: find.byType(TextButton),
matching: find.byType(Material),
));
expect(material.color, customFillColor);
......@@ -367,7 +369,7 @@ void main() {
Material buttonColor(String text) {
return tester.widget<Material>(
find.descendant(
of: find.byType(RawMaterialButton),
of: find.byType(TextButton),
matching: find.widgetWithText(Material, text),
),
);
......@@ -476,7 +478,6 @@ void main() {
inkFeatures,
paints
..circle(color: splashColor)
..rect(color: highlightColor),
);
await touchGesture.up();
......@@ -507,7 +508,6 @@ void main() {
await hoverGesture.removePointer();
});
testWidgets(
'Theme border width and border colors for enabled, selected and disabled states',
(WidgetTester tester) async {
......
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