我是新手,我試圖實作選單,如本例
SliverAppBar( // <-- app bar for custom sticky menu
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
elevation: 0.0,
expandedHeight: 600,
// <-- doesn't work for minimum height setup
flexibleSpace: ScrollableListTabView(
tabHeight: 50,
bodyAnimationDuration: const Duration(milliseconds: 150),
tabAnimationCurve: Curves.easeOut,
tabAnimationDuration: const Duration(milliseconds: 200),
tabs: [
ScrollableListTab(
tab: ListTab(
label: Text('Label 1'),
icon: Icon(Icons.group),
showIconOnList: false),
body: ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: _con.categories.length,
itemBuilder: (context, index) {
return ListTile(
leading: Container(
height: 40,
width: 40,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.grey),
alignment: Alignment.center,
child: Text(index.toString()),
),
title: Text('List element $index'),
);
}
))
],
),
),
陣列結構:
"data": [
{
"id": 1,
"name": "American fried rice",
"price": 11,
"category_id": 1,
"category": {
"id": 1,
"name": "Grains",
},
},
{
"id": 5,
"name": "Pizza Valtellina",
"price": 7.4,
"category_id": 1,
"category": {
"id": 1,
"name": "Grains",
"has_media": true,
},
},
}
],
uj5u.com熱心網友回復:
針對您的情況的最佳解決方案是使用以下軟體包:
scroll_to_index: ^2.0.0
rect_getter: ^1.0.0
請關注這個專案 https://gist.github.com/debuggerx01/49f108d68ed903458e9478b4f0c186f4
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/342551.html
上一篇:Dart中的穩定串列集差
下一篇:無法注冊新的FireBase用戶
