Skip to content

Commit

Permalink
Add example usage for State
Browse files Browse the repository at this point in the history
  • Loading branch information
avenwu committed Feb 18, 2020
1 parent 8b709f9 commit 81164c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## [2.1.0-beta]
## [2.1.0-beta+1]

* Add controller for Appbar to change tab index programmaticlly;
* Support with framework's DefaultTabController and TabController;
* Enable access to the ConvexAppBarState;

## [2.0.3]

Expand Down
12 changes: 12 additions & 0 deletions doc/issue-change-active-tab-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ DefaultTabController(
bottomNavigationBar: ConvexAppBar(controller: _tabController/* some config*/),
);
```
## The raw way
If you don't use TabController at all, then you have to update tab index manually through `ConvexAppBarState`.
This usually requires a defined `GlobalKey` set with `ConvexAppBar`:

```dart
// define field instance
GlobalKey<ConvexAppBarState> _appBarKey = GlobalKey<ConvexAppBarState>();
// construct with key
ConvexAppBar(key: _appBarKey, /* ... */);
// access related State when necessary such as onPageChanged
_appBarKey.currentState.animateTo(2/* index*/);
```
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: convex_bottom_bar
description: A Flutter package which implements a ConvexAppBar to show a convex tab in the bottom bar. Theming supported.
version: 2.1.0-beta
version: 2.1.0-beta+1
homepage: https://github.com/hacktons/convex_bottom_bar

environment:
Expand Down

0 comments on commit 81164c6

Please sign in to comment.