flutter - Flutter - 使用固定小部件滚动
问题描述
我想做一个将地图部分固定在顶部的滚动,一旦我向上滚动这些小部件就可以覆盖在地图的顶部。
我试图做滚动效果。我使用带有一个容器(地图)和一个 SingleChildScroll 的堆栈。但是在我将 SingleChildScroll 放在地图顶部后,地图无法点击。
那么有什么方法可以解决这个问题吗?有什么建议我可以做这个设计吗?非常感谢!
这是代码
return Scaffold(
key: _scaffoldKey,
backgroundColor: ThemeColors.orangeYellow,
floatingActionButton: Padding(
padding: EdgeInsets.only(right: 30),
child: Row(
children: [
_profileButton,
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.startTop,
body: Stack(
children: [
Positioned(
top: 0,
child: Stack(
alignment: Alignment.bottomCenter,
overflow: Overflow.visible,
children: <Widget>[
Container(),
_map,
_nearbyRestaurantBox,
_getCurrentLocationButton,
],
),
),
SingleChildScrollView(
physics: ClampingScrollPhysics(),
child: Column(
children: <Widget>[
Column(
// alignment: Alignment.bottomCenter,
// overflow: Overflow.visible,
children: <Widget>[
// Container(),
// _map,
Padding(
padding: EdgeInsets.only(top: _mapHeight - 70),
),
Stack(
children: [
Column(
children: [
SizedBox(
height: 70,
// child: Container(
// // color: Colors.green,
// ),
),
SizedBox(
height: 70,
child: Container(
color: Colors.amber,
),
)
],
),
// Padding(
// padding: EdgeInsets.only(top: 35),
// ),
Container(
alignment: Alignment.center,
child: Padding(
padding: EdgeInsets.only(top: 5),
child: _searchBox,
),
)
],
),
// Positioned(top: 0, child: _map),
// _searchBox,
// _nearbyRestaurantBox,
// _getCurrentLocationButton,
],
),
Container(
color: ThemeColors.orangeYellow,
child: Center(
child: Column(
children: <Widget>[
_categoryBox,
..._buildBanners(),
],
),
),
),
],
),
)
],
),
);
解决方案
推荐阅读
- javascript - 如何使节点模块依赖于安装在目标项目中的另一个模块
- python - 如何将节点名称分配给矩阵 Networkx?
- python - 从多个链接抓取文本数据并将抓取的数据存储在 csv 文件中
- oracle - Oracle:删除表后表始终“存在”
- circuit-sdk - webhook 回调 url 必须是 https 吗?
- php - 如何在显示下一个调查之前强制进行 PHP 调查
- android - 通过_ID从android中的日历获取特定事件
- java - Sonar-scanner 给出了一个名为“请为您的项目提供带有 sonar.java.binaries 属性的编译类”的错误
- android - 如何在 buildgradle.kts 中设置 ViewBinding?
- .net-core - HttpClient,似乎很难正确使用