Skip to content

Commit e513ffd

Browse files
author
JZoom
committed
1.1.0
1 parent e243ee4 commit e513ffd

File tree

2 files changed

+25
-68
lines changed

2 files changed

+25
-68
lines changed

README.md

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,20 @@ A dropdown menu for Flutter.
55
## Showcase
66

77
![showcase](https://github.com/jzoom/images/raw/master/dropdown_menu.gif)
8+
****
9+
![showcase](https://github.com/jzoom/images/raw/master/dropdown_menu_1.gif)
810

11+
![showcase](https://github.com/jzoom/images/raw/master/dropdown_menu_2.gif)
912

1013
## Installion
1114

1215
```
1316
14-
dropdown_menu : ^1.0.1
17+
dropdown_menu : ^1.1.0
1518
1619
```
1720

21+
## Examples
1822

19-
## Getting Started
2023

21-
It is easy to create dropdown menu like this:
2224

23-
```
24-
25-
new DropdownMenu(
26-
menus: [
27-
new SizedBox(
28-
height: 200.0,
29-
child: ...
30-
),
31-
32-
new DropdownMenuBuilder(
33-
builder:(BuildContext context){
34-
},
35-
height:100.0
36-
)
37-
],
38-
controller: new DropdownMenuController(),
39-
child: new ListView(
40-
children: [1,2,3,4,5,6,7,8,9,10].map((dynamic i){
41-
return new InkWell(
42-
onTap: () {
43-
print(new DateTime.now());
44-
},
45-
child: new Padding(
46-
padding: new EdgeInsets.all(10.0),
47-
child: new Text("Fake content")));
48-
}).toList(),
49-
),
50-
)
51-
52-
53-
```

example/lib/main.dart

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
44
import 'package:dropdown_menu/dropdown_header.dart';
55
import 'dart:math' as math;
66
import 'package:dropdown_menu/dropdown_templates.dart';
7-
import 'package:async_loader/async_loader.dart';
87
import 'package:dropdown_menu/dropdown_sliver.dart';
98
import 'package:dropdown_menu/dropdown_menu.dart';
109
import 'package:dropdown_menu/dropdown_list_menu.dart';
@@ -20,14 +19,6 @@ class MyApp extends StatelessWidget {
2019
return new MaterialApp(
2120
title: 'Flutter Demo',
2221
theme: new ThemeData(
23-
// This is the theme of your application.
24-
//
25-
// Try running your application with "flutter run". You'll see the
26-
// application has a blue toolbar. Then, without quitting the app, try
27-
// changing the primarySwatch below to Colors.green and then invoke
28-
// "hot reload" (press "r" in the console where you ran "flutter run",
29-
// or press Run > Flutter Hot Reload in IntelliJ). Notice that the
30-
// counter didn't reset back to zero; the application is not restarted.
3122
primarySwatch: Colors.blue,
3223
scaffoldBackgroundColor: Colors.white),
3324
home: new MyHomePage(title: 'Flutter Demo Home Page'),
@@ -38,15 +29,6 @@ class MyApp extends StatelessWidget {
3829
class MyHomePage extends StatefulWidget {
3930
MyHomePage({Key key, this.title}) : super(key: key);
4031

41-
// This widget is the home page of your application. It is stateful, meaning
42-
// that it has a State object (defined below) that contains fields that affect
43-
// how it looks.
44-
45-
// This class is the configuration for the state. It holds the values (in this
46-
// case the title) provided by the parent (in this case the App widget) and
47-
// used by the build method of the State. Fields in a Widget subclass are
48-
// always marked "final".
49-
5032
final String title;
5133

5234
@override
@@ -265,7 +247,10 @@ class _MyHomePageState extends State<MyHomePage> {
265247
(BuildContext context, int index) {
266248
return new Container(
267249
color: Colors.black26,
268-
child: new Image.asset("images/header.jpg",fit: BoxFit.fill,),
250+
child: new Image.asset(
251+
"images/header.jpg",
252+
fit: BoxFit.fill,
253+
),
269254
);
270255
}, childCount: 1)),
271256
new SliverPersistentHeader(
@@ -283,7 +268,10 @@ class _MyHomePageState extends State<MyHomePage> {
283268
(BuildContext context, int index) {
284269
return new Container(
285270
color: Theme.of(context).scaffoldBackgroundColor,
286-
child: new Image.asset("images/body.jpg",fit: BoxFit.fill,),
271+
child: new Image.asset(
272+
"images/body.jpg",
273+
fit: BoxFit.fill,
274+
),
287275
);
288276
}, childCount: 10)),
289277
]),
@@ -321,22 +309,20 @@ class _MyHomePageState extends State<MyHomePage> {
321309
appBar: new AppBar(
322310
title: new Text(widget.title),
323311
),
324-
body: _currentIndex == 0 ? buildFixHeaderDropdownMenu() : buildInnerListHeaderDropdownMenu(),
312+
body: _currentIndex == 0
313+
? buildFixHeaderDropdownMenu()
314+
: buildInnerListHeaderDropdownMenu(),
325315
bottomNavigationBar: new BottomNavigationBar(
326-
onTap: (int index){
327-
328-
setState(() {
329-
330-
_currentIndex = index;
331-
332-
});
333-
334-
},
335-
currentIndex: _currentIndex,
316+
onTap: (int index) {
317+
setState(() {
318+
_currentIndex = index;
319+
});
320+
},
321+
currentIndex: _currentIndex,
336322
items: [
337-
{"name": "Fix", "icon": Icons.hearing},
338-
{"name": "ScrollView", "icon": Icons.list}
339-
]
323+
{"name": "Fix", "icon": Icons.hearing},
324+
{"name": "ScrollView", "icon": Icons.list}
325+
]
340326
.map((dynamic data) => new BottomNavigationBarItem(
341327
title: new Text(data["name"]), icon: new Icon(data["icon"])))
342328
.toList()),

0 commit comments

Comments
 (0)