gpt4 book ai didi

flutter - 如何在SliverAppBar下 flutter 地创建一条线?

转载 作者:行者123 更新时间:2023-12-03 02:52:06 28 4
gpt4 key购买 nike

我想在应用栏下方添加一条线,如图2所示。
如何使这条线 flutter ?
图像一是现在的应用程序,图像二是sliverAppBar下的线
*已经尝试使用容器和分隔线

class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
backgroundColor: Colors.white,
elevation: 0,
leading: IconButton(
icon: SvgPicture.asset(
'assets/icons/home_icon.svg',
color: Colors.black,
),
onPressed: () {}
),
actions: [
IconButton(
icon: SvgPicture.asset(
'assets/icons/search_icon.svg',
color: Colors.black,
),
onPressed: () {
}
),
IconButton(
icon: SvgPicture.asset(
'assets/icons/shopping_bag_icon.svg',
color: Colors.black,
),
onPressed: () {},
),
IconButton(
icon: SvgPicture.asset(
'assets/icons/profile_icon.svg',
color: Colors.black,
),
onPressed: () {}
),
],
floating: true,
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => ListTile(title: Text('Item #$index')),
childCount: 1000,
),
),
],
),
);
}
}
App now
app how I want it to be
堆栈的更多文本有效我的问题

最佳答案

SliverAppBar小部件中有一个“底部”属性,该属性采用首选大小的小部件,您可以为其指定以下内容:

bottom: PreferredSize(
preferredSize: Size(double.infinity, 5),
child: Divider(color: Colors.black),
),

关于flutter - 如何在SliverAppBar下 flutter 地创建一条线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64188548/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com