Unverified Commit 333dc5d8 authored by Pedro Massango's avatar Pedro Massango Committed by GitHub

Fixes: "FloatingActionButton.extended's isExtended property if false should...

Fixes: "FloatingActionButton.extended's isExtended property if false should show icon, not label" (#72431)

* Fix extended FAB with isExtended set to false showing both icon and label
parent 392c237d
......@@ -210,7 +210,11 @@ class FloatingActionButton extends StatelessWidget {
label,
const SizedBox(width: 20.0),
]
: <Widget>[
: !isExtended ? <Widget>[
const SizedBox(width: 20.0),
icon,
const SizedBox(width: 20.0),
] : <Widget>[
const SizedBox(width: 16.0),
icon,
const SizedBox(width: 8.0),
......
......@@ -942,6 +942,27 @@ void main() {
paints..circle(color: splashColor),
);
});
testWidgets('extended FAB does not show label when isExtended is false', (WidgetTester tester) async {
const Key iconKey = Key('icon');
const Key labelKey = Key('label');
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: FloatingActionButton.extended(
isExtended: false,
label: const Text('', key: labelKey),
icon: const Icon(Icons.add, key: iconKey),
onPressed: () {},
),
),
);
// Verify that Icon is present and label is not.
expect(find.byKey(iconKey), findsOneWidget);
expect(find.byKey(labelKey), findsNothing);
});
}
Offset _rightEdgeOfFab(WidgetTester tester) {
......
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