dart实例
- import 'package:flutter/material.dart';
- void main() => runApp(new MyApp());
- class MyApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return new MaterialApp(
- title: 'Flutter Demo',
- theme: new ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: new ScaffoldRoute(),
- );
- }
- }
- class ScaffoldRoute extends StatefulWidget {
- @override
- _ScaffoldRouteState createState() => _ScaffoldRouteState();
- }
- class _ScaffoldRouteState extends State<ScaffoldRoute> {
- int _selectedIndex = ;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar( //导航栏
- title: Text("App Name"),
- actions: <Widget>[ //导航栏右侧菜单
- IconButton(icon: Icon(Icons.share), onPressed: () {}),
- ],
- ),
- drawer: new MyDrawer(), //抽屉
- bottomNavigationBar: BottomAppBar(
- color: Colors.white,
- shape: CircularNotchedRectangle(), // 底部导航栏打一个圆形的洞
- child: Row(
- children: [
- IconButton(icon: Icon(Icons.home)),
- SizedBox(), //中间位置空出
- IconButton(icon: Icon(Icons.business)),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceAround, //均分底部导航栏横向空间
- ),
- )
- /*
- bottomNavigationBar: BottomNavigationBar( // 底部导航
- items: <BottomNavigationBarItem>[
- BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('Home')),
- BottomNavigationBarItem(icon: Icon(Icons.business), title: Text('Business')),
- BottomNavigationBarItem(icon: Icon(Icons.school), title: Text('School')),
- ],
- currentIndex: _selectedIndex,
- fixedColor: Colors.blue,
- onTap: _onItemTapped,
- ),
- */
- // floatingActionButton: FloatingActionButton( //悬浮按钮
- // child: Icon(Icons.add),
- // onPressed:_onAdd
- //),
- );
- }
- void _onItemTapped(int index) {
- setState(() {
- _selectedIndex = index;
- });
- }
- void _onAdd(){
- }
- }
- class MyDrawer extends StatelessWidget {
- const MyDrawer({
- Key key,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Drawer(
- child: MediaQuery.removePadding(
- context: context,
- // DrawerHeader consumes top MediaQuery padding.
- removeTop: true,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.only(top: 38.0),
- child: Row(
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: ClipOval(
- child: Image.asset(
- "imgs/avatar.png",
- width: ,
- ),
- ),
- ),
- Text(
- "Wendux",
- style: TextStyle(fontWeight: FontWeight.bold),
- )
- ],
- ),
- ),
- Expanded(
- child: ListView(
- children: <Widget>[
- ListTile(
- leading: const Icon(Icons.add),
- title: const Text('Add account'),
- ),
- ListTile(
- leading: const Icon(Icons.settings),
- title: const Text('Manage accounts'),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
dart实例的更多相关文章
- 最近学习工作流 推荐一个activiti 的教程文档
全文地址:http://www.mossle.com/docs/activiti/ Activiti 5.15 用户手册 Table of Contents 1. 简介 协议 下载 源码 必要的软件 ...
- Dart编程实例 - 类型测试操作符 is!
Dart编程实例 - 类型测试操作符 is! void main() { double n = 2.20; var num = n is! int; print(num); } 本文转自:http:/ ...
- Dart编程实例 - 类型测试操作符is
Dart编程实例 - 类型测试操作符is void main() { int n = 2; print(n is int); } 本文转自:http://codingdict.com/article/ ...
- Dart编程实例 - 相等和关系操作符
Dart编程实例 - 相等和关系操作符 void main() { var num1 = 5; var num2 = 9; var res = num1>num2; print('num1 gr ...
- Dart编程实例 算术操作符
Dart编程实例 算术操作符 void main() { var num1 = 101; var num2 = 2; var res = 0; res = num1+num2; print(" ...
- Dart编程实例 - Const 关键字
Dart编程实例 - Const 关键字 void main() { final v1 = 12; const v2 = 13; v2 = 12; } 本文转自:http://codingdict.c ...
- Dart编程实例 - Final 关键字
Dart编程实例 - Final 关键字 void main() { final val1 = 12; print(val1); } 本文转自:http://codingdict.com/articl ...
- Dart编程实例 - Dynamic 关键字
Dart编程实例 - Dynamic 关键字 void main() { dynamic x = "tom"; print(x); } 本文转自:http://codingdict ...
- Dart编程实例 - Dart 面向对象编程
Dart编程实例 - Dart 面向对象编程 class TestClass { void disp() { print("Hello World"); } } void main ...
随机推荐
- jQuery-导航下拉菜单-实用简单
/*CSS代碼*/ /*導航*/ .nav{background: url("../img/menu_bar.gif") repeat-x;} .nav ul li{display ...
- 检索系统向量化计算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 ...
- vs2013未找到与约束匹配的导出
解决方法: 1.关闭VS: 2.去C:/Users/<your users name>/AppData/Local/Microsoft/VisualStudio/12.0/Componen ...
- jQuery选择器--:selected和:checked
:selected 概述 匹配所有选中的option元素 <!DOCTYPE html> <html> <head> <meta charset=" ...
- css 箭头
.toTop{ width: 2.5rem; height: 2.5rem; background-color: rgba(228,228,228,.6); position: fixed; bott ...
- File §2
Previously speaking,File can be seen as one ducument, also can be seen as list of documents like dir ...
- idea下导入Tomcat源码
对于web开发者来说,如果明白了tomcat那对于开发还是后面的学习都是有很大益处的,但在网上看了很多的文章,总是没弄好,经历了很久才弄好了,写个文章记录下,希望也能帮助到其他人.下载Tomcat源码 ...
- 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 ...
- 自学Java第三个星期的总结
在这一周里我在网上学习了java的分支结构.Number&Matht类.Character类.string类.String Buffer和String Builder类以及数组和日期时间等有关 ...
- JVM虚拟机详解
1. 什么是JVM? JVM是Java Virtual Machine(Java虚拟机)的缩写,JVM是一种用于计算设备的规范,它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来 ...