Flutter 如何在颤振中增加抽屉阻力区宽度?
我的颤振应用程序中有一个抽屉,但是默认的抽屉有一个非常小的拖动区域来显示它。我怎样才能增加呢Flutter 如何在颤振中增加抽屉阻力区宽度?,flutter,navigation-drawer,Flutter,Navigation Drawer,我的颤振应用程序中有一个抽屉,但是默认的抽屉有一个非常小的拖动区域来显示它。我怎样才能增加呢 @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Scaffold( drawerDragStartBehavior: DragStartBehavior.down, drawer: Drawer(
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Scaffold(
drawerDragStartBehavior: DragStartBehavior.down,
drawer: Drawer(
child: Column(
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text(
fullName ?? "",
style: TextStyle(
color: Colors.white,
letterSpacing: 1.0,
fontSize: 16.0,
),
),
您只需使用Scaffold的drawerEdgeDragWidth属性即可:
但这里你要设置抽屉的宽度。我需要改变拖动区域的宽度来显示抽屉。你能告诉我你到底想要什么吗?把抽屉的拖动宽度调大一点。我想打开抽屉,从左到右在屏幕上的中间,但不只是在左拐角。
drawer: SizedBox(
width: MediaQuery.of(context).size.width/1.2,
child: Drawer(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(
height: 10,
),
ListTile(
dense: true,
title: Text(
"Apply for Leave",
style: drawerFont,
),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ApplyLeave()));
},
),
ListTile(
dense: true,
title: Text(
"Approval for Bills",
style: drawerFont,
),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ApplyBill()));
},
)
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
color: Colors.grey[200],
width: double.infinity,
height: 60,
child: Padding(
padding: const EdgeInsets.only(
left: 28.0, top: 15, bottom: 15),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ContactUs()));
},
child: Text(
"Contact Us",
style: drawerFont,
),
),
),
),
],
)
],
),
),
),
return Scaffold(
appBar: MyAppBar(),
drawer: MyDrawer(),
// Put the width you want here
// In this case the drag area fills the whole screen
drawerEdgeDragWidth: MediaQuery.of(context).size.width,
body: MyBody(),
);