- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我注意到 Scaffold.drawer 的 Drawer 只有在存在 Scaffold 的 AppBar 时才会显示。
但是,我使用了位于 BottomNavigationBar 中的 BottomAppBar,而不是 AppBar。
如何让 Drawer 与 BottomAppBar 一起使用?这是我的代码下面没有出现抽屉
class homieclass extends State<homie>{
@覆盖 小部件构建(BuildContext 上下文){ 返回 Material 应用程序( debugShowCheckedModeBanner:假, 家:新脚手架(
backgroundColor: Colors.white70.withOpacity(0.9),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: FloatingActionButton(onPressed: (){},backgroundColor: Colors.redAccent,child: ImageIcon(new AssetImage("ast/hello123.png")),),
bottomNavigationBar: BottomAppBar(child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,mainAxisSize: MainAxisSize.max,children: <Widget>[
IconButton(icon: Icon(Icons.menu), onPressed: (){}),IconButton(icon: Icon(Icons.message), onPressed: (){}),
],
),
),
body: new Column(
children: <Widget>[new SizedBox(height: 50.0, ),
Container(margin: EdgeInsets.only(left: 0.0),child: new Text("Events",textAlign: TextAlign.left,style: TextStyle(fontFamily: 'ssfr',fontSize: 35.0,fontWeight: FontWeight.bold),),)
, Container(margin: EdgeInsets.only(left: 10.0,right: 10.0) ,width: 360.0,height: 40.0,decoration: new BoxDecoration(color: Colors.blueGrey.withOpacity(0.2),
border: new Border.all(color: Colors.blueGrey.withOpacity(0.0), width: 2.0),
borderRadius: new BorderRadius.circular(10.0),),child: new Row(children: <Widget>[SizedBox(width: 10.0,),Icon(Icons.search,color: Colors.blueGrey.withOpacity(0.9),),Text(" Search",style: TextStyle(fontFamily: 'ssft',color: Colors.blueGrey,fontSize: 20.0),)],),)
,new SizedBox(height: 10.0,),new SizedBox(
height: 5.0,
child: new Center(
child: new Container(
margin: new EdgeInsetsDirectional.only(start: 1.0, end: 1.0),
height: 2.0
,
color: Colors.redAccent.withOpacity(0.8),
),
),
),],
),drawer: new Drawer(
child: new ListView(
children: <Widget>[ListTile(title: Text("hello"),)],
),
),
),
);
}
最佳答案
它非常适合我。这是一个工作示例,底部栏中有一个专用的“显示抽屉”按钮(抽屉也可以从左侧拖入):
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Playground',
home: TestPage(),
);
}
}
class TestPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text('Body'),
),
bottomNavigationBar: Builder(builder: (BuildContext context) {
return BottomAppBar(
color: Colors.orange,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
IconButton(icon: Icon(Icons.menu), onPressed: () {
Scaffold.of(context).openDrawer();;
}),
IconButton(icon: Icon(Icons.message), onPressed: () {}),
],
),
);
},),
drawer: Drawer(
child: SafeArea(
right: false,
child: Center(
child: Text('Drawer content'),
),
),
),
);
}
}
Flutter 版本:最新的主版本(虽然我也很确定它适用于 beta 版本)
关于dart - 如何在没有 Scaffold.drawer 的情况下使用 Drawer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51891799/
如您所见,我的按钮位于 Scaffold 内的 body 。但我得到了这个异常(exception): 使用不包含 Scaffold 的上下文调用 Scaffold.of()。 import 'pac
我看到有一些方法可以在 Entity Framework Core 2.0 中构建实体和数据库上下文。 使用 Scaffold-DbContext 使用 dotnet ef dbcontext 脚手架
Spring Roo:[ Controller 脚手架 --class] 和 [web mvc 脚手架 --class] 之间的区别 现在我们想要为 session 应用程序搭建一个网络层。这是使用
我对 MVC3 的各种不同的“主流”脚手架选项有点困惑。有一个名为 MVCScaffolding 的 NuGet 包.它于 2011 年 1 月首次出现,但似乎很活跃并且最近有更新,由 Scott H
我不明白为什么在 flutter 中不可能有这样的结构: //... Scaffold( //... body: myPage(dataList[index]) ) //... 其中 myPa
我喜欢脚手架,它对原型(prototype)设计非常有帮助。但是我们应该使用脚手架来开发应用程序吗? 最佳答案 “脚手架”这个名字现在在 Rails 中有点用词不当(2.0 后)。通过脚手架生成器生成
我的类(class)没有在AppBar中显示后退按钮, 已经尝试将this.automaticallyImplyLeading = true, import 'package:carros/pages
为什么点击我的iconButton我的 snackBar用 Scaffold.of() 向我抛出异常? Scaffold.of() called with a context that does no
我正在处理一个新的小原型(prototype)项目,并尝试使用脚手架功能加载数据。我完成了保存过程,它说它已经保存在 UI 上,但后来我重新访问,对象列表仍然为 0。我添加了 loggingSql:
由于返回脚手架,我的代码一直给我错误。这是我的脚手架代码: class _DashboardState extends State { @override Widget build(Bui
我想使用 Yeoman 搭建我正在进行的几个不同的项目。然而,现在,我想从一些简单的事情开始,比如拥有一个创建以下文件夹结构的生成器: /build/ /src/ /spec/ /spec/test/
The docs对于 NPM 包 grunt-scaffold 缺乏关于其 after() 属性/函数的任何信息。我有一个 grunt 文件,它为新脚本创建一个新目录,并且将样板文件从指定的模板文
我想创建一个与脚手架主体颜色相同的 AppBar,但是我无法弄清楚主体的颜色。我检查了 Scaffold 的源代码,但是他们那里也没有颜色代码。 有什么办法可以查出来吗?谢谢 最佳答案 Scaffol
我发布这个问题是因为很难找到我需要的回复,但我想它一定已经在某个地方得到了回复。如果确实在其他地方被询问和回复,请指出正确的方向 请参见下图,取自 kitkat 设备。脚手架的背景是红色的,主体是绿色
有没有办法让 Scaffold.bottomSheet 部分透明(比如显示其背后正文内容的缺口)?我注意到即使只添加 Text 也会隐式地在其下方放置一个白色背景(Material?),我认为这是不可
根据MS Docs , Scaffold-DbContext 应该接受一个可选参数 -Namespace。但是,似乎 Scaffold-DbContext 无法识别此参数。我错过了什么吗? 命令错误:
我在脚手架中有一个应用栏。 return Scaffold( appBar: styling.appBar( AppBar( leading: styling.icon
我正在尝试使用 Rails 4 搭建一个应用程序,但我在前键、表单和实体名称方面遇到了这个小问题。以下是一些细节: rails g scaffold user_type name:string rai
我正在尝试生成一个布局,我可以在 my rails webapp 之间使用它和移动版本。我一直在用nifty-generator ,但它说生成的文件与 rails3 新应用程序创建生成的文件相同。 d
我是 Ruby on Rails 的新手,我正在尝试创建一个低音吉他导师,以便自学 RoR(和低音吉他)。演练使用 Scaffold 创建 ActiveRecord 类,但它们似乎对应于独立表;没有用
我是一名优秀的程序员,十分优秀!