- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在研究您可以在下面的屏幕截图中看到的概念:
注意:箭头不是 UI 的一部分,而是添加来演示可拖动功能。
屏幕有一个显示位置标题的 SliverAppBar,包含位置描述的 Sliver 主体,以及一个 DraggableScrollableSheet(或类似的替代项)。向上滚动位置描述时,标题会折叠。当 DraggableScrollableSheet 向上滚动时,它会扩展到屏幕的整个高度。
我试了很多次把它放在一起,但总有一些地方不对劲。我最后一次尝试是在 Scaffold 中添加 DraggableScrollableSheet 作为“bottom sheet:”。因为我有一个 BottomAppBar,它破坏了 UI,看起来像下面这样:
脚手架
@override
Widget build(BuildContext context) {
return Scaffold(
body: body,
extendBody: true,
appBar: appBar,
bottomSheet: hasBottomSheet
? DraggableScrollableSheet(
builder:
(BuildContext context, ScrollController scrollController) {
return Container(
color: Colors.blue[100],
child: ListView.builder(
controller: scrollController,
itemCount: 25,
itemBuilder: (BuildContext context, int index) {
return ListTile(title: Text('Item $index'));
},
),
);
},
)
: null,
backgroundColor: Colors.white,
floatingActionButtonLocation: fab_position,
floatingActionButton: hasActionButton ? ScannerFAB() : null,
bottomNavigationBar: AppBarsNav(hasNavButtons: hasNavButtons));
}
脚手架体
class LocationPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ScaffoldWithNav(
hasBottomSheet: true,
body: CustomScrollView(
slivers: <Widget>[
SliverBar(
title: "Location",
hasBackground: true,
backgroundImagePath: 'assets/testImage.jpg'),
SliverToBoxAdapter(
child: Text("very long text "),
),
SliverPadding(
padding: EdgeInsets.only(bottom: 70),
),
],
),
);
}
}
BottomAppBar FAB
class ScannerFAB extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FloatingActionButton(
child: WebsafeSvg.asset('assets/qr-code.svg',
color: Colors.white, height: 24, width: 24),
);
}
}
FAB跳转,内容隐藏。当我设置一个固定大小的容器时,内容回来了,但 FAB 仍然过着自己的生活:)
如果有人知道如何解决这个问题/那些问题,请分享,我将不胜感激!
最佳答案
您可以尝试在当前主体上添加另一个脚手架,并将 DraggableScrollableSheet 放入其中。这样DraggableScrollableSheet就不会影响外面的FAB了。
@override
Widget build(BuildContext context) {
return Scaffold(
body: Scaffold(
body: body,
bottomSheet: ... // move DraggableScrollableSheet to here
),
...
floatingActionButton: ... // keep FAB here
...
)
关于flutter - 将 DraggableScrollableSheet 添加到 Sliver 页面的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62892929/
我正在尝试使嵌套的 Sliver header 具有粘性。 我无法在“bruh”标题(粘性)下使“今天”标题具有粘性。让它感觉像是一些折叠的标题。 有人可以帮忙吗 class ListExample
我尝试在 Sliver List (CustomScrollview - SliverList) 中制作水平滚动列表 这是我的代码: import 'package:flutter/material.
我在 CustomScrollView 中有一个 Sliver 网格,我想在下拉网格时刷新内容。 我深入研究了小部件,但似乎不容易。看起来它实际上与sliver没有密切关系,而是 ListView 。
因此,我正在基于 this 创建一个基于 sliver 的 AppBar我发现的示例,并且正面临错误 named parameter 'slivers' isn't defined。 我的代码看起来有
我试图将 Sliver AppBar 的标题居中并在其下方添加第二个文本。我做不到。 下面是现在的图像以及它应该如何。 谁能帮帮我? 这是我的代码。 import 'package:flutter/m
我制作了一个 sliverappbar,我想在这个 sliverappbar 上放一张卡片。如何在 sliverappbar 上放一张卡片,然后这张卡片与 sliverappbar 一起折叠? 卡片应
我正在尝试使用 Sliver 来实现可折叠列表标题。当我将小部件从正常更改为 Sliver 时,我经常会遇到如下错误: I/flutter ( 3141): ══╡ EXCEPTION CAUGHT
希望你有美好的一天。我想在下面实现这样的事情 => gif image 1 谁的 gif 不清楚。这是来自名为 Yelp 的应用程序的屏幕截图.它是具有扩展和折叠功能的银色应用栏。当它折叠搜索栏固定到
在下面的代码中我遇到了问题,我正在尝试为 Sliver child 的每个 child 设置自定义高度,我刚刚在 Flutter 上了解了这个小部件,我想修复它,例如: CustomScrollVie
我有一个简单的银色应用栏,我将我的主要颜色设置为: theme: ThemeData(primary Color: Color. fromRGBO(50, 50, 205, 1)), 在我添加 sl
我试图在我的 sliver 应用栏上包含一个圆形个人资料图像按钮,但 sliver 应用栏并没有完全正确地呈现它。这就是我得到的,如何在条形应用栏上获得圆形个人资料图片? 我的代码: @ove
将 SliverAppBar 添加到 DraggableScrollableSheet 后,我无法将工作表向上或向下滚动到屏幕,但 SliverAppbar 内的列表工作正常, 完整源代码: impo
我正在使用 SliverAppBar在 Flutter 中,带有背景小部件。 问题是,当它展开时,标题和图标(引导和操作)应该是白色以便正确看到,当它折叠时,它们应该改为黑色。 关于如何从中获得 bo
@override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView(
我在 GridView 上方使用 2 个 Sliver Headers,在 CustomScrollView 上使用 ListView。当我向下滚动时,我只想固定 1 个标题(我正在滚动的标题)。我希
我将 CustomScrollView 与 Sliver 一起使用。在 header 中,我有一些带有自动完成功能的文本字段(在数据库中搜索数据),当输入文本等于某个值时,我需要做一些事情。我尝试使用
因为我的屏幕上有条状应用栏,所以我没有使用 AppBar() 小部件。所以默认情况下状态栏颜色是白色。 有没有办法将状态栏的颜色从银色更改。 下面的代码按预期适用于 Android,但不适用于 iOS
我想要屏幕顶部的 SliverAppBar 和 ReorderableListView 下方的 SliverFillRemaining。 我尝试了多种解决方案,但每一种都不断出现不同的错误。将 Reo
我正在研究您可以在下面的屏幕截图中看到的概念: design concept 注意:箭头不是 UI 的一部分,而是添加来演示可拖动功能。 屏幕有一个显示位置标题的 SliverAppBar,包含位置描
我正在尝试在 SliverList 中运行 Markdown 小部件(包:flutter_markdown 0.2.0),但我遇到了一些问题。 理想情况下,我想在 Sliver 内的 ExpandTi
我是一名优秀的程序员,十分优秀!