AppBar 导航栏
代码演示
import 'package:flutter/material.dart';
import 'package:trionesdev_antd_mobile/trionesdev_antd_mobile.dart';
class TabBarPage extends StatefulWidget {
const TabBarPage({super.key});
@override
State<StatefulWidget> createState() => _TabBarPageState();
}
class _TabBarPageState extends State<TabBarPage> {
@override
Widget build(BuildContext context) {
return AntScaffold(
appBar: AntAppBar(
title: Text("TabBar"),
),
bottomNavigationBar: AntTabBar(children: [
AntTabBarItem(
icon: Icon(Icons.home),
label: Text("首页"),
antKey: 'index',
activeColor: Color(0xff1677FF),
onPressed: (String id) {
print(id);
}),
AntTabBarItem(
icon: Icon(Icons.search),
label: Text("搜索"),
antKey: 'search',
)
]));
}
}
API
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
backIcon | 返回图标 | Widget? | - |
backText | 返回文本 | Widget? | - |
back | 是否展示返回图标 | bool | true |
onBack | 返回时回调 | Function? | true |
leading | 左侧返回图标后面的内容 | Widget? | - |
actions | 右侧操作按钮 | List<Widget>? | - |
toolbarHeight | 工具栏高度 | double? | 56 |
bottom | 底部布局(带高度) | PreferredSizeWidget? | |
centerTitle | 标题是否居中显示 | bool | true |
decoration | 组件背景样式 | BoxDecoration? |