From d22008c3175df2f6d364069480218354e19cf961 Mon Sep 17 00:00:00 2001 From: Jesse Pangburn Date: Wed, 2 Mar 2022 15:10:07 -0800 Subject: [PATCH] Update exposed dropdown menu example The current version of Dart in Dartpad gets an error on the existing example. This fix updates the example to specify the type for the dropdown value which resolves the error. --- .../dartpad/menus/exposed_dropdown/main.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/components/dartpad/menus/exposed_dropdown/main.dart b/docs/components/dartpad/menus/exposed_dropdown/main.dart index 50115a7..1e584d1 100644 --- a/docs/components/dartpad/menus/exposed_dropdown/main.dart +++ b/docs/components/dartpad/menus/exposed_dropdown/main.dart @@ -20,18 +20,18 @@ class ExposedDropdownMenuDemo extends StatefulWidget { } class _ExposedDropdownMenuDemoState extends State { - String dropdownValue = 'Option 1'; + String dropdownValue = 'Option 2'; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Exposed Menu Demo'), + title: const Text('Exposed Menu Demo'), ), body: Center( - child: DropdownButton( + child: DropdownButton( value: dropdownValue, - items: [ + items: const >[ DropdownMenuItem( value: 'Option 1', child: Text('Option 1'), @@ -59,7 +59,7 @@ class _ExposedDropdownMenuDemoState extends State { ], onChanged: (value) { setState(() { - dropdownValue = value; + dropdownValue = value as String; }); }, ), @@ -67,3 +67,5 @@ class _ExposedDropdownMenuDemoState extends State { ); } } + +