import 'package:flutter/material.dart';
//import 'package:flutter/semantics.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MiniTestIII',
home: Scaffold(
appBar: AppBar(
title: (Center(
child: new Text("Add or Remove"),
))),
body: Text(""),
// leading: IconButton(ico)
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
//leading: new Icon(Icons.photo),
title: new Text('Add'),
onTap: () //=>_selecitem('Add'),
{
// SetSelected('Add');
Navigator.pop(context);
},
),
ListTile(
// leading: new Icon(Icons.photo),
title: new Text('Remove'),
onTap: () {
// setContinent(selected)
Navigator.pop(context);
},
),
],
);
});
},
// tooltip: 'Increment',
//tooltip: 'Increment',
),
),
theme: ThemeData(primarySwatch: Colors.green),
);
}
}
ช่วยดูโค้ดให้หน่อยคับ คือ พอกดที่ปุ่มแล้วมันไม่ขึ้นรายการ bottonsheet
//import 'package:flutter/semantics.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MiniTestIII',
home: Scaffold(
appBar: AppBar(
title: (Center(
child: new Text("Add or Remove"),
))),
body: Text(""),
// leading: IconButton(ico)
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
//leading: new Icon(Icons.photo),
title: new Text('Add'),
onTap: () //=>_selecitem('Add'),
{
// SetSelected('Add');
Navigator.pop(context);
},
),
ListTile(
// leading: new Icon(Icons.photo),
title: new Text('Remove'),
onTap: () {
// setContinent(selected)
Navigator.pop(context);
},
),
],
);
});
},
// tooltip: 'Increment',
//tooltip: 'Increment',
),
),
theme: ThemeData(primarySwatch: Colors.green),
);
}
}