中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

怎么建網(wǎng)站錦州推廣網(wǎng)站

怎么建網(wǎng)站錦州,推廣網(wǎng)站,asp網(wǎng)站后臺(tái)密碼文件,中小型企業(yè)網(wǎng)站建設(shè)與管理考試1. Tab的簡(jiǎn)單使用了解 要實(shí)現(xiàn)tab(選項(xiàng)卡或者標(biāo)簽視圖)需要用到三個(gè)組件: TabBarTabBarViewTabController 這一塊,我也不知道怎么整理了,直接提供代碼吧: import package:flutter/material.dart;void main() {runApp(MyApp());…

1. Tab的簡(jiǎn)單使用了解

要實(shí)現(xiàn)tab(選項(xiàng)卡或者標(biāo)簽視圖)需要用到三個(gè)組件:

  • TabBar
  • TabBarView
  • TabController

這一塊,我也不知道怎么整理了,直接提供代碼吧:

import 'package:flutter/material.dart';void main() {runApp(MyApp());
}class MyApp extends StatelessWidget {const MyApp({super.key});Widget build(BuildContext context) {return  MaterialApp(debugShowCheckedModeBanner: true,home: Home(),theme: ThemeData(appBarTheme: AppBarTheme(backgroundColor: Colors.yellow, // 設(shè)置導(dǎo)航欄顏色為藍(lán)色)),);}
}class Home extends StatelessWidget {const Home({super.key});Widget build(BuildContext context) {return DefaultTabController(length: 3, child: Scaffold(appBar: AppBar(leading: IconButton(onPressed: () => debugPrint("navigation button is pressed."), icon: Icon(Icons.menu),tooltip: "Navigation",),actions: [IconButton(onPressed: () => debugPrint("navigation button is pressed."), icon: Icon(Icons.search),tooltip: "search",)],title: Text("App Demo"),elevation: 0.0,bottom: TabBar(unselectedLabelColor: Colors.black38,indicatorColor: Colors.black54,indicatorSize: TabBarIndicatorSize.label,indicatorWeight: 1.0,tabs: [Tab(icon: Icon(Icons.local_florist)),Tab(icon: Icon(Icons.change_history)),Tab(icon: Icon(Icons.directions_bike)),]),),body: TabBarView(children: [Icon(Icons.local_florist, size: 128.0, color: Colors.black12),Icon(Icons.change_history, size: 128.0, color: Colors.black12),Icon(Icons.directions_bike, size: 128.0, color: Colors.black12),]),));}
}

效果圖如下:
在這里插入圖片描述

2. Drawer 側(cè)邊欄簡(jiǎn)單使用

在手勢(shì)在屏幕進(jìn)行左滑手勢(shì)時(shí),可以通過設(shè)置drawer屬性,來實(shí)現(xiàn)側(cè)邊欄顯示的效果。

側(cè)邊欄代碼的實(shí)現(xiàn)如下(為了避免代碼太長(zhǎng),新建一個(gè)實(shí)現(xiàn)Drawer視圖的文件):

import 'package:flutter/material.dart';class DrawerDemo extends StatelessWidget {const DrawerDemo({super.key});Widget build(BuildContext context) {return Drawer(child: ListView(padding: EdgeInsets.zero,children: [// DrawerHeader(//   decoration: BoxDecoration(//     color: Colors.greenAccent//   ),//   child: Text("Header".toUpperCase()),// ),UserAccountsDrawerHeader(accountName: Text("zhuzhu", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black)), accountEmail: Text("zhuzhu@com.net", style: TextStyle(color: Colors.black),),currentAccountPicture: CircleAvatar(backgroundImage: NetworkImage("https://img1.baidu.com/it/u=1368815763,3761060632&fm=253&fmt=auto&app=138&f=JPEG?w=760&h=434"),),decoration: BoxDecoration(image: DecorationImage(image: NetworkImage("https://i-blog.csdnimg.cn/blog_migrate/41635df939e6dd13c6d5e2af785d358b.jpeg"),fit: BoxFit.cover,colorFilter: ColorFilter.mode(Colors.yellow.withAlpha(150), BlendMode.srcOver))),),ListTile(title: Text("Message", textAlign: TextAlign.right),trailing: Icon(Icons.message, color: Colors.black12, size: 22.0),onTap: () => Navigator.pop(context), // 關(guān)閉抽屜),ListTile(title: Text("Favorite", textAlign: TextAlign.right),trailing: Icon(Icons.favorite, color: Colors.black12, size: 22.0),onTap: () => Navigator.pop(context), // 關(guān)閉抽屜),ListTile(title: Text("Settings", textAlign: TextAlign.right),trailing: Icon(Icons.settings, color: Colors.black12, size: 22.0),onTap: () => Navigator.pop(context), // 關(guān)閉抽屜),],),);}
}

然后將DrawerDemo 添加到drawer屬性里,代碼如下:

import 'package:flutter/material.dart';
import 'Demo/Drawer_demo.dart'; // 導(dǎo)入DrawerDemo所在的文件void main() {runApp(MyApp());
}class MyApp extends StatelessWidget {const MyApp({super.key});Widget build(BuildContext context) {return  MaterialApp(debugShowCheckedModeBanner: true,home: Home(),theme: ThemeData(appBarTheme: AppBarTheme(backgroundColor: Colors.yellow, // 設(shè)置導(dǎo)航欄顏色為藍(lán)色)),);}
}class Home extends StatelessWidget {const Home({super.key});Widget build(BuildContext context) {return DefaultTabController(length: 3, child: Scaffold(appBar: AppBar(leading: IconButton(onPressed: () => debugPrint("navigation button is pressed."), icon: Icon(Icons.menu),tooltip: "Navigation",),actions: [IconButton(onPressed: () => debugPrint("navigation button is pressed."), icon: Icon(Icons.search),tooltip: "search",)],title: Text("App Demo"),elevation: 0.0,bottom: TabBar(unselectedLabelColor: Colors.black38,indicatorColor: Colors.black54,indicatorSize: TabBarIndicatorSize.label,indicatorWeight: 1.0,tabs: [Tab(icon: Icon(Icons.local_florist)),Tab(icon: Icon(Icons.change_history)),Tab(icon: Icon(Icons.directions_bike)),]),),body: TabBarView(children: [Icon(Icons.local_florist, size: 128.0, color: Colors.black12),Icon(Icons.change_history, size: 128.0, color: Colors.black12),Icon(Icons.directions_bike, size: 128.0, color: Colors.black12),]),// 添加側(cè)邊欄, 用掃動(dòng)的手勢(shì)來顯示這個(gè)側(cè)邊欄drawer: DrawerDemo()));}
}

效果如下:
在這里插入圖片描述

3. 底部導(dǎo)航欄的添加

底部導(dǎo)航欄的添加,可以通過屬性bottomNavigationBar來設(shè)置,實(shí)現(xiàn)它需要用到這兩個(gè)組件:

  • BottomNavigationBar
  • BottomNavigationBarItem

之前頁(yè)面都是靜態(tài)頁(yè)面,創(chuàng)建的類也都是繼承于StatelessWidget,但是點(diǎn)擊tabbar需要根據(jù)點(diǎn)擊改變狀態(tài),所以,就需要用新的組件StatefulWidget。這一次就先只記錄怎么使用,后面有時(shí)間把這個(gè)控件的說明再補(bǔ)充上。

根據(jù)前面的代碼,抽取出一些代碼,并創(chuàng)建以下三個(gè)類:

  • ExploreDemo
import 'package:flutter/material.dart';
import 'ListView_demo.dart';
import 'Drawer_demo.dart';class  ExploreDemo extends StatelessWidget {Widget build(BuildContext context) {return DefaultTabController(length: 3, child: Scaffold(appBar: AppBar(leading: IconButton(onPressed: () => debugPrint("navigation button is pressed."), icon: Icon(Icons.menu),tooltip: "Navigation",),actions: [IconButton(onPressed: () => debugPrint("navigation button is pressed."), icon: Icon(Icons.search),tooltip: "search",)],title: Text("App Demo"),elevation: 0.0,bottom: TabBar(unselectedLabelColor: Colors.black38,indicatorColor: Colors.black54,indicatorSize: TabBarIndicatorSize.label,indicatorWeight: 1.0,tabs: [Tab(icon: Icon(Icons.local_florist)),Tab(icon: Icon(Icons.change_history)),Tab(icon: Icon(Icons.directions_bike)),]),),body: TabBarView(children: [ListViewDemo(),Icon(Icons.change_history, size: 128.0, color: Colors.black12),Icon(Icons.directions_bike, size: 128.0, color: Colors.black12),]),// 添加側(cè)邊欄, 用掃動(dòng)的手勢(shì)來顯示這個(gè)側(cè)邊欄drawer: DrawerDemo()));}
}
  • HistoryDemo
import 'package:flutter/material.dart';class  HistoryDemo extends StatelessWidget {Widget build(BuildContext context) {return Scaffold(appBar: AppBar(title: Text("歷史記錄")),body: Container(child: Center(child: Text("歷史記錄"),),));}
}
  • MyviewDemo
import 'package:flutter/material.dart';class  MyviewDemo extends StatelessWidget {Widget build(BuildContext context) {return Scaffold(appBar: AppBar(title: Text("個(gè)人主頁(yè)")),body: Container(child: Center(child: Text("個(gè)人主頁(yè)"),),));}
}

基礎(chǔ)工作做好后,在main.dart 文件中,實(shí)現(xiàn)如下代碼:

import 'package:flutter/material.dart';
import 'Demo/Explore_demo.dart';
import 'Demo/History_demo.dart';
import 'Demo/MyView_demo.dart';void main() {runApp(MyApp());
}class MyApp extends StatelessWidget {const MyApp({super.key});Widget build(BuildContext context) {return  MaterialApp(debugShowCheckedModeBanner: true,home: Home(),theme: ThemeData(appBarTheme: AppBarTheme(backgroundColor: Colors.yellow, // 設(shè)置導(dǎo)航欄顏色為藍(lán)色)),);}
}class Home extends StatefulWidget {const Home({super.key});State<StatefulWidget> createState() {return _HomeState();}
}class _HomeState extends State<Home> {int _currentPageIndex = 0;// 提前創(chuàng)建3個(gè)視圖,當(dāng)點(diǎn)擊tabbar的時(shí)候,調(diào)用setState的index來去對(duì)應(yīng)的頁(yè)面final List<Widget> pageLists = [ExploreDemo(),HistoryDemo(),MyviewDemo()];void _onTapHandler (int index) {// 更新狀態(tài)setState(() {_currentPageIndex = index;});}Widget build(BuildContext context) {return Scaffold(// 根據(jù)_currentPageIndex展示視圖body: pageLists[_currentPageIndex],// 設(shè)置底部tabbarbottomNavigationBar: BottomNavigationBar(currentIndex: _currentPageIndex,onTap: _onTapHandler,type: BottomNavigationBarType.fixed,fixedColor: Colors.black,items: [BottomNavigationBarItem(icon: Icon(Icons.explore),label: "explore"),BottomNavigationBarItem(icon: Icon(Icons.history),label: "history"),BottomNavigationBarItem(icon: Icon(Icons.person),label: "My"),]));}
}

效果圖如下:
請(qǐng)?zhí)砑訄D片描述

http://www.risenshineclean.com/news/6134.html

相關(guān)文章:

  • 河北保定網(wǎng)站建設(shè)seo視頻教程百度網(wǎng)盤
  • 專業(yè)網(wǎng)站策劃 西安游戲推廣怎么做引流
  • 如何做網(wǎng)站標(biāo)頭深圳網(wǎng)站seo
  • 房城鄉(xiāng)建設(shè)部門戶網(wǎng)站百度框架戶開戶渠道
  • 網(wǎng)站視頻彈窗廣告代碼軟文標(biāo)題寫作技巧
  • 服務(wù)器做網(wǎng)站用什么系統(tǒng)磁力寶
  • 買完域名后如何建設(shè)網(wǎng)站互聯(lián)網(wǎng)營(yíng)銷師培訓(xùn)大綱
  • 初中做網(wǎng)站軟件千度seo
  • 網(wǎng)站制作 網(wǎng)絡(luò)推廣武漢整站seo數(shù)據(jù)上云
  • asp動(dòng)態(tài)網(wǎng)站開發(fā)畢業(yè)設(shè)計(jì)營(yíng)銷推廣的平臺(tái)
  • 揚(yáng)州服務(wù)器租用seo成都培訓(xùn)
  • 河南企業(yè)網(wǎng)站營(yíng)銷設(shè)計(jì)網(wǎng)絡(luò)營(yíng)銷品牌案例
  • 專業(yè)做網(wǎng)站+上海水果店推廣營(yíng)銷方案
  • 如何利用微博推廣網(wǎng)站so導(dǎo)航 抖音
  • 為了 門戶網(wǎng)站建設(shè)優(yōu)化課程
  • 做收費(fèi)網(wǎng)站成都百度推廣公司聯(lián)系電話
  • 網(wǎng)站建設(shè)與網(wǎng)頁(yè)設(shè)計(jì)作業(yè)軟文世界平臺(tái)
  • 畢業(yè)設(shè)計(jì)做網(wǎng)站答辯深圳剛剛突然宣布
  • 做返利網(wǎng)站能賺錢么網(wǎng)絡(luò)營(yíng)銷做得好的企業(yè)有哪些
  • 贛州網(wǎng)站制作培訓(xùn)建網(wǎng)站找哪個(gè)平臺(tái)好呢
  • 表情包在線制作網(wǎng)站網(wǎng)絡(luò)搜索關(guān)鍵詞排名
  • 網(wǎng)站站內(nèi)交換鏈接怎么做創(chuàng)建網(wǎng)站
  • 廈門做網(wǎng)頁(yè)網(wǎng)站的公司怎么自己制作一個(gè)網(wǎng)站
  • 做網(wǎng)站買二手域名網(wǎng)絡(luò)營(yíng)銷推廣培訓(xùn)機(jī)構(gòu)
  • 網(wǎng)站欄目模板如何選擇谷歌seo課程
  • 大站網(wǎng)站建設(shè)百度自動(dòng)優(yōu)化
  • 遵義網(wǎng)站建設(shè)中心seo優(yōu)化專員編輯
  • 龍華建設(shè)網(wǎng)站企業(yè)郵箱查詢
  • 如何在路由器上做網(wǎng)站轉(zhuǎn)跳app下載推廣
  • 網(wǎng)站建設(shè)游戲公司免費(fèi)手游推廣代理平臺(tái)渠道