zoukankan      html  css  js  c++  java
  • TabBar + TabBarView导航风格

    import 'package:flutter/material.dart';
    import 'News.dart';
    import 'Video.dart';
    import 'Chat.dart';
    import 'MyId.dart';
    
    class AppOne extends StatelessWidget {
      @override
      Widget build(BuildContext context) => new MaterialApp(home: MyHomePage());
    }
    
    class MyHomePage extends StatefulWidget {
      @override
      State<StatefulWidget> createState() => new MyHomePageState();
    }
    
    class MyHomePageState extends State<MyHomePage>
        with SingleTickerProviderStateMixin {
      TabController controller;
    
      @override
      void initState() {
        super.initState();
        controller = new TabController(length: 3, vsync: this);
      }
    
      @override
      void dispose() {
        controller.dispose();
        super.dispose();
      }
    
      /// 相当于TabLayout 和 ViewPage
      @override
      Widget build(BuildContext context) {
        return new Scaffold(
          body: new TabBarView(controller: controller, children: <Widget>[
            new NewsPage(),
            new VideoPage(),
            new ChatPage(),
            new MyIdPage()
          ]),
          bottomNavigationBar: new Material(
            color: Colors.blue,
            child: new TabBar(
              controller: controller,
              tabs: <Tab>[
                new Tab(text: "首页", icon: new Icon(Icons.home)),
                new Tab(text: "列表", icon: new Icon(Icons.list)),
                new Tab(text: "信息", icon: new Icon(Icons.message)),
              ],
              indicatorWeight: 0.1,
            ),
          ),
        );
      }
    }
  • 相关阅读:
    mysql各版本特点
    jQuery 获取文件后缀的方法
    jquery中动态效果
    常用CSS缩写语法总结
    判断两个时间这间间隔几分钟
    jQuery操作Cookie
    禁止表单自动提示缓存数据
    jQuery.lazyload
    Jquery.Sorttable 桌面拖拽自定义
    分享13款非常有用的 jQuery 插件
  • 原文地址:https://www.cnblogs.com/xiongwei/p/10711020.html
Copyright © 2011-2022 走看看