1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(new MyApp());
  4.  
  5. class MyApp extends StatelessWidget {
  6. @override
  7. Widget build(BuildContext context) {
  8. return new MaterialApp(
  9. title: 'Flutter Demo',
  10. theme: new ThemeData(
  11. primarySwatch: Colors.blue,
  12. ),
  13. home: new ScaffoldRoute(),
  14. );
  15. }
  16. }
  17.  
  18. class ScaffoldRoute extends StatefulWidget {
  19. @override
  20. _ScaffoldRouteState createState() => _ScaffoldRouteState();
  21. }
  22.  
  23. class _ScaffoldRouteState extends State<ScaffoldRoute> {
  24. int _selectedIndex = ;
  25.  
  26. @override
  27. Widget build(BuildContext context) {
  28. return Scaffold(
  29. appBar: AppBar( //导航栏
  30. title: Text("App Name"),
  31. actions: <Widget>[ //导航栏右侧菜单
  32. IconButton(icon: Icon(Icons.share), onPressed: () {}),
  33. ],
  34. ),
  35. drawer: new MyDrawer(), //抽屉
  36. bottomNavigationBar: BottomAppBar(
  37. color: Colors.white,
  38. shape: CircularNotchedRectangle(), // 底部导航栏打一个圆形的洞
  39. child: Row(
  40. children: [
  41. IconButton(icon: Icon(Icons.home)),
  42. SizedBox(), //中间位置空出
  43. IconButton(icon: Icon(Icons.business)),
  44. ],
  45. mainAxisAlignment: MainAxisAlignment.spaceAround, //均分底部导航栏横向空间
  46. ),
  47. )
  48. /*
  49. bottomNavigationBar: BottomNavigationBar( // 底部导航
  50. items: <BottomNavigationBarItem>[
  51. BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('Home')),
  52. BottomNavigationBarItem(icon: Icon(Icons.business), title: Text('Business')),
  53. BottomNavigationBarItem(icon: Icon(Icons.school), title: Text('School')),
  54. ],
  55. currentIndex: _selectedIndex,
  56. fixedColor: Colors.blue,
  57. onTap: _onItemTapped,
  58. ),
  59. */
  60. // floatingActionButton: FloatingActionButton( //悬浮按钮
  61. // child: Icon(Icons.add),
  62. // onPressed:_onAdd
  63. //),
  64.  
  65. );
  66. }
  67. void _onItemTapped(int index) {
  68. setState(() {
  69. _selectedIndex = index;
  70. });
  71. }
  72. void _onAdd(){
  73. }
  74. }
  75.  
  76. class MyDrawer extends StatelessWidget {
  77. const MyDrawer({
  78. Key key,
  79. }) : super(key: key);
  80.  
  81. @override
  82. Widget build(BuildContext context) {
  83. return Drawer(
  84. child: MediaQuery.removePadding(
  85. context: context,
  86. // DrawerHeader consumes top MediaQuery padding.
  87. removeTop: true,
  88. child: Column(
  89. crossAxisAlignment: CrossAxisAlignment.start,
  90. children: <Widget>[
  91. Padding(
  92. padding: const EdgeInsets.only(top: 38.0),
  93. child: Row(
  94. children: <Widget>[
  95. Padding(
  96. padding: const EdgeInsets.symmetric(horizontal: 16.0),
  97. child: ClipOval(
  98. child: Image.asset(
  99. "imgs/avatar.png",
  100. width: ,
  101. ),
  102. ),
  103. ),
  104. Text(
  105. "Wendux",
  106. style: TextStyle(fontWeight: FontWeight.bold),
  107. )
  108. ],
  109. ),
  110. ),
  111. Expanded(
  112. child: ListView(
  113. children: <Widget>[
  114. ListTile(
  115. leading: const Icon(Icons.add),
  116. title: const Text('Add account'),
  117. ),
  118. ListTile(
  119. leading: const Icon(Icons.settings),
  120. title: const Text('Manage accounts'),
  121. ),
  122. ],
  123. ),
  124. ),
  125. ],
  126. ),
  127. ),
  128. );
  129. }
  130. }

