refactor(conflict):

This commit is contained in:
sanfan.hx
2019-02-01 12:54:05 +08:00
189 changed files with 2675 additions and 964 deletions

View File

@ -0,0 +1,679 @@
# Flutter Go 代码开发规范 0.1.0 版
## 代码风格
### 标识符三种类型
#### 大驼峰
类、枚举、typedef和类型参数
```
class SliderMenu { ... }
class HttpRequest { ... }
typedef Predicate = bool Function<T>(T value);
```
包括用于元数据注释的类
```
class Foo {
const Foo([arg]);
}
@Foo(anArg)
class A { ... }
@Foo()
class B { ... }
```
#### 使用小写加下划线来命名库和源文件
```
library peg_parser.source_scanner;
import 'file_system.dart';
import 'slider_menu.dart';
```
不推荐如下写法:
```
library pegparser.SourceScanner;
import 'file-system.dart';
import 'SliderMenu.dart';
```
#### 使用小写加下划线来命名导入前缀
```
import 'dart:math' as math;
import 'package:angular_components/angular_components'
as angular_components;
import 'package:js/js.dart' as js;
```
不推荐如下写法:
```
import 'dart:math' as Math;
import 'package:angular_components/angular_components'
as angularComponents;
import 'package:js/js.dart' as JS;
```
#### 使用小驼峰法命名其他标识符
```
var item;
HttpRequest httpRequest;
void align(bool clearItems) {
// ...
}
```
#### 优先使用小驼峰法作为常量命名
```
const pi = 3.14;
const defaultTimeout = 1000;
final urlScheme = RegExp('^([a-z]+):');
class Dice {
static final numberGenerator = Random();
}
```
不推荐如下写法:
```
const PI = 3.14;
const DefaultTimeout = 1000;
final URL_SCHEME = RegExp('^([a-z]+):');
class Dice {
static final NUMBER_GENERATOR = Random();
}
```
#### 不使用前缀字母
因为Dart可以告诉您声明的类型、范围、可变性和其他属性所以没有理由将这些属性编码为标识符名称。
```
defaultTimeout
```
不推荐如下写法:
```
kDefaultTimeout
```
### 排序
为了使你的文件前言保持整洁,我们有规定的命令,指示应该出现在其中。每个“部分”应该用空行分隔。
#### 在其他引入之前引入所需的dart库
```
import 'dart:async';
import 'dart:html';
import 'package:bar/bar.dart';
import 'package:foo/foo.dart';
```
#### 在相对引入之前先引入在包中的库
```
import 'package:bar/bar.dart';
import 'package:foo/foo.dart';
import 'util.dart';
```
#### 第三方包的导入先于其他包
```
import 'package:bar/bar.dart';
import 'package:foo/foo.dart';
import 'package:my_package/util.dart';
```
#### 在所有导入之后,在单独的部分中指定导出
```
import 'src/error.dart';
import 'src/foo_bar.dart';
export 'src/error.dart';
```
不推荐如下写法:
```
import 'src/error.dart';
export 'src/error.dart';
import 'src/foo_bar.dart';
```
### 所有流控制结构,请使用大括号
这样做可以避免悬浮的else问题
```
if (isWeekDay) {
print('Bike to work!');
} else {
print('Go dancing or read a book!');
}
```
#### 例外
一个if语句没有else子句其中整个if语句和then主体都适合一行。在这种情况下如果你喜欢的话你可以去掉大括号
```
if (arg == null) return defaultValue;
```
如果流程体超出了一行需要分划请使用大括号:
```
if (overflowChars != other.overflowChars) {
return overflowChars < other.overflowChars;
}
```
不推荐如下写法:
```
if (overflowChars != other.overflowChars)
return overflowChars < other.overflowChars;
```
## 注释
### 要像句子一样格式化
除非是区分大小写的标识符,否则第一个单词要大写。以句号结尾(或“!”或“?”)。对于所有的注释都是如此doc注释、内联内容甚至TODOs。即使是一个句子片段。
```
greet(name) {
// Assume we have a valid name.
print('Hi, $name!');
}
```
不推荐如下写法:
```
greet(name) {
/* Assume we have a valid name. */
print('Hi, $name!');
}
```
可以使用块注释(/…/)临时注释掉一段代码,但是所有其他注释都应该使用//
### Doc注释
使用///文档注释来记录成员和类型。
使用doc注释而不是常规注释可以让dartdoc找到并生成文档。
```
/// The number of characters in this chunk when unsplit.
int get length => ...
```
> 由于历史原因,达特茅斯学院支持道格评论的两种语法:///(“C#风格”)和/**…* /(“JavaDoc风格”)。我们更喜欢/// 因为它更紧凑。/**和*/在多行文档注释中添加两个无内容的行。在某些情况下,///语法也更容易阅读,例如文档注释包含使用*标记列表项的项目符号列表。
### 考虑为私有api编写文档注释
Doc注释并不仅仅针对库的公共API的外部使用者。它们还有助于理解从库的其他部分调用的私有成员
#### 用一句话总结开始doc注释
以简短的、以用户为中心的描述开始你的文档注释,以句号结尾。
```
/// Deletes the file at [path] from the file system.
void delete(String path) {
...
}
```
不推荐如下写法:
```
/// Depending on the state of the file system and the user's permissions,
/// certain operations may or may not be possible. If there is no file at
/// [path] or it can't be accessed, this function throws either [IOError]
/// or [PermissionError], respectively. Otherwise, this deletes the file.
void delete(String path) {
...
}
```
#### “doc注释”的第一句话分隔成自己的段落
在第一个句子之后添加一个空行,把它分成自己的段落
```
/// Deletes the file at [path].
///
/// Throws an [IOError] if the file could not be found. Throws a
/// [PermissionError] if the file is present but could not be deleted.
void delete(String path) {
...
}
```
## Flutter_Go 使用参考
### 库的引用
flutter go 中导入lib下文件库统一指定报名避免过多的```../../```
```
package:flutter_go/
```
### 字符串的使用
#### 使用相邻字符串连接字符串文字
如果有两个字符串字面值(不是值,而是实际引用的字面值),则不需要使用+连接它们。就像在C和c++中,简单地把它们放在一起就能做到。这是创建一个长字符串很好的方法但是不适用于单独一行。
```
raiseAlarm(
'ERROR: Parts of the spaceship are on fire. Other '
'parts are overrun by martians. Unclear which are which.');
```
不推荐如下写法:
```
raiseAlarm('ERROR: Parts of the spaceship are on fire. Other ' +
'parts are overrun by martians. Unclear which are which.');
```
#### 优先使用模板字符串
```
'Hello, $name! You are ${year - birth} years old.';
```
#### 在不需要的时候,避免使用花括号
```
'Hi, $name!'
"Wear your wildest $decade's outfit."
```
不推荐如下写法:
```
'Hello, ' + name + '! You are ' + (year - birth).toString() + ' y...';
```
不推荐如下写法:
```
'Hi, ${name}!'
"Wear your wildest ${decade}'s outfit."
```
### 集合
#### 尽可能使用集合字面量
如果要创建一个不可增长的列表,或者其他一些自定义集合类型,那么无论如何,都要使用构造函数。
```
var points = [];
var addresses = {};
var lines = <Lines>[];
```
不推荐如下写法:
```
var points = List();
var addresses = Map();
```
#### 不要使用.length查看集合是否为空
```
if (lunchBox.isEmpty) return 'so hungry...';
if (words.isNotEmpty) return words.join(' ');
```
不推荐如下写法:
```
if (lunchBox.length == 0) return 'so hungry...';
if (!words.isEmpty) return words.join(' ');
```
#### 考虑使用高阶方法转换序列
如果有一个集合,并且希望从中生成一个新的修改后的集合,那么使用.map()、.where()和Iterable上的其他方便的方法通常更短也更具有声明性
```
var aquaticNames = animals
.where((animal) => animal.isAquatic)
.map((animal) => animal.name);
```
#### 避免使用带有函数字面量的Iterable.forEach()
在Dart中如果你想遍历一个序列惯用的方法是使用循环。
```
for (var person in people) {
...
}
```
不推荐如下写法:
```
people.forEach((person) {
...
});
```
#### 不要使用List.from(),除非打算更改结果的类型
给定一个迭代,有两种明显的方法可以生成包含相同元素的新列表
```
var copy1 = iterable.toList();
var copy2 = List.from(iterable);
```
明显的区别是第一个比较短。重要的区别是第一个保留了原始对象的类型参数
```
// Creates a List<int>:
var iterable = [1, 2, 3];
// Prints "List<int>":
print(iterable.toList().runtimeType);
```
```
// Creates a List<int>:
var iterable = [1, 2, 3];
// Prints "List<dynamic>":
print(List.from(iterable).runtimeType);
```
### 参数的使用
#### 使用=将命名参数与其默认值分割开
由于遗留原因Dart均允许“:”和“=”作为指定参数的默认值分隔符。为了与可选的位置参数保持一致,使用“=”。
```
void insert(Object item, {int at = 0}) { ... }
```
不推荐如下写法:
```
void insert(Object item, {int at: 0}) { ... }
```
#### 不要使用显式默认值null
如果参数是可选的但没有给它一个默认值则语言隐式地使用null作为默认值因此不需要编写它
```
void error([String message]) {
stderr.write(message ?? '\n');
}
```
不推荐如下写法:
```
void error([String message = null]) {
stderr.write(message ?? '\n');
}
```
### 变量
#### 不要显式地将变量初始化为空
在Dart中未显式初始化的变量或字段自动被初始化为null。不要多余赋值null
```
int _nextId;
class LazyId {
int _id;
int get id {
if (_nextId == null) _nextId = 0;
if (_id == null) _id = _nextId++;
return _id;
}
}
```
不推荐如下写法:
```
int _nextId = null;
class LazyId {
int _id = null;
int get id {
if (_nextId == null) _nextId = 0;
if (_id == null) _id = _nextId++;
return _id;
}
}
```
#### 避免储存你能计算的东西
在设计类时,您通常希望将多个视图公开到相同的底层状态。通常你会看到在构造函数中计算所有视图的代码,然后存储它们:
应该避免的写法:
```
class Circle {
num radius;
num area;
num circumference;
Circle(num radius)
: radius = radius,
area = pi * radius * radius,
circumference = pi * 2.0 * radius;
}
```
如上代码问题:
- 浪费内存
- 缓存的问题是无效——如何知道何时缓存过期需要重新计算?
推荐的写法如下:
```
class Circle {
num radius;
Circle(this.radius);
num get area => pi * radius * radius;
num get circumference => pi * 2.0 * radius;
}
```
### 类成员
#### 不要把不必要地将字段包装在getter和setter中
不推荐如下写法:
```
class Box {
var _contents;
get contents => _contents;
set contents(value) {
_contents = value;
}
}
```
#### 优先使用final字段来创建只读属性
尤其对于 ```StatelessWidget```
#### 在不需要的时候不要用this
不推荐如下写法:
```
class Box {
var value;
void clear() {
this.update(null);
}
void update(value) {
this.value = value;
}
}
```
推荐如下写法:
```
class Box {
var value;
void clear() {
update(null);
}
void update(value) {
this.value = value;
}
}
```
### 构造函数
#### 尽可能使用初始化的形式
不推荐如下写法:
```
class Point {
num x, y;
Point(num x, num y) {
this.x = x;
this.y = y;
}
}
```
推荐如下写法:
```
class Point {
num x, y;
Point(this.x, this.y);
}
```
#### 不要使用new
Dart2使new 关键字可选
推荐写法:
```
Widget build(BuildContext context) {
return Row(
children: [
RaisedButton(
child: Text('Increment'),
),
Text('Click!'),
],
);
}
```
不推荐如下写法:
```
Widget build(BuildContext context) {
return new Row(
children: [
new RaisedButton(
child: new Text('Increment'),
),
new Text('Click!'),
],
);
}
```
### 异步
#### 优先使用async/await代替原始的futures
async/await语法提高了可读性允许你在异步代码中使用所有Dart控制流结构。
```
Future<int> countActivePlayers(String teamName) async {
try {
var team = await downloadTeam(teamName);
if (team == null) return 0;
var players = await team.roster;
return players.where((player) => player.isActive).length;
} catch (e) {
log.error(e);
return 0;
}
}
```
#### 当异步没有任何用处时,不要使用它
如果可以在不改变函数行为的情况下省略异步,那么就这样做。、
```
Future afterTwoThings(Future first, Future second) {
return Future.wait([first, second]);
}
```
不推荐写法:
```
Future afterTwoThings(Future first, Future second) async {
return Future.wait([first, second]);
}
```

