From 61c609c272bf47ae21690f2235a450de45f46b03 Mon Sep 17 00:00:00 2001 From: Chaobin Wu Date: Thu, 6 Feb 2020 10:38:07 +0800 Subject: [PATCH] update README --- CHANGELOG.md | 6 ++++++ README.md | 39 ++++++++++++++++++++++++++------------- pubspec.yaml | 2 +- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf83b3..85dae3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [2.0.1] + +* Update usage instructions in README.md; +* Add new test cases to improve the code coverage; +* Bug fix; + ## [2.0.0] * Support badge on tab item; diff --git a/README.md b/README.md index cb1f14e..bb3de5e 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,7 @@ Scaffold( TabItem(icon: Icons.message, title: 'Message'), TabItem(icon: Icons.people, title: 'Profile'), ], - style: _style.value, - curve: _curve.value, - backgroundColor: _babColor, - onTap: (int i) => setState(() { - _selectedIndex = i; - }), + onTap: (int i) => print('click index=$i'), ) ); ``` @@ -73,15 +68,22 @@ Scaffold( - [Help](#help) ## Badge -If you need to add badge on the tab, use `ConvexAppBar.chip` to get it done. +If you need to add badge on the tab, use `ConvexAppBar.badge` to get it done. [![badge demo](doc/badge-demo-preview.gif)](doc/badge-demo.mp4 "badge demo") ```dart -ConvexAppBar.chip({3: '99+', 4: Icons.assistant_photo, 2: Colors.redAccent}); +ConvexAppBar.badge({0: '99+', 1: Icons.assistant_photo, 2: Colors.redAccent}, + items: [ + TabItem(icon: Icons.home, title: 'Home'), + TabItem(icon: Icons.map, title: 'Discovery'), + TabItem(icon: Icons.add, title: 'Add'), + ], + onTap: (int i) => print('click index=$i'), +); ``` -The `chip` method accept an array of badge; The `badge` is map with tab items, each value of entry can be either `String`, `IconData`, `Color` or `Widget`. +The `badge()` method accept an array of badges; The `badges` is map with tab items, each value of entry can be either `String`, `IconData`, `Color` or `Widget`. ## Theming The bar will use default style, you may want to theme it. Here are some supported attributes: @@ -98,7 +100,7 @@ The bar will use default style, you may want to theme it. Here are some supporte | curveSize | size of the convex shape | | top | top edge of the convex shape relative to AppBar | | style | style to describe the convex shape: **fixed, fixedCircle, react, reactCircle**, ... | -| chipBuilder | custom badge builder, use ConvexAppBar.chip for default badge | +| chipBuilder | custom badge builder, use **ConvexAppBar.badge** for default badge | ![](doc/appbar-demo.gif) @@ -109,13 +111,24 @@ If the default style does not match with your situation, try with `ConvexAppBa ```dart Scaffold( bottomNavigationBar: ConvexAppBar.builder( - count: items.length, - backgroundColor: _tabBackgroundColor, + count: 5, + backgroundColor: Colors.blue, style: TabStyle.fixed, - itemBuilder: _CustomBuilder(items, _tabBackgroundColor), + itemBuilder: Builder(), ) ); + +/*user defined class*/ +class Builder extends DelegateBuilder { + @override + Widget build(BuildContext context, int index, bool active) { + return Text('TAB $index'); + } +} ``` + +Full custom example can be found at [example](example). + ## FAQ * [Using an image instead of an icon for actionItem](doc/issue-image-for-actionitem.md) diff --git a/pubspec.yaml b/pubspec.yaml index 06d86e0..6432da1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.0.0 +version: 2.0.1 homepage: https://github.com/hacktons/convex_bottom_bar environment: