Flutter 颤振:边界半径不';不要在showGeneralDialog下工作
为什么Flutter 颤振:边界半径不';不要在showGeneralDialog下工作,flutter,border,showdialog,Flutter,Border,Showdialog,为什么showGeneralDialog下的BorderRadius不起作用这是我的代码-- import 'package:flutter/material.dart'; class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createStat
showGeneralDialog
下的BorderRadius
不起作用这是我的代码--
import 'package:flutter/material.dart';
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text(widget.title),
actions: <Widget>[
IconButton(
icon: Icon(Icons.arrow_downward),
splashColor: Colors.red,
onPressed: _showDrawer)
],
),
body: Container(
color: Colors.white,
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: Center(child: Text("This Is Body"))),
),
);
}
_showDrawer() {
return showGeneralDialog(
context: context,
barrierDismissible: true,
transitionDuration: Duration(milliseconds: 600),
barrierLabel: MaterialLocalizations.of(context).dialogLabel,
barrierColor: Colors.black.withOpacity(0.5),
pageBuilder: (context, _, __) {
return SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
padding: EdgeInsets.all(0),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft:
Radius.circular(50.0), //This Border Radius doesn't Work
),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 3.0,
spreadRadius: 3.0),
],
),
child: Material(
child: ListView(
children: <Widget>[
Align(
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(Icons.close),
splashColor: Colors.red,
onPressed: () {
Navigator.pop(context, false);
}),
),
Align(
alignment: Alignment.topCenter,
child: ClipOval(
child: Image.asset(
"assets/images/avator.jpg",
width: MediaQuery.of(context).size.height / 10,
height: MediaQuery.of(context).size.height / 10,
fit: BoxFit.cover,
)),
),
Align(
alignment: Alignment.topCenter,
child: Text(
"Abir Ahsan",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
Align(
alignment: Alignment.topCenter,
child: Text(
"abirahsan122@gmail.com",
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
),
Padding(
padding: EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Menu",
style: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.bold),
),
Text(
"Offers",
style: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.bold),
),
Text(
"My Cart",
style: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.bold),
),
Text(
"Last Orders",
style: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.bold),
),
Text(
"Favourite",
style: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.bold),
),
Text(
"My Settings",
style: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.bold),
)
],
),
)
],
),
),
),
],
),
);
},
transitionBuilder: (context, animation, secondaryAnimation, child) {
return SlideTransition(
position: CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
).drive(Tween<Offset>(
begin: Offset(0, -1.0),
end: Offset.zero,
)),
child: child,
);
},
);
}
}
导入“包装:颤振/材料.省道”;
类MyHomePage扩展StatefulWidget{
MyHomePage({Key,this.title}):超级(Key:Key);
最后的字符串标题;
@凌驾
_MyHomePageState createState()=>\u MyHomePageState();
}
类_MyHomePageState扩展状态{
@凌驾
小部件构建(构建上下文){
返回安全区(
孩子:脚手架(
appBar:appBar(
标题:文本(widget.title),
行动:[
图标按钮(
图标:图标(图标。向下箭头),
颜色:颜色。红色,
按下按钮:_showDrawer)
],
),
主体:容器(
颜色:颜色,白色,
高度:MediaQuery.of(context).size.height,
宽度:MediaQuery.of(context).size.width,
子对象:中心(子对象:文本(“这是主体”)),
),
);
}
_展示抽屉(){
返回显示一般对话框(
上下文:上下文,
是的,
转换持续时间:持续时间(毫秒:600),
barrierLabel:MaterialLocalizations.of(context).dialogLabel,
背景色:颜色。黑色。不透明度(0.5),
pageBuilder:(上下文,u,u){
返回安全区(
子:列(
mainAxisAlignment:mainAxisAlignment.start,
儿童:[
容器(
宽度:MediaQuery.of(context).size.width,
高度:MediaQuery.of(context).size.height/2.5,
填充:边缘集。全部(0),
装饰:盒子装饰(
borderRadius:仅限borderRadius(
左下角:
Radius.circular(50.0),//此边界半径无效
),
boxShadow:[
箱形阴影(
颜色:颜色。黑色,
半径:3.0,
扩展半径:3.0),
],
),
儿童:材料(
子:ListView(
儿童:[
对齐(
对齐:alignment.topRight,
孩子:我的钮扣(
图标:图标(Icons.close),
颜色:颜色。红色,
已按下:(){
pop(上下文,false);
}),
),
对齐(
对齐:alignment.topCenter,
孩子:斜坡(
子:Image.asset(
“assets/images/avator.jpg”,
宽度:MediaQuery.of(context).size.height/10,
高度:MediaQuery.of(context).size.height/10,
适合:BoxFit.cover,
)),
),
对齐(
对齐:alignment.topCenter,
子:文本(
“阿比尔·阿桑”,
样式:TextStyle(
颜色:颜色,黑色,
fontWeight:fontWeight.bold,
尺寸:20),,
),
),
对齐(
对齐:alignment.topCenter,
子:文本(
"abirahsan122@gmail.com",
样式:TextStyle(
fontStyle:fontStyle.italic,
),
),
),
填充物(
填充:所有边缘设置(20.0),
子:列(
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
正文(
“菜单”,
样式:TextStyle(
fontSize:15.0,fontWeight:fontWeight.bold),
),
正文(
“提议”,
样式:TextStyle(
fontSize:15.0,fontWeight:fontWeight.bold),
),
正文(
“我的车”,
样式:TextStyle(
fontSize:15.0,fontWeight:fontWeight.bold),
),
正文(
“最后订单”,
样式:TextStyle(
fontSize:15.0,fontWeight:fontWeight.bold),
),
正文(
“最爱”,
样式:TextStyle(
fontSize:15.0,fontWeight:fontWeight.bold),
),
正文(
“我的设置”,
样式:TextStyle(
fontSize:15.0,fontWeight:fontWeight.bold),
)
],
),
)
],
),
),
),
],
),
);
},
transitionBuilder:(上下文、动画、第二动画、子动画){
返回幻灯片转换(
位置:曲线动画(
家长:动画,
曲线:Curves.easeOut,
).驾驶(吐温)(
BoxDecoration(
color: Colors.green, //For example this color
borderRadius: BorderRadius.only(
bottomLeft:
Radius.circular(50.0), //This Border Radius doesn't Work
),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 3.0,
spreadRadius: 3.0
),
],
),
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
padding: EdgeInsets.zero,
child: Material(
elevation: 8,
shadowColor: Colors.black12,
borderRadius: BorderRadius.only(
bottomLeft:
Radius.circular(50.0), //Use the border raidus property of the Material
),
child: ... //The ListView and everything else
)
)
Material(
type: MaterialType.transparency, //Transparent so you don't see a color below other than the one of the container
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
padding: EdgeInsets.zero,
decoration: BoxDecoration(
color: Colors.green, //This color now applies correctly
borderRadius: BorderRadius.only(
bottomLeft:
Radius.circular(50.0),
),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 3.0,
spreadRadius: 3.0),
],
),
child: ... //The ListView and everything else
),
)