模態(tài)底部面板是菜單或?qū)υ捒虻奶娲桨?,可防止用戶與其他控件進(jìn)行互動(dòng),可以使用showModalBottomSheet函數(shù)創(chuàng)建和顯示模態(tài)底部面板。
import 'package:flutter/material.dart'; class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('底部面板') ), body: new Center( child: new RaisedButton( child: new Text('顯示底部面板'), onPressed: () { // showModalBottomSheet:顯示模態(tài)質(zhì)感設(shè)計(jì)底部面板 showModalBottomSheet (context:context, builder:(BuildContext context) { return new Container( child: new Padding( padding: const EdgeInsets.all(32.0), child: new Text( '這是模態(tài)底部面板,點(diǎn)擊任意位置即可關(guān)閉', textAlign: TextAlign.center, style: new TextStyle( color: Theme.of(context).accentColor, fontSize: 24.0 ) ) ) ); }); } ) ) ); } } void main() { runApp(new MaterialApp( title: 'Flutter Demo', home: new MyApp() )); }