ConvexAppBar constructor
ConvexAppBar({
- Key? key,
- required List<
TabItem> items, - int? initialActiveIndex,
- bool? disableDefaultTabController,
- GestureTapIndexCallback? onTap,
- TapNotifier? onTabNotify,
- TabController? controller,
- Color? color,
- Color? activeColor,
- Color? backgroundColor,
- Color? shadowColor,
- Gradient? gradient,
- double? height,
- double? curveSize,
- double? top,
- double? elevation,
- double? cornerRadius,
- TabStyle? style,
- Curve? curve,
- ChipBuilder? chipBuilder,
Construct a new appbar with internal style.
ConvexAppBar(
items: [
TabItem(title: 'Tab A', icon: Icons.add),
TabItem(title: 'Tab B', icon: Icons.near_me),
TabItem(title: 'Tab C', icon: Icons.web),
],
)
You can also define a custom chipBuilder class.
class _ChipBuilder extends ChipBuilder {
@override
Widget build(BuildContext context, Widget child, int index, bool active) {
return Stack(
alignment: Alignment.center,
children: <Widget>[
child,
Positioned.fill(
child: Align(
alignment: Alignment.topRight,
child: Container(
margin: EdgeInsets.only(top: 10, right: 10),
padding: EdgeInsets.only(left: 4, right: 4),
child: Icon(Icons.access_alarm, color: Colors.redAccent),
),
),
)
],
);
;
}
}
See also:
- ConvexAppBar.builder, define a custom tab style by implement a DelegateBuilder.
- ConvexAppBar.badge, construct a new appbar with styled badge.
Implementation
ConvexAppBar({
Key? key,
required List<TabItem> items,
int? initialActiveIndex,
bool? disableDefaultTabController,
GestureTapIndexCallback? onTap,
TapNotifier? onTabNotify,
TabController? controller,
Color? color,
Color? activeColor,
Color? backgroundColor,
Color? shadowColor,
Gradient? gradient,
double? height,
double? curveSize,
double? top,
double? elevation,
double? cornerRadius,
TabStyle? style,
Curve? curve,
ChipBuilder? chipBuilder,
}) : this.builder(
key: key,
itemBuilder: supportedStyle(
style ?? TabStyle.reactCircle,
items: items,
color: color ?? Colors.white60,
activeColor: activeColor ?? Colors.white,
backgroundColor: backgroundColor ?? Colors.blue,
curve: curve ?? Curves.easeInOut,
),
onTap: onTap,
onTapNotify: onTabNotify,
controller: controller,
backgroundColor: backgroundColor,
shadowColor: shadowColor,
count: items.length,
initialActiveIndex: initialActiveIndex,
disableDefaultTabController: disableDefaultTabController ?? false,
gradient: gradient,
height: height,
curveSize: curveSize,
top: top,
elevation: elevation,
cornerRadius: cornerRadius,
curve: curve ?? Curves.easeInOut,
chipBuilder: chipBuilder,
);