Unverified Commit a9f91366 authored by Sulav Parajuli's avatar Sulav Parajuli Committed by GitHub

Fix #141061: Add 'color' property to `DrawerButton` and `EndDrawerButton` (#141159)

## Description

This PR addresses issue #141061, which requested the addition of a 'color' property to buttons extending _ActionButton. The 'color' property has been introduced to enhance customization options for these buttons.

## Issues Fixed

- Fixes #141061
parent b45cd231
......@@ -337,6 +337,7 @@ class DrawerButton extends _ActionButton {
/// Creates a Material Design drawer icon button.
const DrawerButton({
super.key,
super.color,
super.style,
super.onPressed,
}) : super(icon: const DrawerButtonIcon());
......@@ -402,6 +403,7 @@ class EndDrawerButton extends _ActionButton {
/// Creates a Material Design end drawer icon button.
const EndDrawerButton({
super.key,
super.color,
super.style,
super.onPressed,
}) : super(icon: const EndDrawerButtonIcon());
......
......@@ -112,6 +112,24 @@ void main() {
});
testWidgets('DrawerButton color', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Material(
child: DrawerButton(
color: Colors.red,
),
),
),
);
final RichText iconText = tester.firstWidget(find.descendant(
of: find.byType(DrawerButton),
matching: find.byType(RichText),
));
expect(iconText.text.style!.color, Colors.red);
});
testWidgets('DrawerButton color with ButtonStyle', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(useMaterial3: true),
......@@ -227,6 +245,24 @@ void main() {
}, variant: TargetPlatformVariant.all());
testWidgets('EndDrawerButton color', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Material(
child: EndDrawerButton(
color: Colors.red,
),
),
),
);
final RichText iconText = tester.firstWidget(find.descendant(
of: find.byType(EndDrawerButton),
matching: find.byType(RichText),
));
expect(iconText.text.style!.color, Colors.red);
});
testWidgets('EndDrawerButton color with ButtonStyle', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(useMaterial3: true),
......
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