## 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
This commit is contained in:
parent
b45cd23173
commit
a9f9136633
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user