【发布时间】:2019-10-19 19:25:00
【问题描述】:
我想创建一个可扩展的容器,其中包含多个控件,例如文本输入和按钮。
所以我已经实现了一个底部工作表,但我想将此位置设置在顶部。
代码:
Widget build(BuildContext context) {
return Container(
child: Center(
child: RaisedButton(
child: Text('Show Buttom Sheet'),
onPressed: () {
showModalBottomSheet(context: context, builder: (context){
return StreamBuilder(
stream: controller.stream,
builder:(context,snapshot) => GestureDetector(
onVerticalDragUpdate: (DragUpdateDetails details)
{
position = MediaQuery.of(context).size.height-
details.globalPosition.dy;
print('position dy = ${position}');
position.isNegative?Navigator.pop(context)
:controller.add(position);
},
behavior: HitTestBehavior.translucent,
child:
Container(
color: Colors.red,
height: snapshot.hasData ? snapshot.data:200.0,
width: double.infinity,
child: Text('Child'),
)),
);
});
}),
),
);
}
【问题讨论】:
标签: flutter flutter-layout flutter-animation