【发布时间】:2019-04-22 02:30:51
【问题描述】:
【问题讨论】:
-
你有解决办法吗
标签: android ios flutter flutter-animation
【问题讨论】:
标签: android ios flutter flutter-animation
将DraggableBottomSheet 小部件与Stack 小部件一起使用:
这是此^ GIF 中整个页面的gist,或尝试Codepen。
整个页面的结构如下:
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
CustomGoogleMap(),
CustomHeader(),
DraggableScrollableSheet(
initialChildSize: 0.30,
minChildSize: 0.15,
builder: (BuildContext context, ScrollController scrollController) {
return SingleChildScrollView(
controller: scrollController,
child: CustomScrollViewContent(),
);
},
),
],
),
);
}
在Stack:
- 谷歌地图是最低层。
- 标题(搜索字段 + 水平滚动条)位于地图上方。
- DraggableBottomSheet 位于标题上方。
draggable_scrollable_sheet.dart中定义的一些有用参数:
/// The initial fractional value of the parent container's height to use when
/// displaying the widget.
///
/// The default value is `0.5`.
final double initialChildSize;
/// The minimum fractional value of the parent container's height to use when
/// displaying the widget.
///
/// The default value is `0.25`.
final double minChildSize;
/// The maximum fractional value of the parent container's height to use when
/// displaying the widget.
///
/// The default value is `1.0`.
final double maxChildSize;
【讨论】:
模式和持久的底页都不能拖到视图中。持久性底页必须被触发打开(例如,通过按下按钮)然后它可以被上下拖动直到最终消失。我希望有一个选项可以将其拖到视图中...
Rubber 应该满足你的需求;我试了一下,但当我调用 setstate 时它总是吓坏了(所以不适合我)......如果你有同样的问题,请告诉我。
【讨论】: