Skip to content

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是否展示返回图标booltrue
onBack返回时回调Function?true
leading左侧返回图标后面的内容Widget?-
actions右侧操作按钮List<Widget>?-
toolbarHeight工具栏高度double?56
bottom底部布局(带高度)PreferredSizeWidget?
centerTitle标题是否居中显示booltrue
decoration组件背景样式BoxDecoration?