drawer static method
Drawer
drawer(
- BuildContext context, {
- DrawerDelegate delegate = const DrawerChildListDelegate(children: []),
- Color? backgroundColor,
- double? width,
- double? elevation,
- ShapeBorder? shape,
标准Drawer创建
- 包含头部信息。
- 包含菜单项(关于,帮助)。
- 包含版本标注(Footer)。
- 包含背景(Coming soon)
Implementation
static Drawer drawer(
BuildContext context, {
DrawerDelegate delegate = const DrawerChildListDelegate(children: []),
Color? backgroundColor,
double? width,
double? elevation,
ShapeBorder? shape,
}) {
Widget _builderHeader() {
return delegate.buildHeader() ?? Container();
}
List<Widget> _buildList(BuildContext context) {
return delegate.buildList(context);
}
Widget _buildFooter() {
return delegate.buildFooter() ?? Container();
}
return Drawer(
backgroundColor: backgroundColor,
elevation: elevation,
width: width,
shape: shape,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// header
_builderHeader(),
// list buttons
Expanded(
child: ListView(
children: _buildList(context),
),
),
// footer
_buildFooter(),
],
),
);
}