dart实例的更多相关文章

  1. 最近学习工作流 推荐一个activiti 的教程文档

    全文地址:http://www.mossle.com/docs/activiti/ Activiti 5.15 用户手册 Table of Contents 1. 简介 协议 下载 源码 必要的软件 ...

  2. Dart编程实例 - 类型测试操作符 is!

    Dart编程实例 - 类型测试操作符 is! void main() { double n = 2.20; var num = n is! int; print(num); } 本文转自:http:/ ...

  3. Dart编程实例 - 类型测试操作符is

    Dart编程实例 - 类型测试操作符is void main() { int n = 2; print(n is int); } 本文转自:http://codingdict.com/article/ ...

  4. Dart编程实例 - 相等和关系操作符

    Dart编程实例 - 相等和关系操作符 void main() { var num1 = 5; var num2 = 9; var res = num1>num2; print('num1 gr ...

  5. Dart编程实例 算术操作符

    Dart编程实例 算术操作符 void main() { var num1 = 101; var num2 = 2; var res = 0; res = num1+num2; print(" ...

  6. Dart编程实例 - Const 关键字

    Dart编程实例 - Const 关键字 void main() { final v1 = 12; const v2 = 13; v2 = 12; } 本文转自:http://codingdict.c ...

  7. Dart编程实例 - Final 关键字

    Dart编程实例 - Final 关键字 void main() { final val1 = 12; print(val1); } 本文转自:http://codingdict.com/articl ...

  8. Dart编程实例 - Dynamic 关键字

    Dart编程实例 - Dynamic 关键字 void main() { dynamic x = "tom"; print(x); } 本文转自:http://codingdict ...

  9. Dart编程实例 - Dart 面向对象编程

    Dart编程实例 - Dart 面向对象编程 class TestClass { void disp() { print("Hello World"); } } void main ...

随机推荐

  1. jQuery-导航下拉菜单-实用简单

    /*CSS代碼*/ /*導航*/ .nav{background: url("../img/menu_bar.gif") repeat-x;} .nav ul li{display ...

  2. 检索系统向量化计算query-doc相似度

    def cal_sim2(A,B): ''' A :query [1,2] B: answers [[1,2],[3,5]] ''' need_norm=False A = np.array(A) B ...

  3. vs2013未找到与约束匹配的导出

    解决方法: 1.关闭VS: 2.去C:/Users/<your users name>/AppData/Local/Microsoft/VisualStudio/12.0/Componen ...

  4. jQuery选择器--:selected和:checked

    :selected 概述 匹配所有选中的option元素 <!DOCTYPE html> <html> <head> <meta charset=" ...

  5. css 箭头

    .toTop{ width: 2.5rem; height: 2.5rem; background-color: rgba(228,228,228,.6); position: fixed; bott ...

  6. File §2

    Previously speaking,File can be seen as one ducument, also can be seen as list of documents like dir ...

  7. idea下导入Tomcat源码

    对于web开发者来说,如果明白了tomcat那对于开发还是后面的学习都是有很大益处的,但在网上看了很多的文章,总是没弄好,经历了很久才弄好了,写个文章记录下,希望也能帮助到其他人.下载Tomcat源码 ...

  8. Autel MaxiSys Elite Diagnostic Tool Common problem solving methods

    1. updating MaxiFlash Elite to firmware 3.21? My maxisys communicate with the MaxiFlash J2534 but Ma ...

  9. 自学Java第三个星期的总结

    在这一周里我在网上学习了java的分支结构.Number&Matht类.Character类.string类.String Buffer和String Builder类以及数组和日期时间等有关 ...

  10. JVM虚拟机详解

    1. 什么是JVM? JVM是Java Virtual Machine(Java虚拟机)的缩写,JVM是一种用于计算设备的规范,它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来 ...