欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Flutter底部不規(guī)則導(dǎo)航的實(shí)現(xiàn)過程

 更新時(shí)間:2019年08月13日 11:01:31   作者:NiceBrother  
這篇文章主要給大家介紹了關(guān)于Flutter底部不規(guī)則導(dǎo)航的實(shí)現(xiàn)過程,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Flutter具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧

前言

本文主要介紹的是關(guān)于Flutter實(shí)現(xiàn)底部不規(guī)則導(dǎo)航的相關(guān)內(nèi)容,分享出來供大家參考學(xué)習(xí),下面話不多說了,來一起看看詳細(xì)的介紹吧

實(shí)現(xiàn)方法:

1、main.dart文件

import 'package:flutter/material.dart';
import 'bootom_appBar.dart';

void main () =>runApp(MyApp());

class MyApp extends StatelessWidget {

 @override
 Widget build(BuildContext context) {
 return MaterialApp(
  title:'不規(guī)則底部導(dǎo)航',
  //自定義主題樣本
  theme:ThemeData(
   primarySwatch:Colors.lightBlue
  ),
  home:BottomAppBarDemo(),
 );
 }
}

2、bootom_appBar.dart

import 'package:flutter/material.dart';
import 'each_view.dart';

class BottomAppBarDemo extends StatefulWidget {
 @override
 _BottomAppBarDemoState createState() => _BottomAppBarDemoState();
}

class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
 List<Widget> _eachView;
 int _index = 0;
 @override
 void initState() {
  _eachView = List();
  _eachView ..add(EachView('主頁的頁面'));
  _eachView ..add(EachView('副頁的頁面'));
  // TODO: implement initState
  super.initState();
 }
 @override
 Widget build(BuildContext context) {
  return Scaffold(
   //變換頁面
   body: _eachView[_index],
   floatingActionButton: FloatingActionButton(
    onPressed: (){
     Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context){
      return EachView('新添加的頁面');
     }));
    },
    tooltip: '添加',
    child: Icon(
     Icons.add,
     color: Colors.white,
    ),
   ),
   floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
   bottomNavigationBar: BottomAppBar(
    //工具欄比NavigationBar靈活
    color: Colors.lightBlue,
    //與fab融合
    //圓形缺口
    shape: CircularNotchedRectangle(),
    child: Row(
     mainAxisSize: MainAxisSize.max,
     mainAxisAlignment: MainAxisAlignment.spaceAround,
     children: <Widget>[
      IconButton(
       icon: Icon(Icons.home),
       color: Colors.white,
       onPressed: (){
        setState(() {
         _index = 0;
        });
       },
      ),
      IconButton(
       icon: Icon(Icons.airport_shuttle),
       color: Colors.white,
       onPressed: (){
        setState(() {
         _index = 1;
        });
       },
      )
     ],
    ),
   ),
  );
 }
}

3、each_view.dart

import 'package:flutter/material.dart';

class EachView extends StatefulWidget {
 String _title;
 EachView(this._title);
 @override
 _EachViewState createState() => _EachViewState();
}

class _EachViewState extends State<EachView> {
 @override
 Widget build(BuildContext context) {
  return Scaffold(
   appBar: AppBar(title: Text(widget._title),),
   body: Center(child: Text(widget._title),),
  );
 }
}

4、效果展示


總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。

相關(guān)文章

  • Android中使用sax解析xml文件的方法

    Android中使用sax解析xml文件的方法

    本篇文章介紹了,在Android中使用sax解析xml文件的方法。需要的朋友參考下
    2013-04-04
  • android: targetSdkVersion升級(jí)中Only fullscreen activities can request orientation問題的解決方法

    android: targetSdkVersion升級(jí)中Only fullscreen activities can r

    這篇文章主要給大家介紹了關(guān)于Android target SDK和build tool版本升級(jí)中遇到Only fullscreen activities can request orientation問題的解決方法,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2018-09-09
  • Android編譯的注意事項(xiàng)

    Android編譯的注意事項(xiàng)

    今天小編就為大家分享一篇關(guān)于Android編譯的注意事項(xiàng),小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2018-12-12
  • Android開發(fā)筆記之:如何安全中止一個(gè)自定義線程Thread的方法

    Android開發(fā)筆記之:如何安全中止一個(gè)自定義線程Thread的方法

    本篇文章是對(duì)Android中如何安全中止一個(gè)自定義線程Thread的方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
    2013-05-05
  • Android 暫停和恢復(fù)Activity

    Android 暫停和恢復(fù)Activity

    在正常的應(yīng)用程序使用,前臺(tái)activity有時(shí)會(huì)被其他可視化組件遮擋,從而 造成activity的暫停。例如,當(dāng)一個(gè)半透明的activity打開時(shí)(如在一個(gè)風(fēng)格對(duì)話框),以前的activity就暫停了。只要 activity仍然是部分可見,但目前沒有獲得焦點(diǎn),它就依然處于暫停狀態(tài)
    2016-03-03
  • Android入門之Toast的使用教程

    Android入門之Toast的使用教程

    Toast是一種很方便的消息提示框,會(huì)在 屏幕中顯示一個(gè)消息提示框,沒任何按鈕,也不會(huì)獲得焦點(diǎn)一段時(shí)間過后自動(dòng)消失!非常常用!本文就來通過一個(gè)例子把Toast的使用講透
    2022-11-11
  • Android如何監(jiān)聽屏幕旋轉(zhuǎn)

    Android如何監(jiān)聽屏幕旋轉(zhuǎn)

    這篇文章主要介紹了如何監(jiān)聽Android屏幕旋轉(zhuǎn),幫助大家更好的理解和學(xué)習(xí)使用Android開發(fā),感興趣的朋友可以了解下
    2021-03-03
  • Android編程獲取并設(shè)置Activity亮度的方法

    Android編程獲取并設(shè)置Activity亮度的方法

    這篇文章主要介紹了Android編程獲取并設(shè)置Activity亮度的方法,涉及Android針對(duì)屏幕亮度的相關(guān)操作技巧,需要的朋友可以參考下
    2015-12-12
  • Android入門之onTouchEvent觸碰事件的示例詳解

    Android入門之onTouchEvent觸碰事件的示例詳解

    今天給大家?guī)淼氖荰ouchListener與OnTouchEvent的比較,以及多點(diǎn)觸碰的知識(shí)點(diǎn)!?文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下
    2022-12-12
  • 關(guān)于Android?Webview?設(shè)置Cookie問題詳解

    關(guān)于Android?Webview?設(shè)置Cookie問題詳解

    大家好,本篇文章是關(guān)于Android?Webview?設(shè)置Cookie問題詳解,感興趣的同學(xué)可以看看,希望對(duì)你起到幫助,有用的話記得收藏,方便下次瀏覽
    2021-11-11

最新評(píng)論