flutter - 如何在 SliverAppBar 和 SliverList 上堆叠 Circle Avatar?
问题描述
我想实现上面的设计
我用条子做了一些这样的事情
import 'package:flutter/material.dart';
class ProfilePage extends StatefulWidget {
@override
_ProfilePageState createState() => _ProfilePageState();
}
class _ProfilePageState extends State<ProfilePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: DefaultTabController(
length: 4,
child: NestedScrollView(
body: TabBarView(children: [
//pages of tabBar
]),
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverAppBar(
//for the pinned appBar
elevation: 0.0,
backgroundColor: Colors.red,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(backgroundColor: Colors.red.withOpacity(0.4),
child: Icon(Icons.arrow_back,color: Colors.white,),
),
),
pinned: true,
flexibleSpace: FlexibleSpaceBar(
background: Image.network(
"https://images.pexels.com/photos/396547/pexels-photo-396547.jpeg?auto=compress&cs=tinysrgb&h=350",
fit: BoxFit.cover,
),
),
expandedHeight: 150,
),
SliverList(delegate: SliverChildListDelegate([
// for bio and other stuff
])),
SliverAppBar(
toolbarHeight: 0.0,
primary: false,
pinned: true,
bottom: TabBar(tabs: [
// tab bars
],),
)
];
},
),
),
),
);
}
}
我尝试在我的 sliver 列表中添加堆栈,但 Circle Avatar 显示在应用栏后面。
我们如何才能实现这样的设计或实现它的替代方法。
解决方案
推荐阅读
- javascript - 用获取的数据反应上下文
- excel - 调用 VBA 函数时在 Excel 中返回 #VALUE
- java - JTree - Java Swing中仅处理树会扩展但不会扩展树选择
- google-ads-api - Google Adwords/Ads AdGroupAdService
- python - Qcombobox中的错误宽度计算
- https - IIS 标头中的内容安全策略
- go - rabbitmq / amqp 直接回复并返回通知
- snowflake-cloud-data-platform - 雪花中每个表的NUMBER_OF_ROWS_RECLUSTERED如何大于表的行数
- vb.net - VB.net 中的裁剪表单
- swift - SwiftUI = UIViewControllerRepresentable 通过@Binding 更新文本