Skip to content

Commit

Permalink
fix bottom navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
RomeroYang committed Sep 10, 2020
1 parent f37bc03 commit 18c7bd8
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 45 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# 1.0.0
- rebuild staking module & update nominees list
- add validator sort type: judgements
- fix staking action roles
- fix bottom navigation bar

# 0.9.9
- fix accountIndex parsing bug
Expand Down
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = WQ5H736A22;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -518,7 +518,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = WQ5H736A22;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -548,7 +548,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = WQ5H736A22;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
4 changes: 2 additions & 2 deletions lib/common/consts/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ const String cross_chain_transfer_address_laminar =
'5CLaminarAUSDCrossChainTransferxxxxxxxxxxxxxwisu';

/// app versions
const String app_beta_version = 'v1.0.0-beta.4';
const int app_beta_version_code = 1004;
const String app_beta_version = 'v1.0.0-beta.5';
const int app_beta_version_code = 1005;

/// js code versions
const Map<String, int> js_code_version_map = {
Expand Down
48 changes: 29 additions & 19 deletions lib/page-acala/homePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class _AcalaHomePageState extends State<AcalaHomePage> {
// 'Governance',
'Profile',
];
int _tabIndex = 0;

List<BottomNavigationBarItem> _navBarItems(int activeItem) {
Map<String, String> tabs = I18n.of(context).home;
Expand Down Expand Up @@ -102,14 +103,6 @@ class _AcalaHomePageState extends State<AcalaHomePage> {
),
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: i,
iconSize: 22.0,
onTap: (index) {
_pageController.jumpToPage(index);
},
type: BottomNavigationBarType.fixed,
items: _navBarItems(i)),
body: _getPage(i),
)
],
Expand Down Expand Up @@ -137,14 +130,6 @@ class _AcalaHomePageState extends State<AcalaHomePage> {
),
Scaffold(
backgroundColor: Colors.transparent,
bottomNavigationBar: BottomNavigationBar(
currentIndex: i,
iconSize: 22.0,
onTap: (index) {
_pageController.jumpToPage(index);
},
type: BottomNavigationBarType.fixed,
items: _navBarItems(i)),
body: _getPage(i),
)
],
Expand All @@ -164,9 +149,34 @@ class _AcalaHomePageState extends State<AcalaHomePage> {

@override
Widget build(BuildContext context) {
return PageView(
controller: _pageController,
children: _buildPages(),
return SafeArea(
child: Scaffold(
body: PageView(
controller: _pageController,
onPageChanged: (index) {
setState(() {
_tabIndex = index;
});
},
children: _buildPages(),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _tabIndex,
iconSize: 22.0,
onTap: (index) {
setState(() {
_tabIndex = index;
});
_pageController.animateToPage(
index,
duration: Duration(milliseconds: 500),
curve: Curves.ease,
);
},
type: BottomNavigationBarType.fixed,
items: _navBarItems(_tabIndex),
),
),
);
}
}
55 changes: 35 additions & 20 deletions lib/page/homePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ class _HomePageState extends State<HomePage> {

NotificationPlugin _notificationPlugin;

List<String> _tabList = [];
List<String> _tabList = [
'Assets',
'Staking',
'Governance',
'Profile',
];
int _tabIndex = 0;

final List<String> _tabListKusama = [
'Assets',
Expand Down Expand Up @@ -114,14 +120,6 @@ class _HomePageState extends State<HomePage> {
),
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: i,
iconSize: 22.0,
onTap: (index) {
_pageController.jumpToPage(index);
},
type: BottomNavigationBarType.fixed,
items: _navBarItems(i)),
body: _getPage(i),
),
);
Expand All @@ -131,14 +129,6 @@ class _HomePageState extends State<HomePage> {
AssetImage("assets/images/staking/top_bg_$imageColor.png"),
Scaffold(
backgroundColor: Colors.transparent,
bottomNavigationBar: BottomNavigationBar(
currentIndex: i,
iconSize: 22.0,
onTap: (index) {
_pageController.jumpToPage(index);
},
type: BottomNavigationBarType.fixed,
items: _navBarItems(i)),
body: _getPage(i),
),
);
Expand Down Expand Up @@ -177,9 +167,34 @@ class _HomePageState extends State<HomePage> {

@override
Widget build(BuildContext context) {
return PageView(
controller: _pageController,
children: _buildPages(),
return SafeArea(
child: Scaffold(
body: PageView(
controller: _pageController,
onPageChanged: (index) {
setState(() {
_tabIndex = index;
});
},
children: _buildPages(),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _tabIndex,
iconSize: 22.0,
onTap: (index) {
setState(() {
_tabIndex = index;
});
_pageController.animateToPage(
index,
duration: Duration(milliseconds: 500),
curve: Curves.ease,
);
},
type: BottomNavigationBarType.fixed,
items: _navBarItems(_tabIndex),
),
),
);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: PolkaWallet made with Flutter.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1004
version: 1.0.0+1005

environment:
sdk: ">=2.1.0 <3.0.0"
Expand Down

0 comments on commit 18c7bd8

Please sign in to comment.