Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add type attribute and optimize iconColor usage #192

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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