flutter 涓婚〉闈㈠簳閮ㄥ鑸爮瀹炵幇浠ュ強涓婚椋庢牸璁剧疆
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flutter 涓婚〉闈㈠簳閮ㄥ鑸爮瀹炵幇浠ュ強涓婚椋庢牸璁剧疆相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/lap' title='lap'>lap ide info swa nba type uil rri watch
import 鈥榩ackage:flutter/material.dart鈥?span style="color: #000000;">; import 鈥榩ackage:flutter_app/bottom_navigation_widget.dart鈥?span style="color: #000000;">; void main() => runApp(MyApp()); class MyApp extends StatelessWidget @override Widget build(BuildContext context) return MaterialApp( title: 鈥楩lutter Demo鈥?span style="color: #000000;">, theme: ThemeData( primarySwatch: Colors.green, //瀹氫箟涓婚椋庢牸 primarySwatch ), home: new BottomNavigationWidget(), );
import 鈥榩ackage:flutter/material.dart鈥?span style="color: #000000;">; import 鈥榩ackage:flutter_app/pages/AirplayScreen.dart鈥?span style="color: #000000;">; import 鈥榩ackage:flutter_app/pages/EmailScreen.dart鈥?span style="color: #000000;">; import 鈥榩ackage:flutter_app/pages/HomeScreen.dart鈥?span style="color: #000000;">; import 鈥榩ackage:flutter_app/pages/PagesScreen.dart鈥?span style="color: #000000;">; class BottomNavigationWidget extends StatefulWidget _BottomNavigationWidgetState createState() => _BottomNavigationWidgetState(); class _BottomNavigationWidgetState extends State<BottomNavigationWidget> // final _BottomNavigationColor = Colors.blue; int _currentIndex = 0; List<Widget> list = List(); @override void initState() list ..add(HomeScreen()) ..add(EmailScreen()) ..add(PagesScreen()) ..add(AirplayScreen()); super.initState(); @override Widget build(BuildContext context) return Scaffold( body: list[_currentIndex], bottomNavigationBar: BottomNavigationBar( items: [ BottomNavigationBarItem( icon:Icon( Icons.home, // color:_BottomNavigationColor, ), title:Text( 鈥楬ome鈥?span style="color: #000000;">, // style:TextStyle(color:_BottomNavigationColor) ) ), BottomNavigationBarItem( icon:Icon( Icons.email, // color:_BottomNavigationColor, ), title:Text( 鈥楨mail鈥?span style="color: #000000;">, // style:TextStyle(color:_BottomNavigationColor) ) ), BottomNavigationBarItem( icon:Icon( Icons.pages, // color:_BottomNavigationColor, ), title:Text( 鈥楶ages鈥?span style="color: #000000;">, // style:TextStyle(color:_BottomNavigationColor) ) ), BottomNavigationBarItem( icon:Icon( Icons.airplay, // color:_BottomNavigationColor, ), title:Text( 鈥楢ipPlay鈥?span style="color: #000000;">, // style:TextStyle(color:_BottomNavigationColor) ) ), ], currentIndex:_currentIndex, onTap:(int index) setState(() _currentIndex= index; ); , selectedItemColor: Colors.green, // unselectedItemColor: Colors.grey, type:BottomNavigationBarType.fixed ), );
HomeScreen.dart
import 鈥榩ackage:flutter/material.dart鈥?span style="color: #000000;">; class HomeScreen extends StatelessWidget @override Widget build(BuildContext context) return Scaffold( appBar:AppBar( title: Text(鈥楬OME鈥?span style="color: #000000;">), ), body:Center( child: Text(鈥楬OME鈥?span style="color: #000000;">), ) );
鍏朵粬椤甸潰绫讳技
鏁堟灉锛?/p>
以上是关于flutter 涓婚〉闈㈠簳閮ㄥ鑸爮瀹炵幇浠ュ強涓婚椋庢牸璁剧疆的主要内容,如果未能解决你的问题,请参考以下文章