[英]Flutter: How to enlarge an Image when scrolling to the top of a page in an app?
我有一個頁面,頂部有一個圖像,下面有一些其他小部件。 整個頁面是可滾動的。 有誰知道如何在滾動到頂部時放大圖像以創建類似於 Apple Music 中的效果?
在這里,您可以找到我正在嘗試創建的示例:
嘗試使用 Sliver
final bannerHigh = 150.0;
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
backgroundColor: Color(0xFF0084C9),
leading: IconButton(
icon: Icon(
Icons.blur_on,
color: Colors.white70,
),
onPressed: () {
Scaffold.of(context).openDrawer();
},
),
expandedHeight: bannerHigh,
floating: true,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
title: Text("Your title",
style: TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.w600)),
background: Image.network(
'image url',
fit: BoxFit.cover,
),
),
),
SliverList(
delegate: SliverChildListDelegate(
<Widget>[
],
),
),
],
),
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.