Commit df1a957a authored by Adam Barth's avatar Adam Barth

Merge pull request #560 from abarth/dropdown

Add drop down buttons to Material Gallery
parents 048400b3 1f1e0501
...@@ -4,11 +4,13 @@ ...@@ -4,11 +4,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'widget_demo.dart';
class DropDownDemo extends StatefulComponent { class DropDownDemo extends StatefulComponent {
DropDownDemoState createState() => new DropDownDemoState(); _DropDownDemoState createState() => new _DropDownDemoState();
} }
class DropDownDemoState extends State<DropDownDemo> { class _DropDownDemoState extends State<DropDownDemo> {
String _value = "Free"; String _value = "Free";
List<DropDownMenuItem<String>> _buildItems() { List<DropDownMenuItem<String>> _buildItems() {
...@@ -30,26 +32,12 @@ class DropDownDemoState extends State<DropDownDemo> { ...@@ -30,26 +32,12 @@ class DropDownDemoState extends State<DropDownDemo> {
} }
); );
return new Scaffold( return new Center(child: dropdown);
toolBar: new ToolBar(center: new Text('DropDownDemo Demo')),
body: new Container(
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primarySwatch[50]),
child: new Center(child: dropdown)
)
);
} }
} }
void main() { final WidgetDemo kDropDownDemo = new WidgetDemo(
runApp(new MaterialApp( title: 'Drop Down Button',
title: 'DropDownDemo', routeName: '/dropdown',
theme: new ThemeData( builder: (_) => new DropDownDemo()
brightness: ThemeBrightness.light, );
primarySwatch: Colors.blue,
accentColor: Colors.redAccent[200]
),
routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new DropDownDemo(),
}
));
}
...@@ -8,10 +8,12 @@ import 'chip_demo.dart'; ...@@ -8,10 +8,12 @@ import 'chip_demo.dart';
import 'gallery_page.dart'; import 'gallery_page.dart';
import 'date_picker_demo.dart'; import 'date_picker_demo.dart';
import 'widget_demo.dart'; import 'widget_demo.dart';
import 'drop_down_demo.dart';
final List<WidgetDemo> _kDemos = <WidgetDemo>[ final List<WidgetDemo> _kDemos = <WidgetDemo>[
kChipDemo, kChipDemo,
kDatePickerDemo, kDatePickerDemo,
kDropDownDemo,
]; ];
void main() { void main() {
......
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