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);
  • 相关阅读:
    ubuntu13.04 安装java
    PHP shell模式下执行PHP文件报错
    python urllib2 cookie 设置
    新浪微博模拟登录(Python+RSA加密算法)附源代码(转)
    Python 实现腾讯微博模拟登录 (附源码)
    python中的字符串与16进制的转换
    mysql in和exists性能比较和使用
    linux分析dump vmcore文件
    SecureCRT密钥key远连接程ssh证书登录Linux
    /tmp清理机制
  • 原文地址:https://www.cnblogs.com/ssjf/p/11776237.html
Copyright © 2011-2022 走看看