diff --git a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart index 0f88add36e..1098a28b91 100644 --- a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart +++ b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart @@ -72,12 +72,14 @@ class _AccountDetails extends StatefulWidget { @required this.accountEmail, this.onTap, this.isOpen, + this.arrowColor, }) : super(key: key); final Widget accountName; final Widget accountEmail; final VoidCallback onTap; final bool isOpen; + final Color arrowColor; @override _AccountDetailsState createState() => _AccountDetailsState(); @@ -179,7 +181,7 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi angle: _animation.value * math.pi, child: Icon( Icons.arrow_drop_down, - color: Colors.white, + color: widget.arrowColor, semanticLabel: widget.isOpen ? localizations.hideAccountsLabel : localizations.showAccountsLabel, @@ -314,6 +316,7 @@ class UserAccountsDrawerHeader extends StatefulWidget { @required this.accountName, @required this.accountEmail, this.onDetailsPressed, + this.arrowColor = Colors.white, }) : super(key: key); /// The header's background. If decoration is null then a [BoxDecoration] @@ -344,6 +347,9 @@ class UserAccountsDrawerHeader extends StatefulWidget { /// [accountName] and [accountEmail] is tapped. final VoidCallback onDetailsPressed; + /// The [Color] of the arrow icon. + final Color arrowColor; + @override _UserAccountsDrawerHeaderState createState() => _UserAccountsDrawerHeaderState(); } @@ -390,6 +396,7 @@ class _UserAccountsDrawerHeaderState extends State { accountEmail: widget.accountEmail, isOpen: _isOpen, onTap: widget.onDetailsPressed == null ? null : _handleDetailsPressed, + arrowColor: widget.arrowColor, ), ], ), diff --git a/packages/flutter/test/material/user_accounts_drawer_header_test.dart b/packages/flutter/test/material/user_accounts_drawer_header_test.dart index 12854f6e10..8920a5a26e 100644 --- a/packages/flutter/test/material/user_accounts_drawer_header_test.dart +++ b/packages/flutter/test/material/user_accounts_drawer_header_test.dart @@ -216,6 +216,37 @@ void main() { expect(transformWidget.transform.getRotation()[4], 1.0); }); + testWidgets('UserAccountsDrawerHeader icon color changes', (WidgetTester tester) async { + await tester.pumpWidget(MaterialApp( + home: Material( + child: UserAccountsDrawerHeader( + onDetailsPressed: () {}, + accountName: const Text('name'), + accountEmail: const Text('email'), + ), + ), + )); + + Icon iconWidget = tester.firstWidget(find.byType(Icon)); + // Default icon color is white. + expect(iconWidget.color, Colors.white); + + const Color arrowColor = Colors.red; + await tester.pumpWidget(MaterialApp( + home: Material( + child: UserAccountsDrawerHeader( + onDetailsPressed: () { }, + accountName: const Text('name'), + accountEmail: const Text('email'), + arrowColor: arrowColor, + ), + ), + )); + + iconWidget = tester.firstWidget(find.byType(Icon)); + expect(iconWidget.color, arrowColor); + }); + testWidgets('UserAccountsDrawerHeader null parameters LTR', (WidgetTester tester) async { Widget buildFrame({ Widget currentAccountPicture,