flutter - 如何在颤动中制作不可滚动的标题和可滚动的正文?
问题描述
我正在尝试构建一个没有可滚动标题和可滚动正文的项目。SliverAppbar 是首选,但如果我移动身体而不是失去标题。我也可以使用 Slidabele Tile。SliverPersistentHeader 是我的第二选择,但我可以使用 Slidabele Tile。我的问题如下图所示。main.dart Header 不能滚动,body 必须包含硬编码的 Slidable Tile。如何在颤动中制作不可滚动的标题和可滚动的正文?
解决方案
你应该appBar: AppBar(...
在你的内部使用脚手架。所以 MaterialApp->Scaffold->(AppBar 和 listview)。
示例代码:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("This is the title"),
),
body: ListView(
children: <Widget>[
Text("This is text 1"),
Text("This is text 2"),
Text("This is text 3"),
Text("This is text 4"),
Text("This is text 5"),
Text("This is text 6"),
Text("This is text 7"),
Text("This is text 8"),
Text("This is text 9"),
Text("This is text 10"),
Text("This is text 11"),
Text("This is text 12"),
Text("This is text 13"),
Text("This is text 14"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
Text("This is text 15"),
],
),
),
);
}
}
推荐阅读
- python - python模板和f字符串中的字符串
- javascript - how to add and remove input textbox in asp.net master page
- google-cloud-platform - Google Cloud Functions 的 CDN - 使用 openapi-functions.yaml 配置端点
- java - 如何在 JFileChooser 中拥有可编辑的地址栏(Windows 风格)
- omnet++ - 如何让每个节点在 INET (OMNeT++) 中分配自己的 IPv6 地址?
- flask - 如何在 jinja2 表单提交中集成 HTML 数据标签?
- reactjs - 无法创建第一个反应应用程序,events.js:200 抛出反应
- visual-studio-code - 如何在文件中查找选择?
- java - java - 如何在java中将我的swing组件分离到不同的类?
- reactjs - 用于在 Android chrome 浏览器上将语音转换为文本的 Web 语音 API