convex_bottomappbar
this package extends the official bottomappbar to display a convex tab, example can be preview as bellow.
currently the bottomappbar can only display a notch fab with app bar, sometimes we need a convex fab.
install demo app-release.apk
how to use
to use convexappbar, follow these steps to setup scaffold
:
- add fab with
floatingactionbutton
- center the fab with
floatingactionbuttonlocation
- setup app bar by
bottomnavigationbar
the convexappbar
has to two constructors, the convexappbar()
will use default layout to simplify the tab creation.
scaffold(
appbar: appbar(
title: const text('default convexappbar'),
),
body: center(
child: text('tab $_selectedindex', style: textstyle(fontsize: 20)),
),
floatingactionbutton: convexappbar.fab(
text: 'publish',
active: _selectedindex == index_publish,
activecolor: active_color,
color: normal_color,
ontap: () => ontabselected(index_publish),
),
floatingactionbuttonlocation: convexappbar.centerdocked,
bottomnavigationbar: convexappbar(
items: tab_items,
index: _selectedindex,
activecolor: active_color,
color: normal_color,
ontap: ontabselected,
),
)
custom
if the default style does not match with your situation, try with convexappbar.builder()
, which allow you to custom nearly all the tab features.
scaffold(
appbar: appbar(title: const text('custom convexappbar')),
body: palettebody(),
floatingactionbutton: gesturedetector(
ontap: () => _onitemtapped(index_publish),
child: fabcontent(convexcolor),
),
floatingactionbuttonlocation: convexappbar.centerdocked,
bottomnavigationbar: convexappbar.builder(
count: 5,
backgroundcolor: _tabbackgroundcolor,
builder: (buildcontext context, int index) {
var data = _navigationitems[index];
var color = _currentindex == index ? colors.white : colors.white60;
return gesturedetector(
ontap: () => _onitemtapped(index),
child: tabcontent(data, color));
}),
);
example
for more detail, please refer to the example project
Comments are closed.