最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Flutter實(shí)現(xiàn)底部導(dǎo)航欄

 更新時(shí)間:2022年03月23日 10:20:49   作者:夏沫凡塵  
這篇文章主要為大家詳細(xì)介紹了Flutter實(shí)現(xiàn)底部導(dǎo)航欄的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Flutter實(shí)現(xiàn)底部導(dǎo)航欄的具體代碼,供大家參考,具體內(nèi)容如下

效果

實(shí)現(xiàn)

先將自動(dòng)生成的main.dart里面的代碼刪除,

import 'package:flutter/material.dart';
import 'package:flutter_guohe/pages/main.dart';
 
void main() {
 runApp(new Guohe());
}

創(chuàng)建app.dart作為首頁的頁面文件

class Guohe extends StatefulWidget {
 @override
 GuoheState createState() => new GuoheState();
}
 
class GuoheState extends State<Guohe> {
 @override
 Widget build(BuildContext context) {
 
 }
}

創(chuàng)建today.dart、kb.dart、playground.dart三個(gè)頁面文件作為tabview的填充文件,這里用playground.dart為例。

import 'package:flutter/material.dart';
 
class Playground extends StatefulWidget {
 @override
 PlaygroundState createState() => new PlaygroundState();
}
 
class PlaygroundState extends State<Playground> {
 @override
 Widget build(BuildContext context) {
 return new MaterialApp(
  home: new Scaffold(
  appBar: new AppBar(
   title: new Text("操場(chǎng)"),
   backgroundColor: Color.fromARGB(255, 119, 136, 213), //設(shè)置appbar背景顏色
   centerTitle: true, //設(shè)置標(biāo)題是否局中
  ),
  body: new Center(
   child: new Text('操場(chǎng)'),
  ),
  ),
 );
 }
}

app.dart的完整代碼

/**
 * APP的主入口文件
 */
 
import 'package:flutter/material.dart';
 
import 'package:flutter_guohe/pages/main/today.dart';
import 'package:flutter_guohe/pages/main/playground.dart';
import 'package:flutter_guohe/pages/main/kb.dart';
import 'package:flutter_guohe/pages/main/leftmenu.dart';
 
import 'package:flutter_guohe/common/eventBus.dart';
 
//果核的主界面
class Guohe extends StatefulWidget {
 @override
 GuoheState createState() => new GuoheState();
}
 
class GuoheState extends State<Guohe> with SingleTickerProviderStateMixin {
 TabController controller;
 
 @override
 void initState() {
 controller = new TabController(length: 3, vsync: this);
 }
 
 @override
 void dispose() {
 controller.dispose();
 super.dispose();
 }
 
 @override
 Widget build(BuildContext context) {
 return new MaterialApp(
  home: new Scaffold(
  drawer: new LeftMenu(),
  body: new TabBarView(
   controller: controller,
   children: <Widget>[
   new Today(),
   new Kb(),
   new Playground(),
   ],
  ),
  bottomNavigationBar: new Material(
   color: Colors.white,
   child: new TabBar(
   controller: controller,
   labelColor: Colors.deepPurpleAccent,
   unselectedLabelColor: Colors.black26,
   tabs: <Widget>[
    new Tab(
    text: "今日",
    icon: new Icon(Icons.brightness_5),
    ),
    new Tab(
    text: "課表",
    icon: new Icon(Icons.map),
    ),
    new Tab(
    text: "操場(chǎng)",
    icon: new Icon(Icons.directions_run),
    ),
   ],
   ),
  ),
  ),
 );
 }
}

其中

labelColor: Colors.deepPurpleAccent,
unselectedLabelColor: Colors.black26,

第一個(gè)屬性是控制標(biāo)簽顏色,這里我選了紫色,第二個(gè)屬性是未選中標(biāo)簽時(shí)的顏色。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

宜丰县| 舞阳县| 福鼎市| 榆树市| 连平县| 榆树市| 巫山县| 敖汉旗| 泸溪县| 习水县| 义乌市| 广水市| 蕲春县| 宾阳县| 靖远县| 铁力市| 平湖市| 乳山市| 古蔺县| 哈密市| 天水市| 股票| 万山特区| 东港市| 台中县| 天祝| 西城区| 中西区| 桓仁| 洱源县| 清新县| 上虞市| 桂平市| 启东市| 南漳县| 达日县| 什邡市| 鄂温| 开化县| 贵州省| 镇原县|