Skip to content

Commit

Permalink
add type attribute and optimize iconColor usage (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoujuanjuan authored Apr 25, 2022
1 parent 2eece18 commit fb2dc9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class BottomTabbarExampleState extends State<BottomTabbarExample>
BrnBottomTabBar(
fixedColor: Colors.blue,
currentIndex: _selectedIndexTest2,
type: BrnBottomTabBarDisplayType.shifting,
onTap: _onItemSelectedTest2,
items: <BrnBottomTabBarItem>[
BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])),
Expand All @@ -187,6 +188,7 @@ class BottomTabbarExampleState extends State<BottomTabbarExample>
),
BrnBottomTabBar(
fixedColor: Colors.blue,
type: BrnBottomTabBarDisplayType.shifting,
currentIndex: _selectedIndexTest3,
onTap: _onItemSelectedTest3,
items: _getTabBarItems(count: 8),
Expand Down
7 changes: 2 additions & 5 deletions lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BrnBottomTabBar extends StatefulWidget {
required this.items,
this.onTap,
this.currentIndex = 0,
BrnBottomTabBarDisplayType type = BrnBottomTabBarDisplayType.fixed,
this.type = BrnBottomTabBarDisplayType.fixed,
this.fixedColor,
this.iconSize = 24.0,
this.isAnimation = false,
Expand All @@ -43,9 +43,6 @@ class BrnBottomTabBar extends StatefulWidget {
'Every item must have a non-null title',
),
assert(0 <= currentIndex && currentIndex < items.length),
type = items.length <= 3
? BrnBottomTabBarDisplayType.fixed
: BrnBottomTabBarDisplayType.shifting,
super(key: key);

/// 动画是否可见,默认:true
Expand Down Expand Up @@ -427,7 +424,7 @@ class _BottomNavigationTile extends StatelessWidget {
break;
case BrnBottomTabBarDisplayType.shifting:
tweenStart = 16.0;
iconColor = Colors.blue;
iconColor = selected ? BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary : null;
break;
}
return Align(
Expand Down

0 comments on commit fb2dc9e

Please sign in to comment.