我正在try 创建一个应用程序栏,它在展开时看起来像下图
当折叠时,我只需要文本的初始列在应用程序栏中可用,因此图像应该淡出,文本列应该设置动画并成为应用程序栏标题
我曾try 使用SliverAppBar和自定义滚动视图,但灵活空间的标题看起来不太好,而且我不知道如何使图像单独消失,并在折叠时仅显示文本.
到目前为止,这是扩展状态
当我试图折叠它时,就会发生这种情况
这是相同的代码
CustomScrollView(
slivers: [
SliverAppBar(
pinned: true,
leading: GestureDetector(
onTap: () => Get.back(),
child: const Icon(
Icons.arrow_back,
color: Colors.black,
),
),
flexibleSpace: FlexibleSpaceBar(
title: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
children: [
const Expanded(
child: Text.rich(
TextSpan(
text: "Buffet Deal\n",
style:
TextStyle(color: Colors.black, fontSize: 14),
children: [
TextSpan(
text: "Flash Deal",
style: TextStyle(
color: Colors.black, fontSize: 10),
),
]),
),
),
if (_model.imgUrl != null)
CachedNetworkImage(
imageUrl: _model.imgUrl!,
),
const SizedBox(
width: 18,
)
],
),
),
),
expandedHeight: Get.height * 0.2,
backgroundColor: const Color(0xFFFFF4F4)),
SliverToBoxAdapter(
child: Container()
)
],
),
谢谢你的帮助.提前感谢