Flutter 底部图纸未显示在底部
我想在单击页面上的浮动按钮时显示底部的工作表。页面还包括底部导航栏。单击浮动按钮时,底部工作表显示在导航栏上方,而不是页面底部。我怎样才能做到这一点 代码:Flutter 底部图纸未显示在底部,flutter,dart,flutter-layout,flutter-bottomnavigation,actionsheet,Flutter,Dart,Flutter Layout,Flutter Bottomnavigation,Actionsheet,我想在单击页面上的浮动按钮时显示底部的工作表。页面还包括底部导航栏。单击浮动按钮时,底部工作表显示在导航栏上方,而不是页面底部。我怎样才能做到这一点 代码: void main(){ runApp(App()); } 类应用程序扩展了无状态小部件{ //此小部件是应用程序的根。 @凌驾 小部件构建(构建上下文){ 返回材料PP( debugShowCheckedModeBanner:false, 标题:“应用程序”, 主题:主题数据( 主样本:颜色。蓝色, 视觉密度:视觉密度。自适应平台密度,
void main(){
runApp(App());
}
类应用程序扩展了无状态小部件{
//此小部件是应用程序的根。
@凌驾
小部件构建(构建上下文){
返回材料PP(
debugShowCheckedModeBanner:false,
标题:“应用程序”,
主题:主题数据(
主样本:颜色。蓝色,
视觉密度:视觉密度。自适应平台密度,
),
主页:AppNavigation(),
);
}
}
类AppNavigation扩展了StatefulWidget{
@凌驾
_AppNavigationState createState()=>\u AppNavigationState();
}
类_AppNavigationState扩展状态我相信您试图实现的目标是通过使用如下“showModalBottomSheet”实现的:
return Scaffold(
resizeToAvoidBottomInset: false,
floatingActionButton: FloatingActionButton(
onPressed: () {
// what you asked for
showModalBottomSheet(
barrierColor: Colors.white.withOpacity(0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(25),
),
),
context: context,
builder: (context) => Container(
height: 320,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 20,
offset: Offset(0, 3),
),
],
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25),
topRight: Radius.circular(25),
),
),
padding:
EdgeInsets.symmetric(horizontal: 20, vertical: 30),
child: Center(child: Text('Bottom action sheet')),
));
},
child: Icon(Icons.add),
backgroundColor: Colors.deepPurple),
body: Center(child: Text("home page")));
编辑:我修改了代码,使其具有与您发布的图片中相同的阴影效果
return Scaffold(
resizeToAvoidBottomInset: false,
floatingActionButton: FloatingActionButton(
onPressed: () {
// what you asked for
showModalBottomSheet(
barrierColor: Colors.white.withOpacity(0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(25),
),
),
context: context,
builder: (context) => Container(
height: 320,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 20,
offset: Offset(0, 3),
),
],
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25),
topRight: Radius.circular(25),
),
),
padding:
EdgeInsets.symmetric(horizontal: 20, vertical: 30),
child: Center(child: Text('Bottom action sheet')),
));
},
child: Icon(Icons.add),
backgroundColor: Colors.deepPurple),
body: Center(child: Text("home page")));