Unverified Commit 997a6ffc authored by Pedro Massango's avatar Pedro Massango Committed by GitHub

Pass MaterialButton.disabledElevation into RawMaterialButton (#58209)

* Pass disabledElevation from MaterialButton into RawMaterialButton
parent 0b7a08c4
...@@ -415,6 +415,7 @@ class MaterialButton extends StatelessWidget { ...@@ -415,6 +415,7 @@ class MaterialButton extends StatelessWidget {
animationDuration: buttonTheme.getAnimationDuration(this), animationDuration: buttonTheme.getAnimationDuration(this),
child: child, child: child,
materialTapTargetSize: materialTapTargetSize ?? theme.materialTapTargetSize, materialTapTargetSize: materialTapTargetSize ?? theme.materialTapTargetSize,
disabledElevation: disabledElevation ?? 0.0,
); );
} }
......
...@@ -841,4 +841,47 @@ void main() { ...@@ -841,4 +841,47 @@ void main() {
expect(box.size, equals(const Size(76, 36))); expect(box.size, equals(const Size(76, 36)));
expect(childRect, equals(const Rect.fromLTRB(372.0, 293.0, 428.0, 307.0))); expect(childRect, equals(const Rect.fromLTRB(372.0, 293.0, 428.0, 307.0)));
}); });
testWidgets('disabledElevation is passed to RawMaterialButton', (WidgetTester tester) async {
const double disabledElevation = 16;
final Finder rawMaterialButtonFinder = find.descendant(
of: find.byType(MaterialButton),
matching: find.byType(RawMaterialButton)
);
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: MaterialButton(
disabledElevation: disabledElevation,
onPressed: null, // disabled button
child: Text('button'),
),
),
);
final RawMaterialButton rawMaterialButton = tester.widget(rawMaterialButtonFinder);
expect(rawMaterialButton.disabledElevation, equals(disabledElevation));
});
testWidgets('MaterialButton.disabledElevation defaults to 0.0 when not provided', (WidgetTester tester) async {
final Finder rawMaterialButtonFinder = find.descendant(
of: find.byType(MaterialButton),
matching: find.byType(RawMaterialButton)
);
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: MaterialButton(
onPressed: null, // disabled button
child: Text('button'),
),
),
);
final RawMaterialButton rawMaterialButton = tester.widget(rawMaterialButtonFinder);
expect(rawMaterialButton.disabledElevation, equals(0.0));
});
} }
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