flutter - SingleChildScrollView 的问题 - Flutter
问题描述
我试图让一个容器固定,而屏幕的另一部分可以进行一些滚动,是否有可能复制不是屏幕,只有这两个事件?
return SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Container(
child: Column(
children: <Widget>[
Container(
height: 200,
width: double.infinity,
color: Colors.red,
),
SingleChildScrollView(
child: Container(color: Colors.blue,height: 1000,width: double.infinity,))
/* body(context, screenWidth, screenHeight),
bottmtop(context), */
],
),
),
);
解决方案
你可以使用这个例子。如果您想要用户列表而不是使用 SliverList 代替 SliverFillRemaining;
class HeadState extends State<Head> {
@override
Widget build(BuildContext context) {
var screenHeight = MediaQuery.of(context).size.height;
var screenWidth = MediaQuery.of(context).size.width;
return Scaffold(
bottomNavigationBar: BottomNavigationBar(items: []),
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
expandedHeight: screenHeight / 4,
flexibleSpace: Container(
color: Colors.red,
),
),
SliverFillRemaining(
child: Container(
height: screenHeight - screenHeight / 4,
color: Colors.blue,
),
)
],
),
);
}
}
推荐阅读
- php - 如何通过多页使用php将pdf文件插入数据库?
- php - 定期检查从 Laravel 中的 3rd 方应用程序发布的数据
- shader - 为什么 Unreal 材质中的饱和在现代图形硬件中被认为是免费的
- json - 使用 reactjs 和 redux 在多个组件中获取 JSON 数据
- python - cx_Freeze:pytesseract 的可执行文件在其他 PC 上失败
- vue.js - 如何使用 axiosjs 从这样的数组中获取数据
- c# - 在调试 ASP.Net Core 2.1 时自动登录
- tsql - TSQL 一个字符序列必须跟在另一个字符序列之后
- c# - 我如何在 SignalR 中执行基于令牌的身份验证?
- php - 在 Laravel 中插入空字符串或空图像