Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 将抽屉放在AppBar底部的正确方法_Flutter_Dart - Fatal编程技术网

Flutter 将抽屉放在AppBar底部的正确方法

Flutter 将抽屉放在AppBar底部的正确方法,flutter,dart,Flutter,Dart,我就是这么做的 Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Image.asset( 'assets/images/logo.png', height: 20.0, ), leading: InkWell( onTap: () { //d

我就是这么做的

Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Image.asset(
          'assets/images/logo.png',
          height: 20.0,
        ),
        leading: InkWell(
          onTap: () {
            //do something here
          },
          child: Icon(
            Icons.menu,
          ),
        ),
        backgroundColor: Colors.red,
      ),
      body: SafeArea(
        child: RefreshIndicator(
            child: Column(
                       ...
        ),
      drawer: Padding(
        padding: const EdgeInsets.only(top:89), // I've added this so that I can test it
        child: Drawer(
          child: ListView(
            padding: EdgeInsets.zero,
            children: <Widget>[
              ListTile(
                title: Text('Item 1'),
                onTap: () {
                },
              ),
              ListTile(
                title: Text('Item 2'),
                onTap: () {
                },
              ),
       ...
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(
标题:Image.asset(
“assets/images/logo.png”,
身高:20.0,
),
引导:InkWell(
onTap:(){
//在这里做点什么
},
子:图标(
图标菜单,
),
),
背景颜色:Colors.red,
),
正文:安全区(
子:刷新指示器(
子:列(
...
),
抽屉:衬垫(
padding:const-EdgeInsets.only(top:89),//我添加了这个,以便测试它
孩子:抽屉(
子:ListView(
填充:EdgeInsets.zero,
儿童:[
列表砖(
标题:文本(“项目1”),
onTap:(){
},
),
列表砖(
标题:文本(“项目2”),
onTap:(){
},
),
...
我添加了一个padding
padding:const-EdgeInsets。仅(顶部:89)
,但当抽屉打开时,appbar仍然具有透明的外观

解决这个问题的最佳方法是什么?我需要把抽屉放在其他地方吗?还是这是一个简单的解决方法?

@override
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(),
抽屉:安全区(
孩子:抽屉(
子项:列(子项:[
UserAccountsDrawerHeader(
边距:仅限边缘组(底部:3.0),
onDetailsPressed:(){},
currentAccountPicture:CircleAvatar(
半径:30,
子:图标(Icons.person,大小:60,),
),
accountName:文本(“名称”),
accountEmail:Text(“电子邮件Id”),
),
列表砖(
领先:图标(图标。主页,大小:20,),
标题:文本(“主页”),
尾随:图标(图标。箭头\前进\ ios),
onTap:(){},
),
])
)
),
主体:容器(),
);
}

为了查看没有透明外观的
AppBar
,您需要将
抽屉CrimColor
设置为
颜色。在
支架内的
是透明的。如下所示:

小部件构建(构建上下文){
返回脚手架(
…//其他行
drawerScrimColor:Colors.transparent,//在此处将颜色设置为透明
抽屉:衬垫(
…//其他行

您可以添加一个您现在得到的屏幕截图吗?