Unverified Commit 27b7ec34 authored by xubaolin's avatar xubaolin Committed by GitHub

Fix Gallery subtitle not updating correctly upon selection (#73303)

parent a293c822
......@@ -43,7 +43,7 @@ class MenuDemoState extends State<MenuDemo> {
void showMenuSelection(String value) {
if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value))
_simpleValue = value;
setState(() => _simpleValue = value);
showInSnackBar('You selected: $value');
}
......
......@@ -29,4 +29,23 @@ void main() {
await expectLater(tester, meetsGuideline(CustomMinimumContrastGuideline(finder: find.byWidgetPredicate((Widget widget) => widget is Icon))));
});
testWidgets('The selected menu item update test', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
theme: kDarkGalleryTheme,
home: const MenuDemo(),
));
// Popup the menu.
await tester.tap(find.text('An item with a simple menu'));
await tester.pumpAndSettle();
// Select one item.
await tester.tap(find.text('Menu item value three'));
await tester.pumpAndSettle();
// The subtitle updated with the selected item.
expect(find.text('Menu item value three'), findsOneWidget);
});
}
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