View File

@ -3,12 +3,21 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.
> 帮助开发者快速上手 Flutter **内部测试中1.0 正式版将于 2月 20日 发布。** > 帮助开发者快速上手 Flutter **内部测试中1.0 正式版将于 2月 20日 发布。**
## 版本更新历史
> 按时间顺序,展示重要的提交更新内容。
[地址](https://github.com/alibaba/flutter-go/blob/develop/CHANGE-LOG.md)
## 开发规范
> 由于类似 javascript, java, object-c,等开发者的语言习惯不同而产生歧义,我们依据官方提供的 [dart 语言规范](https://www.dartlang.org) 定制。
[<< Flutter Go 开发规范第一版 >>](https://github.com/alibaba/flutter-go/blob/develop/Flutter_Go%20%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91%E8%A7%84%E8%8C%83.md)
## Release安装包下载地址 ## Release安装包下载地址
android下载地址: android下载地址:
<img src="https://img.alicdn.com/tfs/TB1q1GVB4naK1RjSZFtXXbC2VXa-195-198.png" width="200px"> <img src="https://img.alicdn.com/tfs/TB1Hy1FEzDpK1RjSZFrXXa78VXa-386-384.png" width="200px">
iphone下载地址: iphone下载地址:
暂无 暂无
@ -48,7 +57,7 @@ flutter优点主要包括
### app 预览 ### app 预览
<img src="https://img.alicdn.com/tfs/TB1oeicBhjaK1RjSZFAXXbdLFXa-345-717.gif" width=200> <img src="https://img.alicdn.com/tfs/TB1WJNuBmzqK1RjSZPcXXbTepXa-345-717.gif" width=200> <img src="https://img.alicdn.com/tfs/TB13Xh3BkvoK1RjSZFNXXcxMVXa-345-717.gif" width=200> <img src="https://img.alicdn.com/tfs/TB1MtdSBjDpK1RjSZFrXXa78VXa-345-717.gif" width=200> <img src="https://img.alicdn.com/tfs/TB1MoiNExTpK1RjSZFGXXcHqFXa-362-751.gif" width=200> <img src="https://img.alicdn.com/tfs/TB1oeicBhjaK1RjSZFAXXbdLFXa-345-717.gif" width=200> <img src="https://img.alicdn.com/tfs/TB13Xh3BkvoK1RjSZFNXXcxMVXa-345-717.gif" width=200> <img src="https://img.alicdn.com/tfs/TB1MtdSBjDpK1RjSZFrXXa78VXa-345-717.gif" width=200>
### Core Team ### Core Team

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

View File

@ -11,6 +11,7 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; }; 333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
@ -42,6 +43,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@ -92,6 +94,7 @@
children = ( children = (
3B80C3931E831B6300D905FE /* App.framework */, 3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */, 9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@ -209,6 +212,7 @@
files = ( files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
084A20882202E4FD00428FF5 /* flutter go.png in Resources */, 084A20882202E4FD00428FF5 /* flutter go.png in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
@ -449,7 +453,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.ttt.flutterRookieBook; PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterRookieBook;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -473,7 +477,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.ttt.flutterRookieBook; PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterRookieBook;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };

View File

@ -20,6 +20,7 @@ class _FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
print('widget.filePath=======${widget.filePath}');
getExampleCode(context,'${widget.filePath}', DefaultAssetBundle.of(context)) getExampleCode(context,'${widget.filePath}', DefaultAssetBundle.of(context))
.then<void>((String code) { .then<void>((String code) {
if (mounted) { if (mounted) {

View File

@ -78,6 +78,9 @@ class WidgetName2Icon {
"IconData":Icons.date_range, "IconData":Icons.date_range,
"IconThemeData":Icons.insert_comment, "IconThemeData":Icons.insert_comment,
"Canvas":Icons.edit, "Canvas":Icons.edit,
"PainterPath":Icons.gesture,
"CircleProgressBarPainter":Icons.av_timer,
"PainterSketch":Icons.touch_app,
"Material":Icons.android, "Material":Icons.android,
"MaterialApp":Icons.android, "MaterialApp":Icons.android,
"MaterialButton":Icons.speaker, "MaterialButton":Icons.speaker,

View File

@ -4,7 +4,7 @@ class Application {
static Router router; static Router router;
static TabController controller; static TabController controller;
static Map<String, String> github = { static Map<String, String> github = {
'widgetsURL':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/develop/lib/widgets/', 'widgetsURL':'https://github.com/alibaba/flutter-go/blob/develop/lib/widgets/',
//'develop':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/develop/lib/widgets/', //'develop':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/develop/lib/widgets/',
//'master':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/master/lib/widgets/' //'master':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/master/lib/widgets/'
}; };

View File

@ -59,6 +59,7 @@ class Provider {
//Get a location using getDatabasesPath //Get a location using getDatabasesPath
String databasesPath = await getDatabasesPath(); String databasesPath = await getDatabasesPath();
String path = join(databasesPath, 'flutter.db'); String path = join(databasesPath, 'flutter.db');
print(path);
try { try {
db = await openDatabase(path); db = await openDatabase(path);
} catch (e) { } catch (e) {

View File

@ -17,7 +17,7 @@ import 'package:flutter_go/views/widget_page/widget_page.dart';
import 'package:flutter_go/views/welcome_page/fourth_page.dart'; import 'package:flutter_go/views/welcome_page/fourth_page.dart';
import 'package:flutter_go/views/collection_page/collection_page.dart'; import 'package:flutter_go/views/collection_page/collection_page.dart';
import 'package:flutter_go/routers/application.dart'; import 'package:flutter_go/routers/application.dart';
import 'package:flutter_go/utils//provider.dart'; import 'package:flutter_go/utils/provider.dart';
import 'package:flutter_go/model/widget.dart'; import 'package:flutter_go/model/widget.dart';
import 'package:flutter_go/widgets/index.dart'; import 'package:flutter_go/widgets/index.dart';
import 'package:flutter_go/components/search_input.dart'; import 'package:flutter_go/components/search_input.dart';

View File

@ -9,7 +9,7 @@ class WidgetNotFound extends StatelessWidget {
title: Text("widget not found"), title: Text("widget not found"),
), ),
body: Container( body: Container(
child: new Text("widget not found") child: Text("widget not found")
) )
); );
} }

View File

@ -30,8 +30,8 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_scrollViewController = new ScrollController(); _scrollViewController = ScrollController();
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应 _tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
} }
@override @override
@ -46,26 +46,26 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child:new AppBar( // 大量配置属性参考 SliverAppBar 示例 child: AppBar( // 大量配置属性参考 SliverAppBar 示例
title: new Text('title'), title: Text('title'),
leading: new Icon(Icons.home), leading: Icon(Icons.home),
backgroundColor: Colors.amber[500], backgroundColor: Colors.amber[500],
centerTitle: true, centerTitle: true,
actions: <Widget>[ actions: <Widget>[
new IconButton( IconButton(
icon: new Icon(Icons.add_alarm), icon: Icon(Icons.add_alarm),
tooltip: 'Add Alarm', tooltip: 'Add Alarm',
onPressed: () { onPressed: () {
// do nothing // do nothing
}), }),
new PopupMenuButton<String>( PopupMenuButton<String>(
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem<String>( PopupMenuItem<String>(
value: "price", child: new Text('Sort by price')), value: "price", child: Text('Sort by price')),
new PopupMenuItem<String>( PopupMenuItem<String>(
value: "time", child: new Text('Sort by time')), value: "time", child: Text('Sort by time')),
], ],
onSelected: (String action) { onSelected: (String action) {
switch (action) { switch (action) {
@ -78,16 +78,16 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
} }
}) })
], ],
bottom: new TabBar( bottom: TabBar(
isScrollable: true, isScrollable: true,
controller: _tabController, controller: _tabController,
tabs: <Widget>[ tabs: <Widget>[
new Tab(text: "Tabs 1"), Tab(text: "Tabs 1"),
new Tab(text: "Tabs 2"), Tab(text: "Tabs 2"),
new Tab(text: "Tabs 3"), Tab(text: "Tabs 3"),
new Tab(text: "Tabs 4"), Tab(text: "Tabs 4"),
new Tab(text: "Tabs 5"), Tab(text: "Tabs 5"),
new Tab(text: "Tabs 6"), Tab(text: "Tabs 6"),
], ],
), ),
), ),
@ -107,7 +107,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new SizedBox( return SizedBox(
height: 200, height: 200,
child:AppBar( child:AppBar(
title: Text('My Fancy Dress'), title: Text('My Fancy Dress'),

View File

@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -84,7 +84,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -21,7 +21,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new SizedBox( return SizedBox(
height: 100, height: 100,
child: Scaffold( child: Scaffold(
//appBar: AppBar(title: const Text('Bottom App Bar')), //appBar: AppBar(title: const Text('Bottom App Bar')),

View File

@ -38,7 +38,7 @@ class _DemoState extends State<Demo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WidgetDemo( return WidgetDemo(
title: 'BottomAppBar', title: 'BottomAppBar',
codeUrl: 'componentss/Bar/BottomAppBar/demo.dart', codeUrl: 'components/Bar/BottomAppBar/demo.dart',
contentList: [allDomes(context, this)], contentList: [allDomes(context, this)],
docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html',
); );
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -44,9 +44,9 @@ class ButtonBarLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: new EdgeInsets.symmetric(vertical: 0.0), margin: EdgeInsets.symmetric(vertical: 0.0),
height: 100.0, height: 100.0,
child: new Scrollbar(child:ListView( child: Scrollbar(child:ListView(
scrollDirection: Axis.horizontal, // 水平listView scrollDirection: Axis.horizontal, // 水平listView
children: <Widget>[ children: <Widget>[
ButtonBar( ButtonBar(

View File

@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -44,9 +44,9 @@ class SliverAppBarLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
listData.add(new ListItem("我是测试标题$i", Icons.cake)); listData.add( ListItem("我是测试标题$i", Icons.cake));
} }
return new SizedBox( return SizedBox(
height: 500.0, height: 500.0,
child: NestedScrollView( child: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
@ -89,7 +89,7 @@ class SliverAppBarLessDefault extends StatelessWidget {
// SliverPersistentHeader( // SliverPersistentHeader(
// delegate: _SliverAppBarDelegate( // delegate: _SliverAppBarDelegate(
// TabBar( // TabBar(
// controller: new TabController(length: 2, vsync: this), // controller: TabController(length: 2, vsync: this),
// labelColor: Colors.black87, // labelColor: Colors.black87,
// unselectedLabelColor: Colors.grey, // unselectedLabelColor: Colors.grey,
// tabs: [ // tabs: [
@ -101,10 +101,10 @@ class SliverAppBarLessDefault extends StatelessWidget {
]; ];
}, },
body: Center( body: Center(
child: new ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return new ListItemWidget(listData[index]); return ListItemWidget(listData[index]);
}, },
itemCount: listData.length, itemCount: listData.length,
), ),
@ -127,10 +127,10 @@ class ListItemWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new InkWell( return InkWell(
child: new ListTile( child: ListTile(
leading: new Icon(listItem.iconData), leading: Icon(listItem.iconData),
title: new Text(listItem.title), title: Text(listItem.title),
), ),
onTap: () {}, onTap: () {},
); );

View File

@ -40,7 +40,7 @@ class _DemoState extends State<Demo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WidgetDemo( return WidgetDemo(
title: 'SliverAppBar', title: 'SliverAppBar',
codeUrl: 'componentss/Bar/SliverAppBar/demo.dart', codeUrl: 'components/Bar/SliverAppBar/demo.dart',
contentList:[allDomes(context, this)], contentList:[allDomes(context, this)],
docUrl: 'https://docs.flutter.io/flutter/widgets/SliverAppBar-class.html', docUrl: 'https://docs.flutter.io/flutter/widgets/SliverAppBar-class.html',
); );
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -71,7 +71,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -23,15 +23,15 @@ class SnackBarLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// 当BuildContext在Scaffold之前时调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决 // 当BuildContext在Scaffold之前时调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决
return new Center( return Center(
child: new Column( child: Column(
children: <Widget>[ children: <Widget>[
new GestureDetector( GestureDetector(
onTap: () { onTap: () {
final snackBar = new SnackBar( final snackBar = SnackBar(
content: new Text('这是一个SnackBar, 右侧有SnackBarAction'), content: Text('这是一个SnackBar, 右侧有SnackBarAction'),
backgroundColor:Colors.red, backgroundColor:Colors.red,
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮 action: SnackBarAction( // 提示信息上添加一个撤消的按钮
textColor:Colors.black, textColor:Colors.black,
label: '撤消', label: '撤消',
onPressed: () { onPressed: () {
@ -43,19 +43,19 @@ class SnackBarLessDefault extends StatelessWidget {
); );
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('显示SnackBar'), child: Text('显示SnackBar'),
), ),
new GestureDetector( GestureDetector(
onTap: () { onTap: () {
final snackBar = new SnackBar( final snackBar = SnackBar(
content: new Text('右侧无SnackBarAction'), content: Text('右侧无SnackBarAction'),
backgroundColor:Colors.red, backgroundColor:Colors.red,
duration:Duration(minutes: 1),// 持续时间 duration:Duration(minutes: 1),// 持续时间
//animation, //animation,
); );
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('显示无SnackBarAction的SnackBar'), child: Text('显示无SnackBarAction的SnackBar'),
), ),
], ],
) )

View File

@ -40,7 +40,7 @@ class _DemoState extends State<Demo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WidgetDemo( return WidgetDemo(
title: 'SnackBar', title: 'SnackBar',
codeUrl: 'componentss/Bar/SnackBar/demo.dart', codeUrl: 'components/Bar/SnackBar/demo.dart',
contentList: [allDomes(context, this)], contentList: [allDomes(context, this)],
docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html',
); );
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -72,7 +72,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -16,15 +16,15 @@ class SnackBarActionDemo extends StatefulWidget {
class _Demo extends State<SnackBarActionDemo> { class _Demo extends State<SnackBarActionDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Center( return Center(
child: new Column( child: Column(
children: <Widget>[ children: <Widget>[
new RaisedButton( new RaisedButton(
onPressed: () { onPressed: () {
final snackBar = new SnackBar( final snackBar = new SnackBar(
content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'), content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'),
backgroundColor:Color(0xffc91b3a), backgroundColor:Color(0xffc91b3a),
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮 action: SnackBarAction( // 提示信息上添加一个撤消的按钮
textColor:Colors.white, textColor:Colors.white,
label: '撤消', label: '撤消',
onPressed: () { onPressed: () {
@ -37,7 +37,7 @@ class _Demo extends State<SnackBarActionDemo> {
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('点我显示有action的SnackBar'), child: Text('点我显示有action的SnackBar'),
), ),
new RaisedButton( new RaisedButton(
onPressed: () async { onPressed: () async {
@ -49,7 +49,7 @@ class _Demo extends State<SnackBarActionDemo> {
); );
Scaffold.of(context).showSnackBar(snackBar); Scaffold.of(context).showSnackBar(snackBar);
}, },
child: new Text('点我显示无SnackBarAction的SnackBar'), child: Text('点我显示无SnackBarAction的SnackBar'),
), ),
], ],
) )

View File

@ -26,8 +26,8 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_scrollViewController = new ScrollController(); _scrollViewController = ScrollController();
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应 _tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
} }
@override @override
@ -42,27 +42,27 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child:new Scaffold( child: Scaffold(
appBar: new AppBar( // 大量配置属性参考 SliverAppBar 示例 appBar: AppBar( // 大量配置属性参考 SliverAppBar 示例
title: new Text('TabBar'), title: Text('TabBar'),
leading: new Icon(Icons.home), leading: Icon(Icons.home),
backgroundColor: Colors.amber[1000], backgroundColor: Colors.amber[1000],
bottom: new TabBar( bottom: TabBar(
isScrollable: true, isScrollable: true,
controller: _tabController, controller: _tabController,
tabs: <Widget>[ tabs: <Widget>[
new Tab(text: "Tabs 1"), Tab(text: "Tabs 1"),
new Tab(text: "Tabs 2"), Tab(text: "Tabs 2"),
new Tab(text: "Tabs 3"), Tab(text: "Tabs 3"),
new Tab(text: "Tabs 4"), Tab(text: "Tabs 4"),
new Tab(text: "Tabs 5"), Tab(text: "Tabs 5"),
new Tab(text: "Tabs 6"), Tab(text: "Tabs 6"),
], ],
), ),
), ),
body: new TabBarView(controller: _tabController, children: <Widget>[ body: TabBarView(controller: _tabController, children: <Widget>[
Text('TabsView 1'), Text('TabsView 1'),
Text('TabsView 2'), Text('TabsView 2'),
Text('TabsView 3'), Text('TabsView 3'),

View File

@ -50,9 +50,9 @@ class CardLessDefault extends StatelessWidget {
margin:EdgeInsets.all(20.0), margin:EdgeInsets.all(20.0),
// margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距 // margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距
semanticContainer:true, // 表示单个语义容器还是false表示单个语义节点的集合接受单个child但该child可以是RowColumn或其他包含子级列表的widget semanticContainer:true, // 表示单个语义容器还是false表示单个语义节点的集合接受单个child但该child可以是RowColumn或其他包含子级列表的widget
// shape:new Border.all( // shape: Border.all(
// color: Colors.indigo, width: 1.0, style: BorderStyle.solid), // 卡片材质的形状,以及边框 // color: Colors.indigo, width: 1.0, style: BorderStyle.solid), // 卡片材质的形状,以及边框
shape:RoundedRectangleBorder(borderRadius: new BorderRadius.circular(20.0)), // 圆角 shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), // 圆角
//borderRadius: BorderRadius.all(Radius.circular(8.0)), //borderRadius: BorderRadius.all(Radius.circular(8.0)),
child: Column( //card里面的子控件 child: Column( //card里面的子控件
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

View File

@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDomes(BuildContext context, _DemoState that) { Widget allDomes(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -19,9 +19,9 @@ class _Demo extends State<AboutDialogDemo> {
void showAlertDialog(BuildContext context) { void showAlertDialog(BuildContext context) {
showDialog( showDialog(
context: context, context: context,
builder: (_) => new AboutDialog( builder: (_) => AboutDialog(
applicationName: '名称', applicationName: '名称',
applicationIcon: new Icon(Icons.ac_unit), applicationIcon: Icon(Icons.ac_unit),
applicationVersion: 'V1.0', applicationVersion: 'V1.0',
children: <Widget>[ children: <Widget>[
Text('我是一个关于的dialog') Text('我是一个关于的dialog')
@ -29,12 +29,12 @@ class _Demo extends State<AboutDialogDemo> {
)); ));
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'show aboutDialog', 'show aboutDialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),

View File

@ -10,12 +10,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AlertDialogDemo extends StatefulWidget { class AlertDialogDemo extends StatelessWidget{
_Demo createState() => _Demo(); // _Demo createState() => _Demo();
}
class _Demo extends State<AlertDialogDemo> {
void showAlertDialog(BuildContext context) { void showAlertDialog(BuildContext context) {
showDialog<void>( showDialog<void>(
context: context, context: context,
@ -122,12 +119,12 @@ class _Demo extends State<AlertDialogDemo> {
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'点我显示 AlertDialog', '点我显示 AlertDialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),
@ -141,3 +138,8 @@ class _Demo extends State<AlertDialogDemo> {
}); });
} }
} }
// class _Demo extends State<AlertDialogDemo> {
// }

View File

@ -42,12 +42,12 @@ class _Demo extends State<DialogDemo> {
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'点我显示 Dialog', '点我显示 Dialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),
@ -108,14 +108,14 @@ class _DialogMoreDemo extends State<DialogMoreDemo> {
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new RaisedButton( RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'点我显示Dialog', '点我显示Dialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),

View File

@ -20,17 +20,17 @@ class _Demo extends State<SimpleDialogDemo> {
showDialog<Null>( showDialog<Null>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return new SimpleDialog( return SimpleDialog(
title: new Text('选择'), title: Text('选择'),
children: <Widget>[ children: <Widget>[
new SimpleDialogOption( SimpleDialogOption(
child: new Text('选项 1'), child: Text('选项 1'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
new SimpleDialogOption( SimpleDialogOption(
child: new Text('选项 2'), child: Text('选项 2'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -41,12 +41,12 @@ class _Demo extends State<SimpleDialogDemo> {
); );
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return RaisedButton(
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
//padding //padding
child: new Text( child: Text(
'show SimpleDialog', 'show SimpleDialog',
style: new TextStyle( style: TextStyle(
fontSize: 18.0, //textsize fontSize: 18.0, //textsize
color: Colors.white, // textcolor color: Colors.white, // textcolor
), ),

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridPaperDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -40,21 +40,21 @@ class _Demo extends State<GridPaperDemo> {
), ),
GridPaper( GridPaper(
color: Colors.red, color: Colors.red,
child: new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), child: Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -36,21 +36,21 @@ class _Demo extends State<GridTileDemo> {
), ),
footer: Text("GridTile footer", style: TextStyle(color: Colors.white)), footer: Text("GridTile footer", style: TextStyle(color: Colors.white)),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
child: Container(), child: Container(),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
return Container( return Container(
height: 400, height: 400,
color: Color(0xffc91b3a), color: Color(0xffc91b3a),
child: new GridView.count( child: GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 4.0, crossAxisSpacing: 4.0,
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
child: Container(), child: Container(),
), ),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
], ],
) )
); );

View File

@ -17,34 +17,34 @@ class SliverGridDemo extends StatefulWidget {
class _Demo extends State<SliverGridDemo> { class _Demo extends State<SliverGridDemo> {
Widget showCustomScrollView() { Widget showCustomScrollView() {
return new CustomScrollView( return CustomScrollView(
slivers: <Widget>[ slivers: <Widget>[
new SliverGrid( SliverGrid(
gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent( gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200.0, maxCrossAxisExtent: 200.0,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0, crossAxisSpacing: 10.0,
childAspectRatio: 4.0, childAspectRatio: 4.0,
), ),
delegate: new SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
return new Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
color: Colors.cyan[100 * (index % 5)], color: Colors.cyan[100 * (index % 5)],
child: new Text('grid item $index'), child: Text('grid item $index'),
); );
}, },
childCount: 20, childCount: 20,
), ),
), ),
// new SliverFixedExtentList( // SliverFixedExtentList(
// itemExtent: 100.0, // itemExtent: 100.0,
// delegate: new SliverChildBuilderDelegate( // delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) { // (BuildContext context, int index) {
// return new Container( // return Container(
// alignment: Alignment.center, // alignment: Alignment.center,
// color: Colors.lightBlue[100 * (index % 9)], // color: Colors.lightBlue[100 * (index % 9)],
// child: new Text('list item $index'), // child: Text('list item $index'),
// ); // );
// }, // },
// ), // ),

View File

@ -40,7 +40,7 @@ class _DemoState extends State<Demo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WidgetDemo( return WidgetDemo(
title: 'SliverGrid', title: 'SliverGrid',
codeUrl: 'components/Grid/GridPaper/demo.dart', codeUrl: 'components/Grid/SliverGrid/demo.dart',
contentList: [ contentList: [
_Text0, _Text0,
SliverGridDemo(), SliverGridDemo(),

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_go/widgets/components/LIst/AnimatedList/model.dart'; import 'package:flutter_go/widgets/components/List/AnimatedList/model.dart';
class AnimatedListFullDefault extends StatefulWidget { class AnimatedListFullDefault extends StatefulWidget {
AnimatedListFullDefault({Key key, this.parent}) : super(key: key); AnimatedListFullDefault({Key key, this.parent}) : super(key: key);
@ -15,7 +15,7 @@ class AnimatedListFullDefault extends StatefulWidget {
* AnimatedList , * AnimatedList ,
* */ * */
class _AnimatedListFullDefault extends State<AnimatedListFullDefault> { class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
final GlobalKey<AnimatedListState> _listKey = new GlobalKey<AnimatedListState>(); final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
ListModel<int> _list; ListModel<int> _list;
int _selectedItem; int _selectedItem;
int _nextItem; // The next item inserted when the user presses the '+' button. int _nextItem; // The next item inserted when the user presses the '+' button.
@ -26,7 +26,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
if (widget.parent is State) { if (widget.parent is State) {
widget.parent.animatedList = this; // widget.parent.animatedList = this; //
} }
_list = new ListModel<int>( _list = ListModel<int>(
listKey: _listKey, listKey: _listKey,
initialItems: <int>[0, 1, 2], initialItems: <int>[0, 1, 2],
removedItemBuilder: _buildRemovedItem, removedItemBuilder: _buildRemovedItem,
@ -50,7 +50,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
} }
Widget _buildItem(BuildContext context, int index, Animation<double> animation) { Widget _buildItem(BuildContext context, int index, Animation<double> animation) {
return new CardItem( return CardItem(
animation: animation, animation: animation,
item: _list[index], item: _list[index],
selected: _selectedItem == _list[index], selected: _selectedItem == _list[index],
@ -63,7 +63,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
} }
Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) { Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) {
return new CardItem( return CardItem(
animation: animation, animation: animation,
item: item, item: item,
selected: false, selected: false,
@ -107,20 +107,20 @@ class CardItem extends StatelessWidget {
TextStyle textStyle = Theme.of(context).textTheme.display1; TextStyle textStyle = Theme.of(context).textTheme.display1;
if (selected) if (selected)
textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]); textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]);
return new Padding( return Padding(
padding: const EdgeInsets.all(2.0), padding: const EdgeInsets.all(2.0),
child: new SizeTransition( child: SizeTransition(
axis: Axis.vertical, axis: Axis.vertical,
sizeFactor: animation, sizeFactor: animation,
child: new GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: onTap, onTap: onTap,
child: new SizedBox( child: SizedBox(
height: 128.0, height: 128.0,
child: new Card( child: Card(
color: Colors.primaries[item % Colors.primaries.length], color: Colors.primaries[item % Colors.primaries.length],
child: new Center( child: Center(
child: new Text('Item $item', style: textStyle), child: Text('Item $item', style: textStyle),
), ),
), ),
), ),

View File

@ -32,7 +32,7 @@ const String _Text1 =
class Demo extends StatefulWidget { class Demo extends StatefulWidget {
static const String routeName = '/components//List/AnimatedList'; static const String routeName = '/components/List/AnimatedList';
@override @override
_DemoState createState() => _DemoState(); _DemoState createState() => _DemoState();
@ -58,7 +58,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDemoBoxs(BuildContext context, _DemoState that) { Widget allDemoBoxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -25,7 +25,7 @@ class ListModel<E> {
Iterable<E> initialItems, Iterable<E> initialItems,
}) : assert(listKey != null), }) : assert(listKey != null),
assert(removedItemBuilder != null), assert(removedItemBuilder != null),
_items = new List<E>.from(initialItems ?? <E>[]); _items = List<E>.from(initialItems ?? <E>[]);
final GlobalKey<AnimatedListState> listKey; final GlobalKey<AnimatedListState> listKey;
final dynamic removedItemBuilder; final dynamic removedItemBuilder;

View File

@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context, _DemoState that) { Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -67,7 +67,7 @@ class _DemoState extends State<Demo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WidgetDemo( return WidgetDemo(
title: 'ListView', title: 'ListView',
codeUrl: '/componentss/List/ListView/demo.dart', codeUrl: 'components/List/ListView/demo.dart',
contentList: [allCheckboxs(context, this)], contentList: [allCheckboxs(context, this)],
docUrl: 'https://docs.flutter.io/flutter/widgets/ListView-class.html', docUrl: 'https://docs.flutter.io/flutter/widgets/ListView-class.html',
); );
@ -81,7 +81,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context, _DemoState that) { Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -107,7 +107,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
* align的text * align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -36,8 +36,8 @@ class _CheckedPopupMenuItemDemoState extends State<CheckedPopupMenuItemDemo> {
_checkedValues.add(value); _checkedValues.add(value);
} }
Scaffold.of(context).showSnackBar(new SnackBar( Scaffold.of(context).showSnackBar( SnackBar(
content: new Text('Checked $_checkedValues'))); content: Text('Checked $_checkedValues')));
} }
@override @override

View File

@ -19,8 +19,8 @@ class _PopupMenuButtonDemoState extends State<PopupMenuButtonDemo> {
void showMenuSelection(String value) { void showMenuSelection(String value) {
if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value)) if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value))
_simpleValue = value; _simpleValue = value;
Scaffold.of(context).showSnackBar(new SnackBar( Scaffold.of(context).showSnackBar( SnackBar(
content: new Text('You selected: $value'))); content: Text('You selected: $value')));
} }

View File

@ -13,7 +13,7 @@ class PopupMenuDividerDemo extends StatefulWidget {
class _PopupMenuDividerDemoState extends State<PopupMenuDividerDemo> { class _PopupMenuDividerDemoState extends State<PopupMenuDividerDemo> {
void showInSnackBar(String value) { void showInSnackBar(String value) {
Scaffold.of(context) Scaffold.of(context)
.showSnackBar(new SnackBar(content: new Text('You selected: $value'))); .showSnackBar( SnackBar(content: Text('You selected: $value')));
} }
@override @override

View File

@ -18,7 +18,7 @@ const String content0 = '''
const String content1 = ''' const String content1 = '''
### **基本用法** ### **基本用法**
> 此widget通过调整Divider widget 来适应于弹出菜单中 > 此widget通过调整Divider widget 来适应于弹出菜单中
- 在 PopupMenuButton 中直接 new PopupMenuDivider() 即可 - 在 PopupMenuButton 中直接 PopupMenuDivider() 即可
'''; ''';
class Demo extends StatefulWidget { class Demo extends StatefulWidget {

View File

@ -34,7 +34,7 @@ class _DemoState extends State<Demo> {
PopupMenuDividerDemo() PopupMenuDividerDemo()
], ],
docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuEntry-class.html', docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuEntry-class.html',
codeUrl: 'components/Menu/PopupMenuEntry/demo.dart', codeUrl: 'components/Menu/PopupMenuDivider/demo.dart',
title: 'PopupMenuEntry', title: 'PopupMenuEntry',
); );
} }

View File

@ -34,7 +34,7 @@ class _DemoState extends State<Demo> {
PopupMenuDividerDemo() PopupMenuDividerDemo()
], ],
docUrl: "https://docs.flutter.io/flutter/material/PopupMenuItem-class.html", docUrl: "https://docs.flutter.io/flutter/material/PopupMenuItem-class.html",
codeUrl: 'components/Menu/PopupMenuEntry/demo.dart', codeUrl: 'components/Menu/PopupMenuDivider/demo.dart',
title: 'PopupMenuItem', title: 'PopupMenuItem',
); );
} }

View File

@ -40,17 +40,17 @@ class _BottomNavigationBarFullDefault extends State {
fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed则通过 fixedColor 设置选中 item 的颜色 fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed则通过 fixedColor 设置选中 item 的颜色
items: <BottomNavigationBarItem> [ items: <BottomNavigationBarItem> [
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("Home"), icon: new Icon(Icons.home)), title: Text("Home"), icon: Icon(Icons.home)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("List"), icon: new Icon(Icons.list)), title: Text("List"), icon: Icon(Icons.list)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("Message"), icon: new Icon(Icons.message)), title: Text("Message"), icon: Icon(Icons.message)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("add"), icon: new Icon(Icons.add)), title: Text("add"), icon: Icon(Icons.add)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("menu"), icon: new Icon(Icons.menu)), title: Text("menu"), icon: Icon(Icons.menu)),
BottomNavigationBarItem( BottomNavigationBarItem(
title: new Text("other"), icon: new Icon(Icons.devices_other)), title: Text("other"), icon: Icon(Icons.devices_other)),
], ],
); );

View File

@ -57,7 +57,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDemoBoxs(BuildContext context, _DemoState that) { Widget allDemoBoxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -79,7 +79,7 @@ Widget allDemoBoxs(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -21,20 +21,20 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new SizedBox( return SizedBox(
height: 100, height: 100,
child: Scaffold( child: Scaffold(
bottomNavigationBar: new BottomNavigationBar(items: [ bottomNavigationBar: BottomNavigationBar(items: [
new BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.laptop_chromebook), icon: Icon(Icons.laptop_chromebook),
title: new Text("主页"), title: Text("主页"),
backgroundColor: Colors.red backgroundColor: Colors.red
), ),
new BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.list), title: new Text("分类"),backgroundColor: Colors.grey), icon: Icon(Icons.list), title: Text("分类"),backgroundColor: Colors.grey),
new BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.local_grocery_store), title: new Text("购物车")), icon: Icon(Icons.local_grocery_store), title: Text("购物车")),
new BottomNavigationBarItem(icon: new Icon(Icons.person), title: new Text("我的")) BottomNavigationBarItem(icon: Icon(Icons.person), title: Text("我的"))
], ],
//onTap: onTap, //onTap: onTap,
//currentIndex: page //currentIndex: page
@ -46,13 +46,13 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
//backgroundColor: Colors.grey, //backgroundColor: Colors.grey,
// //
//// body: new PageView( //// body: PageView(
//// ////
//// children: [ //// children: [
//// new Index(), //// Index(),
//// new Classify(), //// Classify(),
//// new Shopping(), //// Shopping(),
//// new Myself() //// Myself()
//// ], //// ],
//// ////
//// controller: pageController, //// controller: pageController,

View File

@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context, _DemoState that) { Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -70,7 +70,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -14,8 +14,8 @@ class DayPickerDemo extends StatefulWidget {
} }
class _DayPickerState extends State<DayPickerDemo> { class _DayPickerState extends State<DayPickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
TimeOfDay _time = new TimeOfDay.now(); TimeOfDay _time = TimeOfDay.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -29,7 +29,7 @@ class _DayPickerState extends State<DayPickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
Future<void> _selectTime(BuildContext context) async { Future<void> _selectTime(BuildContext context) async {
@ -40,23 +40,23 @@ class _DayPickerState extends State<DayPickerDemo> {
setState(() { setState(() {
_time = picked; _time = picked;
}); });
if (picked == null) _time = new TimeOfDay.now(); if (picked == null) _time = TimeOfDay.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },
), ),
new Text('时间选择'), Text('时间选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_time.toString()}'), child: Text('date selected:${_time.toString()}'),
onPressed: () { onPressed: () {
_selectTime(context); _selectTime(context);
}, },

View File

@ -14,7 +14,7 @@ class MothPickerDemo extends StatefulWidget {
} }
class _MothPickerState extends State<MothPickerDemo> { class _MothPickerState extends State<MothPickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -28,16 +28,16 @@ class _MothPickerState extends State<MothPickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },

View File

@ -14,8 +14,8 @@ class ShowDatePickerDemo extends StatefulWidget {
} }
class _ShowDatePickerState extends State<ShowDatePickerDemo> { class _ShowDatePickerState extends State<ShowDatePickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
TimeOfDay _time = new TimeOfDay.now(); TimeOfDay _time = TimeOfDay.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -29,7 +29,7 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
Future<void> _selectTime(BuildContext context) async { Future<void> _selectTime(BuildContext context) async {
@ -40,23 +40,23 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
setState(() { setState(() {
_time = picked; _time = picked;
}); });
if (picked == null) _time = new TimeOfDay.now(); if (picked == null) _time = TimeOfDay.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },
), ),
new Text('时间选择'), Text('时间选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_time.toString()}'), child: Text('date selected:${_time.toString()}'),
onPressed: () { onPressed: () {
_selectTime(context); _selectTime(context);
}, },

View File

@ -14,7 +14,7 @@ class YearPickerDemo extends StatefulWidget {
} }
class _YearPickerDemoState extends State<YearPickerDemo> { class _YearPickerDemoState extends State<YearPickerDemo> {
DateTime _date = new DateTime.now(); DateTime _date = DateTime.now();
Future<void> _selectDate(BuildContext context) async { Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
@ -28,16 +28,16 @@ class _YearPickerDemoState extends State<YearPickerDemo> {
_date = picked; _date = picked;
}); });
if (picked == null) _date = new DateTime.now(); if (picked == null) _date = DateTime.now();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
new Text('日期选择'), Text('日期选择'),
new RaisedButton( RaisedButton(
child: new Text('date selected:${_date.toString()}'), child: Text('date selected:${_date.toString()}'),
onPressed: () { onPressed: () {
_selectDate(context); _selectDate(context);
}, },

View File

@ -38,7 +38,7 @@ class _DemoState extends State<Demo> {
content1, content1,
CircularDemo(), CircularDemo(),
], ],
codeUrl: '/components/Progress/CircularProgressIndicator/demo.dart', codeUrl: 'components/Progress/CircularProgressIndicator/demo.dart',
docUrl: docUrl:
'https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html', 'https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html',
title: 'CircularProgressIndicator'); title: 'CircularProgressIndicator');

View File

@ -38,7 +38,7 @@ class _DemoState extends State<Demo> {
content1, content1,
LinearProgressIndicatorDemo(), LinearProgressIndicatorDemo(),
], ],
codeUrl: '/components/Progress/LinearProgressIndicator/demo.dart', codeUrl: 'components/Progress/LinearProgressIndicator/demo.dart',
docUrl: docUrl:
'https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html', 'https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html',
title: 'LinearProgressIndicator'); title: 'LinearProgressIndicator');

View File

@ -35,7 +35,7 @@ class _DemoState extends State<Demo> {
content1, content1,
// LinearProgressIndicatorDemo(), // LinearProgressIndicatorDemo(),
], ],
codeUrl: '/components/Progress/RefreshProgressIndicator/demo.dart', codeUrl: 'components/Progress/RefreshProgressIndicator/demo.dart',
docUrl:'https://docs.flutter.io/flutter/material/RefreshProgressIndicator-class.html', docUrl:'https://docs.flutter.io/flutter/material/RefreshProgressIndicator-class.html',
title: 'RefreshProgressIndicator'); title: 'RefreshProgressIndicator');
} }

View File

@ -37,9 +37,9 @@ class _ScaffoldDemo extends State with SingleTickerProviderStateMixin {
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child: new Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Sample Code'), title: Text('Sample Code'),
), ),

View File

@ -56,7 +56,7 @@ class _DemoState extends State<Demo> {
codeUrl: 'components/Scaffold/Scaffold/demo.dart', codeUrl: 'components/Scaffold/Scaffold/demo.dart',
contentList: [ contentList: [
_Text0, _Text0,
new ScaffoldDemo(), ScaffoldDemo(),
], ],
docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html', docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html',
); );

View File

@ -28,9 +28,9 @@ class _ScaffoldStateDemo extends State with SingleTickerProviderStateMixin {
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
// 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。 // 否则,如果最近的 Navigator 具有任何先前的 router 则会插入BackButton。
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。 // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下空的 leading widget 将导致 middle/title widget 拉伸开始。
return new SizedBox( return SizedBox(
height: 500, height: 500,
child:new Scaffold( child: Scaffold(
key:_scaffoldKey, key:_scaffoldKey,
appBar: AppBar( appBar: AppBar(
title: Text('ScaffoldState Demo'), title: Text('ScaffoldState Demo'),

View File

@ -11,7 +11,7 @@ class ScrollPhysicsDemo extends StatefulWidget {
} }
class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> { class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> {
final PageController _pageController = new PageController(); final PageController _pageController = PageController();
double _currentPage = 0.0; double _currentPage = 0.0;
@override @override
@ -54,21 +54,21 @@ class _SimplePage extends StatelessWidget {
final double parallaxOffset; final double parallaxOffset;
@override @override
Widget build(BuildContext context) => new Center( Widget build(BuildContext context) => Center(
child: Container( child: Container(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
child: new Center( child: Center(
child: new Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new Text( Text(
data, data,
style: const TextStyle(fontSize: 60.0,color: Colors.white), style: const TextStyle(fontSize: 60.0,color: Colors.white),
), ),
new SizedBox(height: 40.0), SizedBox(height: 40.0),
new Transform( Transform(
transform: transform:
new Matrix4.translationValues(parallaxOffset, 0.0, 0.0), Matrix4.translationValues(parallaxOffset, 0.0, 0.0),
child: const Text('左右滑动,这是第二行滚动速度更快的小字',style: const TextStyle(fontSize: 16.0,color: Colors.white),), child: const Text('左右滑动,这是第二行滚动速度更快的小字',style: const TextStyle(fontSize: 16.0,color: Colors.white),),
), ),
], ],

View File

@ -17,15 +17,15 @@ var selectItemValue;
class DropdownButtonDefault extends StatelessWidget { class DropdownButtonDefault extends StatelessWidget {
List<DropdownMenuItem> generateItemList() { List<DropdownMenuItem> generateItemList() {
final List<DropdownMenuItem> items = new List(); final List<DropdownMenuItem> items = List();
final DropdownMenuItem item1 = new DropdownMenuItem( final DropdownMenuItem item1 = DropdownMenuItem(
value: '张三', child: new Text('张三')); value: '张三', child: Text('张三'));
final DropdownMenuItem item2 = new DropdownMenuItem( final DropdownMenuItem item2 = DropdownMenuItem(
value: '李四', child: new Text('李四')); value: '李四', child: Text('李四'));
final DropdownMenuItem item3 = new DropdownMenuItem( final DropdownMenuItem item3 = DropdownMenuItem(
value: '王二', child: new Text('王二')); value: '王二', child: Text('王二'));
final DropdownMenuItem item4 = new DropdownMenuItem( final DropdownMenuItem item4 = DropdownMenuItem(
value: '麻子', child: new Text('麻子')); value: '麻子', child: Text('麻子'));
items.add(item1); items.add(item1);
items.add(item2); items.add(item2);
items.add(item3); items.add(item3);
@ -36,7 +36,7 @@ class DropdownButtonDefault extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DropdownButton( return DropdownButton(
hint: new Text('下拉菜单选择一个人名'), hint: Text('下拉菜单选择一个人名'),
//设置这个value之后,选中对应位置的item //设置这个value之后,选中对应位置的item
//再次呼出下拉菜单会自动定位item位置在当前按钮显示的位置处 //再次呼出下拉菜单会自动定位item位置在当前按钮显示的位置处
value: selectItValue, value: selectItValue,
@ -51,54 +51,54 @@ class DropdownButtonDefault extends StatelessWidget {
} }
List<DropdownMenuItem> getListData(){ List<DropdownMenuItem> getListData(){
List<DropdownMenuItem> items=new List(); List<DropdownMenuItem> items= List();
DropdownMenuItem dropdownMenuItem1=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem1= DropdownMenuItem(
child:new Text('1'), child: Text('1'),
value: '1', value: '1',
); );
items.add(dropdownMenuItem1); items.add(dropdownMenuItem1);
DropdownMenuItem dropdownMenuItem2=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem2= DropdownMenuItem(
child:new Text('2'), child: Text('2'),
value: '2', value: '2',
); );
items.add(dropdownMenuItem2); items.add(dropdownMenuItem2);
DropdownMenuItem dropdownMenuItem3=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem3= DropdownMenuItem(
child:new Text('3'), child: Text('3'),
value: '3', value: '3',
); );
items.add(dropdownMenuItem3); items.add(dropdownMenuItem3);
DropdownMenuItem dropdownMenuItem4=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem4= DropdownMenuItem(
child:new Text('4'), child: Text('4'),
value: '4', value: '4',
); );
items.add(dropdownMenuItem4); items.add(dropdownMenuItem4);
DropdownMenuItem dropdownMenuItem5=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem5= DropdownMenuItem(
child:new Text('5'), child: Text('5'),
value: '5', value: '5',
); );
items.add(dropdownMenuItem5); items.add(dropdownMenuItem5);
DropdownMenuItem dropdownMenuItem6=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem6= DropdownMenuItem(
child:new Text('6'), child: Text('6'),
value: '6', value: '6',
); );
items.add(dropdownMenuItem6); items.add(dropdownMenuItem6);
DropdownMenuItem dropdownMenuItem7=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem7= DropdownMenuItem(
child:new Text('7'), child: Text('7'),
value: '7', value: '7',
); );
items.add(dropdownMenuItem7); items.add(dropdownMenuItem7);
DropdownMenuItem dropdownMenuItem8=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem8= DropdownMenuItem(
child:new Text('8'), child: Text('8'),
value: '8', value: '8',
); );
items.add(dropdownMenuItem8); items.add(dropdownMenuItem8);
DropdownMenuItem dropdownMenuItem9=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem9= DropdownMenuItem(
child:new Text('9'), child: Text('9'),
value: '9', value: '9',
); );
items.add(dropdownMenuItem9); items.add(dropdownMenuItem9);
DropdownMenuItem dropdownMenuItem10=new DropdownMenuItem( DropdownMenuItem dropdownMenuItem10= DropdownMenuItem(
child:new Text('10'), child: Text('10'),
value: '10', value: '10',
); );
items.add(dropdownMenuItem10); items.add(dropdownMenuItem10);

View File

@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allDropdownButtons(BuildContext context,_DemoState that){ Widget allDropdownButtons(BuildContext context,_DemoState that){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -87,14 +87,14 @@ Widget allDropdownButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }

View File

@ -101,9 +101,9 @@ class FlatButtonCustom extends StatelessWidget {
splashColor: Colors.deepPurple, splashColor: Colors.deepPurple,
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: new EdgeInsets.only( padding: EdgeInsets.only(
bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
shape: (shape is ShapeBorder) ? shape : new Border.all( shape: (shape is ShapeBorder) ? shape : Border.all(
// 设置边框样式 // 设置边框样式
color: Colors.grey, color: Colors.grey,
width: 2.0, width: 2.0,

View File

@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allFlatButtons(BuildContext context){ Widget allFlatButtons(BuildContext context){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -109,7 +109,7 @@ Widget allFlatButtons(BuildContext context){
flatButton.FlatButtonCustom('危险按钮',Colors.pink), flatButton.FlatButtonCustom('危险按钮',Colors.pink),
SizedBox(height: 10.0), SizedBox(height: 10.0),
flatButton.FlatButtonCustom('点击我试试!', Colors.red, flatButton.FlatButtonCustom('点击我试试!', Colors.red,
new Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid), Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid),
() => _showMessage('点击了 FLAT BUTTON ', context)), () => _showMessage('点击了 FLAT BUTTON ', context)),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ])
@ -126,16 +126,16 @@ void _showMessage(String name, BuildContext context) {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: new Text('提示'), title: Text('提示'),
content: new Text(name), content: Text(name),
actions: <Widget>[ actions: <Widget>[
new FlatButton( FlatButton(
// alert 的取消按钮 // alert 的取消按钮
onPressed: () { onPressed: () {
// 取消的事件 // 取消的事件
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
child: new Text('取消')) child: Text('取消'))
]); ]);
} }
); );
@ -145,14 +145,14 @@ void _showMessage(String name, BuildContext context) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }

View File

@ -49,7 +49,7 @@ class FloatingActionButtonCustom extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _onPressed = onPressed; final _onPressed = onPressed;
return new FloatingActionButton( return FloatingActionButton(
// 子视图一般为Icon不推荐使用文字 // 子视图一般为Icon不推荐使用文字
child: const Icon(Icons.refresh), child: const Icon(Icons.refresh),
// FAB的文字解释FAB被长按时显示也是无障碍功能 // FAB的文字解释FAB被长按时显示也是无障碍功能
@ -109,8 +109,8 @@ class FloatingActionButtonCustom2 extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
backgroundColor: Colors.amber, backgroundColor: Colors.amber,
//如果不手动设置icon和text颜色,则默认使用foregroundColor颜色 //如果不手动设置icon和text颜色,则默认使用foregroundColor颜色
icon: new Icon(Icons.flag,color: Colors.red), icon: Icon(Icons.flag,color: Colors.red),
label: new Text('FloatingActionButton.extended', maxLines: 1), label: Text('FloatingActionButton.extended', maxLines: 1),
); );
} }
} }

View File

@ -72,7 +72,7 @@ class _DemoState extends State<Demo> {
Widget allFloatingActionButtons(BuildContext context,_DemoState that){ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -109,16 +109,16 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -128,14 +128,14 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -159,7 +159,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -75,7 +75,7 @@ class IconButtonCustom extends StatelessWidget {
iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小 iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小
// 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚 // 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚
splashColor: _randomColor(), splashColor: _randomColor(),
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
// 描述按下按钮时将发生的操作的文本 // 描述按下按钮时将发生的操作的文本
tooltip:'这是${ type.codePoint }信息', tooltip:'这是${ type.codePoint }信息',
// IconButton 的点击事件 // IconButton 的点击事件

View File

@ -66,7 +66,7 @@ class _DemoState extends State<Demo> {
Widget allIconButtons(BuildContext context,_DemoState that){ Widget allIconButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -106,14 +106,14 @@ Widget allIconButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -137,7 +137,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -79,7 +79,7 @@ class OutlineButtonCustom extends StatelessWidget {
// 文本内容 // 文本内容
child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'), child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'),
// 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor // 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor
borderSide:new BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()), borderSide: BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()),
// 按钮颜色 // 按钮颜色
color: _randomColor(), color: _randomColor(),
// 按钮失效时边框颜色 // 按钮失效时边框颜色
@ -100,7 +100,7 @@ class OutlineButtonCustom extends StatelessWidget {
splashColor: _randomColor(), splashColor: _randomColor(),
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
//高亮时候的阴影 //高亮时候的阴影
highlightElevation: 10.0, highlightElevation: 10.0,
shape: shape, // 在Outline 里只能设置圆角,边框用borderSide shape: shape, // 在Outline 里只能设置圆角,边框用borderSide

View File

@ -75,7 +75,7 @@ class _DemoState extends State<Demo> {
Widget allOutlineButtons(BuildContext context,_DemoState that){ Widget allOutlineButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -136,16 +136,16 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -155,14 +155,14 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -186,7 +186,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -71,8 +71,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
child: Text('点我试试'), child: Text('点我试试'),
onSelected: (String value) {}, onSelected: (String value) {},
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")), PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")) PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
]); ]);
} }
@ -82,8 +82,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
icon: Icon(Icons.menu), icon: Icon(Icons.menu),
onSelected: (String value) {}, onSelected: (String value) {},
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")), PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")) PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
]); ]);
} }
} }
@ -116,10 +116,10 @@ class PopupMenuButtonCustom extends StatelessWidget {
initialValue:selectStr, initialValue:selectStr,
// 按下按钮时调用以创建要在菜单中显示的项目。 // 按下按钮时调用以创建要在菜单中显示的项目。
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")), PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")), PopupMenuItem(value: "选项二的内容", child: Text("选项二")),
new PopupMenuItem(value: "选项三的内容", child: new Text("选项三")), PopupMenuItem(value: "选项三的内容", child: Text("选项三")),
new PopupMenuItem(value: "选项四的内容", child: new Text("选项四")) PopupMenuItem(value: "选项四的内容", child: Text("选项四"))
], ],
// 应用于弹出菜单按钮的偏移量(x,y)。 // 应用于弹出菜单按钮的偏移量(x,y)。
offset:Offset(0.0,50.0), offset:Offset(0.0,50.0),
@ -134,7 +134,7 @@ class PopupMenuButtonCustom extends StatelessWidget {
}); });
}, },
// 默认情况下匹配IconButton的8 dps填充。在某些情况下特别是在此按钮作为列表项的尾随元素出现的情况下能够将填充设置为零是有用的。 // 默认情况下匹配IconButton的8 dps填充。在某些情况下特别是在此按钮作为列表项的尾随元素出现的情况下能够将填充设置为零是有用的。
padding:new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0), padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0),
//描述按下按钮时将发生的操作的文本。 //描述按下按钮时将发生的操作的文本。
tooltip:'这是信息' tooltip:'这是信息'
); );

View File

@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
Widget allPopupMenuButton(Demo widget,State parent){ Widget allPopupMenuButton(Demo widget,State parent){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[

View File

@ -105,10 +105,10 @@ class RaisedButtonCustom extends StatelessWidget {
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: padding:
new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
shape: (shape is ShapeBorder) shape: (shape is ShapeBorder)
? shape ? shape
: new Border.all( : Border.all(
// 设置边框样式 // 设置边框样式
color: Colors.grey, color: Colors.grey,
width: 2.0, width: 2.0,

View File

@ -74,7 +74,7 @@ class _DemoState extends State<Demo> {
Widget allRaisedButtons(BuildContext context,_DemoState that){ Widget allRaisedButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -135,16 +135,16 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -154,14 +154,14 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -185,7 +185,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -62,7 +62,7 @@ class RawMaterialButtonCustom extends StatelessWidget {
splashColor: _randomColor(), splashColor: _randomColor(),
// 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias // 抗锯齿能力,抗锯齿等级依次递增,none默认),hardEdge,antiAliasWithSaveLayer,antiAlias
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
//高亮时候的阴影 //高亮时候的阴影
highlightElevation: 10.0, highlightElevation: 10.0,
// 按钮材质的形状 // 按钮材质的形状

View File

@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
Widget allRawMaterialButtons(BuildContext context,_DemoState that){ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -108,16 +108,16 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return AlertDialog( // return AlertDialog(
// title: new Text('提示'), // title: Text('提示'),
// content: new Text(name), // content: Text(name),
// actions: <Widget>[ // actions: <Widget>[
// new FlatButton( // FlatButton(
// // alert 的取消按钮 // // alert 的取消按钮
// onPressed: () { // onPressed: () {
// // 取消的事件 // // 取消的事件
// Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
// }, // },
// child: new Text('取消')) // child: Text('取消'))
// ]); // ]);
// } // }
// ); // );
@ -127,14 +127,14 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left //style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }
@ -158,7 +158,7 @@ ShapeBorder drawShape(String type){
break; break;
case 'radius': case 'radius':
return RoundedRectangleBorder( return RoundedRectangleBorder(
side:new BorderSide( // 保留原来的边框样式 side: BorderSide( // 保留原来的边框样式
width: borderWidth, width: borderWidth,
color: _color, color: _color,
style: BorderStyle.solid, style: BorderStyle.solid,

View File

@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
/* /*
* Checkbox 默认的实例 * Checkbox 默认的实例
* index 当前checkbox 的索引值 * index 当前checkbox 的索引值
* */ */
class CheckboxDefault extends StatefulWidget{ class CheckboxDefault extends StatefulWidget{
final int index; final int index;
final parent; final parent;
@ -41,7 +41,7 @@ class _CheckboxDefault extends State {
/* /*
* Checkbox 默认的实例 * Checkbox 默认的实例
* index 当前checkbox 的索引值 * index 当前checkbox 的索引值
* */ */
class CheckboxSelect extends StatelessWidget { class CheckboxSelect extends StatelessWidget {
final int index; final int index;
final widget; final widget;

View File

@ -59,7 +59,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context,_DemoState that){ Widget allCheckboxs(BuildContext context,_DemoState that){
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
@ -97,13 +97,13 @@ Widget allCheckboxs(BuildContext context,_DemoState that){
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt){ Widget textAlignBar(String txt){
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: txt) MarkdownBody(data: txt)
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left) // Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
]) ])
); );
} }

View File

@ -34,7 +34,7 @@ class _CheckboxListTileStateDefault extends State {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
new Center( Center(
child: CheckboxListTile( child: CheckboxListTile(
value: _value, value: _value,
selected:true,// 默认文字是否高亮 selected:true,// 默认文字是否高亮
@ -48,10 +48,10 @@ class _CheckboxListTileStateDefault extends State {
activeColor: Colors.red, // 选中此复选框时要使用的颜色 activeColor: Colors.red, // 选中此复选框时要使用的颜色
), ),
), ),
new Center( Center(
child: new CheckboxListTile( child: CheckboxListTile(
value: isChecks[0], value: isChecks[0],
title: new Text('选项1'), title: Text('选项1'),
activeColor: _value ? Colors.red : Colors.green, activeColor: _value ? Colors.red : Colors.green,
controlAffinity: ListTileControlAffinity.platform, controlAffinity: ListTileControlAffinity.platform,
onChanged: (bool){ onChanged: (bool){
@ -60,10 +60,10 @@ class _CheckboxListTileStateDefault extends State {
}); });
}), }),
), ),
new Center( Center(
child: new CheckboxListTile( child: CheckboxListTile(
value: isChecks[1], value: isChecks[1],
title: new Text('选项2'), title: Text('选项2'),
activeColor: _value ? Colors.red : Colors.green, activeColor: _value ? Colors.red : Colors.green,
controlAffinity: ListTileControlAffinity.platform, controlAffinity: ListTileControlAffinity.platform,
onChanged: (bool){ onChanged: (bool){
@ -72,10 +72,10 @@ class _CheckboxListTileStateDefault extends State {
}); });
}), }),
), ),
new Center( Center(
child: new CheckboxListTile( child: CheckboxListTile(
value: isChecks[2], value: isChecks[2],
title: new Text('选项3'), title: Text('选项3'),
activeColor: _value ? Colors.red : Colors.green, activeColor: _value ? Colors.red : Colors.green,
controlAffinity: ListTileControlAffinity.platform, controlAffinity: ListTileControlAffinity.platform,
onChanged: (bool){ onChanged: (bool){
@ -84,10 +84,10 @@ class _CheckboxListTileStateDefault extends State {
}); });
}), }),
), ),
new Center( Center(
child: new CheckboxListTile( child: CheckboxListTile(
value: isChecks[3], value: isChecks[3],
title: new Text('选项4'), title: Text('选项4'),
activeColor: _value ? Colors.red : Colors.green, activeColor: _value ? Colors.red : Colors.green,
controlAffinity: ListTileControlAffinity.platform, controlAffinity: ListTileControlAffinity.platform,
onChanged: (bool){ onChanged: (bool){

View File

@ -61,7 +61,7 @@ class _DemoState extends State<Demo> {
*/ */
Widget allCheckboxs(BuildContext context, _DemoState that) { Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container( return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), //padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, //mainAxisSize: MainAxisSize.max,
children:[ children:[
@ -79,7 +79,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
* 带align的text * 带align的text
* */ * */
Widget textAlignBar(String txt) { Widget textAlignBar(String txt) {
return new Align( return Align(
alignment: FractionalOffset.centerLeft, alignment: FractionalOffset.centerLeft,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
class DefaultTextField extends StatelessWidget { class DefaultTextField extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return Container(
padding: const EdgeInsets.all(30.0), padding: const EdgeInsets.all(30.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, //文本是起始端对齐 crossAxisAlignment: CrossAxisAlignment.start, //文本是起始端对齐
@ -29,7 +29,7 @@ class CustomTextField extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return Container(
padding: const EdgeInsets.all(30.0), padding: const EdgeInsets.all(30.0),
child: TextField( child: TextField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,

View File

@ -22,27 +22,27 @@ class _Demo extends State<RadioADemo> {
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ( return (
new Container( Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: new Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new Radio( Radio(
value: 1, value: 1,
groupValue: groupValue,//当value和groupValue一致的时候则选中 groupValue: groupValue,//当value和groupValue一致的时候则选中
onChanged: (T){ onChanged: (T){
onChange(T); onChange(T);
} }
), ),
new Radio( Radio(
value: 2, value: 2,
groupValue: groupValue, groupValue: groupValue,
onChanged: (T){ onChanged: (T){
onChange(T); onChange(T);
} }
), ),
new Radio( Radio(
value: 3, value: 3,
groupValue: groupValue, groupValue: groupValue,
onChanged: (T){ onChanged: (T){

View File

@ -18,7 +18,6 @@ Radio widget 代表表单中的单选按钮, 当groupValue = value时代表组
在表单中, 单选按钮是表示一组互斥选项按钮中的一个。当一个按钮被选中,之前选中的按钮就变为非选中的。 在表单中, 单选按钮是表示一组互斥选项按钮中的一个。当一个按钮被选中,之前选中的按钮就变为非选中的。
### **基本用法** ### **基本用法**
以下是Radio的属性主产明 以下是Radio的属性主产明
- activeColor → Color - 激活时的颜色。 - activeColor → Color - 激活时的颜色。

View File

@ -24,7 +24,7 @@ class _Demo extends State<DemoA> {
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column( return Column(
children: <Widget>[ children: <Widget>[
RadioListTile<String>( RadioListTile<String>(
title: const Text('A'), title: const Text('A'),

View File

@ -33,6 +33,7 @@ class _DemoState extends State<Demo> {
contentList: [ contentList: [
content1, content1,
new DemoA() new DemoA()
], ],
title: 'RadioListTile', title: 'RadioListTile',
docUrl: 'https://docs.flutter.io/flutter/material/RadioListTile-class.html', docUrl: 'https://docs.flutter.io/flutter/material/RadioListTile-class.html',

View File

@ -16,7 +16,7 @@ class SliderDemo extends StatefulWidget {
class _Demo extends State<SliderDemo> { class _Demo extends State<SliderDemo> {
double value = 0.0; double value = 0.0;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Slider( return Slider(
value: value,//实际进度的位置 value: value,//实际进度的位置
inactiveColor: Colors.black12,//进度中不活动部分的颜色 inactiveColor: Colors.black12,//进度中不活动部分的颜色
label: 'value: $value', label: 'value: $value',
@ -43,8 +43,8 @@ class SliderThemeDemo extends StatefulWidget {
class _SliderThemeDemo extends State<SliderThemeDemo> { class _SliderThemeDemo extends State<SliderThemeDemo> {
double value = 0.0; double value = 0.0;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return Container(
child: new SliderTheme( child: SliderTheme(
data: SliderTheme.of(context).copyWith( data: SliderTheme.of(context).copyWith(
// activeTickMarkColor:Colors.yellowAccent, // activeTickMarkColor:Colors.yellowAccent,
activeTrackColor: Colors.yellowAccent,//实际进度的颜色 activeTrackColor: Colors.yellowAccent,//实际进度的颜色
@ -52,21 +52,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
thumbColor: Colors.black,//滑块中心的颜色 thumbColor: Colors.black,//滑块中心的颜色
inactiveTrackColor:Colors.red,//默 认进度条的颜色 inactiveTrackColor:Colors.red,//默 认进度条的颜色
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色 valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式 valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
color: Colors.white, color: Colors.white,
), ),
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色 inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
overlayColor: Colors.pink,//滑块边缘颜色 overlayColor: Colors.pink,//滑块边缘颜色
), ),
child: new Container( child: Container(
width: 340.0, width: 340.0,
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0), margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
child: new Row( child: Row(
children: <Widget>[ children: <Widget>[
new Text('0.0'), Text('0.0'),
new Expanded( Expanded(
flex: 1, flex: 1,
child: new Slider( child: Slider(
value: value, value: value,
label: '$value', label: '$value',
divisions: 10, divisions: 10,
@ -79,7 +79,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
max: 100.0, max: 100.0,
), ),
), ),
new Text('100.0'), Text('100.0'),
], ],
), ),
), ),

View File

@ -46,8 +46,30 @@ const contentB = '''
### **高级用法** ### **高级用法**
> 自定义Slider 样式 > 自定义Slider 样式
<<<<<<< HEAD
如果当前Slider样式 无法满足需求, 可以通过 **SliderTheme** 定制复杂样式 如果当前Slider样式 无法满足需求, 可以通过 **SliderTheme** 定制复杂样式
=======
如果当前Slider样式 无法满足需求, 可以通过 ** SliderTheme ** 定制复杂样式
```
SliderTheme(
data: SliderTheme.of(context).copyWith(
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
inactiveTickMarkColor:Colors.black
thumbColor: Colors.black,//滑块中心的颜色
inactiveTrackColor:Colors.red,//默 认进度条的颜色
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
color: Colors.white,
),
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
overlayColor: Colors.pink,//滑块边缘颜色
child: Slider()
)
```
>>>>>>> ccb5c9e42883b23266fb95b9caf4e958d817ff48
### **基本实例** ### **基本实例**

View File

@ -17,8 +17,8 @@ class SliderThemeDemo extends StatefulWidget {
class _SliderThemeDemo extends State<SliderThemeDemo> { class _SliderThemeDemo extends State<SliderThemeDemo> {
double value = 0.0; double value = 0.0;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return Container(
child: new SliderTheme( child: SliderTheme(
data: SliderTheme.of(context).copyWith( data: SliderTheme.of(context).copyWith(
// activeTickMarkColor:Colors.yellowAccent, // activeTickMarkColor:Colors.yellowAccent,
activeTrackColor: Colors.yellowAccent,//实际进度的颜色 activeTrackColor: Colors.yellowAccent,//实际进度的颜色
@ -26,21 +26,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
thumbColor: Colors.black,//滑块中心的颜色 thumbColor: Colors.black,//滑块中心的颜色
inactiveTrackColor:Colors.red,//默 认进度条的颜色 inactiveTrackColor:Colors.red,//默 认进度条的颜色
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色 valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式 valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
color: Colors.white, color: Colors.white,
), ),
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色 inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
overlayColor: Colors.pink,//滑块边缘颜色 overlayColor: Colors.pink,//滑块边缘颜色
), ),
child: new Container( child: Container(
width: 340.0, width: 340.0,
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0), margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
child: new Row( child: Row(
children: <Widget>[ children: <Widget>[
new Text('0.0'), Text('0.0'),
new Expanded( Expanded(
flex: 1, flex: 1,
child: new Slider( child: Slider(
value: value, value: value,
label: '$value', label: '$value',
divisions: 10, divisions: 10,
@ -53,7 +53,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
max: 100.0, max: 100.0,
), ),
), ),
new Text('100.0'), Text('100.0'),
], ],
), ),
), ),

View File

@ -21,7 +21,36 @@ const contentA = '''
> 通过更改sliderTheme.data, 修改Slider总体样式 > 通过更改sliderTheme.data, 修改Slider总体样式
<<<<<<< HEAD
具体属性, 请查阅: SliderThemeData.data. 具体属性, 请查阅: SliderThemeData.data.
=======
基本属性参考以下代码:
```
SliderTheme(
data: SliderThemeData({
@required Color activeTrackColor,
@required Color inactiveTrackColor,
@required Color disabledActiveTrackColor,
@required Color disabledInactiveTrackColor,
@required Color activeTickMarkColor,
@required Color inactiveTickMarkColor,
@required Color disabledActiveTickMarkColor,
@required Color disabledInactiveTickMarkColor,
@required Color thumbColor,
@required Color disabledThumbColor,
@required Color overlayColor,
@required Color valueIndicatorColor,
@required SliderComponentShape thumbShape,
@required SliderComponentShape valueIndicatorShape,
@required ShowValueIndicator showValueIndicator,
@required TextStyle valueIndicatorTextStyle
}),
child: anyWidgetContain(Slider) // 用来包含slider的widget容器窗口
),
```
>>>>>>> ccb5c9e42883b23266fb95b9caf4e958d817ff48
### **基本实例** ### **基本实例**
@ -42,7 +71,7 @@ class _Demo extends State<Demo> {
codeUrl: 'elements/Form/Slider/SliderTheme/demo.dart', codeUrl: 'elements/Form/Slider/SliderTheme/demo.dart',
contentList: [ contentList: [
contentA, contentA,
new SliderThemeDemo(), SliderThemeDemo(),
], ],
docUrl: 'https://docs.flutter.io/flutter/material/SliderTheme-class.html', docUrl: 'https://docs.flutter.io/flutter/material/SliderTheme-class.html',
); );

View File

@ -17,8 +17,8 @@ class SliderThemeDemo extends StatefulWidget {
class _SliderThemeDemo extends State<SliderThemeDemo> { class _SliderThemeDemo extends State<SliderThemeDemo> {
double value = 0.0; double value = 0.0;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return Container(
child: new SliderTheme( child: SliderTheme(
data: SliderTheme.of(context).copyWith( data: SliderTheme.of(context).copyWith(
// activeTickMarkColor:Colors.yellowAccent, // activeTickMarkColor:Colors.yellowAccent,
activeTrackColor: Colors.yellowAccent,//实际进度的颜色 activeTrackColor: Colors.yellowAccent,//实际进度的颜色
@ -26,21 +26,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
thumbColor: Colors.black,//滑块中心的颜色 thumbColor: Colors.black,//滑块中心的颜色
inactiveTrackColor:Colors.red,//默 认进度条的颜色 inactiveTrackColor:Colors.red,//默 认进度条的颜色
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色 valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式 valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
color: Colors.white, color: Colors.white,
), ),
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色 inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
overlayColor: Colors.pink,//滑块边缘颜色 overlayColor: Colors.pink,//滑块边缘颜色
), ),
child: new Container( child: Container(
width: 340.0, width: 340.0,
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0), margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
child: new Row( child: Row(
children: <Widget>[ children: <Widget>[
new Text('0.0'), Text('0.0'),
new Expanded( Expanded(
flex: 1, flex: 1,
child: new Slider( child: Slider(
value: value, value: value,
label: '$value', label: '$value',
divisions: 10, divisions: 10,
@ -53,7 +53,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
max: 100.0, max: 100.0,
), ),
), ),
new Text('100.0'), Text('100.0'),
], ],
), ),
), ),

View File

@ -39,7 +39,7 @@ class _Demo extends State<Demo> {
codeUrl: 'elements/Form/Slider/SliderThemeData/demo.dart', codeUrl: 'elements/Form/Slider/SliderThemeData/demo.dart',
contentList: [ contentList: [
contentA, contentA,
new SliderThemeDemo() SliderThemeDemo()
], ],
docUrl: 'https://docs.flutter.io/flutter/material/SliderThemeData-class.html', docUrl: 'https://docs.flutter.io/flutter/material/SliderThemeData-class.html',
); );

View File

@ -39,7 +39,7 @@ class _Demo extends State<Demo> {
codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart', codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart',
contentList: [ contentList: [
contentA, contentA,
new AnimatedSwitcherDemo() AnimatedSwitcherDemo()
], ],
docUrl: '', docUrl: '',
); );

View File

@ -18,7 +18,7 @@ class SwitchDemo extends StatefulWidget {
class _Demo extends State<SwitchDemo> { class _Demo extends State<SwitchDemo> {
bool check = false; bool check = false;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Switch( return Switch(
value: this.check, value: this.check,
onChanged: (bool val) { onChanged: (bool val) {
this.setState(() { this.setState(() {
@ -36,7 +36,7 @@ class SwitchHighDemo extends StatefulWidget {
class _SwitchHighDemo extends State<SwitchHighDemo> { class _SwitchHighDemo extends State<SwitchHighDemo> {
bool check = false; bool check = false;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Switch.adaptive( return Switch.adaptive(
value: this.check, value: this.check,
activeColor: Colors.blue, // 激活时原点颜色 activeColor: Colors.blue, // 激活时原点颜色
onChanged: (bool val) { onChanged: (bool val) {
@ -56,7 +56,7 @@ class SwitchTypesDemo extends StatefulWidget {
class _SwitchTypesDemo extends State<SwitchTypesDemo> { class _SwitchTypesDemo extends State<SwitchTypesDemo> {
bool check = false; bool check = false;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Switch( return Switch(
value: this.check, value: this.check,
activeTrackColor:Colors.green, activeTrackColor:Colors.green,
inactiveThumbColor: Colors.black, inactiveThumbColor: Colors.black,

Some files were not shown because too many files have changed in this diff Show More