@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33
44typedef IndexTapCallback = void Function (int );
55typedef IndexLongTapCallback = void Function (BuildContext , int );
6+
67class PureBottomBar extends StatefulWidget {
78 final int initPosition;
89
@@ -11,33 +12,36 @@ class PureBottomBar extends StatefulWidget {
1112
1213 // item 长按事件
1314 final IndexLongTapCallback ? onItemLongTap;
14- const PureBottomBar ({Key ? key, this .onItemTap,this .onItemLongTap,this .initPosition= 0 }) : super (key: key);
15+ const PureBottomBar (
16+ {Key ? key, this .onItemTap, this .onItemLongTap, this .initPosition = 0 })
17+ : super (key: key);
1518
1619 @override
1720 State <PureBottomBar > createState () => _PureBottomBarState ();
1821}
1922
2023class _PureBottomBarState extends State <PureBottomBar > {
21- List <String > get bottomBar => const ['组件' ,'绘制' , '收藏' ,'我的' ];
24+ List <String > get bottomBar => const ['组件' , '绘制' ,
25+ // '宝具',
26+ '收藏' , '我的' ];
2227
23- List <IconData > get bottomBarIcon => const [
24- TolyIcon .icon_layout,
25- TolyIcon .dingzhi1,
28+ List <IconData > get bottomBarIcon => const [
29+ TolyIcon .icon_layout,
30+ TolyIcon .dingzhi1,
31+ // TolyIcon.icon_artifact,
2632 TolyIcon .icon_collect,
27- TolyIcon .yonghu,
28- ];
33+ TolyIcon .yonghu,
34+ ];
2935 int _position = 0 ;
3036
3137 @override
3238 void initState () {
3339 super .initState ();
3440 _position = widget.initPosition;
35-
3641 }
3742
3843 @override
3944 Widget build (BuildContext context) {
40-
4145 return Wrap (
4246 children: [
4347 // Divider(height: 1,),
@@ -49,7 +53,6 @@ class _PureBottomBarState extends State<PureBottomBar> {
4953
5054 widget.onItemTap? .call (_position);
5155 setState (() {
52-
5356 // _controller.jumpToPage(_position);
5457 });
5558 },
@@ -64,7 +67,12 @@ class _PureBottomBarState extends State<PureBottomBar> {
6467 showUnselectedLabels: true ,
6568 showSelectedLabels: true ,
6669 // backgroundColor: themeColor.itemColor,
67- items: bottomBar.asMap ().keys.map ((index) => BottomNavigationBarItem (label: bottomBar[index], icon: Icon (bottomBarIcon[index]))).toList (),
70+ items: bottomBar
71+ .asMap ()
72+ .keys
73+ .map ((index) => BottomNavigationBarItem (
74+ label: bottomBar[index], icon: Icon (bottomBarIcon[index])))
75+ .toList (),
6876 ),
6977 ],
7078 );
0 commit comments