zoukankan      html  css  js  c++  java
  • Flutter-tabbar切換

    頂部tabbar切換

    import 'package:flutter/material.dart';
    import 'index_attendance_record.dart';
    import 'index_diet.dart';
    
    class IndexScreen extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        TabController _tabController;
        return new DefaultTabController(
          length: 4,
          child: Scaffold(
            appBar: AppBar(
              bottom: TabBar(
                tabs: <Widget>[
                  Tab(icon: Icon(Icons.event_note),text: '出勤紀錄',),
                  Tab(icon: Icon(Icons.local_dining),text: '膳食',),
                  Tab(icon: Icon(Icons.face),text: '成長紀錄',),
                  Tab(icon: Icon(Icons.description),text: '訂單紀錄',),
                ],
                controller: _tabController,
              ),
            ),
            body: TabBarView(
              children: <Widget>[
                Center(child: AttendanceRecordScreen(),),
                Center(child: IndexDietScreen()),
                Center(child: Text('巴士')),
                Center(child: Text('巴士123123')),
              ],
            ),
          ),
        );
      }
    }

     屬性詳情

    const TabBar({
        Key key,
        @required this.tabs,//显示的标签内容,一般使用Tab对象,也可以是其他的Widget
        this.controller,//TabController对象
        this.isScrollable = false,//是否可滚动
        this.indicatorColor,//指示器颜色
        this.indicatorWeight = 2.0,//指示器高度
        this.indicatorPadding = EdgeInsets.zero,//底部指示器的Padding
        this.indicator,//指示器decoration,例如边框等
        this.indicatorSize,//指示器大小计算方式,TabBarIndicatorSize.label跟文字等宽,TabBarIndicatorSize.tab跟每个tab等宽
        this.labelColor,//选中label颜色
        this.labelStyle,//选中label的Style
        this.labelPadding,//每个label的padding值
        this.unselectedLabelColor,//未选中label颜色
        this.unselectedLabelStyle,//未选中label的Style
        }) : assert(tabs != null),
        assert(isScrollable != null),
        assert(indicator != null || (indicatorWeight != null && indicatorWeight > 0.0)),
        assert(indicator != null || (indicatorPadding != null)),
        super(key: key);
  • 相关阅读:
    bzoj 4245: [ONTAK2015]OR-XOR【按位贪心】
    bzoj 4247: 挂饰【dp】
    bzoj 3503: [Cqoi2014]和谐矩阵【高斯消元】
    bzoj 3029: 守卫者的挑战【概率dp】
    bzoj 3732: Network【克鲁斯卡尔+树链剖分】
    bzoj 1040: [ZJOI2008]骑士【基环树+树形dp】
    bzoj 3668: [Noi2014]起床困难综合症【贪心】
    bzoj 2157: 旅游【树链剖分+线段树】
    bzoj 4521: [Cqoi2016]手机号码【数位dp】
    bzoj 3437: 小P的牧场【斜率优化】
  • 原文地址:https://www.cnblogs.com/ssjf/p/11776237.html
Copyright © 2011-2022 走看看