diff --git a/CHANGE-LOG.md b/CHANGE-LOG.md deleted file mode 100644 index a625fbfe..00000000 --- a/CHANGE-LOG.md +++ /dev/null @@ -1,86 +0,0 @@ -## 更新日志 - - -#### 2019-2-5 - - [x] 处理因为flutter版本导致的项目运行不起来 - - [x] 更新readme, 加入开发日志, 与相关说明 - - [x] 加入 首页欢迎效果图 - - [x] refactor(整理richText的说明): - - [x] 解决一些页面的code演示打不开的问题 - - [x] add:开发规范 - - [x] add:版本更新历史链接 - - [x] Update README.md - - [x] add:添加版本号 - - [x] feat:添加代码开发规范 - - [x] refactor(update: version & fiexed warns): - - [x] fix(solve conflict): - - [x] modify:toast and andrid apk label - - [x] Add:自动 pr 工具抓取器,抓取两周前至今的,提交数据,并去重 - - [x] fix:fluttetToast backHome - - [x] fix:modified the style of toast && remote files - - [x] chore(删除tools/log.json): - - [x] 重构文件结构 - - [x] 关于手册图标更换 - - [x] 增加demo: CupertinoNavigationBar CupertinoPageRoute CupertinoPageScaffold CupertinoPicker,CupertinoPopupSurface CupertinoTimerPickerDemo - - -#### 2019-1-24 - - [x] 功能:更新小部件的图标 - - [x] 功能:添加CupertinoTimerPickerDemo - - [x] 调试:消除警告 - - [x] 修复:关于手册图标更换 - - [x] 添加:文案描述 - - [x] 添加:CupertinoPicker,CupertinoPopupSurface -#### 2019-1-23 - - [x] 修复: 导航栏home返回报错 - - [x] 修复:收集错误 - - [x] 添加:CupertinoNavigationBar CupertinoPageRoute CupertinoPageScaffold -#### 2019-1-22 - - [x] 功能:在Allsimon拉请求中添加英文简介 -#### 2019-1-21 - - [x] 功能:Cupertino的子项 -#### 2019-1-20 - - [x] 功能:CupertinoSwitch演示 - - [x] 功能:为搜索列表加入图标 - - [x] 功能:CupertinoSliverRefreshControl演示 - - [x] 功能:CupertinoSliverNavigationBar演示 -#### 2019-1-18 - - [x] 更新:SharedPreferences保存数据和android设备布局溢出 - - [x] 功能:添加CupertinoScrollbar演示 - - [x] 功能:第四页暂时用欢迎页替代。后期再开发 -#### 2019-1-17 - - [x] 添加:+许可证 -#### 2019-1-16 - - [x] 转换:将README翻译为En语言环境 - - [x] 功能:CupertinoScrollbar演示 -#### 2019-1-14 - - [x] 添加:增加手册页面 - - [x] 功能:文字演示 - - [x] 重构:修改过的图标 - - [x] 重构:文档,文章,组件收藏,新增webView - - [x] 重构:修改过的演示 - - [x] 重构:代码视图 - - [x] 更新:版本 和readme.md - - [x] 修改:添加代码视图 - - [x] 功能:添加搜索历史记录板 - - [x] 修改:列出加标头错误 -#### 2019-1-15 - - [x] 功能:welcomepage -#### 2019-1-13 - - [x] 添加:一些输入描述 - - [x] 功能:加入GridPaper&SliverGrid - - [x] 重构:修改db - - [x] 重构:删除数据库 TabBarView - - [x] 添加:网格视图 - - [x] 修改:checkbosListTile 错误 - - [x] 修改:自动提示文案 - - [x] 功能:增加免责声明,声明组件,自动弹出,左上角入口 - - [x] 重构:整理数据库初始逻辑,判断数据库完整性,判断是否存在已知的cat,widget,collection 三张表。 - - [x] 修复:DialogDemo,无法关闭的问题 -#### 2019-1-12 - - [x] 修复:icon没有,但内容有的,组件,给补充了icon - - [x] 修改:1.整理文件 2.修正分析 - - [x] 更新:flutter_rookie_book => flutter_go - - [x] 更新:更新SearchInput文件名=> search_input - - [x] 修改:文件名称的大小写规范 - - [x] 修改:修正bottomNavigationBar iconButton警告 diff --git a/FlutterGo.apk b/FlutterGo.apk deleted file mode 100644 index 01ce3048..00000000 Binary files a/FlutterGo.apk and /dev/null differ diff --git a/Flutter_Go 代码开发规范.md b/Flutter_Go 代码开发规范.md deleted file mode 100644 index 614f44b3..00000000 --- a/Flutter_Go 代码开发规范.md +++ /dev/null @@ -1,679 +0,0 @@ -# Flutter Go 代码开发规范 0.1.0 版 - -## 代码风格 - -### 标识符三种类型 - -#### 大驼峰 -类、枚举、typedef和类型参数 - -``` - class SliderMenu { ... } - - class HttpRequest { ... } - - typedef Predicate = bool Function(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 = []; -``` - -不推荐如下写法: - -``` - 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: -var iterable = [1, 2, 3]; - -// Prints "List": -print(iterable.toList().runtimeType); -``` - -``` -// Creates a List: -var iterable = [1, 2, 3]; - -// Prints "List": -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 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]); - } -``` - - - - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0d5ee6f4..00000000 --- a/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -BSD License - -Copyright (c) 2018-present, Alibaba Group Holding Limited. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of the copyright holder nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README-en.md b/README-en.md deleted file mode 100644 index e6a91cfe..00000000 --- a/README-en.md +++ /dev/null @@ -1,88 +0,0 @@ -## Flutter Go - -![https://img.alicdn.com/tfs/TB1OJkeHNYaK1RjSZFnXXa80pXa-229-229.png](https://img.alicdn.com/tfs/TB1OJkeHNYaK1RjSZFnXXa80pXa-229-229.png) - -> Help developers get started quickly Flutter **Flutter Go 1.0 Android has been released** - - -## Download URL - -Android download URL: - - - -Iphone download URL: -No - -## Development Environment -This Project need latest package, please update regularly. - -- dart(version: 2.0.0) -- flutter(version: v1.0.0) - -### Background - -#### What is Flutter? - -On June 21, 2018, Google released the first release preview of Flutter as a new responsive, cross-platform, high-performance mobile development framework launched by Google. Flutter is a cross-platform mobile UI framework designed to help developers develop high-performance, high-fidelity Android and iOS apps using a single set of code. - -The advantages of Flutter mainly include: -- Cross-platform -- Open source -- Hot Reload, responsive framework, and its rich controls and development tools -- Flexible interface design and control combinations -- High quality user experience with a portable GPU-accelerated rendering engine and high-performance ARM code runtime - -#### The origin of Flutter Go - -- Flutter has too little learning material, which is relatively difficult for students who are not good at English. -- The official website document example is not sound enough, not intuitive enough -- The usage of each widget is different, and the properties are numerous. To run a demo of a widget, it is often necessary to look through various materials everywhere. - -#### Advantages of Flutter Go - -- Detailed idiom widgets up to **130+** -- Companion Demo Explain the widget's general usage -- Centralized integration of widget cases, an APP to get all the usage of common widgets -- Continuous iteration ‘chasing new’ official version - -### App Preview - - - - -### Core Team - - - - - - - - - - - -
- -
- @minghe -
- -
- @ryan730 -
- -
- @Nealyang -
- -
- @hanxu317317 -
- -
- @DeckeDeng -
- -Powered by [Alibaba Auction Front-end Team](https://github.com/alibaba-paimai-frontend) diff --git a/README.md b/README.md deleted file mode 100644 index 8ea37a97..00000000 --- a/README.md +++ /dev/null @@ -1,128 +0,0 @@ -Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.md) | [中文简体](https://github.com/alibaba/flutter-go/blob/master/README.md) -## Flutter Go - -![https://img.alicdn.com/tfs/TB1OJkeHNYaK1RjSZFnXXa80pXa-229-229.png](https://img.alicdn.com/tfs/TB1OJkeHNYaK1RjSZFnXXa80pXa-229-229.png) - -> 帮助开发者快速上手 Flutter **Flutter Go 1.0 Android版已正式发布** - -## 版本更新历史 -> 按时间顺序,展示重要的提交更新内容。 - -[地址](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) - -## The Flutter-Go Roadmap(路线图) for 2019 -> 考虑到 Flutter 未来的变化和策略的可变性, roadmap 不排除有一定调整,但总体不会变化太大。 - - - - - -## Release安装包下载地址 - -android下载地址: - - - -iphone下载地址: AppStore上面进行搜索fluttego - - - - -## 基础环境 -本项目环境持续更新. 请定期更新各依赖包. - -- dart(version: 2.0.0) -- flutter(version: v1.0.0) - - -### 背景 - -#### Flutter 是什么? - -2018年6月21日Google发布Flutter首个release预览版,作为Google 大力推出的一种全新的响应式,跨平台,高性能的移动开发框架。Flutter是一个跨平台的移动UI框架,旨在帮助开发者使用一套代码开发高性能、高保真的Android和iOS应用。 - -flutter优点主要包括: -- 跨平台 -- 开源 -- Hot Reload、响应式框架、及其丰富的控件以及开发工具 -- 灵活的界面设计以及控件组合 -- 借助可以移植的GPU加速的渲染引擎以及高性能ARM代码运行时已达到高质量的用户体验 - -#### Flutter Go 的由来 - -- Flutter学习资料太少,对于英文不好的同学相对来说比较困难 -- 官网文档示例不够健全,不够直观 -- 各个 widget 的用法各异,属性纷繁,要运行一个 widget 的 demo 往往要到处翻阅各种资料 - -#### Flutter Go 的优势 - -- 详解常用 widget 多达 **140+** 个 -- 配套 Demo 详解 widget 常规用法 -- 集中整合 widget 案例,一个 APP 搞定所有常用 widget 的用法 -- 持续迭代 ‘追新’ 官方版本 - -### app 预览 - - - - -### Core Team - - - - - - - - - - - -
- -
- @minghe -
- -
- @ryan730 -
- -
- @Nealyang -
- -
- @hanxu317317 -
- -
- @DeckeDeng -
- -### 版权说明 -- 感谢大家对 `flutter go` 的支持和下载,但近期发现,有类似直接被发布到苹果 app store 上的行为,并未注明真实来源,copyright 和 项目的 github 地址,以及开发者的版权相关信息( 包括删除"首页栏的版权声明"和"关于我们"的行为 ); - -- 上述行为,打击了 `flutter go` 开发者的积极性,同时干扰了 flutter go app 的正常发布渠道,基于 app 开源项目的发布特殊性,特更新 [LICENSE](LICENSE) 「 开源许可证 」,由 MIT 协议 更改为 BSD 协议, 同时建议不要随意发布到公共渠道的应用商店,影响官方 `flutter go` 的app版本迭代; - -- 大家可以继续放心的开源使用,但是要求注意和遵守以下许可前提: -``` - * 版权声明样式 - //Copyright (c) 2018-present, Alibaba Group Holding Limited. All rights reserved. - - * 源代码的重新分发必须保留上述版权声明,条件清单和免责声明。 - - * 二进制形式的再分发必须复制上述版权声明,此条件列表以及文档中的以下免责声明和/或随分发提供的其他材料。 -``` -- 由于本开源项目是供大家学习和交流 flutter 之用,里面耗费了开发人员大量的心血,精力和热情,请尊重开发者的劳动成果,以及相关许可证之规定; - -- 大家的互相信任,尊重与支持,才是开源社区前进的动力和来源. - -Powered by [阿里拍卖前端团队](https://github.com/alibaba-paimai-frontend) - -+++++++ \ No newline at end of file diff --git a/android/.project b/android/.project deleted file mode 100644 index 3964dd3f..00000000 --- a/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - android - Project android created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index e8895216..00000000 --- a/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir= -eclipse.preferences.version=1 diff --git a/android/app/.classpath b/android/app/.classpath deleted file mode 100644 index eb19361b..00000000 --- a/android/app/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/android/app/.project b/android/app/.project deleted file mode 100644 index ac485d7c..00000000 --- a/android/app/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - app - Project app created by Buildship. - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/android/app/.settings/org.eclipse.buildship.core.prefs b/android/app/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index b1886adb..00000000 --- a/android/app/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir=.. -eclipse.preferences.version=1 diff --git a/android/app/build.gradle b/android/app/build.gradle deleted file mode 100644 index 03806468..00000000 --- a/android/app/build.gradle +++ /dev/null @@ -1,95 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -def keystoreProperties = new Properties() -def keystorePropertiesFile = rootProject.file('key.properties') -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} - - -android { - compileSdkVersion 28 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.alibaba.fluttergo" - minSdkVersion 16 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - signingConfigs { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - } - } - buildTypes { - release { - signingConfig signingConfigs.release - } - } - -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' - //firebase - implementation 'com.google.firebase:firebase-core:16.0.8' - //Crashlytics SDK - implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9' - // 性能监控 - ///implementation 'com.google.firebase:firebase-perf:16.2.3' - // 登陆 - ////implementation 'com.google.firebase:firebase-auth:16.0.3' -} -//firebase -apply plugin: 'com.google.gms.google-services' -//Crashlytics SDK -apply plugin: 'io.fabric' -// 性能监控 -///apply plugin: 'com.google.firebase.firebase-perf' \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json deleted file mode 100644 index 06bce26c..00000000 --- a/android/app/google-services.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "project_info": { - "project_number": "611157827052", - "firebase_url": "https://alibaba-flutter-go.firebaseio.com", - "project_id": "alibaba-flutter-go", - "storage_bucket": "alibaba-flutter-go.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:611157827052:android:c6129e5eff2f125d", - "android_client_info": { - "package_name": "com.alibaba.fluttergo" - } - }, - "oauth_client": [ - { - "client_id": "611157827052-iiuevj8qu56alpqh47v37j9sd4e40di7.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyA9chxDIuds7gmPQTJPpDpoXyN9rDTdvhU" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "611157827052-iiuevj8qu56alpqh47v37j9sd4e40di7.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - } - ], - "configuration_version": "1" -} diff --git a/android/app/release/output.json b/android/app/release/output.json deleted file mode 100644 index 16e1b0c5..00000000 --- a/android/app/release/output.json +++ /dev/null @@ -1 +0,0 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"0.0.5","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index 615dd053..00000000 --- a/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 80c74332..00000000 --- a/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/android/app/src/main/kotlin/fluttergo/ali/com/fluttergo/MainActivity.kt b/android/app/src/main/kotlin/fluttergo/ali/com/fluttergo/MainActivity.kt deleted file mode 100644 index 947b661a..00000000 --- a/android/app/src/main/kotlin/fluttergo/ali/com/fluttergo/MainActivity.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.alibaba.fluttergo - -import android.os.Bundle - -import io.flutter.app.FlutterActivity -import io.flutter.plugins.GeneratedPluginRegistrant - -class MainActivity: FlutterActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - GeneratedPluginRegistrant.registerWith(this) - } -} diff --git a/android/app/src/main/res/drawable/flutter_go_logo.png b/android/app/src/main/res/drawable/flutter_go_logo.png deleted file mode 100644 index a2fa74a3..00000000 Binary files a/android/app/src/main/res/drawable/flutter_go_logo.png and /dev/null differ diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 65431575..00000000 --- a/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - diff --git a/android/app/src/main/res/drawable/logo.png b/android/app/src/main/res/drawable/logo.png deleted file mode 100644 index 98ad452f..00000000 Binary files a/android/app/src/main/res/drawable/logo.png and /dev/null differ diff --git a/android/app/src/main/res/drawable/splash.png b/android/app/src/main/res/drawable/splash.png deleted file mode 100644 index d42caece..00000000 Binary files a/android/app/src/main/res/drawable/splash.png and /dev/null differ diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index 02a96f05..00000000 --- a/android/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_logo.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_logo.png deleted file mode 100644 index bb7bd02c..00000000 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_logo.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_logo.png deleted file mode 100644 index bb7bd02c..00000000 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_logo.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_logo.png deleted file mode 100644 index bb7bd02c..00000000 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_logo.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_logo.png deleted file mode 100644 index bb7bd02c..00000000 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_logo.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_logo.png deleted file mode 100644 index bb7bd02c..00000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/spalsh.png b/android/app/src/main/res/mipmap-xxxhdpi/spalsh.png deleted file mode 100644 index dc63fc0e..00000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/spalsh.png and /dev/null differ diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 00fa4417..00000000 --- a/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index 615dd053..00000000 --- a/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 01a308ee..00000000 --- a/android/build.gradle +++ /dev/null @@ -1,45 +0,0 @@ -buildscript { - ext.kotlin_version = '1.3.0' - repositories { - google() - jcenter() - //Crashlytics SDK - maven { - url 'https://maven.fabric.io/public' - } - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' - //firebase - classpath 'com.google.gms:google-services:4.2.0' - //Crashlytics SDK - classpath 'io.fabric.tools:gradle:1.26.1' - // 性能监控 - ///classpath 'com.google.firebase:firebase-plugins:1.1.5' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - jcenter() - //Crashlytics SDK - maven { - url 'https://maven.google.com/' - } - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/android/gradle.properties b/android/gradle.properties deleted file mode 100644 index 678cd624..00000000 --- a/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableJetifier=true -android.useAndroidX=true \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index c2bcac0e..00000000 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Thu Jan 10 15:37:36 CST 2019 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/android/key.properties b/android/key.properties deleted file mode 100644 index 0be86790..00000000 --- a/android/key.properties +++ /dev/null @@ -1,4 +0,0 @@ -storePassword=fluttergo123 -keyPassword=fluttergo123 -keyAlias=key -storeFile=/Users/xj.deng/key.jks \ No newline at end of file diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index 5a2f14fb..00000000 --- a/android/settings.gradle +++ /dev/null @@ -1,15 +0,0 @@ -include ':app' - -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() - -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} diff --git a/api.md b/api.md deleted file mode 100644 index e2c3506d..00000000 --- a/api.md +++ /dev/null @@ -1,1964 +0,0 @@ -## widget库 -### 扑组件框架 - -使用方法:进口 package:flutter/widgets.dart - -### 类 - -#### AbsorbPointer -> 在命中测试期间吸收指针的widget。[...] - -#### align -一个widget,用于将其子项与其自身对齐,并根据子级的大小自行调整大小。[...] - -对准 -矩形内的一个点。[...] - -AlignmentDirectional -偏移量,表示为“ 大小”的一部分,但其水平分量取决于书写方向。[...] - -AlignmentGeometry -Alignment的 基类,允许文本方向感知分辨率。[...] - -AlignmentGeometryTween -两个AlignmentGeometry之间的插值。[...] - -AlignmentTween -两个对齐之间的插值。[...] - -AlignTransition -Align的 动画版本,可以为其Align.alignment属性设置动画。 - -AlwaysScrollableScrollPhysics -滚动物理总是让用户滚动。[...] - -AlwaysStoppedAnimation < T > -在给定值停止的动画[...] - -Animate< T > -一个通过输入动画来生成类型为T的值的对象。[...] - -AnimatedAlign -Align的 动画版本,只要给定的对齐发生变化,就会在给定的持续时间内自动转换child的位置。[...] - -AnimatedBuilder -用于构建动画的通用widget。[...] - -AnimatedContainer -在一段时间内逐渐更改其值的容器。[...] - -AnimatedCrossFade -一个widget,它在两个给定的子节点之间交叉淡化,并在它们的大小之间设置动画。[...] - -AnimatedDefaultTextStyle - -DefaultTextStyle的 动画版本,无论何时给定的样式发生更改,都会在给定的持续时间内自动转换默认文本样式(文本样式以应用于没有显式样式的后代Text widget)。[...] - -AnimatedList -一个滚动容器,可在插入或移除项目时为其设置动画。[...] - -AnimatedListState -滚动容器的状态,在插入或移除项目时为其设置动画。[...] - -AnimatedModalBarrier -一个widget,可以防止用户与自身后面的widget交互,并且可以使用动画颜色值进行配置。[...] - -AnimatedOpacity -不透明度的 动画版本,只要给定的不透明度发生变化,就会自动转换child在给定持续时间内的不透明度。[...] - -AnimatedPadding -Padding的 动画版本,无论何时给定的插入更改,它都会在给定的持续时间内自动转换缩进。[...] - -AnimatedPhysicalModel -PhysicalModel的 动画版本。[...] - -AnimatedPositioned -定位的 动画版本,可在给定位置发生变化时自动转换child在给定持续时间内的位置。[...] - -AnimatedPositionedDirectional -PositionedDirectional的 动画版本,可在给定位置发生变化时自动转换child在给定持续时间内的位置。[...] - -AnimatedSize -动画窗口widget,只要给定子项的大小发生更改,就会在给定的持续时间内自动转换其大小。 - -AnimatedSwitcher -默认情况下,窗口widget在新窗口widget和先前在AnimatedSwitcher上设置为窗口widget的窗口widget之间执行FadeTransition。[...] - -AnimatedWidget -在给定的Listenable更改值时重建的窗口widget。[...] - -AnimatedWidgetBaseState < T扩展了ImplicitlyAnimatedWidget > -具有隐式动画的widget的基类。[...] - -Animate< T > -值为type的动画T。[...] - -AnimationController -动画控制器。[...] - -AnimationEagerListenerMixin -一个mixin用dispose契约替换didRegisterListener / didUnregisterListener契约。 - -AnimationLazyListenerMixin -mixin仅在此对象已注册侦听器时帮助侦听另一个对象。 - -AnimationLocalListenersMixin -一个mixin,它实现addListener / removeListener协议,并在调用notifyListeners时通知所有已注册的侦听器。 - -AnimationLocalStatusListenersMixin -一个mixin,它实现addStatusListener / removeStatusListener协议,并在调用notifyStatusListeners时通知所有已注册的侦听器。 - -AnimationMax < T extends num > -跟踪最多两个其他动画的动画。[...] - -AnimationMean -双 s 的动画,跟踪其他两个动画的平均值。[...] - -AnimationMin < T extends num > -跟踪最少两个其他动画的动画。[...] - -AnimationWithParentMixin < T > -通过将其行为推迟到给定的父动画来 实现大多数动画界面。[...] - -ASPECTRATIO -尝试将子项调整为特定宽高比的widget。[...] - -AssetBundleImageKey -由AssetImage或ExactAssetImage获取的图像的键。[...] - -AssetBundleImageProvider -ImageProvider的 一个子类,它知道AssetBundle。[...] - -AssetImage -从AssetBundle获取图像,根据上下文确定要使用的确切图像。[...] - -AsyncSnapshot < T > -与异步计算的最新交互的不可变表示。[...] - -AutomaticKeepAlive -允许子树请求在惰性列表中保持活动状态。[...] - -AutomaticKeepAliveClientMixin < T扩展StatefulWidget > -为AutomaticKeepAlive的客户提供方便的方法。[...] - -BackdropFilter -一个widget,它将过滤器应用于现有的绘制内容,然后绘制子项。[...] - -BallisticScrollActivity -基于物理模拟动画滚动视图的活动。[...] - -旗帜 -在另一个widget的角落上方显示对角线消息。[...] - -BannerPainter -画横幅。 -底线 -根据child的基线定位child的widget。[...] - -BeveledRectangleBorder -带有扁平或“斜角”角的矩形边框。[...] - -BlockSemantics -一个窗口widget,它删除在同一个语义容器中绘制在其之前的所有窗口widget的语义。[...] - -边境 -盒子的边框,由四个边组成:顶部,右侧,底部,左侧。[...] - -BorderDirectional -盒子的边框,由四个边组成,其侧面基于读取方向翻转。[...] - -BorderRadius -矩形每个角的一组不可变半径。[...] - -BorderRadiusDirectional -矩形的每个角的一组不可变半径,但是角的指定方式取决于书写方向。[...] - -BorderRadiusGeometry -BorderRadius的 基类,允许文本方向感知解析。[...] - -BorderRadiusTween -两个BorderRadius之间的插值。[...] - -BorderSide -盒子边框的一面。[...] - -BottomNavigationBarItem -材质的BottomNavigationBar 或带有图标和标题的iOS主题CupertinoTabBar中的交互式按钮。[...] - -BouncingScrollPhysics -滚动物理环境允许滚动偏移超出内容范围,但随后将内容反弹回这些边界的边缘。[...] - -BouncingScrollSimulation -与iOS匹配的滚动物理实现。[...] - -BoxBorder -框边框的基类,可以绘制为矩形,圆形或圆角矩形。[...] - -BoxConstraints -不可变的布局约束RenderBox布局。[...] - -BoxConstraintsTween -两个BoxConstraints之间的插值。[...] - -BoxDecoration -关于如何绘制框的不可变描述。[...] - -BoxPainter -一个有状态的类,可以绘制一个特定的装饰。[...] - -BoxScrollView -一个滚动型采用单个子布局的模型。[...] - -BoxShadow -由盒子投下的阴影。[...] - -BuildContext -窗口widget树中窗口widget位置的句柄。[...] - -生成器 -一个柏拉图窗口widget,它调用闭包来获取其子窗口widget。[...] - -BuildOwner -窗口widget框架的管理器类。[...] - -帆布 -用于记录图形操作的界面。[...] - -中央 -一个小孩,它将child置于其中心。[...] - -ChangeNotifier -可以扩展或混合的类,使用VoidCallback为通知提供更改通知API 。[...] - -CheckedModeBanner -在已检查模式下运行时 显示标有“DEBUG” 的横幅。 MaterialApp默认构建其中一个。在发布模式下无效。 - -CircleBorder -适合可用空间内圆圈的边框。[...] - -ClampingScrollPhysics -滚动物理场以防止滚动偏移超出内容边界的环境。[...] - -ClampingScrollSimulation -与Android匹配的滚动物理实现。[...] - -ClipOval -使用椭圆剪辑其子项的widget。[...] - -ClipPath -使用路径剪辑其子项的窗口widget。[...] - -ClipRect -使用矩形剪辑其子项的widget。[...] - -ClipRRect -使用圆角矩形剪辑其子项的窗口widget。[...] - -颜色 -ARGB格式的不可变32位颜色值。[...] - -ColorFilter -描述在绘制形状或使用特定Paint合成图层时应用的滤镜。滤色器是一种采用两种颜色并输出一种颜色的功能。在合成期间应用时,在整个图层与目标合并之前,它将独立应用于正在绘制的图层的每个像素。[...] - -ColorSwatch < T > -一种颜色,有一个相关颜色的小表称为“样本”。[...] - -ColorTween -两种颜色之间的插值。[...] - -柱 -在垂直方向排列布局子控件的控件[...] - -ComponentElement -一个元素是组成其他要素秒。[...] - -CompositedTransformFollower -一个遵循CompositedTransformTarget的widget。[...] - -CompositedTransformTarget -CompositedTransformFollower 可以定位的widget。[...] - -CompoundAnimation < T > -用于组合多个动画的界面。子类只需要实现valuegetter来控制子动画的组合方式。可以链接组合2个以上的动画。[...] - -ConstrainedBox -一个widget,对其子级施加其他约束。[...] - -容器 -一个结合了常用的绘图组件,定位组件和尺寸组件的便捷组件。[...] - -立方体 -单位区间的三次多项式映射。[...] - -曲线 -单位间隔到单位间隔的映射。[...] - -CurvedAnimation -将曲线应用于另一个动画的动画。[...] - -曲线 -常见动画曲线的集合。[...] - -CurveTween -通过给定曲线转换给定动画的值。[...] - -CustomClipper < T > -用于提供自定义剪辑的界面。[...] - -CustomMultiChildLayout -一个widget,它使用委托来调整和定位多个子节点。[...] - -CustomPaint的 -一个widget,提供在绘制阶段绘制的画布。[...] - -CustomPainter -所用的接口CustomPaint的(在部件库)和 RenderCustomPaint(在绘制库)。[...] - -CustomPainterSemantics -包含描述由CustomPaint使用的Canvas包含的矩形中绘制的信息的属性。[...] - -CustomScrollView -一个滚动型创建使用棉条自定义滚动效果。[...] - -CustomSingleChildLayout -一个widget,将其单个子级的布局推迟到委托。[...] - -DecoratedBox -在儿童绘画之前或之后 绘制装饰的widget。[...] - -DecoratedBoxTransition -动画版的DecoratedBox是其动画的不同属性装饰。[...] - -装饰 -盒子装饰(应用于Rect的装饰)的描述。[...] - -DecorationImage -箱子装饰的图象。[...] - -DecorationImagePainter -装饰图像 的画家。[...] - -DecorationTween -两个装饰之间的插值。[...] - -DefaultAssetBundle -一个widget,用于确定其后代的默认资产包。[...] - -DefaultTextStyle -要应用于后代Text widget而没有显式样式的文本样式。 - -DefaultWidgetsLocalizations -widget库的美国英语本地化版本。[...] - -方向性 -用于确定文本和文本方向敏感渲染对象的环境方向性的窗口widget。[...] - -可取消 -可以通过在指示的方向上拖动来解除的widget。[...] - -DragDownDetails -使用GestureDragDownCallback的回调的详细信息对象。[...] - -DragEndDetails -使用GestureDragEndCallback的回调的详细信息对象。[...] - -可拖动< T > -可以拖动到DragTarget的窗口widget。[...] - -DragScrollActivity -滚动视图在用户在屏幕上拖动手指时执行的活动。[...] - -DragStartDetails -使用GestureDragStartCallback的回调的详细信息对象。[...] - -DragTarget < T > -删除Draggable widget 时接收数据的widget。[...] - -DragUpdateDetails -使用GestureDragUpdateCallback的回调的详细信息对象。[...] - -DrivenScrollActivity -基于动画参数设置动画滚动视图的活动。[...] - -EdgeInsets -四个基本方向中每个方向的一组不可变的偏移量。[...] - -EdgeInsetsDirectional -四个基本方向中的每个方向上的不可变的偏移集,但其水平分量取决于书写方向。[...] - -EdgeInsetsGeometry -EdgeInsets的 基类,允许文本方向感知分辨率。[...] - -EdgeInsetsGeometryTween -两个EdgeInsetsGeometry之间的插值。[...] - -EdgeInsetsTween -两个EdgeInsets之间的插值。[...] - -EditableText -基本文本输入字段。[...] - -EditableTextState -声明EditableText的状态。 - -ElasticInCurve -振荡曲线,在超出其范围的同时增大幅度。[...] - -ElasticInOutCurve -一条振荡曲线,在超出其范围时会增大然后收缩。[...] - -ElasticOutCurve -一条振荡曲线,在超出其范围时会缩小幅度。[...] - -元件 -树中特定位置 的Widget实例化。[...] - -ErrorWidget -呈现异常消息的widget。[...] - -ExactAssetImage -从AssetBundle获取图像,将其与给定比例相关联。[...] - -ExcludeSemantics -删除其后代的所有语义的widget。[...] - -扩展 -一个使Row,Column或Flex的子控件扩展尺寸的控件。[...] - -FadeInImage -在加载目标图像时显示占位符图像的图像,然后在加载时淡入新图像。[...] - -FadeTransition -动画widget的不透明度。[...] - -FileImage -将给定的File对象解码为图像,将其与给定的比例相关联。[...] - -FittedBox -秤,并根据自身内部定位其子契合。[...] - -FittedSizes -applyBoxFit 返回的这对大小。 - -FixedColumnWidth -将列的大小调整为特定数量的像素。[...] - -FixedExtentMetrics -ScrollPosition到具有固定项目大小的滚动视图的 度量标准。[...] - -FixedExtentScrollController -用于滚动视图的控制器,其项目具有相同的大小。[...] - -FixedExtentScrollPhysics -一种捕捉物理,它总是直接落在物品上而不是滚动范围内的任何地方。[...] - -FixedScrollMetrics -与Scrollable视口关联的值的不可变快照。[...] - -柔性 -在一维数组中显示其子项的窗口widget。[...] - -FlexColumnWidth -在布置了所有其他列之后,通过占用剩余空间的一部分来确定列的大小。[...] - -灵活 -控制行,列或Flex的子项如何弯曲的widget。[...] - -FlippedCurve -曲线是其给定曲线的反转。[...] - -流 -根据FlowDelegate中的逻辑,可以有效地调整和定位子项的widget。[...] - -FlowDelegate -一个控制流布局外观的委托。[...] - -FlowPaintingContext -FlowDelegate绘制的 上下文。[...] - -FlutterErrorDetails -提供给FlutterExceptionHandler回调的信息的类。[...] - -FlutterLogoDecoration -关于如何绘制Flutter徽标的不可变描述。 -的FocusManager -管理焦点树。[...] - -FocusNode -焦点树中可以接收焦点的叶节点。[...] - -FocusScope -建立一个widget可以获得焦点的范围。[...] - -FocusScopeNode -焦点树中的内部节点。[...] - -fontWeight设置 -用于绘制文本的字形的粗细 -形成 -用于将多个表单字段widget(例如TextField widget)分组在一起的可选容器。[...] - -FormField < T > -单个表单字段。[...] - -FormFieldState < T > -FormField 的当前状态。传递给FormFieldBuilder方法,用于构造表单字段的widget。 - -FormState -与窗口widget关联的状态。[...] - -FractionallySizedBox -一个widget,可将其子级调整为总可用空间的一小部分。有关布局算法的更多详细信息,请参阅 RenderFractionallySizedOverflowBox。[...] - -FractionalOffset -偏移量,表示为大小的一部分。[...] - -FractionalOffsetTween -两个小数偏移之间的插值。[...] - -FractionalTranslation -在绘制其子项之前应用转换转换。[...] - -FractionColumnWidth -将列的大小调整为表的约束'maxWidth的一小部分。[...] - -FutureBuilder < T > -基于与Future交互的最新快照构建自己的widget。[...] - -GestureDetector -检测手势的widget。[...] - -GestureRecognizerFactory < T扩展了GestureRecognizer > -用于创建手势识别器的工厂。[...] - -GestureRecognizerFactoryWithHandlers < T扩展了GestureRecognizer > -工厂用于创建委托给回调的手势识别器。[...] - -GlobalKey < Ť延伸国< StatefulWidget > > -整个应用程序中唯一的密钥。[...] - -GlobalObjectKey < Ť延伸国< StatefulWidget > > -一个全局键,从用作其值的对象获取其标识。[...] - -GlowingOverscrollIndicator -滚动视图已过度滚动的可视指示。[...] - -梯度 -2D渐变。[...] - -GridPaper -一个widget,用于绘制一个像素宽的直线网格。[...] - -网格视图 -可滚动的2Dwidget数组。[...] - -英雄 -一个widget,标记其子级为英雄动画的候选者。[...] - -HeroController -一个导航观察者管理英雄的转变。[...] - -HoldScrollActivity -滚动活动,除了可以释放以恢复正常的空闲行为之外什么也不做。[...] - -HSVColor -使用alpha,hue,饱和度和值表示的颜色。[...] - -图标 -图形图标插件与来自于所述的字体的字形绘制IconData如材料的预定IconData以s 图标。[...] - -IconData -字体标志符号表示的图标说明。[...] - -IconTheme -控制窗口widget子树中图标的默认颜色,不透明度和大小。[...] - -IconThemeData -定义图标的颜色,不透明度和大小。[...] - -IdleScrollActivity -滚动活动,什么都不做。[...] - -IgnorePointer -在命中测试期间不可见的widget。[...] - -图片 -显示图像的widget。[...] - -ImageCache -类为imageCache对象。[...] - -ImageConfiguration -传递给ImageProvider.resolve方法的配置信息,用于选择特定图像。[...] - -的ImageIcon -来自ImageProvider的图标,例如AssetImage。[...] - -的imageinfo -一个dart:ui.Image对象及其对应的比例。[...] - -ImageProvider < T > -识别图像而不提交精确的最终资产。这允许识别一组图像,并且稍后基于环境(例如,设备像素比)来解析精确图像。[...] - -ImageShader -用于平铺图像的着色器(由Paint.shader使用)。 - -的ImageStream -图像资源的句柄。[...] - -ImageStreamCompleter -用于管理dart加载的基类:用于ImageStream的ui.Image对象 。[...] - -ImplicitlyAnimatedWidget -用于构建窗口widget的抽象窗口widget,可在一段时间内逐渐更改其值。[...] - -IndexedStack -一个堆栈,显示来自子项列表的单个子项。[...] - -InheritedElement -使用InheritedWidget作为其配置 的Element。 - -InheritedWidget -widget的基类,可以有效地在树中传播信息。[...] - -InspectorSelection -检查员的可变选择状态。 -间隔 -曲线直到开始为0.0 ,然后弯曲(根据曲线从0.0到1.0 结束,然后是1.0。[...] - -IntrinsicColumnWidth -根据该列中所有单元格的固有尺寸确定列的大小。[...] - -IntrinsicHeight -一个widget,可以将其子级调整为子级的内在高度。[...] - -IntrinsicWidth -一个widget,可以将其子级调整为子级的内部宽度。[...] - -IntTween -两个整数之间的插值。[...] - -活着 -标记一个child需要保持活着,即使它在一个懒惰的列表中,否则将删除它。[...] - -KeepAliveHandle -甲收听其可以手动触发。[...] - -KeepAliveNotification -指示此通知气泡必须保持活动的子树,即使它通常会作为优化被丢弃。[...] - -键 -Key是Widget,Element和SemanticsNode的标识符[...] - -KeyedSubtree -构建其子项的widget。[...] - -LabeledGlobalKey < Ť延伸国< StatefulWidget > > -带调试标签的全局密钥。[...] - -LayerLink -LeaderLayer可以注册 的对象。[...] - -LayoutBuilder -构建可依赖于父窗口widget大小的窗口widget树。[...] - -LayoutChangedNotification -指示接收此通知的对象的其中一个后代的布局已经以某种方式更改,因此关于该布局的任何假设都不再有效。[...] - -LayoutId -用于标识CustomMultiChildLayout中的子项的元数据。[...] - -LeafRenderObjectElement -使用LeafRenderObjectWidget作为其配置 的Element。 - -LeafRenderObjectWidget -RenderObjectWidgets的超类,用于配置没有子项的RenderObject子类。 - -LimitedBox -只有当它不受约束时才限制其大小的盒子。[...] - -的LinearGradient -2D线性渐变。[...] - -ListBody -一个widget,它沿着给定的轴顺序排列它的子节点,强制它们到另一个轴的父节点的维度。[...] - -可听 -维护侦听器列表的对象。 - -倾听者 -一个widget,它响应指针事件调用回调。[...] - -列表显示 -可线性排列的widget可滚动列表。[...] - -ListWheelScrollView -一个盒子,可以滚动轮子上的child。[...] - -ListWheelViewport -显示轮子上的子集子集的视口。[...] - -语言环境 -用于选择用户语言和格式首选项的标识符,由语言和国家/地区组成。这是BCP 47定义的区域设置标识符的子集。[...] - -LocalHistoryEntry - -LocalHistoryRoute 历史记录中的条目。 - -LocalHistoryRoute < T > -可以通过弹出列表在内部处理返回导航的路由。[...] - -本地化 -为其 定义区域设置child以及子项所依赖的本地化资源。[...] - -LocalizationsDelegate < T > -用于一组本地化资源类型的工厂,T由Localizationswidget加载 。[...] - -LocalKey -不是GlobalKey的关键[...] - -LongPressDraggable < T > -从长按开始使其child可以拖拽。 - -MaskFilter -一个蒙版过滤器,用于在绘制时应用于形状。掩码过滤器是一种采用彩色像素位图的函数,并返回另一个彩色像素位图。[...] - -Matrix4 -4D矩阵。值以列主要顺序存储。 - -Matrix4Tween -两个Matrix4之间的插值。[...] - -MatrixUtils -用于处理矩阵的实用程序函数。 - -MaxColumnWidth -确定列的大小,使其大小为两个列宽规范的最大值。[...] - -MediaQuery -建立媒体查询解析给定数据的子树。[...] - -MediaQueryData -有关介质的信息(例如,窗口)。[...] - -MemoryImage -将给定的Uint8List缓冲区解码为图像,将其与给定的比例相关联。[...] - -MergeSemantics -一个widget,它合并其后代的语义。[...] - -元数据 -在渲染树中保存不透明的元数据。[...] - -MinColumnWidth -确定列的大小,使其大小为两个列宽规范中的最小值。[...] - -ModalBarrier -一个widget,阻止用户与自身后面的widget交互。[...] - -ModalRoute < T > -阻止与先前路由交互的路由。[...] - -MultiChildLayoutDelegate -一个控制多个子项布局的委托。[...] - -MultiChildRenderObjectElement -使用MultiChildRenderObjectWidget作为其配置 的Element。[...] - -MultiChildRenderObjectWidget - -RenderObjectWidgets的超类,用于配置具有单个子项列表的RenderObject子类。(此超类仅为该子列表提供存储,它实际上不提供更新逻辑。) - -MultiFrameImageStreamCompleter -管理图像帧的解码和调度。[...] - -NavigationToolbar -NavigationToolbar是一个布局助手,用于沿水平轴定位3个widget或widget组,这对于应用程序的导航栏是合理的,例如在Material Design和iOS中。[...] - -航海家 -一个widget,用于管理具有堆栈规则的一组子widget。[...] - -NavigatorObserver -用于观察导航器行为的界面。 - -NavigatorState -Navigator widget 的状态。 - -NestedScrollView -其中的滚动视图可以嵌套其他滚动视图,其滚动位置本质上是链接的。[...] - -NestedScrollViewViewport -NestedScrollView使用 的Viewport变体。[...] - -NetworkImage -从网络获取给定的URL,将其与给定的比例相关联。[...] - -NeverScrollableScrollPhysics -滚动物理,不允许用户滚动。[...] - -通知 -可以冒泡widget树的通知。[...] -NotificationListener < T extends Notification > -一个widget,用于侦听通知冒泡树。[...] -ObjectKey -从用作其值的对象获取其标识的键。[...] -抵消 -不可变的2D浮点偏移量。[...] -台下 -一个widget,它将child放在树中,但没有绘制任何东西,没有让child可用于命中测试,也没有占用父母的任何空间。[...] - -OneFrameImageStreamCompleter -管理dart:ui.Image对象的加载,用于静态ImageStream(只有一帧)。 - -不透明度 -使子项部分透明的widget。[...] - -OrientationBuilder -构建可依赖于父窗口widget方向的窗口widget树(与设备方向不同)。[...] - -OverflowBox -一个widget,它对子进程施加的约束不同于从其父进程获得的约束,可能允许子进程溢出父进程。[...] - -覆盖 -一个堆栈条目可以独立进行管理。[...] - -OverlayEntry -在一个地方叠加,可以包含一个widget。[...] - -OverlayRoute < T > -在导航器的叠加层中显示窗口widget的路径。 - -OverlayState -Overlay 的当前状态。[...] - -OverscrollIndicatorNotification -GlowingOverscrollIndicator将开始显示过度滚动指示的 通知。[...] - -OverscrollNotification -通知Scrollable widget未更改其滚动位置,因为更改会导致其滚动位置超出其滚动边界。[...] - -填充 -一个widget,通过给定的填充来保护其子级。[...] - -的PageController -PageView 的控制器。[...] - -PageMetrics -PageView的 度量标准。[...] - -PageRoute < T > -替换整个屏幕的模态路线。 - -PageRouteBuilder < T > -用于根据回调定义一次性页面路由的实用程序类。[...] - -PageScrollPhysics -滚动由使用物理浏览量。[...] - -PageStorage -为此窗口widget子树建立页面存储桶的窗口widget。 - -PageStorageBucket -与应用中的页面关联的存储桶。[...] - -PageStorageKey < T > -一个ValueKey用于定义PageStorage值将被保存。[...] - -页面预览 -可逐页工作的可滚动列表。[...] - -涂料 -在画布上绘制时使用的样式的说明。[...] - -PaintingBinding -绑定绘画库。[...] - -PaintingContext -一个画画的地方。[...] - -ParentDataElement < T扩展RenderObjectWidget > -使用ParentDataWidget作为其配置 的Element。 - -ParentDataWidget < T扩展RenderObjectWidget > -将ParentData信息挂接到RenderObjectWidget的子 节点的widget的基类。[...] - -路径 -平面的复杂一维子集。[...] - -PerformanceOverlay -显示性能统计信息 [...] - -PhysicalModel -表示将其子项剪辑为形状的物理层的窗口widget。[...] - -PhysicalShape -一个widget,表示将其子级剪辑为路径的物理层。[...] - -占位符 -一个widget,用于绘制一个框,表示有一天会添加其他widget的位置。[...] - -PointerCancelEvent -指针的输入不再指向此接收器。 - -PointerDownEvent -指针已与设备联系。 - -PointerEvent -触摸,手写笔或鼠标事件的基类。[...] - -PointerMoveEvent -当指针与设备接触时,指针相对于设备移动。[...] - -PointerUpEvent -指针已停止与设备联系。 - -PopupRoute < T > -在当前路线上覆盖窗口widget的模态路径。 - -定位 -一个控件,用于控制堆栈子项的位置。[...] - -PositionedDirectional -一个widget,用于控制堆栈子项的位置,而不需要提交特定的TextDirection。[...] - -PositionedTransition -定位的 动画版本,它采用特定的 动画在动画的生命周期内将child的位置从起始位置转换到结束位置。[...] - -PREFERREDSIZE -具有首选大小的widget。[...] - -PreferredSizeWidget -窗口widget的接口,如果不受约束,则可以返回此窗口widget所希望的大小。[...] - -PrimaryScrollController -将ScrollController与子树关联。[...] - -ProxyAnimation -作为另一个动画的代理的动画。[...] - -ProxyElement -使用ProxyWidget作为其配置 的Element。 - -ProxyWidget -提供了子窗口widget的窗口widget,而不是构建新窗口widget。[...] - -的RadialGradient -2D径向渐变。[...] - -半径 -圆形或椭圆形的半径。 - -RawGestureDetector -一个widget,用于检测给定手势工厂描述的手势。[...] - -RawGestureDetectorState -国家对RawGestureDetector。 - -RawImage -一个直接显示dart:ui.Image的widget。[...] - -RawKeyboardListener -每当用户按下或释放键盘上的键时调用回调的widget。[...] - -RawKeyEvent -原始密钥事件的基类。[...] - -矩形 -一个不可变的,2D,轴对齐的浮点矩形,其坐标相对于给定的原点。[...] - -RectTween -两个矩形之间的插值。[...] - -RelativePositionedTransition -Positioned的 动画版本,它根据相对于具有指定大小的边界框的rect值转换子项的位置。[...] - -RelativeRect -一个不可变的2D,轴对齐的浮点矩形,其坐标相对于另一个矩形的边缘给出,称为容器。由于矩形的尺寸是相对于容器的尺寸,因此该类没有宽度和高度成员。为了确定矩形的宽度或高度,将其转换为一个矩形使用toRect() (通过容器本身的矩形),然后检查该对象。[...] - -RelativeRectTween -两个相对rects之间的插值。[...] - -RenderBox -2D笛卡尔坐标系中的渲染对象。[...] - -RenderNestedScrollViewViewport -NestedScrollView使用 的RenderViewport变体。[...] - -渲染对象 -渲染树中的对象。[...] - -RenderObjectElement -使用RenderObjectWidget作为其配置 的Element。[...] - -RenderObjectToWidgetAdapter < T扩展RenderObject > -从RenderObject到Element树的桥梁。[...] - -RenderObjectToWidgetElement < T扩展RenderObject > -由RenderObject托管的RootRenderObjectElement。[...] - -RenderObjectWidget -RenderObjectWidgets提供用于配置RenderObjectElement s,这涡卷渲染对象 s,这提供了应用程序的实际渲染。 - -RenderSliv​​erOverlapAbsorber -包裹另一个的条子,迫使其布局范围被视为重叠。[...] - -RenderSliv​​erOverlapInjector -基于存储在SliverOverlapAbsorberHandle中的值具有条子几何形状的条子 。[...] - -RepaintBoundary -一个widget,为其子级创建单独的显示列表。[...] - -ReverseAnimation -与另一个动画相反的动画。[...] - -ReverseTween < T > -一个Tween,反向评估其父级。 - -富文本 -一段富文本。[...] - -RootRenderObjectElement -树根处的元素。[...] - -RotatedBox -一个widget,可以将其子项旋转整数个四分之一圈。[...] - -RotationTransition -动画widget的旋转。 - -RoundedRectangleBorder -带圆角的矩形边框。[...] - -路线< T > -由导航器管理的条目的抽象。[...] -RouteAware -知道其当前Route的对象的接口。[...] -RouteObserver < R extends Route > -一个导航观察者通知RouteAware变化s到他们的状态路线。[...] -RouteSettings -可能在构建路径时有用的数据。 -行 -使子控件横向排列显示的控件。[...] -RRect -一个不可变的圆角矩形,具有所有四个角的自定义半径。 -RSTransform -由平移,旋转和均匀比例组成的变换。[...] -SafeArea -一个widget,通过足够的填充来保护其子级,以避免操作系统的入侵。[...] -锯齿 -锯齿曲线,在单位间隔内重复给定次数。[...] - -ScaleEndDetails -有关GestureScaleEndCallback的详细信息。 - -ScaleStartDetails -有关GestureScaleStartCallback的详细信息。 - -ScaleTransition -动画转换widget的比例。 - -ScaleUpdateDetails -有关GestureScaleUpdateCallback的详细信息。 - -滚动 -滚动的widget。[...] - -ScrollableState -Scrollable widget的 State对象。[...] - -ScrollActivity -用于滚动活动(如拖动和投掷)的基类。[...] - -ScrollActivityDelegate -ScrollActivity 的后端。[...] - -ScrollbarPainter -用于绘制滚动条 的CustomPainter。[...] - -ScrollBehavior -描述可滚动窗口widget的行为方式。[...] - -ScrollConfiguration -控制可滚动窗口widget在子树中的行为方式。[...] - -ScrollContext -Scrollable widget实现 的接口,以便使用 ScrollPosition。[...] - -ScrollController -控制可滚动的widget。[...] - -ScrollDragController -当用户在屏幕上拖动手指时滚动滚动视图。[...] - -ScrollEndNotification -Scrollable widget已停止滚动的 通知。[...] - -ScrollHoldController -用于保持Scrollable静止的接口。[...] - -ScrollMetrics -Scrollable内容的 描述,用于建模视口的状态。[...] - -ScrollNotification -与滚动相关 的通知。[...] - -ScrollPhysics -确定Scrollable widget的物理特性。[...] - -的scrollPosition -确定滚动视图中可见的内容部分。[...] - -ScrollPositionWithSingleContext -滚动位置,用于管理单个ScrollContext的滚动活动 。[...] - -ScrollSpringSimulation -一个SpringSimulation,其中x的值保证在模拟isDone()时具有完全最终值。 - -ScrollStartNotification -Scrollable widget已开始滚动的 通知。[...] - -ScrollUpdateNotification -Scrollable widget已更改其滚动位置的 通知。[...] - -滚动型 -滚动的widget。[...] - -语义 -一个widget,用widget含义的描述来注释widget树。[...] - -SemanticsDebugger -一个可视化child语义的widget。[...] - -着色器 -Gradient和ImageShader 等对象的基类,它们对应于Paint.shader使用的着色器。 - -ShaderMask -一个widget,它将Shader生成的遮罩应用于其子级。[...] - -ShapeBorder -形状轮廓的基类。[...] - -ShapeDecoration -关于如何绘制任意形状的不可变描述。[...] - -ShrinkWrappingViewport -内部较大的widget,收缩包装在主轴上的子项。[...] - -模拟 -所有模拟的基类。[...] - -SingleChildLayoutDelegate -用于计算具有单个子项的渲染对象的布局的委托。[...] - -SingleChildRenderObjectElement -使用SingleChildRenderObjectWidget作为其配置 的Element。[...] - -SingleChildRenderObjectWidget -RenderObjectWidgets的超类,用于配置具有单个子槽的RenderObject子类。(此超类仅为该子级提供存储,它实际上不提供更新逻辑。) - -SingleChildScrollView -可以滚动单个窗口widget的框。[...] - -SingleTickerProviderStateMixin < T扩展StatefulWidget > -提供单个Ticker,配置为仅在启用当前树时打勾,如TickerMode所定义。[...] - -尺寸 -保持2D浮点大小。[...] - -SizeChangedLayoutNotification -指示接收此通知的对象的其中一个后代的大小已更改,因此有关该布局的任何假设都不再有效。[...] - -SizeChangedLayoutNotifier -一个widget, 当其子级的布局维度发生更改时自动调度SizeChangedLayoutNotification。[...] -SizedBox - -具有指定大小的框。[...] - -SizedOverflowBox -一个特定大小的窗口widget,但将其原始约束传递给其子节点,然后可能会溢出。[...] - -SizeTransition -动画自己的大小和剪辑并对齐child。[...] - -SizeTween -两种尺寸之间的插值。[...] - -SlideTransition -动画widget相对于其正常位置的位置。[...] - -SliverChildBuilderDelegate -使用构建器回调为子项提供子项的委托。[...] - -SliverChildDelegate -为儿童提供条子的代表。[...] - -SliverChildListDelegate -使用明确列表为儿童提供儿童的代表。[...] - -SliverFillRemaining -包含单个框子项的条子,填充视口中的剩余空间。[...] - -SliverFillViewport -包含多个子框的子条,每个子框填充视口。[...] - -SliverFixedExtentList -将多个具有相同主轴范围的盒子项放置在线性阵列中的条子。[...] - -SliverGrid -将多个盒子儿童放置在二维排列中的条子。[...] - -SliverGridDelegate -控制网格中图块的布局。[...] - -SliverGridDelegateWithFixedCrossAxisCount -创建横轴中具有固定数量的切片的网格布局。[...] - -SliverGridDelegateWithMaxCrossAxisExtent -使用每个都具有最大横轴范围的切片创建网格布局。[...] - -SliverList -沿着主轴将多个盒子放置在线性阵列中的条子。[...] - -SliverMultiBoxAdaptorElement -一个懒惰地为SliverMultiBoxAdaptorWidget构建子元素的元素。[...] - -SliverMultiBoxAdaptorWidget -条子的基类,有多个盒子元素。[...] - -SliverOverlapAbsorber -包裹另一个的条子,迫使其布局范围被视为重叠。[...] - -SliverOverlapAbsorberHandle -提供给SliverOverlapAbsorber,SliverOverlapInjector和NestedScrollViewViewport的句柄,用于在NestedScrollView中移位重叠。[...] - -SliverOverlapInjector -基于存储在SliverOverlapAbsorberHandle中的值具有条子几何形状的条子 。[...] - -SliverPadding -在另一条棉条的每一侧都应用衬垫的条子。[...] - -SliverPersistentHeader -当条子滚动到视口的前缘时,尺寸​​变化的条子。[...] - -SliverPersistentHeaderDelegate -委派配置SliverPersistentHeader。 - -SliverPrototypeExtentList -将盒子放置在线性阵列中并将它们限制为沿主轴具有与原型项相同程度的条子。[...] - -SliverSafeArea -通过足够的填充来插入另一条条子的条子,以避免操作系统的入侵。[...] - -SliverToBoxAdapter -包含单个框widget的条子。[...] -堆 -一个widget,用于将其子级相对于其框的边缘定位。[...] - -StadiumBorder -一个边框,适合体育场形状的边框(两端有半圆形的框),适用于它所应用的widget的矩形。[...] - -State < T扩展StatefulWidget > -StatefulWidget 的逻辑和内部状态。[...] - -StatefulBuilder -一个柏拉图窗口widget,它们都具有状态并调用闭包来获取其子窗口widget。[...] - -StatefulElement -使用StatefulWidget作为其配置 的Element。 - -StatefulWidget -具有可变状态的widget。[...] - -StatelessElement -使用StatelessWidget作为其配置 的Element。 - -StatelessWidget -一个不需要可变状态的widget。[...] - -StatusTransitionWidget -在给定动画更改状态时重建的窗口widget。 - -StepTween -地板之间的两个整数之间的插值。[...] - -StreamBuilder < T > -基于与Stream交互的最新快照构建自身的小组件。[...] - -StreamBuilderBase < T,S > -基于与指定Stream的交互构建自己的widget的基类。[...] - -表 -为其子项使用表布局算法的窗口widget。[...] - -表格边框 -表格widget的 边框规范。[...] - -TableCell的 -一个widget,用于控制表的子节点的对齐方式。[...] - -TableColumnWidth -用于描述RenderTable中列的宽度的基类。[...] - -的TableRow -表 中的一组水平单元格。[...] - -TapDownDetails -有关GestureTapDownCallback的详细信息,例如位置。 - -TapUpDetails -有关GestureTapUpCallback的详细信息,例如位置。 - -文本 -一系列具有单一样式的文本。[...] - -文本框 -包含一段文本的矩形。[...] - -TextDecoration -在文本附近绘制的线性装饰。 - -TextEditingController -用于可编辑文本字段的控制器。[...] - -TextEditingValue -用于编辑文本行的当前文本,选择和撰写状态。 - -TextInputType -要优化文本输入控件的信息类型。[...] - -TextPainter -将TextSpan树绘制到Canvas中的对象。[...] - -TextPosition -文本字符串中的视觉位置。 - -的TextRange -一串文本中的一系列字符。 - -TextSelection -表示选择的一系列文本。 - -TextSelectionControls -用于构建选择UI的界面,由工具栏widget的实现者提供。[...] - -TextSelectionDelegate -用于操作选择的界面,供工具栏widget的实现者使用。 - -TextSelectionOverlay -管理一对文本选择句柄的对象。[...] - -TextSpan -不可变的文本范围。[...] - -文字样式 -一种不可变的样式,其中绘制文本。[...] - -TextStyleTween -两个TextStyle之间的插值。[...] - -质地 -一个矩形,后端纹理映射在该矩形上。[...] - -阈 -曲线为0.0,直到达到阈值,然后跳到1.0。[...] - -TickerFuture -表示正在进行的Ticker序列的对象。[...] - -TickerMode -启用或禁用窗口widget子树中的代码(以及动画控制器)。[...] - -TickerProvider -由可以销售Ticker对象的类实现的接口。[...] - -TickerProviderStateMixin < T扩展StatefulWidget > -提供Ticker对象,这些对象配置为仅在启用当前树时打勾,如TickerMode所定义。[...] - -标题 -在操作系统中描述此应用程序的widget。 - -公差 -指定距离,持续时间和速度差异的最大允许幅度的结构被认为是相等的。 - -TrackingScrollController -一个ScrollController,其initialScrollOffset跟踪其最近更新的ScrollPosition。[...] - -TrainHoppingAnimation -此动画通过代理一个动画开始,但可以给出第二个动画。当他们的时间交叉时(或者因为第二个是相反的方向,或者因为一个超过另一个),动画会跳到代理第二个动画,第二个动画成为新的“第一”动画。[...] - -转变 -在绘制其子项之前应用转换的窗口widget。[...] - -TransformProperty -处理表示变换的Matrix4的属性。 - -TransitionRoute < T > -具有入口和出口过渡的路线。 - -Tween < T扩展动态 > -开始值和结束值之间的线性插值。[...] - -TypeMatcher < T > -此类是“is”运算符的解决方法,它不接受变量值作为其右操作数 - -UnconstrainedBox -一个widget,它对子节点没有约束,允许它以“自然”大小呈现。[...] - -唯一键 -一个只与自己相等的关键。 - -UniqueWidget < Ť延伸国< StatefulWidget > > -有状态窗口widget的基类,它在树中只有一个膨胀的实例。[...] - -UserScrollNotification -用户已更改滚动方向的通知。[...] - -ValueKey < T > -使用特定类型的值来标识自身的钥匙。[...] - -ValueNotifier < T > -甲ChangeNotifier保存单个值。[...] - -速度 -二维速度。 - -视口 -内部更大的widget。[...] - -ViewportNotificationMixin -Mixin for Notification用于跟踪他们已经通过的RenderAbstractViewport的数量。[...] - -窗口widget -用于描述元素的配置[...] - -WidgetInspector -一个widget,可以检查子widget的结构。[...] - -WidgetInspectorService -GUI工具用于与WidgetInspector交互的服务。[...] - -WidgetsApp -一个便利类,它包含了应用程序通常需要的许多widget。[...] - -WidgetsBinding -widget层和Flutter引擎之间的粘合剂。 - -WidgetsBindingObserver -使用Widgets图层绑定注册的类的接口。[...] - -WidgetsFlutterBinding -基于Widgets框架的应用程序的具体绑定。这是将框架绑定到Flutter引擎的粘合剂。 - -WidgetsLocalizations -用于最低级别的Flutter框架的本地化资源值的接口。[...] - -WidgetToRenderBoxAdapter -用于在窗口widget树中放置特定RenderBox的适配器。[...] - -WillPopScope -注册回调以否决用户尝试解除封闭的 ModalRoute。[...] - -包 -一个widget,以多个水平或垂直运行方式显示其子项。[...] - -常量 -kAlwaysCompleteAnimation →const 动画< double > -一个总是完整的动画。[...] - -const _AlwaysCompleteAnimation() -kAlwaysDismissedAnimation →const 动画< double > -一个总是被解雇的动画。[...] -const _AlwaysDismissedAnimation() - -属性 -debugHighlightDeprecatedWidgets ↔ 布尔 -显示已弃用的widget的横幅。 - -读/写 -debugPrint ↔ DebugPrintCallback -将消息打印到控制台,您可以使用“flutter”工具的“logs”命令(“flutter logs”)访问该控制台。[...] - -读/写 -debugPrintBuildScope ↔ 布尔 -记录所有来电BuildOwner.buildScope。[...] - -读/写 -debugPrintGlobalKeyedWidgetLifecycle ↔ 布尔 -在取消激活具有全局键的窗口widget时记录,并在重新激活(重新记录)时记录。[...] - -读/写 -debugPrintRebuildDirtyWidgets ↔ 布尔 -记录每帧构建的脏widget。[...] - -读/写 -debugPrintScheduleBuildForStacks ↔ 布尔 -记录将widget标记为需要重建的调用堆栈。[...] - -读/写 -debugProfileBuildsEnabled ↔ 布尔 -Timeline为每个构建的Widget 添加事件。[...] -读/写 -imageCache → ImageCache -实现Flutter框架图像缓存的单例。[...] - -只读 -函数 -applyBoxFit(BoxFit fit, Size inputSize, Size outputSize) → FittedSizes -应用BoxFit值。[...] - -axisDirectionIsReversed(AxisDirection axisDirection) → bool -返回沿给定轴方向行进是否以数字递减顺序访问沿该轴的坐标。[...] - -axisDirectionToAxis(AxisDirection axisDirection) → 轴 -返回包含给定AxisDirection的Axis。[...] - -createLocalImageConfiguration(BuildContext context,{ Size size }) → ImageConfiguration -基于给定的BuildContext(以及可选的大小) 创建ImageConfiguration。[...] - -debugAssertAllWidgetVarsUnset(String reason) → bool -如果未更改任何窗口widget库调试变量,则返回true。[...] - -debugCheckHasDirectionality(BuildContext context) → bool -断言给定的上下文具有Directionality祖先。[...] - -debugCheckHasMediaQuery(BuildContext context) → bool -断言给定上下文具有MediaQuery祖先。[...] - -debugCheckHasTable(BuildContext context) → bool -断言给定上下文具有表祖先。[...] - -debugChildrenHaveDuplicateKeys(Widget parent, Iterable < Widget > children) → bool -如果给定子列表包含任何重复的非null键,则置位。[...] - -debugDescribeTransform(Matrix4 transform) → List < String > -以对TransformProperty有用的格式返回表示给定转换的字符串列表。[...] - -debugDumpApp() →void -打印当前正在运行的应用程序的字符串表示。 - -debugDumpLayerTree() →void -打印整个图层树的文本表示。 - -debugDumpRenderTree() →void -打印整个渲染树的文本表示。 - -debugItemsHaveDuplicateKeys(Iterable < Widget > items) → bool -如果给定的项列表包含任何重复的非空键,则断言。[...] - -debugPrintStack({ String label, int maxFrames }) →void -使用debugPrint和 FlutterError.defaultStackFilter将当前堆栈转储到控制台。[...] - -debugWidgetBuilderValue(Widget小 部件, Widget 内置) →void -断言built widget不为空。[...] - -decodeImageFromList(Uint8List list) → Future < Image > -从字节列表创建图像。[...] - -defaultScrollNotificationPredicate(ScrollNotification notification) → bool -一个ScrollNotificationPredicate,它检查是否 notification.depth == 0,这意味着通知没有通过任何插入的滚动widget。 -flipAxis(轴 方向) → 轴 -返回给定轴的反面。[...] - -flipAxisDirection(AxisDirection axisDirection) → AxisDirection -返回给定AxisDirection的反向。[...] - -getAxisDirectionFromAxisReverseAndDirectionality(BuildContext context, Axis axis, bool reverse) → AxisDirection -返回当前Directionality中给定Axis中 的AxisDirection(或反之,如果为true)。[...] - -reverse -hashList(Iterable < Object > arguments) → int -将Iterable中任意数量对象 的Object.hashCode值合并为一个值。如果给定null,则此函数将返回相同的值,就像给出一个空列表一样。 -hashValues(Object arg01, Object arg02,[ Object arg03 = _hashEnd, Object arg04 = _hashEnd, Object arg05 = _hashEnd, Object arg06 = _hashEnd, Object arg07 = _hashEnd, Object arg08 = _hashEnd, Object arg09 = _hashEnd, Object arg10 = _hashEnd, 对象 arg11 = _hashEnd, 对象 arg12 = _hashEnd, 对象 arg13 = _hashEnd, 对象 arg14 = _hashEnd, 对象 arg15 = _hashEnd, 对象 arg16 = _hashEnd, 对象 arg17 = _hashEnd, 对象 arg18 = _hashEnd, 对象 arg19 = _hashEnd, 对象 arg20 =_hashEnd ]) → int -将最多20个对象的哈希码组合成一个值。[...] - -paintBorder(Canvas canvas, Rect rect,{ BorderSide top:BorderSide.none, BorderSide right:BorderSide.none, BorderSide bottom:BorderSide.none, BorderSide left:BorderSide.none }) →void -在画布上绘制给定矩形周围的边框。[...] - -paintImage({ Canvas canvas, Rect rect, Image image, ColorFilter colorFilter, BoxFit fit, Alignment alignment:Alignment.center, Rect centerSlice, ImageRepeat repeat:ImageRepeat.noRepeat, bool flipHorizo​​ntally:false }) →void -将图像绘制到画布上的给定矩形中。[...] - -paintZigZag(画布 画布, 油漆 颜料, 偏移 开始, 偏移 结束, int zigs, 双倍 宽度) →void -在两点之间画一条线,在连接两点的线上对角线前后切割。[...] - -positionDependentBox({ Size size, Size childSize, Offset target, bool preferBelow, double verticalOffset:0.0, double margin:10.0 }) → Offset -将子框放在容器框内,位于目标点的上方或下方。[...] - -precacheImage(ImageProvider 提供程序, BuildContext 上下文,{ Size size }) → Future < Null > -将图像预取到图像缓存中。[...] - -runApp(widget 应用程序) →无效 -给给定的widget充气并将其附加到屏幕上。[...] - -textDirectionToAxisDirection(TextDirection textDirection) → AxisDirection -返回在给定TextDirection中进行读取的AxisDirection。[...] - -枚举 -AnimationStatus - -动画的状态 -AppLifecycleState -申请可以进入的国家。[...] - -轴 -两个方面的两个基本方向。[...] - -AxisDirection -沿水平轴或垂直轴的方向。 - -BannerLocation -在哪里展示横幅。[...] - -混合模式 -在画布上绘画时使用的算法。[...] - -BlurStyle -用于MaskFilter对象中模糊的样式。 - -边框 -在边框中 为BorderSide绘制的线条样式。 - -BoxFit -如何将盒子刻在另一个盒子里。[...] - -BoxShape -渲染Border或BoxDecoration时使用的形状。[...] - -ConnectionState -与异步计算的连接状态。[...] - -CrossAxisAlignment -如何将儿童沿横轴放置在柔性布局中。[...] - -CrossFadeState -指定要显示的两个子项中的哪一个。请参阅AnimatedCrossFade。[...] - -DecorationPosition -在哪里画一个盒子装饰。 - -DiagnosticLevel -用于过滤显示和省略哪些诊断的各种优先级。[...] - -DismissDirection -可以驳回不予受理 的方向。 - -DragAnchor -凡可拖动应在拖动过程中被锚定。 - -FadeInImagePhase -FadeInImage经历 的阶段。 - -FilterQuality -图像过滤器的质量级别。[...] - -FLEXFIT -如何将child铭刻在可用空间内。[...] - -FlutterLogoStyle -绘制Flutter徽标的可能方法。 - -字体样式 -是否在字体中倾斜字形 - -GrowthDirection -相对于滚动偏移轴,条子内容的排序方向。[...] - -HitTestBehavior -在命中测试期间如何表现。 - -ImageRepeat -如何绘制未被图像覆盖的框的任何部分。 - -MainAxisAlignment -如何在柔性布局中沿着主轴放置子项。[...] - -MainAxisSize -主轴应占用多少空间。[...] - -方向 -无论是纵向还是横向。 - -溢出 -是否应该剪掉溢出的child,或者看到他们的溢出。 - -PaintingStyle -在画布上绘制形状和路径的策略。[...] - -PathFillType -确定决定如何计算Path内部的缠绕规则。[...] - -RenderComparison -两个对象之间差异的描述,在它将如何影响渲染的上下文中。[...] - -RoutePopDisposition -指示是否应弹出当前路由。[...] - -SelectionChangedCause -指示触发所选文本更改的内容(包括对光标位置的更改)。 - -StackFit -如何调整Stack的未定位子项的大小。[...] - -StrokeCap -用于行结尾的样式。[...] - -StrokeJoin -用于线连接的样式。[...] - -TableCellVerticalAlignment -RenderTable对象中 单元格的垂直对齐选项。[...] - -上投放 -用户交互应适应目标的平台。[...] - -TextAffinity -是否TextPosition是视觉上的上游或其偏移的下游。[...] - -textAlign设置 -是否以及如何水平对齐文本。 - -TextBaseline -用于对齐文本的水平线。 - -TextDecorationStyle -绘制文本装饰的样式 - -TextDirection -文本流动的方向。[...] - -TextOverflow -如何处理溢出的文本。 - -TextSelectionHandleType -要显示哪种类型的选择句柄。[...] - -TILEMODE -定义渐变边缘发生的事情。[...] - -VertexMode -定义在绘制一组三角形时如何解释点列表。[...] - -VerticalDirection -盒子垂直流动的方向。[...] - -WrapAlignment -Wrap 如何对齐对象。[...] - -WrapCrossAlignment -谁包裹应该在横轴的运行中对齐儿童。 - -类型定义 -AnimatedCrossFadeBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey) → Widget -签名AnimatedCrossFade.layoutBuilder回拨。[...] - -AnimatedListItemBuilder(BuildContext context, int index, Animation < double > animation) → Widget -使用的构建器回调的签名AnimatedList。 - -AnimatedListRemovedItemBuilder(BuildContext context, Animation < double > animation) → Widget -使用的构建器回调的签名AnimatedListState.removeItem。 - -AnimatedSwitcherLayoutBuilder(List < Widget > children) → Widget -用于生成自定义布局的构建器的签名 AnimatedSwitcher。[...] - -AnimatedSwitcherTransitionBuilder(Widget child, Animation < double > animation) → Widget -用于生成自定义转换的构建器的签名 AnimatedSwitcher。[...] - -AnimationStatusListener(AnimationStatus status) →无效 -使用附加的听众签名Animation.addStatusListener。 - -AsyncWidgetBuilder < T > (BuildContext context, AsyncSnapshot < T > snapshot) → Widget -签名用于基于异步交互构建widget的策略。[...] - -CreateRectTween(Rect begin, Rect end) → Tween < Rect > -一个函数的签名,它接受两个Rect实例并返回 RectTween它们之间的转换。[...] - -DismissDirectionCallback(DismissDirection direction) →void -使用的签名Dismissible表示已在给定的情况下被解雇direction。[...] - -DraggableCanceledCallback(速度 速度, 偏移 偏移) →无效 -在Draggable没有被a接受的情况下丢弃a的签名DragTarget。[...] - -DragTargetAccept < T > (T 数据) →无效 -用于使a DragTarget接受给定数据的签名。[...] - -DragTargetBuilder < T > (BuildContext context, List < T > candidateData, List rejectedData) → Widget -建立儿童的签名DragTarget。[...] - -DragTargetLeave < T > (T 数据) →无效 -Draggable离开 时签名DragTarget。[...] - -DragTargetWillAccept < T > (T 数据) → bool -用于确定给定数据是否将被a接受的签名DragTarget。[...] - -ElementVisitor(元素 元素) →无效 -签名回拨给BuildContext.visitChildElements。[...] - -ErrorWidgetBuilder(FlutterErrorDetails 详细信息) → Widget -构建窗口widget时发生错误时调用的构造函数的签名。[...] - -FormFieldBuilder < T > (FormFieldState < T > 字段) → Widget -用于构建表示表单字段的窗口widget的签名。[...] - -FormFieldSetter < T > (T newValue) →无效 -签名,以便在表单字段更改值时收到通知。[...] - -FormFieldValidator < T > (T 值) → 字符串 -用于验证表单字段的签名。[...] - -GenerateAppTitle(BuildContext context) → String -签名WidgetsApp.onGenerateTitle。[...] - -GestureDragCancelCallback() →无效 -当先前触发的指针GestureDragDownCallback未完成时的签名 。[...] - -GestureDragDownCallback(DragDownDetails 详细信息) →void -当指针接触屏幕并可能开始移动时的签名。[...] - -GestureDragEndCallback(DragEndDetails 详细信息) →void -当先前与屏幕接触并且移动的指针不再与屏幕接触时的签名。[...] - -GestureDragStartCallback(DragStartDetails 详细信息) →void -指针接触屏幕并开始移动时的签名。[...] - -GestureDragUpdateCallback(DragUpdateDetails 详细信息) →void -当与屏幕接触并且移动的指针再次移动时签名。[...] - -GestureLongPressCallback() →无效 -当指针长时间保持与同一位置的屏幕保持接触时的签名。 - -GestureRecognizerFactoryConstructor < T扩展GestureRecognizer > () →T -签名用于实现的闭包GestureRecognizerFactory.constructor。 - -GestureRecognizerFactoryInitializer < T扩展GestureRecognizer > (T 实例) →无效 -签名用于实现的闭包GestureRecognizerFactory.initializer。 - -GestureScaleEndCallback(ScaleEndDetails 详细信息) →无效 -当指针不再与屏幕接触时的签名。 - -GestureScaleStartCallback(ScaleStartDetails 详细信息) →无效 -当与屏幕接触的指针建立焦点并且初始比例为1.0时的签名。 - -GestureScaleUpdateCallback(ScaleUpdateDetails 详细信息) →无效 -当与屏幕接触的指针指示新的焦点和/或比例时的签名。 - -GestureTapCallback() →无效 -发生敲击时的签名。 - -GestureTapCancelCallback() →无效 -当先前触发a的指针GestureTapDownCallback不会导致点击时的签名 。 - -GestureTapDownCallback(TapDownDetails 详细信息) →无效 -当可能导致点击的指针与屏幕接触时的签名。[...] - -GestureTapUpCallback(TapUpDetails 详细信息) →无效 -当触发敲击的指针停止接触屏幕时的签名。[...] - -ImageListener(ImageInfo image, bool synchronousCall) →void -报告图像可用的回调签名。[...] - -IndexedWidgetBuilder(BuildContext context, int index) → Widget -用于为给定索引创建窗口widget的函数的签名,例如,在列表中。[...] - -InspectorSelectButtonBuilder(BuildContext context, VoidCallback onPressed) → Widget -使用的构建器回调的签名 WidgetInspector.selectButtonBuilder。 - -InspectorSelectionChangedCallback() →无效 -用于选择的签名更改回调 WidgetInspectorService.selectionChangedCallback。 - -LayoutWidgetBuilder(BuildContext context, BoxConstraints constraints) → Widget - -LayoutBuilder构建器函数 的签名。 - -LocaleResolutionCallback(Locale locale, Iterable < Locale > supportedLocales) → Locale -签名WidgetsApp.localeResolutionCallback。[...] - -NestedScrollViewHeaderSliv​​ersBuilder(BuildContext context, bool innerBoxIsScrolled) → List < Widget > -NestedScrollView用于构建其标题的 签名。[...] - -NotificationListenerCallback < T扩展通知 > (T 通知) → bool -Notification听众 签名。[...] - -OrientationWidgetBuilder(BuildContext context, Orientation orientation) → Widget -签名用于构建给定的widget的函数Orientation。[...] - -PointerCancelEventListener(PointerCancelEvent 事件) →void -用于收听PointerCancelEvent活动的签名。[...] - -PointerDownEventListener(PointerDownEvent 事件) →void -用于收听PointerDownEvent活动的签名。[...] - -PointerMoveEventListener(PointerMoveEvent 事件) →void -用于收听PointerMoveEvent活动的签名。[...] - -PointerUpEventListener(PointerUpEvent 事件) →void -用于收听PointerUpEvent活动的签名。[...] - -RouteFactory(RouteSettings 设置) → 路由 -为给定的路线设置创建路线。[...] - -RoutePageBuilder(BuildContext context, Animation < double > animation, Animation < double > secondaryAnimation) → Widget -用于PageRouteBuilder构建路径主要内容的函数的签名。[...] - -RoutePredicate(路线 路线) → 布尔 -Navigator.popUntil谓词参数的 签名。 - -RouteTransitionsBuilder(BuildContext context, Animation < double > animation, Animation < double > secondaryAnimation, Widget child) → Widget -用于PageRouteBuilder构建路径转换的函数的签名。[...] - -ScrollNotificationPredicate(ScrollNotification 通知) → bool -谓词ScrollNotification,用于自定义侦听来自其子项的通知的widget。 - -SelectionChangedCallback(TextSelection selection, SelectionChangedCause cause) →void -用户更改选择(包括光标位置)时报告的回调签名。 - -SemanticsBuilderCallback(Size size) → List < CustomPainterSemantics > -返回的函数的签名CustomPainter.semanticsBuilder。[...] - -ShaderCallback(Rect bounds) → Shader -签名为创建Shader给定的函数Rect。[...] - -StatefulWidgetBuilder(BuildContext context, StateSetter setState) → Widget -使用的构建器回调的签名StatefulBuilder。[...] - -StateSetter(VoidCallback fn) →无效 -State.setState功能 的签名。 - -TextSelectionOverlayChanged(TextEditingValue value, Rect caretRect) →void -签名报告变更的筛选组件 TextEditingValue为的目的TextSelectionOverlay。该 caretRect参数给出插入符在的坐标空间中的位置RenderBox由给定的TextSelectionOverlay.renderObject。[...] - -TransitionBuilder(BuildContext context, Widget child) → Widget -给child建立widget的构建器。[...] - -TweenConstructor < T > (T targetValue) → Tween < T > -签名Tween工厂。[...] - -TweenVisitor < T > (Tween < T > 补间, T targetValue, TweenConstructor < T > 构造函数) → Tween < T > -传递回调的签名AnimatedWidgetBaseState.forEachTween。 - -ValueChanged < T > (T 值) →无效 -报告基础值已更改的回调签名。[...] - -ValueGetter < T > () →T -用于按需报告值的回调签名。[...] - -ValueSetter < T > (T 值) →无效 -用于报告已设置值的回调的签名。[...] - -ViewportBuilder(BuildContext context, ViewportOffset position) → Widget -用于Scrollable构建视口的签名,通过该视口显示可滚动内容。 - -VoidCallback() →无效 -没有参数的回调签名并且不返回任何数据。 - -WidgetBuilder(BuildContext context) → Widget -用于创建窗口widget的函数的签名,例如StatelessWidget.build 或State.build。[...] - -WillPopCallback() → 未来< bool > -签名回拨,验证可以调用Navigator.pop。[...] - -异常/错误 - -FlutterError -用于报告特定于Flutter的断言失败和合同违规的错误类。 - -TickerCanceled -当股票代码被取消时,TickerFuture.orCancel未来Ticker对象 抛出异常。 diff --git a/assets/app.db b/assets/app.db deleted file mode 100644 index a6752d63..00000000 Binary files a/assets/app.db and /dev/null differ diff --git a/assets/fonts/Flamante-Roma-Medium.ttf b/assets/fonts/Flamante-Roma-Medium.ttf deleted file mode 100755 index aa52ae4c..00000000 Binary files a/assets/fonts/Flamante-Roma-Medium.ttf and /dev/null differ diff --git a/assets/fonts/Flamante-Roma-MediumItalic.ttf b/assets/fonts/Flamante-Roma-MediumItalic.ttf deleted file mode 100755 index c9240e72..00000000 Binary files a/assets/fonts/Flamante-Roma-MediumItalic.ttf and /dev/null differ diff --git a/assets/fonts/Lato-Bold.ttf b/assets/fonts/Lato-Bold.ttf deleted file mode 100755 index 74343694..00000000 Binary files a/assets/fonts/Lato-Bold.ttf and /dev/null differ diff --git a/assets/images/FlutterGo.png b/assets/images/FlutterGo.png deleted file mode 100644 index 319ea858..00000000 Binary files a/assets/images/FlutterGo.png and /dev/null differ diff --git a/assets/images/ali_connors.png b/assets/images/ali_connors.png deleted file mode 100644 index b7e34322..00000000 Binary files a/assets/images/ali_connors.png and /dev/null differ diff --git a/assets/images/btn_icon_dingyuehao_normal.png b/assets/images/btn_icon_dingyuehao_normal.png deleted file mode 100644 index 669f76fe..00000000 Binary files a/assets/images/btn_icon_dingyuehao_normal.png and /dev/null differ diff --git a/assets/images/calendar.png b/assets/images/calendar.png deleted file mode 100644 index 505cfd85..00000000 Binary files a/assets/images/calendar.png and /dev/null differ diff --git a/assets/images/food01.jpeg b/assets/images/food01.jpeg deleted file mode 100644 index da111751..00000000 Binary files a/assets/images/food01.jpeg and /dev/null differ diff --git a/assets/images/food02.jpeg b/assets/images/food02.jpeg deleted file mode 100644 index 7bb62d17..00000000 Binary files a/assets/images/food02.jpeg and /dev/null differ diff --git a/assets/images/food03.jpeg b/assets/images/food03.jpeg deleted file mode 100644 index e806712b..00000000 Binary files a/assets/images/food03.jpeg and /dev/null differ diff --git a/assets/images/food04.jpeg b/assets/images/food04.jpeg deleted file mode 100644 index 95d03802..00000000 Binary files a/assets/images/food04.jpeg and /dev/null differ diff --git a/assets/images/food05.jpeg b/assets/images/food05.jpeg deleted file mode 100644 index 6de19c69..00000000 Binary files a/assets/images/food05.jpeg and /dev/null differ diff --git a/assets/images/food06.jpeg b/assets/images/food06.jpeg deleted file mode 100644 index 53ce675c..00000000 Binary files a/assets/images/food06.jpeg and /dev/null differ diff --git a/assets/images/house.png b/assets/images/house.png deleted file mode 100644 index cd2b9ba8..00000000 Binary files a/assets/images/house.png and /dev/null differ diff --git a/assets/images/normal_user_icon.png b/assets/images/normal_user_icon.png deleted file mode 100644 index be30d9c1..00000000 Binary files a/assets/images/normal_user_icon.png and /dev/null differ diff --git a/assets/images/nothing.png b/assets/images/nothing.png deleted file mode 100644 index 1279985f..00000000 Binary files a/assets/images/nothing.png and /dev/null differ diff --git a/assets/images/p1.png b/assets/images/p1.png deleted file mode 100644 index 063ba531..00000000 Binary files a/assets/images/p1.png and /dev/null differ diff --git a/assets/images/p2.png b/assets/images/p2.png deleted file mode 100644 index 31ad2ed6..00000000 Binary files a/assets/images/p2.png and /dev/null differ diff --git a/assets/images/p3.png b/assets/images/p3.png deleted file mode 100644 index 2ee3cc03..00000000 Binary files a/assets/images/p3.png and /dev/null differ diff --git a/assets/images/paimaiLogo.png b/assets/images/paimaiLogo.png deleted file mode 100644 index 0df24bcf..00000000 Binary files a/assets/images/paimaiLogo.png and /dev/null differ diff --git a/assets/images/painterImg.jpeg b/assets/images/painterImg.jpeg deleted file mode 100644 index b602c1b4..00000000 Binary files a/assets/images/painterImg.jpeg and /dev/null differ diff --git a/assets/images/plane.png b/assets/images/plane.png deleted file mode 100644 index 1ddb1ac5..00000000 Binary files a/assets/images/plane.png and /dev/null differ diff --git a/assets/images/timg.jpeg b/assets/images/timg.jpeg deleted file mode 100644 index 418bbc7c..00000000 Binary files a/assets/images/timg.jpeg and /dev/null differ diff --git a/develop.md b/develop.md deleted file mode 100644 index ad1b1817..00000000 --- a/develop.md +++ /dev/null @@ -1,160 +0,0 @@ -# flutter-common-widgets-app - -### 使用背景 -* 鉴于目前flutter官方庞大的小部件(widget)系统以及api文档,只有文字描述,而没有可视化实例。 -* 我们开发这套app,可以系统的看到常用小部件(widget)的用法。 -* 辅助初学者更快上手,flutter官方小部件(widget) - - - -### 参考资料 - -* [flutter-widgets的官方库地址]( https://docs.flutter.kim/widgets/widgets-library.html ) -* [flutter-widgets的官方目录集]( http://doc.flutter-dev.cn/widgets/ ) -* [sqlitestudio 本地可视化工具] (https://sqlitestudio.pl/index.rvt) - -### 分支命名及使用规范 - -* 分支命名规范 - - 自己开发分支命名统一为 username ,如:yifeng - - 分支两条主线为 Master分支和develop分支 - - Master作为发布分支,develop作为开发测试分支、自己开发分支从dev checkout出去,发布即 merge to master - -* 分支合并规范 - - 从最新的develop分支checkout出自己的开发分支 - - 在自己开发开发分支开发完成后,先去develop分支pull最新代码, - - 将develop 分支最新代码 merge 到自己分支,确保无冲突 - - 再切回develop分支merge自己开发分支代码,确保无冲突,且能正常运行 - -### commit 提交规范 -* $git cz - -* 用于说明 commit 的类别,只允许使用下面7个标识。 - - - feat:新功能(feature) - - - fix:修补bug - - - docs:文档(documentation) - - - style: 格式(不影响代码运行的变动) - - - refactor:重构(即不是新增功能,也不是修改bug的代码变动) - - - test:增加测试 - - - chore:构建过程或辅助工具的变动 - - -### 代码规范 -* 文件命名规范 - - 文件命名使用下划线命名法,如:hello_world - - 请使用英文进行命名,不允许使用拼音。命名要求具有可读性,尽量避免使用缩写与数字 - - 未完待续 - -* 代码编码规范 - - 文件编码统一使用 UTF-8 编码; - - 前端编码采用首字母小写驼峰法. Widget Class 必须采用首字母大写驼峰法. - -### 文件目录结构(以LIb文件说明) - -- lib - - main.dart 入口文件 - - common 公共的method - - components widget - - generated - - model 存放模型, 不应该加入逻辑层 - - router 路由 - - views 展示界面 - - widget (与components概念重合,废弃) - -``` javascript -├── main.dart //入口文件 -├── common 公共的method -│   ├── Style.dart -│   ├── eventBus.dart -│   ├── provider.dart -│   └── sql.dart -├── components //app展示框架用到的组件 -│   ├── Input.dart -│   ├── List.dart -│   ├── Pagination.dart -│   ├── Pagination2.dart -│   ├── SearchInput.dart -│   └── homeBanner.dart -├── generated -│   └── i18n.dart -├── model //本地存放模型, 不应该加入逻辑层 -│   ├── base.dart -│   ├── cat.dart -│   ├── story.dart -│   └── widget.dart -├── routers //路由 -│   ├── application.dart -│   ├── router_handler.dart -│   └── routers.dart -├── views //app展示界面 -│   ├── Detail.dart -│   ├── FirstPage.dart -│   ├── FourthPage.dart -│   ├── ThirdPage.dart -│   ├── category.dart -│   ├── demos -│   │   ├── home.dart -│   │   └── layout -│   │   ├── SamplePage.dart -│   │   └── layout_type.dart -│   └── widgetPage.dart -└── widgets - └── ... //下面详细说明 -``` - -``` javascript -└── widgets // 对flutter所有元素和组件的分类 - ├── 404.dart - ├── index.dart // widgets 的总入口文件 - ├── components // 组件的分类 (区别于上面的components) - │   └── index.dart - ├── elements // 基础元素的分类 - │   ├── index.dart // elements下的 elements 类型入口文件 - │   ├── Form // elements下的 From 类型集合 - │   │   ├── Button // button 元素,里面是 文件夹代表类名/index.dart - │   │   │   ├── FlatButton - │   │   │   │   └── index.dart - │   │   │   ├── RaisedButton - │   │   │   │   └── index.dart - │   │   │   └── index.dart - │   │   ├── CheckBox - │   │   ├── Input - │   │   ├── Radio - │   │   ├── Slider - │   │   ├── Switch - │   │   ├── Text - │   │   └── index.dart - │   ├── Frame // elements下的 Frame 类型集合 - │   │   ├── Align - │   │   ├── Axis - │   │   ├── Box - │   │   ├── Expanded - │   │   ├── Layout - │   │   ├── Stack - │   │   ├── Table - │   │   └── spacing - │   └── Media // elements下的 Media 类型集合 - │      ├── Canvas - │      ├── Icon - │      └── Image - └── themes - └── index.dart -``` - -```javascript -widget 里的文件结构,用来存放封装的逻辑组件, 文件目录应为, 类比rax -- widget // widget 下详细元素或组件的目录结构 - - hello-world // 例如 - - mods // (可选, 子模块) - - mocks // (可选) - - utils // (可选, 存放暂时的私有method) - - schema - - index.dart -``` \ No newline at end of file diff --git a/docs/17_02_18__11_13_2018.jpg b/docs/17_02_18__11_13_2018.jpg deleted file mode 100644 index d10ad51b..00000000 Binary files a/docs/17_02_18__11_13_2018.jpg and /dev/null differ diff --git a/docs/17_47_49__11_13_2018.jpg b/docs/17_47_49__11_13_2018.jpg deleted file mode 100644 index 50f40002..00000000 Binary files a/docs/17_47_49__11_13_2018.jpg and /dev/null differ diff --git a/docs/20_03_01__11_13_2018.jpg b/docs/20_03_01__11_13_2018.jpg deleted file mode 100644 index b7eac31d..00000000 Binary files a/docs/20_03_01__11_13_2018.jpg and /dev/null differ diff --git a/docs/36B53C6F-98F1-452B-B45A-A93293CC6B3C.png b/docs/36B53C6F-98F1-452B-B45A-A93293CC6B3C.png deleted file mode 100644 index 948b24df..00000000 Binary files a/docs/36B53C6F-98F1-452B-B45A-A93293CC6B3C.png and /dev/null differ diff --git a/docs/Screenshot_20181121-170331_Samsung Notes.jpg b/docs/Screenshot_20181121-170331_Samsung Notes.jpg deleted file mode 100644 index fbff9a55..00000000 Binary files a/docs/Screenshot_20181121-170331_Samsung Notes.jpg and /dev/null differ diff --git a/docs/jiegou.png b/docs/jiegou.png deleted file mode 100644 index 2de8a842..00000000 Binary files a/docs/jiegou.png and /dev/null differ diff --git a/flutter_01.png b/flutter_01.png deleted file mode 100644 index 16a118fc..00000000 Binary files a/flutter_01.png and /dev/null differ diff --git a/ios/.gitignore b/ios/.gitignore deleted file mode 100644 index 79cc4da8..00000000 --- a/ios/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -.idea/ -.vagrant/ -.sconsign.dblite -.svn/ - -.DS_Store -*.swp -profile - -DerivedData/ -build/ -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m - -.generated/ - -*.pbxuser -*.mode1v3 -*.mode2v3 -*.perspectivev3 - -!default.pbxuser -!default.mode1v3 -!default.mode2v3 -!default.perspectivev3 - -xcuserdata - -*.moved-aside - -*.pyc -*sync/ -Icon? -.tags* - -/Flutter/app.flx -/Flutter/app.zip -/Flutter/flutter_assets/ -/Flutter/App.framework -/Flutter/Flutter.framework -/Flutter/Generated.xcconfig -/ServiceDefinitions.json - -Pods/ -.symlinks/ diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist deleted file mode 100644 index 9367d483..00000000 --- a/ios/Flutter/AppFrameworkInfo.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 8.0 - - diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig deleted file mode 100644 index e8efba11..00000000 --- a/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig deleted file mode 100644 index 399e9340..00000000 --- a/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile deleted file mode 100644 index 7c6cb6f6..00000000 --- a/ios/Podfile +++ /dev/null @@ -1,63 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '9.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; - end - pods_ary = [] - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname, :path => podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary -end - -target 'Runner' do - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - - # Flutter Pods - generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') - if generated_xcode_build_settings.empty? - puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." - end - generated_xcode_build_settings.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join('.symlinks', 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) - end - } - - # Plugin Pods - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.map { |p| - symlink = File.join('.symlinks', 'plugins', p[:name]) - File.symlink(p[:path], symlink) - pod p[:name], :path => File.join(symlink, 'ios') - } -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end - end -end diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 263c2ab2..00000000 --- a/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,588 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0828E495220692B500A59437 /* iPhone Portrait-Retina 4.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E486220692B400A59437 /* iPhone Portrait-Retina 4.png */; }; - 0828E496220692B500A59437 /* iPad Portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E487220692B400A59437 /* iPad Portrait.png */; }; - 0828E497220692B500A59437 /* iPhone X_XS Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E488220692B400A59437 /* iPhone X_XS Landscape.png */; }; - 0828E498220692B500A59437 /* iPhone XS Max Portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E489220692B400A59437 /* iPhone XS Max Portrait.png */; }; - 0828E499220692B500A59437 /* iPhone Portrait-Retina HD 4.7.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E48A220692B400A59437 /* iPhone Portrait-Retina HD 4.7.png */; }; - 0828E49A220692B500A59437 /* iPhone X_XS Portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E48B220692B400A59437 /* iPhone X_XS Portrait.png */; }; - 0828E49B220692B500A59437 /* iPad Landscape@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E48C220692B400A59437 /* iPad Landscape@2x.png */; }; - 0828E49C220692B500A59437 /* iPhone Landscape-Retina HD 5.5.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E48D220692B400A59437 /* iPhone Landscape-Retina HD 5.5.png */; }; - 0828E49D220692B500A59437 /* iPhone Portrait@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E48E220692B400A59437 /* iPhone Portrait@2x.png */; }; - 0828E49E220692B500A59437 /* iPad Portrait@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E48F220692B400A59437 /* iPad Portrait@2x.png */; }; - 0828E49F220692B500A59437 /* iPhone XS Max Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E490220692B400A59437 /* iPhone XS Max Landscape.png */; }; - 0828E4A0220692B500A59437 /* iPad Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E491220692B500A59437 /* iPad Landscape.png */; }; - 0828E4A1220692B500A59437 /* iPhone XR Portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E492220692B500A59437 /* iPhone XR Portrait.png */; }; - 0828E4A2220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E493220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png */; }; - 0828E4A3220692B500A59437 /* iPhone XR Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 0828E494220692B500A59437 /* iPhone XR Landscape.png */; }; - 0828E4A52206936100A59437 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0828E4A42206936100A59437 /* Images.xcassets */; }; - 084A20882202E4FD00428FF5 /* flutter go.png in Resources */ = {isa = PBXBuildFile; fileRef = 084A20872202E4FD00428FF5 /* flutter go.png */; }; - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 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, ); }; }; - 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 94722E5B22511D3600F63900 /* GoogleService-Info.plist */; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; - 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0828E486220692B400A59437 /* iPhone Portrait-Retina 4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone Portrait-Retina 4.png"; sourceTree = ""; }; - 0828E487220692B400A59437 /* iPad Portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPad Portrait.png"; sourceTree = ""; }; - 0828E488220692B400A59437 /* iPhone X_XS Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone X_XS Landscape.png"; sourceTree = ""; }; - 0828E489220692B400A59437 /* iPhone XS Max Portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone XS Max Portrait.png"; sourceTree = ""; }; - 0828E48A220692B400A59437 /* iPhone Portrait-Retina HD 4.7.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone Portrait-Retina HD 4.7.png"; sourceTree = ""; }; - 0828E48B220692B400A59437 /* iPhone X_XS Portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone X_XS Portrait.png"; sourceTree = ""; }; - 0828E48C220692B400A59437 /* iPad Landscape@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPad Landscape@2x.png"; sourceTree = ""; }; - 0828E48D220692B400A59437 /* iPhone Landscape-Retina HD 5.5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone Landscape-Retina HD 5.5.png"; sourceTree = ""; }; - 0828E48E220692B400A59437 /* iPhone Portrait@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone Portrait@2x.png"; sourceTree = ""; }; - 0828E48F220692B400A59437 /* iPad Portrait@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPad Portrait@2x.png"; sourceTree = ""; }; - 0828E490220692B400A59437 /* iPhone XS Max Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone XS Max Landscape.png"; sourceTree = ""; }; - 0828E491220692B500A59437 /* iPad Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPad Landscape.png"; sourceTree = ""; }; - 0828E492220692B500A59437 /* iPhone XR Portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone XR Portrait.png"; sourceTree = ""; }; - 0828E493220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone Portrait-Retina HD 5.5.png"; sourceTree = ""; }; - 0828E494220692B500A59437 /* iPhone XR Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone XR Landscape.png"; sourceTree = ""; }; - 0828E4A42206936100A59437 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 084A20872202E4FD00428FF5 /* flutter go.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flutter go.png"; sourceTree = ""; }; - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 94722E5B22511D3600F63900 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A9941E6EA19A9CEF6B117A70 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - CBA6E34746642008D95A119D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - DDA792F029EDD7A11295D192 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, - 333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0828E485220692A700A59437 /* launch */ = { - isa = PBXGroup; - children = ( - 0828E491220692B500A59437 /* iPad Landscape.png */, - 0828E48C220692B400A59437 /* iPad Landscape@2x.png */, - 0828E48F220692B400A59437 /* iPad Portrait@2x.png */, - 0828E487220692B400A59437 /* iPad Portrait.png */, - 0828E48D220692B400A59437 /* iPhone Landscape-Retina HD 5.5.png */, - 0828E486220692B400A59437 /* iPhone Portrait-Retina 4.png */, - 0828E48A220692B400A59437 /* iPhone Portrait-Retina HD 4.7.png */, - 0828E493220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png */, - 0828E48E220692B400A59437 /* iPhone Portrait@2x.png */, - 0828E488220692B400A59437 /* iPhone X_XS Landscape.png */, - 0828E48B220692B400A59437 /* iPhone X_XS Portrait.png */, - 0828E494220692B500A59437 /* iPhone XR Landscape.png */, - 0828E492220692B500A59437 /* iPhone XR Portrait.png */, - 0828E490220692B400A59437 /* iPhone XS Max Landscape.png */, - 0828E489220692B400A59437 /* iPhone XS Max Portrait.png */, - ); - path = launch; - sourceTree = ""; - }; - 0C172CA58CDB230D5DA80034 /* Pods */ = { - isa = PBXGroup; - children = ( - CBA6E34746642008D95A119D /* Pods-Runner.debug.xcconfig */, - A9941E6EA19A9CEF6B117A70 /* Pods-Runner.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; - 2EC8A3499721CE770475DCE7 /* Frameworks */ = { - isa = PBXGroup; - children = ( - DDA792F029EDD7A11295D192 /* libPods-Runner.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 3B80C3931E831B6300D905FE /* App.framework */, - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 0828E485220692A700A59437 /* launch */, - 084A20872202E4FD00428FF5 /* flutter go.png */, - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - 0C172CA58CDB230D5DA80034 /* Pods */, - 2EC8A3499721CE770475DCE7 /* Frameworks */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 94722E5B22511D3600F63900 /* GoogleService-Info.plist */, - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 0828E4A42206936100A59437 /* Images.xcassets */, - ); - path = Runner; - sourceTree = ""; - }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 97C146F21CF9000F007C117D /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 443E32A5789BE5CCDA6B5E59 /* [CP] Check Pods Manifest.lock */, - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - C38E5EAE601417DA9DF11753 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1000; - ORGANIZATIONNAME = "The Chromium Authors"; - TargetAttributes = { - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 4WLT68XRNA; - ProvisioningStyle = Manual; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0828E4A0220692B500A59437 /* iPad Landscape.png in Resources */, - 0828E4A1220692B500A59437 /* iPhone XR Portrait.png in Resources */, - 0828E49F220692B500A59437 /* iPhone XS Max Landscape.png in Resources */, - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 0828E4A3220692B500A59437 /* iPhone XR Landscape.png in Resources */, - 0828E4A2220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png in Resources */, - 0828E49A220692B500A59437 /* iPhone X_XS Portrait.png in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 0828E49E220692B500A59437 /* iPad Portrait@2x.png in Resources */, - 0828E49D220692B500A59437 /* iPhone Portrait@2x.png in Resources */, - 0828E499220692B500A59437 /* iPhone Portrait-Retina HD 4.7.png in Resources */, - 084A20882202E4FD00428FF5 /* flutter go.png in Resources */, - 0828E497220692B500A59437 /* iPhone X_XS Landscape.png in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 0828E4A52206936100A59437 /* Images.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - 0828E49B220692B500A59437 /* iPad Landscape@2x.png in Resources */, - 0828E495220692B500A59437 /* iPhone Portrait-Retina 4.png in Resources */, - 0828E498220692B500A59437 /* iPhone XS Max Portrait.png in Resources */, - 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */, - 0828E496220692B500A59437 /* iPad Portrait.png in Resources */, - 0828E49C220692B500A59437 /* iPhone Landscape-Retina HD 5.5.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; - }; - 443E32A5789BE5CCDA6B5E59 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - C38E5EAE601417DA9DF11753 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, - 97C146F31CF9000F007C117D /* main.m in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 4WLT68XRNA; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.alibaba.fluttergo; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = FlutterGO_alibaba_distribution_app_store; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 4WLT68XRNA; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.alibaba.fluttergo; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = FlutterGO_alibaba_distribution_ad_hoc; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index 04305270..00000000 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc14..00000000 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index 949b6789..00000000 --- a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - BuildSystemType - Original - - diff --git a/ios/Runner/AppDelegate.h b/ios/Runner/AppDelegate.h deleted file mode 100644 index 36e21bbf..00000000 --- a/ios/Runner/AppDelegate.h +++ /dev/null @@ -1,6 +0,0 @@ -#import -#import - -@interface AppDelegate : FlutterAppDelegate - -@end diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m deleted file mode 100644 index 7474c39b..00000000 --- a/ios/Runner/AppDelegate.m +++ /dev/null @@ -1,19 +0,0 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" - -@import Firebase;//增加 firebase 支持 - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - - [FIRApp configure];//增加 firebase 支持 - - [GeneratedPluginRegistrant registerWithRegistry:self]; - // Override point for customization after application launch. - [NSThread sleepForTimeInterval:2]; - return [super application:application didFinishLaunchingWithOptions:launchOptions]; -} - -@end diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift deleted file mode 100644 index 71cc41e3..00000000 --- a/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import UIKit -import Flutter - -@UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024*1024@as.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024*1024@as.png deleted file mode 100644 index 08914f3d..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024*1024@as.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x-1.png deleted file mode 100644 index 055f3bcd..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x-1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x.png deleted file mode 100644 index 055f3bcd..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/152*152.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/152*152.png deleted file mode 100644 index 943f238d..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/152*152.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/167*167.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/167*167.png deleted file mode 100644 index 32cd3ce8..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/167*167.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/180*180@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/180*180@3x.png deleted file mode 100644 index d9e78f38..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/180*180@3x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/20*20.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/20*20.png deleted file mode 100644 index 647ecd69..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/20*20.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x-2.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x-2.png deleted file mode 100644 index 6e15bb66..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x-2.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x.png deleted file mode 100644 index 6e15bb66..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-1.png deleted file mode 100644 index d2feff96..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-2.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-2.png deleted file mode 100644 index d2feff96..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-2.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x.png deleted file mode 100644 index d2feff96..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x-1.png deleted file mode 100644 index dc39ef7d..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x-1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x.png deleted file mode 100644 index dc39ef7d..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/60*60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/60*60@3x.png deleted file mode 100644 index 962f2ef7..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/60*60@3x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/76*76.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/76*76.png deleted file mode 100644 index e2dbdfbb..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/76*76.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x-1.png deleted file mode 100644 index 97274408..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x-1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x.png deleted file mode 100644 index 97274408..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/87*87.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/87*87.png deleted file mode 100644 index 5cce3c2f..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/87*87.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 7fbfe11e..00000000 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "40*40@1x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "60*60@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "29*29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "58*58@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "87*87.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "80*80@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "120*120@2x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "120*120@2x-1.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "180*180@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "20*20.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "40*40@1x-2.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "29*29@1x-2.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "58*58@2x-1.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "40*40@1x-1.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "80*80@2x-1.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "76*76.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "152*152.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "167*167.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "1024*1024@as.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/Contents.json b/ios/Runner/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c..00000000 --- a/ios/Runner/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/Image.imageset/Contents.json b/ios/Runner/Assets.xcassets/Image.imageset/Contents.json deleted file mode 100644 index f8f827e4..00000000 --- a/ios/Runner/Assets.xcassets/Image.imageset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/Contents.json b/ios/Runner/Assets.xcassets/Launch2.launchimage/Contents.json deleted file mode 100644 index ca2d1f56..00000000 --- a/ios/Runner/Assets.xcassets/Launch2.launchimage/Contents.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "images" : [ - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "2688h", - "filename" : "iPhone XS Max Portrait.png", - "minimum-system-version" : "12.0", - "orientation" : "portrait", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "12.0", - "subtype" : "2688h", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "1792h", - "filename" : "iPhone XR Portrait.png", - "minimum-system-version" : "12.0", - "orientation" : "portrait", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "12.0", - "subtype" : "1792h", - "scale" : "2x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "2436h", - "filename" : "iPhone X_XS Portrait.png", - "minimum-system-version" : "11.0", - "orientation" : "portrait", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "11.0", - "subtype" : "2436h", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "736h", - "filename" : "iPhone Portrait-Retina HD 5.5.png", - "minimum-system-version" : "8.0", - "orientation" : "portrait", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "667h", - "filename" : "iPhone Portrait-Retina HD 4.7.png", - "minimum-system-version" : "8.0", - "orientation" : "portrait", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "iPhone Portrait@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "retina4", - "filename" : "iPhone Portrait-Retina 4.png", - "minimum-system-version" : "7.0", - "orientation" : "portrait", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "iPad Portrait.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "iPad Landscape.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "iPad Portrait@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "iPad Landscape@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Landscape.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Landscape.png deleted file mode 100644 index 67d50a0e..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Landscape.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Landscape@2x.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Landscape@2x.png deleted file mode 100644 index 43bc74a8..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Landscape@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Portrait.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Portrait.png deleted file mode 100644 index 77b47800..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Portrait.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Portrait@2x.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Portrait@2x.png deleted file mode 100644 index 7ef64577..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPad Portrait@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina 4.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina 4.png deleted file mode 100644 index 71444466..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina 4.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina HD 4.7.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina HD 4.7.png deleted file mode 100644 index 4742330c..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina HD 4.7.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina HD 5.5.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina HD 5.5.png deleted file mode 100644 index a54e30b3..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait-Retina HD 5.5.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait@2x.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait@2x.png deleted file mode 100644 index be1234ca..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone Portrait@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone XR Portrait.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone XR Portrait.png deleted file mode 100644 index da1c3963..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone XR Portrait.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone XS Max Portrait.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone XS Max Portrait.png deleted file mode 100644 index 43cbc3cc..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone XS Max Portrait.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone X_XS Portrait.png b/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone X_XS Portrait.png deleted file mode 100644 index d4889395..00000000 Binary files a/ios/Runner/Assets.xcassets/Launch2.launchimage/iPhone X_XS Portrait.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json deleted file mode 100644 index c09c47c0..00000000 --- a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "flutter go.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "flutter go-1.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "flutter go-2.png", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "scale" : "1x" - }, - { - "idiom" : "iphone", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725b..00000000 --- a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-1.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-1.png deleted file mode 100644 index d42caece..00000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-2.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-2.png deleted file mode 100644 index d42caece..00000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go-2.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go.png deleted file mode 100644 index d42caece..00000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/flutter go.png and /dev/null differ diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 73c0a8c2..00000000 --- a/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard deleted file mode 100644 index f3c28516..00000000 --- a/ios/Runner/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist deleted file mode 100644 index 4f83dfab..00000000 --- a/ios/Runner/GoogleService-Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CLIENT_ID - 611157827052-0n777p43lrtr2dpo7gco5o3lffu7a7r4.apps.googleusercontent.com - REVERSED_CLIENT_ID - com.googleusercontent.apps.611157827052-0n777p43lrtr2dpo7gco5o3lffu7a7r4 - API_KEY - AIzaSyDztt5Q9D7plAc8VqNtHumAci6BaoOiTg4 - GCM_SENDER_ID - 611157827052 - PLIST_VERSION - 1 - BUNDLE_ID - com.alibaba.fluttergo - PROJECT_ID - alibaba-flutter-go - STORAGE_BUCKET - alibaba-flutter-go.appspot.com - IS_ADS_ENABLED - - IS_ANALYTICS_ENABLED - - IS_APPINVITE_ENABLED - - IS_GCM_ENABLED - - IS_SIGNIN_ENABLED - - GOOGLE_APP_ID - 1:611157827052:ios:c6129e5eff2f125d - DATABASE_URL - https://alibaba-flutter-go.firebaseio.com - - \ No newline at end of file diff --git a/ios/Runner/Images.xcassets/LaunchImage-2.launchimage/Contents.json b/ios/Runner/Images.xcassets/LaunchImage-2.launchimage/Contents.json deleted file mode 100644 index a0ad363c..00000000 --- a/ios/Runner/Images.xcassets/LaunchImage-2.launchimage/Contents.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist deleted file mode 100644 index d94b59b8..00000000 --- a/ios/Runner/Info.plist +++ /dev/null @@ -1,55 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - Flutter Go - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - flutter_go - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - NSCameraUsageDescription - 测试拍照 - NSMicrophoneUsageDescription - 测试麦克风 - NSPhotoLibraryAddUsageDescription - 测试选择图片 - NSPhotoLibraryUsageDescription - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 7335fdf9..00000000 --- a/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/ios/Runner/main.m b/ios/Runner/main.m deleted file mode 100644 index dff6597e..00000000 --- a/ios/Runner/main.m +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import -#import "AppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/ios/flutter go.png b/ios/flutter go.png deleted file mode 100644 index d42caece..00000000 Binary files a/ios/flutter go.png and /dev/null differ diff --git a/ios/launch/iPad Landscape.png b/ios/launch/iPad Landscape.png deleted file mode 100644 index 67d50a0e..00000000 Binary files a/ios/launch/iPad Landscape.png and /dev/null differ diff --git a/ios/launch/iPad Landscape@2x.png b/ios/launch/iPad Landscape@2x.png deleted file mode 100644 index 43bc74a8..00000000 Binary files a/ios/launch/iPad Landscape@2x.png and /dev/null differ diff --git a/ios/launch/iPad Portrait.png b/ios/launch/iPad Portrait.png deleted file mode 100644 index 77b47800..00000000 Binary files a/ios/launch/iPad Portrait.png and /dev/null differ diff --git a/ios/launch/iPad Portrait@2x.png b/ios/launch/iPad Portrait@2x.png deleted file mode 100644 index 7ef64577..00000000 Binary files a/ios/launch/iPad Portrait@2x.png and /dev/null differ diff --git a/ios/launch/iPhone Landscape-Retina HD 5.5.png b/ios/launch/iPhone Landscape-Retina HD 5.5.png deleted file mode 100644 index 2c9ee6e5..00000000 Binary files a/ios/launch/iPhone Landscape-Retina HD 5.5.png and /dev/null differ diff --git a/ios/launch/iPhone Portrait-Retina 4.png b/ios/launch/iPhone Portrait-Retina 4.png deleted file mode 100644 index 71444466..00000000 Binary files a/ios/launch/iPhone Portrait-Retina 4.png and /dev/null differ diff --git a/ios/launch/iPhone Portrait-Retina HD 4.7.png b/ios/launch/iPhone Portrait-Retina HD 4.7.png deleted file mode 100644 index 4742330c..00000000 Binary files a/ios/launch/iPhone Portrait-Retina HD 4.7.png and /dev/null differ diff --git a/ios/launch/iPhone Portrait-Retina HD 5.5.png b/ios/launch/iPhone Portrait-Retina HD 5.5.png deleted file mode 100644 index a54e30b3..00000000 Binary files a/ios/launch/iPhone Portrait-Retina HD 5.5.png and /dev/null differ diff --git a/ios/launch/iPhone Portrait@2x.png b/ios/launch/iPhone Portrait@2x.png deleted file mode 100644 index be1234ca..00000000 Binary files a/ios/launch/iPhone Portrait@2x.png and /dev/null differ diff --git a/ios/launch/iPhone XR Landscape.png b/ios/launch/iPhone XR Landscape.png deleted file mode 100644 index 2b9df193..00000000 Binary files a/ios/launch/iPhone XR Landscape.png and /dev/null differ diff --git a/ios/launch/iPhone XR Portrait.png b/ios/launch/iPhone XR Portrait.png deleted file mode 100644 index da1c3963..00000000 Binary files a/ios/launch/iPhone XR Portrait.png and /dev/null differ diff --git a/ios/launch/iPhone XS Max Landscape.png b/ios/launch/iPhone XS Max Landscape.png deleted file mode 100644 index 079621c5..00000000 Binary files a/ios/launch/iPhone XS Max Landscape.png and /dev/null differ diff --git a/ios/launch/iPhone XS Max Portrait.png b/ios/launch/iPhone XS Max Portrait.png deleted file mode 100644 index 43cbc3cc..00000000 Binary files a/ios/launch/iPhone XS Max Portrait.png and /dev/null differ diff --git a/ios/launch/iPhone X_XS Landscape.png b/ios/launch/iPhone X_XS Landscape.png deleted file mode 100644 index dd4d82f9..00000000 Binary files a/ios/launch/iPhone X_XS Landscape.png and /dev/null differ diff --git a/ios/launch/iPhone X_XS Portrait.png b/ios/launch/iPhone X_XS Portrait.png deleted file mode 100644 index d4889395..00000000 Binary files a/ios/launch/iPhone X_XS Portrait.png and /dev/null differ diff --git a/lib/api/api.dart b/lib/api/api.dart deleted file mode 100644 index 93d4f6b8..00000000 --- a/lib/api/api.dart +++ /dev/null @@ -1,10 +0,0 @@ -class Api{ - // static const String BASE_URL = 'http://127.0.0.1:6001/'; - static const String BASE_URL = 'http://flutter-go.alibaba.net/'; - - static const String DO_LOGIN = BASE_URL+'doLogin';//登陆 - - static const String CHECK_LOGIN = BASE_URL+'checkLogin';//验证登陆 - - static const String LOGOUT = BASE_URL+'logout';//退出登陆 -} \ No newline at end of file diff --git a/lib/blocs/bak/search_api.dart b/lib/blocs/bak/search_api.dart deleted file mode 100644 index 0548d34e..00000000 --- a/lib/blocs/bak/search_api.dart +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 3:20 PM - * email: zhu.yan@alibaba-inc.com - * tartget: FlatButton 的示例 - */ -import 'dart:async'; -import 'package:dio/dio.dart'; -import 'dart:convert'; -import './search_result.dart'; -import 'package:html/parser.dart' show parse; - -var dio = new Dio(); -class Api { - Future> search(name) async { - print('=========>>>'); - var response = await dio.get("https://www.so.com/s?ie=utf-8&q=$name"); -// var document = parse(response.data); -// var app = document.querySelectorAll('.res-title a'); - List res = []; -// app.forEach((f) { -// res.add( -// SearchResult( -// title: f.text, -// source: f.attributes["data-url"] ?? f.attributes["href"], -// ), -// ); -// }); - return res; - } -} - -Api api = Api(); \ No newline at end of file diff --git a/lib/blocs/bak/search_bloc.dart b/lib/blocs/bak/search_bloc.dart deleted file mode 100644 index 08d526c8..00000000 --- a/lib/blocs/bak/search_bloc.dart +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 7:17 PM - * email: zhu.yan@alibaba-inc.com - * tartget: - */ -import 'dart:async'; -import 'package:bloc/bloc.dart'; - -import './search_event.dart'; -import './search_state.dart'; -import './search_api.dart'; - - -/// 这里导入api类与上面的SearchEvent与SearchState文件 - -class SearchBloc extends Bloc { - @override - SearchState get initialState => SearchUninitialized(); - - @override - Stream mapEventToState(SearchEvent event,) async* { - if (event is SearchFetch) { - try { - yield SearchLoading(); - final res = await api.search(event.query); - yield SearchLoaded(res: res); - } catch (_) { - yield SearchError(); - } - } - } -} \ No newline at end of file diff --git a/lib/blocs/bak/search_event.dart b/lib/blocs/bak/search_event.dart deleted file mode 100644 index 0ecc0b44..00000000 --- a/lib/blocs/bak/search_event.dart +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 7:18 PM - * email: zhu.yan@alibaba-inc.com - * tartget: - */ -abstract class SearchEvent {} - -class SearchFetch extends SearchEvent { - final String query; - - SearchFetch({this.query}); - - @override - String toString() => 'SearchFetch:获取搜索结果事件'; -} \ No newline at end of file diff --git a/lib/blocs/bak/search_result.dart b/lib/blocs/bak/search_result.dart deleted file mode 100644 index 8001e49a..00000000 --- a/lib/blocs/bak/search_result.dart +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 7:11 PM - * email: zhu.yan@alibaba-inc.com - * tartget: - */ -class SearchResult { - String title; - String source; - - SearchResult({this.title, this.source}); -} \ No newline at end of file diff --git a/lib/blocs/bak/search_state.dart b/lib/blocs/bak/search_state.dart deleted file mode 100644 index 85d85791..00000000 --- a/lib/blocs/bak/search_state.dart +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 7:13 PM - * email: zhu.yan@alibaba-inc.com - * tartget: - */ -import './search_result.dart'; - -abstract class SearchState {} - -class SearchError extends SearchState { - @override - String toString() => 'SearchError:获取失败'; -} - -class SearchUninitialized extends SearchState { - @override - String toString() => 'SearchUninitialized:未初始化'; -} - -class SearchLoading extends SearchState { - @override - String toString() => 'SearchLoading :正在加载'; -} - -class SearchLoaded extends SearchState { - final List res; - - SearchLoaded({ - this.res, - }); - - @override - String toString() => 'SearchLoaded:加载完毕'; -} \ No newline at end of file diff --git a/lib/blocs/bak/search_widget.dart b/lib/blocs/bak/search_widget.dart deleted file mode 100644 index 1e29848a..00000000 --- a/lib/blocs/bak/search_widget.dart +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 7:19 PM - * email: zhu.yan@alibaba-inc.com - * tartget: - */ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -//import 'package:suiyi/blocs/search/bloc.dart'; -import './search_event.dart'; -import './search_state.dart'; -import './search_bloc.dart'; - - -class SearchWidget extends StatefulWidget { - final SearchDelegate delegate; - final String query; - SearchWidget({this.delegate, this.query}); - @override - _SearchWidgetState createState() => _SearchWidgetState(); -} - -class _SearchWidgetState extends State { - final SearchBloc _search = SearchBloc(); - String old; - @override - void dispose() { - _search.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - print('1:${old}'); - print('2:${widget.query}'); - if (old != widget.query) { - _search.dispatch(SearchFetch(query: widget.query)); - old = widget.query; - } - return BlocBuilder( - bloc: _search, - builder: (BuildContext context, SearchState state) { - print('-------${state}'); - if (state is SearchUninitialized || state is SearchLoading) { - return Center( - child: CircularProgressIndicator(), - ); - } else if (state is SearchError) { - return Center( - child: Text('获取失败'), - ); - } else if (state is SearchLoaded) { - return ListView.builder( - itemBuilder: (BuildContext context, int index) { - return ListTile( - dense: true, - leading: Icon( - Icons.bookmark_border, - size: 32, - ), - title: Text( - state.res[index].title, - overflow: TextOverflow.ellipsis, - ), - subtitle: Text(state.res[index].source), - onTap: () { - // 在这里对选中的结果进行解析,因为我目前是用golang实现的,所以就没贴代码了。 - print(state.res[index].source); - }, - ); - }, - itemCount: state.res.length, - ); - } - }, - ); - } -} \ No newline at end of file diff --git a/lib/blocs/industry_api.dart b/lib/blocs/industry_api.dart deleted file mode 100644 index fc8b2967..00000000 --- a/lib/blocs/industry_api.dart +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 3:20 PM - * email: zhu.yan@alibaba-inc.com - * tartget: FlatButton 的示例 - */ -import 'dart:async'; -import 'package:dio/dio.dart'; -import 'dart:convert'; -import 'package:html/parser.dart' show parse; -import './industry_model.dart'; -import './search_result.dart'; - -var dio = new Dio(); -//class Api2 { -// /// 关键字提示(起点) -// Future> suggestion(String query) async { -//// http.Response response = await http.get( -//// "https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query"); -// var response = await dio.get("https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query", data: {}); -// //var response = await dio.get("https://www.so.com/s?ie=utf-8&q=$query"); -// print('1=====>${query}'); -// print('2=====>${response.data}'); -// //var data = Suggestion.fromJson(json.decode(response.body)); -// //var data = Suggestion.fromJson(json.decode(response.data)); -// var data = Suggestion.fromJson(json.decode(response.data)); -// List suggestion = []; -// data.suggestions.forEach((k) { -// //print('=====>${k.value}'); -// suggestion.add(k.value); -// }); -// -// return Future.delayed(Duration(seconds:2), () { -// return suggestion; -// }); -// //return suggestion; -// } -//} -class Api { - /// 关键字提示(起点) - Future> suggestion(String query) async { -// http.Response response = await http.get( -// "https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query"); - /// var response = await dio.get("https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query", data: {}); - var response = await dio.get("https://www.so.com/s?ie=utf-8&q=$query flutter"); - var document = parse(response.data); - var app = document.querySelectorAll('.res-title a'); - ///print('1=====>${query}'); - ///print('2=====>${response.data}'); - ////print('3=====>${app}'); - List res = []; - app.forEach((f) { - ///print('f==>${f}'); - res.add( - SearchResult( - title: f.text, - source: f.attributes["data-url"] ?? f.attributes["href"], - ), - ); - }); - - return Future.delayed(Duration(seconds:2), () { - return res; - }); - //return suggestion; - } -} - -Api api = Api(); \ No newline at end of file diff --git a/lib/blocs/industry_bloc.dart b/lib/blocs/industry_bloc.dart deleted file mode 100644 index 3bcd464c..00000000 --- a/lib/blocs/industry_bloc.dart +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 5:19 PM - * email: zhu.yan@alibaba-inc.com - * tartget: - */ -import 'dart:async'; -import 'package:bloc/bloc.dart'; -import './industry_api.dart'; -import './industry_event.dart'; -import './industry_state.dart'; - -class SuggestionBloc extends Bloc { - @override - SuggestionState get initialState => SuggestionUninitialized(); - @override - Stream mapEventToState(SuggestionEvent event)async* { - //Stream mapEventToState(SuggestionState currentState, SuggestionEvent event,) async* { - if (event is SuggestionFetch) { - //print('event==>${event}'); - try { - yield SuggestionLoading(); - final res = await api.suggestion(event.query); - print('res====>${res}'); - yield SuggestionLoaded(res: res); - } catch (_) { - yield SuggestionError(); - } - } - if (event is SuggestionClearFetch) { - //print('event==>${event}'); - try { - yield SuggestionUninitialized(); - } catch (_) { - yield SuggestionError(); - } - } - } -} diff --git a/lib/blocs/industry_event.dart b/lib/blocs/industry_event.dart deleted file mode 100644 index 641720b2..00000000 --- a/lib/blocs/industry_event.dart +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 3:35 PM - * email: zhu.yan@alibaba-inc.com - */ -abstract class SuggestionEvent {} - -class SuggestionFetch extends SuggestionEvent { - final String query; - - SuggestionFetch({this.query}); - - @override - String toString() => 'SuggestionFetch:获取关键字提示事件'; -} - -class SuggestionClearFetch extends SuggestionEvent { - final String query; - - SuggestionClearFetch({this.query}); - - @override - String toString() => 'SuggestionClearFetch:清空界面'; -} \ No newline at end of file diff --git a/lib/blocs/industry_main.dart b/lib/blocs/industry_main.dart deleted file mode 100644 index 22dfbc0a..00000000 --- a/lib/blocs/industry_main.dart +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 3:52 PM - * email: zhu.yan@alibaba-inc.com - */ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import './industry_bloc.dart'; -import './industry_event.dart'; -import './industry_state.dart'; - -final SuggestionBloc suggestion = SuggestionBloc(); - -class IndustryPage extends StatefulWidget { - final Function itemTitle; - IndustryPage({Key key,this.itemTitle}) : super(key: key); - - @override - _IndustryState createState() => _IndustryState(); -} - -class _IndustryState extends State { - @override - Widget build(BuildContext context) { - return Material( - child: Column( - children: [ -// TextField( -// autofocus: true, -// textAlign: TextAlign.center, -// onSubmitted: (text) { -// print('onSubmitted:${text}'); -// suggestion.dispatch(SuggestionFetch(query: text)); -// }, -// ), - Expanded( - child: BlocBuilder( - bloc: suggestion, - builder: (BuildContext context, SuggestionState state) { - print('BlocBuilder----${state}'); - if (state is SuggestionUninitialized) { - return Center( - child: Text('暂无内容'), - ); - } else if (state is SuggestionLoading) { - return Center( - child: CircularProgressIndicator(), - ); - } else if (state is SuggestionError) { - return Center( - child: Text('出现错误'), - ); - } else if (state is SuggestionLoaded) { - if (state.res.length == 0) { - return Center( - child: Text('没有适合的结果,更换查询条件试试'), - ); - }else { - if (widget.itemTitle is Function) { - return widget.itemTitle(state); - } - } - } - }, - ), - ), - ], - ), - ); - } - - @override - void dispose() { - //suggestion.dispose();//添加这个第二次进入会失灵 - super.dispose(); - } -} \ No newline at end of file diff --git a/lib/blocs/industry_model.dart b/lib/blocs/industry_model.dart deleted file mode 100644 index ea6cb081..00000000 --- a/lib/blocs/industry_model.dart +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 3:19 PM - * email: zhu.yan@alibaba-inc.com - */ -class Suggestion { - String query; - List suggestions; - int code; - - Suggestion({this.query, this.suggestions, this.code}); - - Suggestion.fromJson(Map json) { - query = json['query']; - if (json['suggestions'] != null) { - suggestions = new List(); - json['suggestions'].forEach((v) { - suggestions.add(new Suggestions.fromJson(v)); - }); - } - code = json['code']; - } - - Map toJson() { - final Map data = new Map(); - data['query'] = this.query; - if (this.suggestions != null) { - data['suggestions'] = this.suggestions.map((v) => v.toJson()).toList(); - } - data['code'] = this.code; - return data; - } -} - -class Suggestions { - Data data; - String value; - - Suggestions({this.data, this.value}); - - Suggestions.fromJson(Map json) { - data = json['data'] != null ? new Data.fromJson(json['data']) : null; - value = json['value']; - } - - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.toJson(); - } - data['value'] = this.value; - return data; - } -} - -class Data { - String category; - - Data({this.category}); - - Data.fromJson(Map json) { - category = json['category']; - } - - Map toJson() { - final Map data = new Map(); - data['category'] = this.category; - return data; - } -} \ No newline at end of file diff --git a/lib/blocs/industry_state.dart b/lib/blocs/industry_state.dart deleted file mode 100644 index b129830c..00000000 --- a/lib/blocs/industry_state.dart +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 3:37 PM - * email: zhu.yan@alibaba-inc.com - */ -abstract class SuggestionState {} - -class SuggestionError extends SuggestionState { - @override - String toString() => 'SuggestionError:获取失败'; -} - -class SuggestionUninitialized extends SuggestionState { - @override - String toString() => 'SuggestionUninitialized:未初始化'; -} - -class SuggestionLoading extends SuggestionState { - @override - String toString() => 'SuggestionLoading :正在加载'; -} - -class SuggestionLoaded extends SuggestionState { - final List res; - - SuggestionLoaded({ - this.res, - }); - - @override - String toString() => 'SuggestionLoaded:加载完毕'; -} diff --git a/lib/blocs/search_result.dart b/lib/blocs/search_result.dart deleted file mode 100644 index 8001e49a..00000000 --- a/lib/blocs/search_result.dart +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/4/28 - * Time: 7:11 PM - * email: zhu.yan@alibaba-inc.com - * tartget: - */ -class SearchResult { - String title; - String source; - - SearchResult({this.title, this.source}); -} \ No newline at end of file diff --git a/lib/components/cate_card.dart b/lib/components/cate_card.dart deleted file mode 100644 index 4d43c5d0..00000000 --- a/lib/components/cate_card.dart +++ /dev/null @@ -1,128 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../model/cat.dart'; -import '../resources/widget_name_to_icon.dart'; -import '../components/widget_item_container.dart'; - -class CateCard extends StatefulWidget { - final Cat category; - CateCard({@required this.category}); - @override - _CateCardState createState() => _CateCardState(); -} - -class _CateCardState extends State { - // 一级菜单目录下的二级Cat集合 - List _firstChildList = new List(); - CatControlModel catControl = new CatControlModel(); - - @override - void initState() { - super.initState(); - getFirstChildCategoriesByParentId(); - } - - // 获取一层目录下的二级内容 - getFirstChildCategoriesByParentId() async { - int parentId = widget.category.id; - // 构建查询条件 - Cat childCateCondition = new Cat(parentId: parentId); - - List list = await catControl.getList(childCateCondition); - if (list.isNotEmpty&&list.length>=1 && this.mounted) { - setState(() { - _firstChildList = list; - }); - } - } - - @override - Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - widget.category.name = widget.category.name.replaceFirst( - //首字母转为大写 - widget.category.name.substring(0, 1), - widget.category.name.substring(0, 1).toUpperCase()); - - return Container( - width: screenWidth, - padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0), - child: Stack( - children: [ - Container( - width: screenWidth - 20, - margin: const EdgeInsets.only(top: 30.0, bottom: 0.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4.0), - ), - child: Column( - children: [ - Container( - width: screenWidth - 20, - padding: const EdgeInsets.only(left: 65.0, top: 3.0), - height: 30.0, - child: Text( - widget.category.name, - style: TextStyle( - color: Theme.of(context).primaryColor, - fontSize: 18.0, - ), - ), - ), - _buildWidgetContainer(), - ], - ), - ), - Positioned( - left: 0.0, - top: 0.0, - child: Container( - height: 60.0, - width: 60.0, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(30.0), - ), - child: Center( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.circular(23.0), - ), - height: 46.0, - width: 46.0, - child: Icon( - WidgetName2Icon.icons[widget.category.name], - color: Colors.white, - size: 30.0, - ), - ), - ), - ), - ) - ], - ), - ); - } - - Widget _buildWidgetContainer() { - if (this._firstChildList.length == 0) { - return Container(); - } - return Container( - padding: const EdgeInsets.only(bottom: 10.0, top: 5.0), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/paimaiLogo.png'), - alignment: Alignment.bottomRight - ), - ), - child: WidgetItemContainer( - categories: this._firstChildList, - columnCount: 3, - isWidgetPoint:false - ), - ); - } -} diff --git a/lib/components/category.dart b/lib/components/category.dart deleted file mode 100644 index 7c6c0715..00000000 --- a/lib/components/category.dart +++ /dev/null @@ -1,143 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; - -import '../routers/application.dart'; -import '../model/cat.dart'; -import '../model/widget.dart'; -import '../widgets/index.dart'; -import '../components/widget_item_container.dart'; - -enum CateOrWigdet { Cat, WidgetDemo } - -class CategoryHome extends StatefulWidget { - CategoryHome(this.name); - final String name; - - @override - _CategoryHome createState() => new _CategoryHome(); -} - -class _CategoryHome extends State { - String title = ''; - // 显示列表 cat or widget; - List categories = []; - List widgetPoints = []; - List catHistory = new List(); - - CatControlModel catControl = new CatControlModel(); - WidgetControlModel widgetControl = new WidgetControlModel(); - // 所有的可用demos; - List widgetDemosList = new WidgetDemoList().getDemos(); - - @override - void initState() { - super.initState(); - // 初始化加入顶级的name - this.getCatByName(widget.name).then((Cat cat) { - catHistory.add(cat); - searchCatOrWigdet(); - }); - } - - Future getCatByName(String name) async { - return await catControl.getCatByName(name); - } - - Future back() { - if (catHistory.length == 1) { - return Future.value(true); - } - catHistory.removeLast(); - searchCatOrWigdet(); - return Future.value(false); - } - - void go(Cat cat) { - catHistory.add(cat); - searchCatOrWigdet(); - } - - void searchCatOrWigdet() async { - // 假设进入这个界面的parent一定存在 - Cat parentCat = catHistory.last; - - - // 继续搜索显示下一级depth: depth + 1, parentId: parentCat.id - List _categories = - await catControl.getList(new Cat(parentId: parentCat.id)); - List _widgetPoints = new List(); - if (_categories.isEmpty) { - _widgetPoints = - await widgetControl.getList(new WidgetPoint(catId: parentCat.id)); - } - - this.setState(() { - categories = _categories; - title = parentCat.name; - widgetPoints = _widgetPoints; - }); - } - - void onCatgoryTap(Cat cat) { - go(cat); - } - - void onWidgetTap(WidgetPoint widgetPoint) { - String targetName = widgetPoint.name; - String targetRouter = '/category/error/404'; - widgetDemosList.forEach((item) { - // print("targetRouter = item.routerName> ${[item.name,targetName]}"); - if (item.name == targetName) { - targetRouter = item.routerName; - } - }); - Application.router.navigateTo(context, "$targetRouter"); - } - - Widget _buildContent() { - WidgetItemContainer wiContaienr = WidgetItemContainer( - columnCount: 3, - categories: categories, - isWidgetPoint:false - ); - if (widgetPoints.length > 0) { - wiContaienr = WidgetItemContainer( - categories: widgetPoints, - columnCount: 3, - isWidgetPoint:true - ); - } - return Container( - padding: const EdgeInsets.only(bottom: 10.0, top: 5.0), - decoration: BoxDecoration( - color: Colors.white, - image: DecorationImage( - image: AssetImage('assets/images/paimaiLogo.png'), - alignment: Alignment.bottomRight), - ), - child: wiContaienr, - ); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(title), - ), - body: WillPopScope( - onWillPop: () { - return back(); - }, - child: ListView( - children: [ - _buildContent(), - ], - ), - // child: Container(color: Colors.blue,child: Text('123'),), - ), - ); - } -} - diff --git a/lib/components/disclaimer_msg.dart b/lib/components/disclaimer_msg.dart deleted file mode 100644 index 78ebb0a5..00000000 --- a/lib/components/disclaimer_msg.dart +++ /dev/null @@ -1,196 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/12 -/// Time: 下午9:19 -/// email: zhu.yan@alibaba-inc.com - -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - - -const disclaimerText1 = - '\r\r\r\r\r\r本APP属于个人的非赢利性开源项目,以供开源社区使用,凡本APP转载的所有的文章 、图片、音频、视频文件等资料的版权归版权所有人所有,本APP采用的非本站原创文章及图片等内容无法一一和版权者联系,如果本网所选内容的文章作者及编辑认为其作品不宜上网供大家浏览,或不应无偿使用请及时用电子邮件或电话通知我们,以迅速采取适当措施,避免给双方造成不必要的经济损失。'; -const disclaimerText2 = - '\n\r\r\r\r\r\r对于已经授权本APP独家使用并提供给本站资料的版权所有人的文章、图片等资料,如需转载使用,需取得本站和版权所有人的同意。本APP所刊发、转载的文章,其版权均归原作者所有,如其他媒体、网站或个人从本网下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本网注明的“稿件来源”,并自负版权等法律责任。'; - -class DisclaimerMsg extends StatefulWidget { - final State pWidget; - - DisclaimerMsg({Key key, this.pWidget}) : super(key: key); - - DisclaimerMsgState createState() => DisclaimerMsgState(); -} - -class DisclaimerMsgState extends State { - Future _prefs = SharedPreferences.getInstance(); - Future _unKnow; - var _valBool = false; - var _readed = false; - - //SharedPreferences 存储结果 - void refs(bool value) async { - final SharedPreferences prefs = await _prefs; - final bool unKnow = value; - if (mounted) { - setState(() { - _unKnow = prefs.setBool("disclaimer::Boolean", unKnow).then((bool success) { - return unKnow; - }); - }); - } - } - - @override - void initState() { - super.initState(); - //获取SharedPreferences 存储结果 - _unKnow = _prefs.then((SharedPreferences prefs) { - return (prefs.getBool('disclaimer::Boolean') ?? false); - }); - _unKnow.then((bool value) { - _valBool = value; - _readed = value; - }); - } - - void showAlertDialog(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, // user must tap button! - builder: (BuildContext context) { - return AlertDialog( - //title: Text('免责声明'), - content: SingleChildScrollView( - child: ListBody( - children: [ - Container( - padding: EdgeInsets.fromLTRB(5.0, 5.0, 10.0, 10.0), - //width: 100, - height: 35, - child: Text('免责声明', - style: TextStyle( - fontSize: 18, fontWeight: FontWeight.w700)), - decoration: BoxDecoration( - //color: Colors.blue, - image: DecorationImage( - fit: BoxFit.fitWidth, - image: AssetImage('assets/images/paimaiLogo.png')), - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - //alignment: Alignment.bottomRight, - )), - SizedBox(height: 20), - Text(disclaimerText1), - Text(disclaimerText2), - ], - ), - ), - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(20.0)), // 圆角 - - actions: [ - new Container( - width: 250, - child: _create(), - ) - ], - ); - }, - ); - } - - Row _create() { - //已读 - if (_readed) { - return Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - FlatButton( - padding: EdgeInsets.symmetric(horizontal: 20.0), - child: Text('已阅读知晓', - style: TextStyle(fontSize: 16, color: Colors.white)), - //可点击 - color: Theme.of(context).primaryColor, - onPressed: () { - Navigator.of(context).pop(); - }, - ), - SizedBox( - width: 10.0, - ) - ], - ); - } - - //第一次读取 - return Row(mainAxisAlignment: MainAxisAlignment.spaceAround, - //crossAxisAlignment:CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Checkbox( - activeColor: Theme.of(context).primaryColor, - tristate: false, - value: _valBool, - onChanged: (bool bol) { - if(mounted) { - setState(() { - _valBool = bol; - }); - } - Navigator.of(context).pop(); // here I pop to avoid multiple Dialogs - showAlertDialog(context); //here i call the same function - }), - Text('不再自动提示', style: TextStyle(fontSize: 14)), - ], - ), - FlatButton( - child: Text('知道了', - style: TextStyle(fontSize: 16, color: Colors.white)), - //可点击 - color: _valBool - ? Theme.of(context).primaryColor - : Theme.of(context).primaryColor.withAlpha(800), - onPressed: () { - // if (_valBool) { - refs(_valBool); - Navigator.of(context).pop(); - // } - }, - ), - ]); - } - - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - showAlertDialog(context); - }, - child: Stack( - //alignment: const Alignment(1.6, 1.6), - children: [ - Container( - width: 90.0, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: - BorderRadius.horizontal(right: Radius.circular(10)), - color: Colors.black45, - ), - child: Text( - '🔔 免责声明', - style: TextStyle( - fontSize: 14.0, - //fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), - ], - )); - } -} diff --git a/lib/components/full_screen_code_dialog.dart b/lib/components/full_screen_code_dialog.dart deleted file mode 100644 index 76147749..00000000 --- a/lib/components/full_screen_code_dialog.dart +++ /dev/null @@ -1,81 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-14 11:42:32 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-14 14:42:00 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/utils/example_code_parser.dart'; -import 'package:flutter_go/utils/syntax_highlighter.dart'; - -class FullScreenCodeDialog extends StatefulWidget { - const FullScreenCodeDialog({this.filePath}); - - final String filePath; - _FullScreenCodeDialogState createState() => _FullScreenCodeDialogState(); -} - -class _FullScreenCodeDialogState extends State { - String _exampleCode; - - @override - void didChangeDependencies() { - print('widget.filePath=======${widget.filePath}'); - getExampleCode(context,'${widget.filePath}', DefaultAssetBundle.of(context)) - .then((String code) { - if (mounted) { - setState(() { - _exampleCode = code ?? 'Example code not found'; - }); - } - }); - super.didChangeDependencies(); - } - - @override - Widget build(BuildContext context) { - final SyntaxHighlighterStyle style = - Theme.of(context).brightness == Brightness.dark - ? SyntaxHighlighterStyle.darkThemeStyle() - : SyntaxHighlighterStyle.lightThemeStyle(); - - Widget body; - if (_exampleCode == null) { - body = const Center(child: CircularProgressIndicator()); - } else { - Widget _codeWidget; - try{ - DartSyntaxHighlighter(style).format(_exampleCode); - _codeWidget = RichText( - text: TextSpan( - style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0), - children: [ - DartSyntaxHighlighter(style).format(_exampleCode) - ],), - ); - }catch (err){ - _codeWidget = Text(_exampleCode); - } - body = SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: _codeWidget, - ), - ); - } - - return Scaffold( - appBar: AppBar( - leading: IconButton( - icon: const Icon( - Icons.clear, - semanticLabel: 'Close', - ), - onPressed: () { - Navigator.pop(context); - }), - title: const Text('Example code'), - ), - body: body); - } -} diff --git a/lib/components/home_banner.dart b/lib/components/home_banner.dart deleted file mode 100644 index 36345cbe..00000000 --- a/lib/components/home_banner.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; - -import '../model/story.dart'; - -class HomeBanner extends StatefulWidget { - final List bannerStories; - final OnTapBannerItem onTap; - - HomeBanner(this.bannerStories, this.onTap, {Key key}) - :super(key: key); - - @override - State createState() { - return _BannerState(); - } -} - -class _BannerState extends State { - int virtualIndex = 0; - int realIndex = 1; - PageController controller; - Timer timer; - - @override - void initState() { - super.initState(); - controller = PageController(initialPage: realIndex); - timer = Timer.periodic(Duration(seconds: 5), (timer) { // 自动滚动 - /// print(realIndex); - controller.animateToPage(realIndex + 1, - duration: Duration(milliseconds: 300), - curve: Curves.linear); - }); - } - - @override - void dispose() { - super.dispose(); - controller.dispose(); - timer.cancel(); - } - - /// pagination 的计数器 - Widget _numberIndicator(BuildContext context, int index, int itemCount) { - return Container( - decoration: BoxDecoration( - color: Colors.black45, borderRadius: BorderRadius.circular(20.0)), - margin: EdgeInsets.only(top: 10.0, right: 5.0), - padding: EdgeInsets.symmetric(horizontal: 6.0, vertical: 2.0), - child: Text("${++index}/$itemCount", - style: TextStyle( color: Colors.white70, fontSize: 12.0, fontWeight:FontWeight.bold )), - ); - } - - @override - Widget build(BuildContext context) { - return Container( - height: 226.0, - child: Stack( - alignment: Alignment.bottomCenter, - children: [ - PageView( - controller: controller, - onPageChanged: _onPageChanged, - children: _buildItems(),), - _buildIndicator(), // 下面的小点 - Positioned(//方法二 - top: 0.0, - right: 0.0, - child: _numberIndicator(context,virtualIndex,widget.bannerStories.length), - ) - ]), - ); - } - - List _buildItems() { // 排列轮播数组 - List items = []; - if (widget.bannerStories.length > 0) { - // 头部添加一个尾部Item,模拟循环 - items.add( - _buildItem(widget.bannerStories[widget.bannerStories.length - 1])); - // 正常添加Item - items.addAll( - widget.bannerStories.map((story) => _buildItem(story)).toList( - growable: false)); - // 尾部 - items.add( - _buildItem(widget.bannerStories[0])); - } - return items; - } - - Widget _buildItem(StoryModel story) { - return GestureDetector( - onTap: () { // 按下 - if (widget.onTap != null) { - widget.onTap(story); - } - }, - child: Stack( - fit: StackFit.expand, - children: [ - Image.network(story.image, fit: BoxFit.cover), - _buildItemTitle(story.title), // 内容文字,大意 - ],),); - } - - Widget _buildItemTitle(String title) { - return Container( - decoration: BoxDecoration( /// 背景的渐变色 - gradient: LinearGradient( - begin: Alignment.bottomCenter, - end: const Alignment(0.0, -0.8), - colors: [const Color(0xa0000000), Colors.transparent], - ), - ), - alignment: Alignment.bottomCenter, - child: Container( - margin: EdgeInsets.symmetric(vertical: 22.0, horizontal: 16.0), - child: Text( - title, style: TextStyle(color: Colors.white, fontSize: 18.0),),), - ); - } - - Widget _buildIndicator() { - List indicators = []; - for (int i = 0; i < widget.bannerStories.length; i++) { - indicators.add(Container( - width: 6.0, - height: 6.0, - margin: EdgeInsets.symmetric(horizontal: 1.5, vertical: 10.0), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: i == virtualIndex ? Colors.white : Colors.grey))); - } - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: indicators); - } - - _onPageChanged(int index) { - realIndex = index; - int count = widget.bannerStories.length; - if (index == 0) { - virtualIndex = count - 1; - controller.jumpToPage(count); - } else if (index == count + 1) { - virtualIndex = 0; - controller.jumpToPage(1); - } else { - virtualIndex = index - 1; - } - setState(() {}); - } -} - -typedef void OnTapBannerItem(StoryModel story); \ No newline at end of file diff --git a/lib/components/list_refresh.dart b/lib/components/list_refresh.dart deleted file mode 100644 index b4a13244..00000000 --- a/lib/components/list_refresh.dart +++ /dev/null @@ -1,183 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/4 -/// Time: 上午1:16 -/// email: zhu.yan@alibaba-inc.com -/// target: ListRefresh 的示例 - -import 'dart:async'; - -import 'package:flutter/material.dart'; - -class ListRefresh extends StatefulWidget { - final renderItem; - final requestApi; - final headerView; - - const ListRefresh([this.requestApi, this.renderItem, this.headerView]) : super(); - - @override - State createState() => _ListRefreshState(); -} - -class _ListRefreshState extends State { - bool isLoading = false; // 是否正在请求数据中 - bool _hasMore = true; // 是否还有更多数据可加载 - int _pageIndex = 0; // 页面的索引 - int _pageTotal = 0; // 页面的索引 - List items = new List(); - ScrollController _scrollController = new ScrollController(); - - @override - void initState() { - super.initState(); - _getMoreData(); - _scrollController.addListener(() { - // 如果下拉的当前位置到scroll的最下面 - if (_scrollController.position.pixels == - _scrollController.position.maxScrollExtent) { - _getMoreData(); - } - }); - } - -// 回弹效果 - backElasticEffect() { -// double edge = 50.0; -// double offsetFromBottom = _scrollController.position.maxScrollExtent - _scrollController.position.pixels; -// if (offsetFromBottom < edge) { // 添加一个动画没有更多数据的时候 ListView 向下移动覆盖正在加载更多数据的标志 -// _scrollController.animateTo( -// _scrollController.offset - (edge -offsetFromBottom), -// duration: new Duration(milliseconds: 1000), -// curve: Curves.easeOut); -// } - } - -// list探底,执行的具体事件 - Future _getMoreData() async { - if (!isLoading && _hasMore) { - // 如果上一次异步请求数据完成 同时有数据可以加载 - if (mounted) { - setState(() => isLoading = true); - } - //if(_hasMore){ // 还有数据可以拉新 - List newEntries = await mokeHttpRequest(); - //if (newEntries.isEmpty) { - _hasMore = (_pageIndex <= _pageTotal); - if (this.mounted) { - setState(() { - items.addAll(newEntries); - isLoading = false; - }); - } - backElasticEffect(); - } else if (!isLoading && !_hasMore) { - // 这样判断,减少以后的绘制 - _pageIndex = 0; - backElasticEffect(); - } - } - -// 伪装吐出新数据 - Future mokeHttpRequest() async { - if (widget.requestApi is Function) { - final listObj = await widget.requestApi({'pageIndex': _pageIndex}); - _pageIndex = listObj['pageIndex']; - _pageTotal = listObj['total']; - return listObj['list']; - } else { - return Future.delayed(Duration(seconds: 2), () { - return []; - }); - } - } -// 下拉加载的事件,清空之前list内容,取前X个 -// 其实就是列表重置 - Future _handleRefresh() async { - List newEntries = await mokeHttpRequest(); - if (this.mounted) { - setState(() { - items.clear(); - items.addAll(newEntries); - isLoading = false; - _hasMore = true; - return null; - }); - } - } - -// 加载中的提示 - Widget _buildLoadText() { - return Container( - child: Padding( - padding: const EdgeInsets.all(18.0), - child: Center( - child: Text("数据没有更多了!!!"), - ), - )); - } - -// 上提加载loading的widget,如果数据到达极限,显示没有更多 - Widget _buildProgressIndicator() { - if (_hasMore) { - return new Padding( - padding: const EdgeInsets.all(8.0), - child: new Center( - child: Column( - children: [ - new Opacity( - opacity: isLoading ? 1.0 : 0.0, - child: new CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation(Colors.blue)), - ), - SizedBox(height: 20.0), - Text( - '稍等片刻更精彩...', - style: TextStyle(fontSize: 14.0), - ) - ], - ) - //child: - ), - ); - } else { - return _buildLoadText(); - } - } - - @override - void dispose() { - super.dispose(); - _scrollController.dispose(); - } - - @override - Widget build(BuildContext context) { - return new RefreshIndicator( - child: ListView.builder( - itemCount: items.length + 1, - itemBuilder: (context, index) { - if (index == 0 && index != items.length) { - if(widget.headerView is Function){ - return widget.headerView(); - }else { - return Container(height: 0); - } - } - if (index == items.length) { - //return _buildLoadText(); - return _buildProgressIndicator(); - } else { - //print('itemsitemsitemsitems:${items[index].title}'); - //return ListTile(title: Text("Index${index}:${items[index].title}")); - if (widget.renderItem is Function) { - return widget.renderItem(index, items[index]); - } - } - }, - controller: _scrollController, - ), - onRefresh: _handleRefresh, - ); - } -} diff --git a/lib/components/list_view_item.dart b/lib/components/list_view_item.dart deleted file mode 100644 index c8aa682d..00000000 --- a/lib/components/list_view_item.dart +++ /dev/null @@ -1,53 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-14 17:53:54 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-14 17:57:51 - -import 'package:flutter/material.dart'; -import '../routers/application.dart'; -import '../routers/routers.dart'; -import 'dart:core'; - - -class ListViewItem extends StatelessWidget { - final String itemUrl; - final String itemTitle; - final String data; - - const ListViewItem({Key key, this.itemUrl, this.itemTitle, this.data}) - : super(key: key); - - - @override - Widget build(BuildContext context) { - return Card( - color: Colors.white, - elevation: 4.0, - margin: new EdgeInsets.symmetric(horizontal: 10.0, vertical: 6.0), - child: ListTile( - onTap: () { - // _launchURL(itemUrl, context); - Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent(itemTitle)}&url=${Uri.encodeComponent(itemUrl)}'); - }, - title: Padding( - child: Text( - itemTitle, - style: TextStyle(color: Colors.black, fontSize: 15.0), - ), - padding: EdgeInsets.only(top: 10.0), - ), - subtitle: Row( - children: [ - Padding( - child: Text(data, - style: TextStyle(color: Colors.black54, fontSize: 10.0)), - padding: EdgeInsets.only(top: 10.0, bottom: 10.0), - ) - ], - ), - trailing: - Icon(Icons.keyboard_arrow_right, color: Colors.grey, size: 30.0), - ), - ); - } -} diff --git a/lib/components/markdown.dart b/lib/components/markdown.dart deleted file mode 100644 index 02cf6af7..00000000 --- a/lib/components/markdown.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter_markdown/flutter_markdown.dart' as md; -import 'package:flutter/material.dart'; - -import 'package:flutter_go/utils/high_light_code.dart'; - -/// 使用方法 -/// MarkdownBody(markdown) -final hightlighter = new HighLight(); -class HighLight extends md.SyntaxHighlighter { - @override - TextSpan format(String source) { - final SyntaxHighlighterStyle style = SyntaxHighlighterStyle.lightThemeStyle(); - return TextSpan( - style: const TextStyle(fontSize: 10.0), - children: [ - DartSyntaxHighlighter(style).format(source) - ] - ); - } -} - - - -class MarkdownBody extends StatelessWidget { - final String data; - MarkdownBody(this.data); - @override - Widget build(BuildContext context) { - return md.MarkdownBody(data: data, syntaxHighlighter: new HighLight()); - } -} \ No newline at end of file diff --git a/lib/components/pagination.dart b/lib/components/pagination.dart deleted file mode 100644 index e7fdd379..00000000 --- a/lib/components/pagination.dart +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; - -import './home_banner.dart'; -import '../model/story.dart'; - -class Pagination extends StatelessWidget { - static final String routeName = '/material/page-selector'; - static final List icons = [ - const Icon(Icons.event, semanticLabel: 'Event'), - const Icon(Icons.home, semanticLabel: 'Home'), - const Icon(Icons.android, semanticLabel: 'Android'), - const Icon(Icons.alarm, semanticLabel: 'Alarm'), - const Icon(Icons.face, semanticLabel: 'Face'), - const Icon(Icons.language, semanticLabel: 'Language'), - ]; - - final List arr = [ - {'image': 'https://img.alicdn.com/tfs/TB1W4hMAwHqK1RjSZJnXXbNLpXa-519-260.jpg', 'type': 0, 'id': 9695909, 'url': 'https://www.zhihu.com/question/294145797/answer/551162834', 'title': '为什么阿里巴巴、腾讯和 Google 之类的企业都在使用 Flutter 开发 App?'}, - {'image': 'https://img.alicdn.com/tfs/TB1XmFIApzqK1RjSZSgXXcpAVXa-720-338.jpg', 'type': 0, 'id': 9695859, 'url': 'https://zhuanlan.zhihu.com/p/51696594', 'title': 'Flutter 1.0 正式发布: Google 的便携 UI 工具包'}, - {'image': 'https://img.alicdn.com/tfs/TB1mClCABLoK1RjSZFuXXXn0XXa-600-362.jpg', 'type': 0, 'id': 96956491409, 'url':'https://zhuanlan.zhihu.com/p/53497167','title': 'Flutter 示范应用现已开源 — 万物起源(The History of Everything)'}, - {'image': 'https://img.alicdn.com/tfs/TB1fXxIAAvoK1RjSZFNXXcxMVXa-600-362.jpg', 'type': 0, 'id': 9695816, 'url': 'https://mp.weixin.qq.com/s?__biz=MzAwODY4OTk2Mg==&mid=2652048101&idx=1&sn=20296088e4bd8ca33c5c9991167d9f7d&chksm=808caaa0b7fb23b65c0e5806209f8d86da6732f3a00a70353f3606018339518b0a8656f14dc5&mpsshare=1&scene=2&srcid=0106SZapVysZdIS6Oc5AhNH6&from=timeline&ascene=2&devicetype=android-27&version=27000038&nettype=WIFI&abtest_cookie=BQABAAgACgALABMAFAAFAJ2GHgAjlx4AV5keAJuZHgCcmR4AAAA%3D&lang=zh_CN&pass_ticket=4K1%2FUpsxP4suPj2iubR17wbAP7r9LW9iYrPAC2dppTqv7j7JO5FWMXtcKeBRxueV&wx_header=1', 'title': 'Flutter 与 Material Design 双剑合璧,助您构建精美应用'} - ]; - - void _launchURL(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } - } - - List _pageSelector(BuildContext context) { - List list = []; - List bannerStories = []; - /// super.initState(); - arr.forEach((item) { - bannerStories.add(StoryModel.fromJson(item)); - }); - - - if (arr.length > 0) { - list.add(HomeBanner(bannerStories, (story) { - _launchURL('${story.url}'); - })); - } - return list; - } - - @override - Widget build(BuildContext context) { - return - Column( - key:Key('__header__'), - //physics: AlwaysScrollableScrollPhysics(), - //padding: EdgeInsets.only(), - children: _pageSelector(context) - ); - } -} diff --git a/lib/components/search_input.dart b/lib/components/search_input.dart deleted file mode 100644 index b0abdf03..00000000 --- a/lib/components/search_input.dart +++ /dev/null @@ -1,493 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:fluro/fluro.dart'; -import 'package:meta/meta.dart'; -import 'package:flutter_go/resources/widget_name_to_icon.dart'; -import 'package:flutter_go/routers/application.dart'; -import '../model/search_history.dart'; - -typedef String FormFieldFormatter(T v); -typedef bool MaterialSearchFilter(T v, String c); -typedef int MaterialSearchSort(T a, T b, String c); -typedef Future> MaterialResultsFinder(String c); -typedef void OnSubmit(String value); - -///搜索结果内容显示面板 -class MaterialSearchResult extends StatelessWidget { - const MaterialSearchResult({ - Key key, - this.value, - this.text, - this.icon, - this.onTap - }) : super(key: key); - - final String value; - final VoidCallback onTap; - final String text; - final IconData icon; - - @override - Widget build(BuildContext context) { - - return new InkWell( - onTap: this.onTap, - child: new Container( - height: 64.0, - padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0), - child: new Row( - children: [ - new Container(width: 30.0, margin: EdgeInsets.only(right: 10), child: new Icon(icon)) ?? null, - new Expanded(child: new Text(value, style: Theme.of(context).textTheme.subhead)), - new Text(text, style: Theme.of(context).textTheme.subhead) - ], - ), - ), - ); - } -} - -class MaterialSearch extends StatefulWidget { - MaterialSearch({ - Key key, - this.placeholder, - this.results, - this.getResults, - this.filter, - this.sort, - this.limit: 10, - this.onSelect, - this.onSubmit, - this.barBackgroundColor = Colors.white, - this.iconColor = Colors.black, - this.leading, - }) : assert(() { - if (results == null && getResults == null || - results != null && getResults != null) { - throw new AssertionError( - 'Either provide a function to get the results, or the results.'); - } - - return true; - }()), - super(key: key); - - final String placeholder; - - final List> results; - final MaterialResultsFinder getResults; - final MaterialSearchFilter filter; - final MaterialSearchSort sort; - final int limit; - final ValueChanged onSelect; - final OnSubmit onSubmit; - final Color barBackgroundColor; - final Color iconColor; - final Widget leading; - - @override - _MaterialSearchState createState() => new _MaterialSearchState(); -} - -class _MaterialSearchState extends State { - bool _loading = false; - List> _results = []; - - String _criteria = ''; - TextEditingController _controller = new TextEditingController(); - - _filter(dynamic v, String c) { - return v - .toString() - .toLowerCase() - .trim() - .contains(new RegExp(r'' + c.toLowerCase().trim() + '')); - } - - @override - void initState() { - super.initState(); - - if (widget.getResults != null) { - _getResultsDebounced(); - } - - _controller.addListener(() { - setState(() { - _criteria = _controller.value.text; - if (widget.getResults != null) { - _getResultsDebounced(); - } - }); - }); - } - - Timer _resultsTimer; - Future _getResultsDebounced() async { - if (_results.length == 0) { - setState(() { - _loading = true; - }); - } - - if (_resultsTimer != null && _resultsTimer.isActive) { - _resultsTimer.cancel(); - } - - _resultsTimer = new Timer(new Duration(milliseconds: 400), () async { - if (!mounted) { - return; - } - - setState(() { - _loading = true; - }); - - var results = await widget.getResults(_criteria); - - if (!mounted) { - return; - } - - if (results != null) { - setState(() { - _loading = false; - _results = results; - }); - } - }); - } - - @override - void dispose() { - super.dispose(); - _resultsTimer?.cancel(); - } - Widget buildBody(List results) { - if (_criteria.isEmpty) { - return History(); - } else if (_loading) { - return new Center( - child: new Padding( - padding: const EdgeInsets.only(top: 50.0), - child: new CircularProgressIndicator() - ) - ); - } - if (results.isNotEmpty) { - var content = new SingleChildScrollView( - child: new Column( - children: results - ) - ); - return content; - } - return Center(child: Text("暂无数据")); - } - - @override - Widget build(BuildContext context) { - var results = - (widget.results ?? _results).where((MaterialSearchResult result) { - if (widget.filter != null) { - return widget.filter(result.value, _criteria); - } - //only apply default filter if used the `results` option - //because getResults may already have applied some filter if `filter` option was omited. - else if (widget.results != null) { - return _filter(result.value, _criteria); - } - - return true; - }).toList(); - - if (widget.sort != null) { - results.sort((a, b) => widget.sort(a.value, b.value, _criteria)); - } - - results = results.take(widget.limit).toList(); - - IconThemeData iconTheme = - Theme.of(context).iconTheme.copyWith(color: widget.iconColor); - - return new Scaffold( - appBar: new AppBar( - leading: widget.leading, - backgroundColor: widget.barBackgroundColor, - iconTheme: iconTheme, - title: new TextField( - controller: _controller, - autofocus: true, - decoration: - new InputDecoration.collapsed(hintText: widget.placeholder), - style: Theme.of(context).textTheme.title, - onSubmitted: (String value) { - if (widget.onSubmit != null) { - widget.onSubmit(value); - } - }, - ), - actions: _criteria.length == 0 - ? [] - : [ - new IconButton( - icon: new Icon(Icons.clear), - onPressed: () { - setState(() { - _controller.text = _criteria = ''; - }); - }), - ], - ), - body: buildBody(results), - ); - } -} - -class _MaterialSearchPageRoute extends MaterialPageRoute { - _MaterialSearchPageRoute({ - @required WidgetBuilder builder, - RouteSettings settings: const RouteSettings(), - maintainState: true, - bool fullscreenDialog: false, - }) : assert(builder != null), - super( - builder: builder, - settings: settings, - maintainState: maintainState, - fullscreenDialog: fullscreenDialog); -} - -class MaterialSearchInput extends StatefulWidget { - MaterialSearchInput({ - Key key, - this.onSaved, - this.validator, - this.autovalidate, - this.placeholder, - this.formatter, - this.results, - this.getResults, - this.filter, - this.sort, - this.onSelect, - }); - - final FormFieldSetter onSaved; - final FormFieldValidator validator; - final bool autovalidate; - final String placeholder; - final FormFieldFormatter formatter; - - final List> results; - final MaterialResultsFinder getResults; - final MaterialSearchFilter filter; - final MaterialSearchSort sort; - final ValueChanged onSelect; - - @override - _MaterialSearchInputState createState() => - new _MaterialSearchInputState(); -} - -class _MaterialSearchInputState extends State> { - GlobalKey> _formFieldKey = - new GlobalKey>(); - - _buildMaterialSearchPage(BuildContext context) { - return new _MaterialSearchPageRoute( - settings: new RouteSettings( - name: 'material_search', - isInitialRoute: false, - ), - builder: (BuildContext context) { - return new Material( - child: new MaterialSearch( - placeholder: widget.placeholder, - results: widget.results, - getResults: widget.getResults, - filter: widget.filter, - sort: widget.sort, - onSelect: (dynamic value) => Navigator.of(context).pop(value), - ), - ); - }); - } - - _showMaterialSearch(BuildContext context) { - Navigator.of(context) - .push(_buildMaterialSearchPage(context)) - .then((dynamic value) { - if (value != null) { - _formFieldKey.currentState.didChange(value); - widget.onSelect(value); - } - }); - } - - bool get autovalidate { - return widget.autovalidate ?? - Form.of(context)?.widget?.autovalidate ?? - false; - } - - bool _isEmpty(field) { - return field.value == null; - } - - Widget build(BuildContext context) { - final TextStyle valueStyle = Theme.of(context).textTheme.subhead; - - return new InkWell( - onTap: () => _showMaterialSearch(context), - child: new FormField( - key: _formFieldKey, - validator: widget.validator, - onSaved: widget.onSaved, - autovalidate: autovalidate, - builder: (FormFieldState field) { - return new InputDecorator( - isEmpty: _isEmpty(field), - decoration: new InputDecoration( - labelText: widget.placeholder, - border: InputBorder.none, - errorText: field.errorText, - ), - child: _isEmpty(field) - ? null - : new Text( - widget.formatter != null - ? widget.formatter(field.value) - : field.value.toString(), - style: valueStyle), - ); - }, - ), - ); - } -} - -///搜索框 -class SearchInput extends StatelessWidget { - final getResults; - - final ValueChanged onSubmitted; - - final VoidCallback onSubmitPressed; - - SearchInput(this.getResults, this.onSubmitted, this.onSubmitPressed); - - @override - Widget build(BuildContext context) { - return new Container( - height: 40.0, - decoration: BoxDecoration( - color: Theme.of(context).backgroundColor, - borderRadius: BorderRadius.circular(4.0)), - child: new Row( - children: [ - new Padding( - padding: new EdgeInsets.only(right: 10.0, top: 3.0, left: 10.0), - child: new Icon(Icons.search, - size: 24.0, color: Theme.of(context).accentColor), - ), - new Expanded( - child: new MaterialSearchInput( - placeholder: '搜索 flutter 组件', - getResults: getResults, - ), - ), - ], - ), - ); - } -} -// wigdet干掉.=> componets - - -class History extends StatefulWidget { - const History() : super(); - - @override - _History createState() => _History(); -} - -// AppBar 默认的实例,有状态 -class _History extends State { - SearchHistoryList searchHistoryList = new SearchHistoryList(); - - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - super.dispose(); - } - buildChips(BuildContext context) { - List list = []; - List historyList = searchHistoryList.getList(); - print("historyList> $historyList"); - Color bgColor = Theme.of(context).primaryColor; - historyList.forEach((SearchHistory value) { - - Widget icon = CircleAvatar( - backgroundColor: bgColor, - child: Text( - value.name.substring(0, 1), - style: TextStyle(color: Colors.white), - ), - ); - if (WidgetName2Icon.icons[value.name] != null) { - icon = Icon(WidgetName2Icon.icons[value.name], size: 25); - } - - list.add( - InkWell( - onTap: () { - Application.router.navigateTo(context, "${value.targetRouter}", transition: TransitionType.inFromRight); - }, - child: Chip( - avatar: icon, - label: Text("${value.name}"), - ), - ) - ); - }); - return list; - } - @override - Widget build(BuildContext context) { - List childList = buildChips(context); - if (childList.length == 0) { - return Center( - child: Text("当前历史面板为空"), - ); - } - return Column( - children: [ - Container( - alignment: Alignment.centerLeft, - padding: EdgeInsets.fromLTRB(12.0, 12, 12, 0), - child: InkWell( - onLongPress: () { - searchHistoryList.clear(); - }, - child: Text('历史搜索'), - ), - ), - Container( - padding: EdgeInsets.only(left: 10), - alignment: Alignment.topLeft, - child: Wrap( - spacing: 6.0, // gap between adjacent chips - runSpacing: 0.0, // gap between lines - children: childList - ), - ) - ], - ); - } -} \ No newline at end of file diff --git a/lib/components/widget_demo.dart b/lib/components/widget_demo.dart deleted file mode 100644 index bbce9f51..00000000 --- a/lib/components/widget_demo.dart +++ /dev/null @@ -1,200 +0,0 @@ -/// @author Nealyang -/// 新widget详情页模板 - -import 'dart:core'; - -import 'package:flutter/material.dart'; - -import '../routers/application.dart'; -import '../routers/routers.dart'; -import '../components/markdown.dart'; -import '../model/collection.dart'; -import '../widgets/index.dart'; -import '../event/event_bus.dart'; -import '../event/event_model.dart'; - -class WidgetDemo extends StatefulWidget { - final List contentList; - final String docUrl; - final String title; - final String codeUrl; - final Widget bottomNaviBar; - - WidgetDemo( - {Key key, - @required this.title, - @required this.contentList, - @required this.codeUrl, - @required this.docUrl, - this.bottomNaviBar}) - : super(key: key); - - _WidgetDemoState createState() => _WidgetDemoState(); -} - -class _WidgetDemoState extends State { - bool _hasCollected = false; - CollectionControlModel _collectionControl = new CollectionControlModel(); - var _collectionIcons; - List widgetDemosList = new WidgetDemoList().getDemos(); - String _router = ''; - final GlobalKey _scaffoldKey = GlobalKey(); - - List _buildContent() { - List _list = [ - SizedBox( - height: 10.0, - ), - ]; - widget.contentList.forEach((item) { - if (item.runtimeType == String) { - _list.add(MarkdownBody(item)); - _list.add( - SizedBox( - height: 20.0, - ), - ); - } else { - _list.add(item); - } - }); - return _list; - } - - @override - void initState() { - super.initState(); - _collectionControl.getRouterByName(widget.title).then((list) { - widgetDemosList.forEach((item) { - if (item.name == widget.title) { - _router = item.routerName; - } - }); - if (this.mounted) { - setState(() { - _hasCollected = list.length > 0; - }); - } - }); - } - -// 点击收藏按钮 - _getCollection() { - if (_hasCollected) { - // 删除操作 - _collectionControl.deleteByName(widget.title).then((result) { - if (result > 0 && this.mounted) { - setState(() { - _hasCollected = false; - }); - _scaffoldKey.currentState - .showSnackBar(SnackBar(content: Text('已取消收藏'))); - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, true)); - } - return; - } - print('删除错误'); - }); - } else { - // 插入操作 - _collectionControl - .insert(Collection(name: widget.title, router: _router)) - .then((result) { - if (this.mounted) { - setState(() { - _hasCollected = true; - }); - - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, false)); - } - - _scaffoldKey.currentState - .showSnackBar(SnackBar(content: Text('收藏成功'))); - } - }); - } - } - - void _selectValue(value) { - if (value == 'doc') { - // _launchURL(widget.docUrl); - Application.router.navigateTo(context, - '${Routes.webViewPage}?title=${Uri.encodeComponent(widget.title)} Doc&&url=${Uri.encodeComponent(widget.docUrl)}'); - } else if (value == 'code') { - Application.router.navigateTo(context, - '${Routes.codeView}?filePath=${Uri.encodeComponent(widget.codeUrl)}'); - } - } - - @override - Widget build(BuildContext context) { - if (_hasCollected) { - _collectionIcons = Icons.favorite; - } else { - _collectionIcons = Icons.favorite_border; - } - return Scaffold( - key: _scaffoldKey, - appBar: AppBar( - title: Text(widget.title), - actions: [ - new IconButton( - tooltip: 'goBack home', - onPressed: () { - Navigator.popUntil(context, ModalRoute.withName('/')); - }, - icon: Icon(Icons.home), - ), - new IconButton( - tooltip: 'collection', - onPressed: _getCollection, - icon: Icon(_collectionIcons), - ), - PopupMenuButton( - onSelected: _selectValue, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 'doc', - child: ListTile( - leading: Icon( - Icons.library_books, - size: 22.0, - ), - title: Text('查看文档'), - ), - ), - const PopupMenuDivider(), - const PopupMenuItem( - value: 'code', - child: ListTile( - leading: Icon( - Icons.code, - size: 22.0, - ), - title: Text('查看Demo'), - ), - ), - ], - ), - ], - ), - body: Container( - padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), - child: ListView( - shrinkWrap: true, - padding: const EdgeInsets.all(0.0), - children: [ - Column( - children: _buildContent(), - ), - ], - ), - ), - bottomNavigationBar: - (widget.bottomNaviBar is Widget) ? widget.bottomNaviBar : null); - } -} diff --git a/lib/components/widget_item.dart b/lib/components/widget_item.dart deleted file mode 100644 index e8dd6958..00000000 --- a/lib/components/widget_item.dart +++ /dev/null @@ -1,98 +0,0 @@ -/// @author 一凨 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/utils/style.dart'; -import 'package:flutter_go/resources/widget_name_to_icon.dart'; - -String _widgetName; - -class WidgetItem extends StatelessWidget { - final String title; - final VoidCallback onTap; - final int index; //用于计算border - final int totalCount; - final int rowLength; - final String textSize; - - WidgetItem( - {this.title, - this.onTap, - this.index, - this.totalCount, - this.rowLength, - this.textSize}); - - Border _buildBorder(context) { - Border _border; - bool isRight = (index % rowLength) == (rowLength - 1); //是不是最右边的,决定是否有右侧边框 - var currentRow = (index + 1) % rowLength > 0 - ? (index + 1) ~/ rowLength + 1 - : (index + 1) ~/ rowLength; - int totalRow = totalCount % rowLength > 0 - ? totalCount ~/ rowLength + 1 - : totalCount ~/ rowLength; - if (currentRow < totalRow && isRight) { - //不是最后一行,是最右边 - _border = Border( - bottom: const BorderSide( - width: 1.0, color: Color(WidgetDemoColor.borderColor)), - ); - } - if (currentRow < totalRow && !isRight) { - _border = Border( - right: const BorderSide( - width: 1.0, color: Color(WidgetDemoColor.borderColor)), - bottom: const BorderSide( - width: 1.0, color: Color(WidgetDemoColor.borderColor)), - ); - } - if (currentRow == totalRow && !isRight) { - _border = Border( - right: const BorderSide( - width: 1.0, color: Color(WidgetDemoColor.borderColor)), - ); - } - return _border; - } - - @override - Widget build(BuildContext context) { - _widgetName = title.replaceFirst( - //首字母转为大写 - title.substring(0, 1), - title.substring(0, 1).toUpperCase()); - Icon widgetIcon; - if (WidgetName2Icon.icons[_widgetName] != null) { - widgetIcon = Icon(WidgetName2Icon.icons[_widgetName]); - } else { - widgetIcon = Icon( - Icons.crop, - ); - } - final textStyle = (textSize == 'middle') - ? TextStyle(fontSize: 13.8, fontFamily: 'MediumItalic') - : TextStyle(fontSize: 16.0); - return InkWell( - onTap: onTap, - child: Container( - decoration: new BoxDecoration( - border: _buildBorder(context), - ), - padding: const EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0), - height: 150.0, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - widgetIcon, - SizedBox( - height: 8.0, - ), - Text(_widgetName, style: textStyle), - ], - ), - ), - ); - } -} diff --git a/lib/components/widget_item_container.dart b/lib/components/widget_item_container.dart deleted file mode 100644 index a1461857..00000000 --- a/lib/components/widget_item_container.dart +++ /dev/null @@ -1,83 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fluro/fluro.dart'; -import './widget_item.dart'; -import '../routers/application.dart'; -import '../widgets/index.dart'; - -class WidgetItemContainer extends StatelessWidget { - final int columnCount; //一行几个 - final List categories; - final bool isWidgetPoint; - - // 所有的可用demos; - final List widgetDemosList = new WidgetDemoList().getDemos(); - - WidgetItemContainer( - {Key key, - @required this.categories, - @required this.columnCount, - @required this.isWidgetPoint}) - : super(key: key); - - List _buildColumns(context) { - List _listWidget = []; - List _listRows = []; - int addI; - for (int i = 0, length = categories.length; i < length; i += columnCount) { - _listRows = []; - for (int innerI = 0; innerI < columnCount; innerI++) { - addI = innerI + i; - if (addI < length) { - dynamic item = categories[addI]; - _listRows.add( - Expanded( - flex: 1, - child: WidgetItem( - title: item.name, - onTap: () { - if (isWidgetPoint) { - String targetName = item.name; - String targetRouter = '/category/error/404'; - widgetDemosList.forEach((item) { - if (item.name == targetName) { - targetRouter = item.routerName; - } - }); - Application.router.navigateTo(context, "$targetRouter", transition: TransitionType.inFromRight); - } else { - Application.router - .navigateTo(context, "/category/${item.name}", transition: TransitionType.inFromRight); - } - }, - index: addI, - totalCount: length, - rowLength: columnCount, - textSize: isWidgetPoint ? 'middle' : 'small', - ), - ), - ); - } else { - _listRows.add( - Expanded( - flex: 1, - child: Container(), - ), - ); - } - } - _listWidget.add( - Row( - children: _listRows, - ), - ); - } - return _listWidget; - } - - @override - Widget build(BuildContext context) { - return Column( - children: _buildColumns(context), - ); - } -} diff --git a/lib/event/event_bus.dart b/lib/event/event_bus.dart deleted file mode 100644 index ce2123df..00000000 --- a/lib/event/event_bus.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:event_bus/event_bus.dart'; - -class ApplicationEvent{ - static EventBus event; -} \ No newline at end of file diff --git a/lib/event/event_model.dart b/lib/event/event_model.dart deleted file mode 100644 index f72f0cb6..00000000 --- a/lib/event/event_model.dart +++ /dev/null @@ -1,7 +0,0 @@ -class CollectionEvent{ - final String widgetName; - final String router; - final bool isRemove; - // token uid... - CollectionEvent(this.widgetName,this.router,this.isRemove); -} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart deleted file mode 100644 index fdcee399..00000000 --- a/lib/main.dart +++ /dev/null @@ -1,105 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fluro/fluro.dart'; -import 'package:flutter/rendering.dart'; -import 'routers/routers.dart'; -import 'routers/application.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:flutter_go/utils/provider.dart'; -import 'package:flutter_go/utils/shared_preferences.dart'; -import 'package:flutter_go/views/home.dart'; -import 'package:flutter_go/model/search_history.dart'; -import 'package:flutter_go/utils/analytics.dart' as Analytics; -import 'package:flutter_go/views/login_page/login_page.dart'; -import 'package:flutter_go/utils/data_utils.dart'; - -//import 'views/welcome_page/index.dart'; - -const int ThemeColor = 0xFFC91B3A; -SpUtil sp; -var db; - -class MyApp extends StatefulWidget { - MyApp() { - final router = new Router(); - - Routes.configureRoutes(router); - - Application.router = router; - } - - @override - _MyAppState createState() => _MyAppState(); -} - -class _MyAppState extends State { - bool _hasLogin = false; - bool _isLoading = true; - - @override - void initState() { - super.initState(); - DataUtils.checkLogin().then((hasLogin) { - setState(() { - _hasLogin = hasLogin; - _isLoading = false; - }); - }).catchError((onError){ - setState(() { - _hasLogin = true; - _isLoading = false; - }); - print('身份信息验证失败:$onError'); - }); - } - - showWelcomePage() { - if (_isLoading) { - return Container( - color: const Color(ThemeColor), - child: Center( - child: SpinKitPouringHourglass(color: Colors.white), - ), - ); - } else { - // 判断是否已经登录 - if (_hasLogin) { - return AppPage(); - } else { - return LoginPage(); - } - } - } - - @override - Widget build(BuildContext context) { - return new MaterialApp( - title: 'title', - theme: new ThemeData( - primaryColor: Color(ThemeColor), - backgroundColor: Color(0xFFEFEFEF), - accentColor: Color(0xFF888888), - textTheme: TextTheme( - //设置Material的默认字体样式 - body1: TextStyle(color: Color(0xFF888888), fontSize: 16.0), - ), - iconTheme: IconThemeData( - color: Color(ThemeColor), - size: 35.0, - ), - ), - home: new Scaffold(body: showWelcomePage()), - debugShowCheckedModeBanner: false, - onGenerateRoute: Application.router.generator, - navigatorObservers: [Analytics.observer], - ); - } -} - -void main() async { - final provider = new Provider(); - await provider.init(true); - sp = await SpUtil.getInstance(); - new SearchHistoryList(sp); - db = Provider.db; - runApp(new MyApp()); -} diff --git a/lib/model/base.dart b/lib/model/base.dart deleted file mode 100644 index 43cb7a55..00000000 --- a/lib/model/base.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:sqflite/sqflite.dart'; - -class BaseModel{ - Database db; - final String table = ''; - var query; - BaseModel(this.db){ - query = db.query; - } -} \ No newline at end of file diff --git a/lib/model/cat.dart b/lib/model/cat.dart deleted file mode 100644 index e9ecae7b..00000000 --- a/lib/model/cat.dart +++ /dev/null @@ -1,107 +0,0 @@ - -import 'dart:async'; - -import 'package:flutter_go/utils/sql.dart'; - -abstract class CatInterface{ - int get id; - //类目名称 - String get name; - //描述 - String get desc; - //第几级类目,默认 1 - int get depth; - //父类目id,没有为 0 - int get parentId; -} - -class Cat implements CatInterface { - int id; - String name; - String desc; - int depth; - int parentId; - - Cat({this.id, this.name, this.desc, this.depth, this.parentId}); - - Cat.fromJSON(Map json) - : id = json['id'], - name = json['name'], - desc = json['desc'], - depth = json['depth'], - parentId = json['parentId']; - - String toString() { - return '(Cat $name)'; - } - - Map toMap() { - return { - 'id': id, - 'name': name, - 'desc': desc, - 'depth': depth, - 'parentId': parentId - }; - } - Map toSqlCondition() { - Map _map = this.toMap(); - Map condition = {}; - _map.forEach((k, value) { - - if (value != null) { - - condition[k] = value; - } - }); - - if (condition.isEmpty) { - return {}; - } - - return condition; - } -} - - -class CatControlModel{ - final String table = 'cat'; - Sql sql; - CatControlModel() { - sql = Sql.setTable(table); - } - - /// 获取一级类目 - Future mainList() async{ - List listJson = await sql.getByCondition(conditions: {'parentId': 0}); - List cats = listJson.map((json) { - return new Cat.fromJSON(json); - }).toList(); - return cats; - } - - // 获取Cat不同深度与parent的列表 - Future> getList([Cat cat]) async{ - - - if (cat == null) { - cat = new Cat(depth: 1, parentId: 0); - } - // print("cat in getList ${cat.toMap()}"); - List listJson = await sql.getByCondition(conditions: cat.toSqlCondition()); - List cats = listJson.map((json) { - return new Cat.fromJSON(json); - }).toList(); - return cats; - } - - // 通过name获取Cat对象信息 - Future getCatByName(String name) async { - List json = await sql.getByCondition(conditions: {'name': name}); - if (json.isEmpty) { - return null; - } - return new Cat.fromJSON(json.first); - } - -} diff --git a/lib/model/collection.dart b/lib/model/collection.dart deleted file mode 100644 index 388fb3d8..00000000 --- a/lib/model/collection.dart +++ /dev/null @@ -1,68 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-07 16:24:42 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-08 17:37:42 - -import 'dart:async'; - -import 'package:flutter_go/utils/sql.dart'; - -abstract class CollectionInterface { - String get name; - String get router; -} - -class Collection implements CollectionInterface { - String name; - String router; - - Collection({this.name, this.router}); - - factory Collection.fromJSON(Map json){ - return Collection(name: json['name'],router: json['router']); - } - - Object toMap() { - return {'name': name, 'router': router}; - } -} - -class CollectionControlModel { - final String table = 'collection'; - Sql sql; - - CollectionControlModel() { - sql = Sql.setTable(table); - } - - // 获取所有的收藏 - - // 插入新收藏 - Future insert(Collection collection) { - var result = - sql.insert({'name': collection.name, 'router': collection.router}); - return result; - } - - // 获取全部的收藏 - Future> getAllCollection() async { - List list = await sql.getByCondition(); - List resultList = []; - list.forEach((item){ - print(item); - resultList.add(Collection.fromJSON(item)); - }); - return resultList; - } - - // 通过收藏名获取router - Future getRouterByName(String name) async { - List list = await sql.getByCondition(conditions: {'name': name}); - return list; - } - - // 删除 - Future deleteByName(String name) async{ - return await sql.delete(name,'name'); - } -} diff --git a/lib/model/search_history.dart b/lib/model/search_history.dart deleted file mode 100644 index da2e4cdd..00000000 --- a/lib/model/search_history.dart +++ /dev/null @@ -1,101 +0,0 @@ -/// -/// Created with Android Studio. -/// User: 三帆 -/// Date: 18/02/2019 -/// Time: 14:19 -/// email: sanfan.hx@alibaba-inc.com -/// target: 搜索WidgetDemo中的历史记录model -/// - -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:flutter_go/utils/shared_preferences.dart'; - - -class SearchHistory { - final String name; - final String targetRouter; - - SearchHistory({@required this.name, @required this.targetRouter}); -} - -class SearchHistoryList { - static SpUtil _sp; - static SearchHistoryList _instance; - static List _searchHistoryList = []; - - static SearchHistoryList _getInstance(SpUtil sp) { - if (_instance == null) { - _sp = sp; - String json = sp.get(SharedPreferencesKeys.searchHistory); - _instance = new SearchHistoryList.fromJSON(json); - } - return _instance; - } - - factory SearchHistoryList([SpUtil sp]) { - if (sp == null && _instance == null) { - print(new ArgumentError( - ['SearchHistoryList need instantiatied SpUtil at first timte '])); - } - return _getInstance(sp); - } - -// List _searchHistoryList = []; - - // 存放的最大数量 - int _count = 10; - - SearchHistoryList.fromJSON(String jsonData) { - _searchHistoryList = []; - if (jsonData == null) { - return; - } - List jsonList = json.decode(jsonData); - jsonList.forEach((value) { - _searchHistoryList.add(SearchHistory( - name: value['name'], targetRouter: value['targetRouter'])); - }); - } - - List getList() { - return _searchHistoryList; - } - - clear() { - _sp.remove(SharedPreferencesKeys.searchHistory); - _searchHistoryList = []; - } - - save() { - _sp.putString(SharedPreferencesKeys.searchHistory, this.toJson()); - } - - add(SearchHistory item) { - print("_searchHistoryList> ${_searchHistoryList.length}"); - for (SearchHistory value in _searchHistoryList) { - if (value.name == item.name) { - return; - } - } - if (_searchHistoryList.length > _count) { - _searchHistoryList.removeAt(0); - } - _searchHistoryList.add(item); - save(); - } - - toJson() { - List> jsonList = []; - _searchHistoryList.forEach((SearchHistory value) { - jsonList.add({'name': value.name, 'targetRouter': value.targetRouter}); - }); - return json.encode(jsonList); - } - - @override - String toString() { - return this.toJson(); - } -} diff --git a/lib/model/story.dart b/lib/model/story.dart deleted file mode 100644 index c8bfbab2..00000000 --- a/lib/model/story.dart +++ /dev/null @@ -1,23 +0,0 @@ -class StoryModel { - final String title; - final String image; - final int id; - final String url; - - StoryModel(this.id, this.title, {this.image,this.url}); - - StoryModel.fromJson(Map json) - : this(json['id'], json['title'], - image: json['image'] != null ? json['image'] : (json['images'] != null ? json['images'][0] : null), - url: json['url'] != null ? json['url'] : (json['url'] != null ? json['url'][0] : null), - ); - - Map toJson() { - return { - 'id': id, - 'title': title, - 'image': image, - 'url':url - }; - } -} \ No newline at end of file diff --git a/lib/model/user_info.dart b/lib/model/user_info.dart deleted file mode 100644 index b47b08a3..00000000 --- a/lib/model/user_info.dart +++ /dev/null @@ -1,24 +0,0 @@ -class UserInfo { - String username; - int id; - String avatarPic; - String themeColor; - String urlName; - - UserInfo({ - this.avatarPic, - this.id, - this.themeColor, - this.urlName, - this.username, - }); - - factory UserInfo.fromJson(Map json) { - return UserInfo( - avatarPic: json['avatar_pic'], - id: int.parse(json['id']), - username: json['name'], - themeColor: json['theme_color'], - urlName: json['url_name']); - } -} diff --git a/lib/model/user_info_cache.dart b/lib/model/user_info_cache.dart deleted file mode 100644 index e2045f92..00000000 --- a/lib/model/user_info_cache.dart +++ /dev/null @@ -1,62 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-07 16:24:42 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-08 17:37:42 - -import 'dart:async'; - -import 'package:flutter_go/utils/sql.dart'; - -abstract class UserInfoInterface { - String get username; - String get password; -} - -class UserInfo implements UserInfoInterface { - String username; - String password; - - UserInfo({this.username, this.password}); - - factory UserInfo.fromJSON(Map json){ - return UserInfo(username: json['username'],password: json['password']); - } - - Object toMap() { - return {'username': username, 'password': password}; - } -} - -class UserInfoControlModel { - final String table = 'userInfo'; - Sql sql; - - UserInfoControlModel() { - sql = Sql.setTable(table); - } - - // 获取所有的收藏 - - // 插入新的缓存 - Future insert(UserInfo userInfo) { - var result = - sql.insert({'username': userInfo.username, 'password': userInfo.password}); - return result; - } - - // 获取用户信息 - Future> getAllInfo() async { - List list = await sql.getByCondition(); - List resultList = []; - list.forEach((item){ - print(item); - resultList.add(UserInfo.fromJSON(item)); - }); - return resultList; - } - - // 清空表中数据 - Future deleteAll() async{ - return await sql.deleteAll(); - } -} diff --git a/lib/model/widget.dart b/lib/model/widget.dart deleted file mode 100644 index bcc6ae7f..00000000 --- a/lib/model/widget.dart +++ /dev/null @@ -1,144 +0,0 @@ - -import 'dart:async'; - -import "package:flutter/material.dart"; - -import 'package:flutter_go/utils/sql.dart'; - -abstract class WidgetInterface { - int get id; - - //组件英文名 - String get name; - - //组件中文名 - String get cnName; - - //组件截图 - String get image; - - //组件markdown 文档 - String get doc; - - //类目 id - int get catId; -} - -class WidgetPoint implements WidgetInterface { - int id; - - //组件英文名 - String name; - - //组件中文名 - String cnName; - - //组件截图 - String image; - - // 路由地址 - String routerName; - - //组件markdown 文档 - String doc; - - //组件 demo ,多个以 , 分割 - String demo; - - //类目 id - int catId; - final WidgetBuilder buildRouter; - - WidgetPoint( - {this.id, - this.name, - this.cnName, - this.image, - this.doc, - this.catId, - this.routerName, - this.buildRouter}); - - WidgetPoint.fromJSON(Map json) - : id = json['id'], - name = json['name'], - image = json['image'], - cnName = json['cnName'], - routerName = json['routerName'], - doc = json['doc'], - catId = json['catId'], - buildRouter = json['buildRouter']; - - String toString() { - return '(WidgetPoint $name)'; - } - - Object toMap() { - return { - 'id': id, - 'name': name, - 'cnName': cnName, - 'image': image, - 'doc': doc, - 'catId': catId - }; - } - - Map toSqlCondition() { - Map _map = this.toMap(); - Map condition = {}; - _map.forEach((k, value) { - if (value != null) { - condition[k] = value; - } - }); - - if (condition.isEmpty) { - return {}; - } - - return condition; - } -} - -class WidgetControlModel { - final String table = 'widget'; - Sql sql; - - WidgetControlModel() { - sql = Sql.setTable(table); - } - - // 获取Widget不同条件的列表 - Future> getList(WidgetPoint widgetPoint) async { - List listJson = - await sql.getByCondition(conditions: widgetPoint.toSqlCondition()); - List widgets = listJson.map((json) { - return new WidgetPoint.fromJSON(json); - }).toList(); - // print("widgets $widgets"); - return widgets; - } - - // 通过name获取Cat对象信息 - Future getCatByName(String name) async { - List json = await sql.getByCondition(conditions: {'name': name}); - if (json.isEmpty) { - return null; - } - return new WidgetPoint.fromJSON(json.first); - } - Future> search(String name) async { - List json = await sql.search(conditions: {'name': name}); - - if (json.isEmpty) { - return []; - } - - List widgets = json.map((json) { - return new WidgetPoint.fromJSON(json); - }).toList(); - - return widgets; - } -} diff --git a/lib/resources/icon_names.dart b/lib/resources/icon_names.dart deleted file mode 100644 index e7562778..00000000 --- a/lib/resources/icon_names.dart +++ /dev/null @@ -1,17 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/23 -/// Time: 上午2:14 -/// email: zhu.yan@alibaba-inc.com -/// target: IconNames 的示例 - -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; - -class IconNames { - static List names = [Icons.ac_unit,Icons.access_alarm,Icons.access_alarms,Icons.access_time,Icons.accessibility,Icons.accessibility_new,Icons.accessible,Icons.accessible_forward,Icons.account_balance,Icons.account_balance_wallet,Icons.account_box,Icons.account_circle,Icons.adb,Icons.add,Icons.add_a_photo,Icons.add_alarm,Icons.add_alert,Icons.add_box,Icons.add_call,Icons.add_circle,Icons.add_circle_outline,Icons.add_comment,Icons.add_location,Icons.add_photo_alternate,Icons.add_shopping_cart,Icons.add_to_home_screen,Icons.add_to_photos,Icons.add_to_queue,Icons.adjust,Icons.airline_seat_flat,Icons.airline_seat_flat_angled,Icons.airline_seat_individual_suite,Icons.airline_seat_legroom_extra,Icons.airline_seat_legroom_normal,Icons.airline_seat_legroom_reduced,Icons.airline_seat_recline_extra,Icons.airline_seat_recline_normal,Icons.airplanemode_active,Icons.airplanemode_inactive,Icons.airplay,Icons.airport_shuttle,Icons.alarm,Icons.alarm_add,Icons.alarm_off,Icons.alarm_on,Icons.album,Icons.all_inclusive,Icons.all_out,Icons.alternate_email,Icons.android,Icons.announcement,Icons.apps,Icons.archive,Icons.arrow_back,Icons.arrow_back_ios,Icons.arrow_downward,Icons.arrow_drop_down,Icons.arrow_drop_down_circle,Icons.arrow_drop_up,Icons.arrow_forward,Icons.arrow_forward_ios,Icons.arrow_left,Icons.arrow_right,Icons.arrow_upward,Icons.art_track,Icons.aspect_ratio,Icons.assessment,Icons.assignment,Icons.assignment_ind,Icons.assignment_late,Icons.assignment_return,Icons.assignment_returned,Icons.assignment_turned_in,Icons.assistant,Icons.assistant_photo,Icons.atm,Icons.attach_file,Icons.attach_money,Icons.attachment,Icons.audiotrack,Icons.autorenew,Icons.av_timer,Icons.backspace,Icons.backup,Icons.battery_alert,Icons.battery_charging_full,Icons.battery_full,Icons.battery_std,Icons.battery_unknown,Icons.beach_access,Icons.beenhere,Icons.block,Icons.bluetooth,Icons.bluetooth_audio,Icons.bluetooth_connected,Icons.bluetooth_disabled,Icons.bluetooth_searching,Icons.blur_circular,Icons.blur_linear,Icons.blur_off,Icons.blur_on,Icons.book,Icons.bookmark,Icons.bookmark_border,Icons.border_all,Icons.border_bottom,Icons.border_clear,Icons.border_color,Icons.border_horizontal,Icons.border_inner,Icons.border_left,Icons.border_outer,Icons.border_right,Icons.border_style,Icons.border_top,Icons.border_vertical,Icons.branding_watermark,Icons.brightness_1,Icons.brightness_2,Icons.brightness_3,Icons.brightness_4,Icons.brightness_5,Icons.brightness_6,Icons.brightness_7,Icons.brightness_auto,Icons.brightness_high,Icons.brightness_low,Icons.brightness_medium,Icons.broken_image,Icons.brush,Icons.bubble_chart,Icons.bug_report,Icons.build,Icons.burst_mode,Icons.business,Icons.business_center,Icons.cached,Icons.cake,Icons.calendar_today,Icons.calendar_view_day,Icons.call,Icons.call_end,Icons.call_made,Icons.call_merge,Icons.call_missed,Icons.call_missed_outgoing,Icons.call_received,Icons.call_split,Icons.call_to_action,Icons.camera,Icons.camera_alt,Icons.camera_enhance,Icons.camera_front,Icons.camera_rear,Icons.camera_roll,Icons.cancel,Icons.card_giftcard,Icons.card_membership,Icons.card_travel,Icons.casino,Icons.cast,Icons.cast_connected,Icons.category,Icons.center_focus_strong,Icons.center_focus_weak,Icons.change_history,Icons.chat,Icons.chat_bubble,Icons.chat_bubble_outline,Icons.check,Icons.check_box,Icons.check_box_outline_blank,Icons.check_circle,Icons.check_circle_outline,Icons.chevron_left,Icons.chevron_right,Icons.child_care,Icons.child_friendly,Icons.chrome_reader_mode,Icons.class_,Icons.clear,Icons.clear_all,Icons.close,Icons.closed_caption,Icons.cloud,Icons.cloud_circle,Icons.cloud_done,Icons.cloud_download,Icons.cloud_off,Icons.cloud_queue,Icons.cloud_upload,Icons.code,Icons.collections,Icons.collections_bookmark,Icons.color_lens,Icons.colorize,Icons.comment,Icons.compare,Icons.compare_arrows,Icons.computer,Icons.confirmation_number,Icons.contact_mail,Icons.contact_phone,Icons.contacts,Icons.content_copy,Icons.content_cut,Icons.content_paste,Icons.control_point,Icons.control_point_duplicate,Icons.copyright,Icons.create,Icons.create_new_folder,Icons.credit_card,Icons.crop,Icons.crop_3_2,Icons.crop_5_4,Icons.crop_7_5,Icons.crop_16_9,Icons.crop_din,Icons.crop_free,Icons.crop_landscape,Icons.crop_original,Icons.crop_portrait,Icons.crop_rotate,Icons.crop_square,Icons.dashboard,Icons.data_usage,Icons.date_range,Icons.dehaze,Icons.delete,Icons.delete_forever,Icons.delete_outline,Icons.delete_sweep,Icons.departure_board,Icons.description,Icons.desktop_mac,Icons.desktop_windows,Icons.details,Icons.developer_board,Icons.developer_mode,Icons.device_hub,Icons.device_unknown,Icons.devices,Icons.devices_other,Icons.dialer_sip,Icons.dialpad,Icons.directions,Icons.directions_bike,Icons.directions_boat,Icons.directions_bus,Icons.directions_car,Icons.directions_railway,Icons.directions_run,Icons.directions_subway,Icons.directions_transit,Icons.directions_walk,Icons.disc_full,Icons.dns,Icons.do_not_disturb,Icons.do_not_disturb_alt,Icons.do_not_disturb_off,Icons.do_not_disturb_on,Icons.dock,Icons.domain,Icons.done,Icons.done_all,Icons.done_outline,Icons.donut_large,Icons.donut_small,Icons.drafts,Icons.drag_handle,Icons.drive_eta,Icons.dvr,Icons.edit,Icons.edit_attributes,Icons.edit_location,Icons.eject,Icons.email,Icons.enhanced_encryption,Icons.equalizer,Icons.error,Icons.error_outline,Icons.euro_symbol,Icons.ev_station,Icons.event,Icons.event_available,Icons.event_busy,Icons.event_note,Icons.event_seat,Icons.exit_to_app,Icons.expand_less,Icons.expand_more,Icons.explicit,Icons.explore,Icons.exposure,Icons.exposure_neg_1,Icons.exposure_neg_2,Icons.exposure_plus_1,Icons.exposure_plus_2,Icons.exposure_zero,Icons.extension,Icons.face,Icons.fast_forward,Icons.fast_rewind,Icons.fastfood,Icons.favorite,Icons.favorite_border,Icons.featured_play_list,Icons.featured_video,Icons.feedback,Icons.fiber_dvr,Icons.fiber_manual_record,Icons.fiber_new,Icons.fiber_pin,Icons.fiber_smart_record,Icons.file_download,Icons.file_upload,Icons.filter,Icons.filter_1,Icons.filter_2,Icons.filter_3,Icons.filter_4,Icons.filter_5,Icons.filter_6,Icons.filter_7,Icons.filter_8,Icons.filter_9,Icons.filter_9_plus,Icons.filter_b_and_w,Icons.filter_center_focus,Icons.filter_drama,Icons.filter_frames,Icons.filter_hdr,Icons.filter_list,Icons.filter_none,Icons.filter_tilt_shift,Icons.filter_vintage,Icons.find_in_page,Icons.find_replace,Icons.fingerprint,Icons.first_page,Icons.fitness_center,Icons.flag,Icons.flare,Icons.flash_auto,Icons.flash_off,Icons.flash_on,Icons.flight,Icons.flight_land,Icons.flight_takeoff,Icons.flip,Icons.flip_to_back,Icons.flip_to_front,Icons.folder,Icons.folder_open,Icons.folder_shared,Icons.folder_special,Icons.font_download,Icons.format_align_center,Icons.format_align_justify,Icons.format_align_left,Icons.format_align_right,Icons.format_bold,Icons.format_clear,Icons.format_color_fill,Icons.format_color_reset,Icons.format_color_text,Icons.format_indent_decrease,Icons.format_indent_increase,Icons.format_italic,Icons.format_line_spacing,Icons.format_list_bulleted,Icons.format_list_numbered,Icons.format_list_numbered_rtl,Icons.format_paint,Icons.format_quote,Icons.format_shapes,Icons.format_size,Icons.format_strikethrough,Icons.format_textdirection_l_to_r,Icons.format_textdirection_r_to_l,Icons.format_underlined,Icons.forum,Icons.forward,Icons.forward_5,Icons.forward_10,Icons.forward_30,Icons.four_k,Icons.free_breakfast,Icons.fullscreen,Icons.fullscreen_exit,Icons.functions,Icons.g_translate,Icons.gamepad,Icons.games,Icons.gavel,Icons.gesture,Icons.get_app,Icons.gif,Icons.golf_course,Icons.gps_fixed,Icons.gps_not_fixed,Icons.gps_off,Icons.grade,Icons.gradient,Icons.grain,Icons.graphic_eq,Icons.grid_off,Icons.grid_on,Icons.group,Icons.group_add,Icons.group_work,Icons.hd,Icons.hdr_off,Icons.hdr_on,Icons.hdr_strong,Icons.hdr_weak,Icons.headset,Icons.headset_mic,Icons.headset_off,Icons.healing,Icons.hearing,Icons.help,Icons.help_outline,Icons.high_quality,Icons.highlight,Icons.highlight_off,Icons.history,Icons.home,Icons.hot_tub,Icons.hotel,Icons.hourglass_empty,Icons.hourglass_full,Icons.http,Icons.https,Icons.image,Icons.image_aspect_ratio,Icons.import_contacts,Icons.import_export,Icons.important_devices,Icons.inbox,Icons.indeterminate_check_box,Icons.info,Icons.info_outline,Icons.input,Icons.insert_chart,Icons.insert_comment,Icons.insert_drive_file,Icons.insert_emoticon,Icons.insert_invitation,Icons.insert_link,Icons.insert_photo,Icons.invert_colors,Icons.invert_colors_off,Icons.iso,Icons.keyboard,Icons.keyboard_arrow_down,Icons.keyboard_arrow_left,Icons.keyboard_arrow_right,Icons.keyboard_arrow_up,Icons.keyboard_backspace,Icons.keyboard_capslock,Icons.keyboard_hide,Icons.keyboard_return,Icons.keyboard_tab,Icons.keyboard_voice,Icons.kitchen,Icons.label,Icons.label_important,Icons.label_outline,Icons.landscape,Icons.language,Icons.laptop,Icons.laptop_chromebook,Icons.laptop_mac,Icons.laptop_windows,Icons.last_page,Icons.launch,Icons.layers,Icons.layers_clear,Icons.leak_add,Icons.leak_remove,Icons.lens,Icons.library_add,Icons.library_books,Icons.library_music,Icons.lightbulb_outline,Icons.line_style,Icons.line_weight,Icons.linear_scale,Icons.link,Icons.link_off,Icons.linked_camera,Icons.list,Icons.live_help,Icons.live_tv,Icons.local_activity,Icons.local_airport,Icons.local_atm,Icons.local_bar,Icons.local_cafe,Icons.local_car_wash,Icons.local_convenience_store,Icons.local_dining,Icons.local_drink,Icons.local_florist,Icons.local_gas_station,Icons.local_grocery_store,Icons.local_hospital,Icons.local_hotel,Icons.local_laundry_service,Icons.local_library,Icons.local_mall,Icons.local_movies,Icons.local_offer,Icons.local_parking,Icons.local_pharmacy,Icons.local_phone,Icons.local_pizza,Icons.local_play,Icons.local_post_office,Icons.local_printshop,Icons.local_see,Icons.local_shipping,Icons.local_taxi,Icons.location_city,Icons.location_disabled,Icons.location_off,Icons.location_on,Icons.location_searching,Icons.lock,Icons.lock_open,Icons.lock_outline,Icons.looks,Icons.looks_3,Icons.looks_4,Icons.looks_5,Icons.looks_6,Icons.looks_one,Icons.looks_two,Icons.loop,Icons.loupe,Icons.low_priority,Icons.loyalty,Icons.mail,Icons.mail_outline,Icons.map,Icons.markunread,Icons.markunread_mailbox,Icons.maximize,Icons.memory,Icons.menu,Icons.merge_type,Icons.message,Icons.mic,Icons.mic_none,Icons.mic_off,Icons.minimize,Icons.missed_video_call,Icons.mms,Icons.mobile_screen_share,Icons.mode_comment,Icons.mode_edit,Icons.monetization_on,Icons.money_off,Icons.monochrome_photos,Icons.mood,Icons.mood_bad,Icons.more,Icons.more_horiz,Icons.more_vert,Icons.motorcycle,Icons.mouse,Icons.move_to_inbox,Icons.movie,Icons.movie_creation,Icons.movie_filter,Icons.multiline_chart,Icons.music_note,Icons.music_video,Icons.my_location,Icons.nature,Icons.nature_people,Icons.navigate_before,Icons.navigate_next,Icons.navigation,Icons.near_me,Icons.network_cell,Icons.network_check,Icons.network_locked,Icons.network_wifi,Icons.new_releases,Icons.next_week,Icons.nfc,Icons.no_encryption,Icons.no_sim,Icons.not_interested,Icons.not_listed_location,Icons.note,Icons.note_add,Icons.notification_important,Icons.notifications,Icons.notifications_active,Icons.notifications_none,Icons.notifications_off,Icons.notifications_paused,Icons.offline_bolt,Icons.offline_pin,Icons.ondemand_video,Icons.opacity,Icons.open_in_browser,Icons.open_in_new,Icons.open_with,Icons.outlined_flag,Icons.pages,Icons.pageview,Icons.palette,Icons.pan_tool,Icons.panorama,Icons.panorama_fish_eye,Icons.panorama_horizontal,Icons.panorama_vertical,Icons.panorama_wide_angle,Icons.party_mode,Icons.pause,Icons.pause_circle_filled,Icons.pause_circle_outline,Icons.payment,Icons.people,Icons.people_outline,Icons.perm_camera_mic,Icons.perm_contact_calendar,Icons.perm_data_setting,Icons.perm_device_information,Icons.perm_identity,Icons.perm_media,Icons.perm_phone_msg,Icons.perm_scan_wifi,Icons.person,Icons.person_add,Icons.person_outline,Icons.person_pin,Icons.person_pin_circle,Icons.personal_video,Icons.pets,Icons.phone,Icons.phone_android,Icons.phone_bluetooth_speaker,Icons.phone_forwarded,Icons.phone_in_talk,Icons.phone_iphone,Icons.phone_locked,Icons.phone_missed,Icons.phone_paused,Icons.phonelink,Icons.phonelink_erase,Icons.phonelink_lock,Icons.phonelink_off,Icons.phonelink_ring,Icons.phonelink_setup,Icons.photo,Icons.photo_album,Icons.photo_camera,Icons.photo_filter,Icons.photo_library,Icons.photo_size_select_actual,Icons.photo_size_select_large,Icons.photo_size_select_small,Icons.picture_as_pdf,Icons.picture_in_picture,Icons.picture_in_picture_alt,Icons.pie_chart,Icons.pie_chart_outlined,Icons.pin_drop,Icons.place,Icons.play_arrow,Icons.play_circle_filled,Icons.play_circle_outline,Icons.play_for_work,Icons.playlist_add,Icons.playlist_add_check,Icons.playlist_play,Icons.plus_one,Icons.poll,Icons.polymer,Icons.pool,Icons.portable_wifi_off,Icons.portrait,Icons.power,Icons.power_input,Icons.power_settings_new,Icons.pregnant_woman,Icons.present_to_all,Icons.print,Icons.priority_high,Icons.public,Icons.publish,Icons.query_builder,Icons.question_answer,Icons.queue,Icons.queue_music,Icons.queue_play_next,Icons.radio,Icons.radio_button_checked,Icons.radio_button_unchecked,Icons.rate_review,Icons.receipt,Icons.recent_actors,Icons.record_voice_over,Icons.redeem,Icons.redo,Icons.refresh,Icons.remove,Icons.remove_circle,Icons.remove_circle_outline,Icons.remove_from_queue,Icons.remove_red_eye,Icons.remove_shopping_cart,Icons.reorder,Icons.repeat,Icons.repeat_one,Icons.replay,Icons.replay_5,Icons.replay_10,Icons.replay_30,Icons.reply,Icons.reply_all,Icons.report,Icons.report_off,Icons.report_problem,Icons.restaurant,Icons.restaurant_menu,Icons.restore,Icons.restore_from_trash,Icons.restore_page,Icons.ring_volume,Icons.room,Icons.room_service,Icons.rotate_90_degrees_ccw,Icons.rotate_left,Icons.rotate_right,Icons.rounded_corner,Icons.router,Icons.rowing,Icons.rss_feed,Icons.rv_hookup,Icons.satellite,Icons.save,Icons.save_alt,Icons.scanner,Icons.scatter_plot,Icons.schedule,Icons.school,Icons.score,Icons.screen_lock_landscape,Icons.screen_lock_portrait,Icons.screen_lock_rotation,Icons.screen_rotation,Icons.screen_share,Icons.sd_card,Icons.sd_storage,Icons.search,Icons.security,Icons.select_all,Icons.send,Icons.sentiment_dissatisfied,Icons.sentiment_neutral,Icons.sentiment_satisfied,Icons.sentiment_very_dissatisfied,Icons.sentiment_very_satisfied,Icons.settings,Icons.settings_applications,Icons.settings_backup_restore,Icons.settings_bluetooth,Icons.settings_brightness,Icons.settings_cell,Icons.settings_ethernet,Icons.settings_input_antenna,Icons.settings_input_component,Icons.settings_input_composite,Icons.settings_input_hdmi,Icons.settings_input_svideo,Icons.settings_overscan,Icons.settings_phone,Icons.settings_power,Icons.settings_remote,Icons.settings_system_daydream,Icons.settings_voice,Icons.share,Icons.shop,Icons.shop_two,Icons.shopping_basket,Icons.shopping_cart,Icons.short_text,Icons.show_chart,Icons.shuffle,Icons.shutter_speed,Icons.signal_cellular_4_bar,Icons.signal_cellular_connected_no_internet_4_bar,Icons.signal_cellular_no_sim,Icons.signal_cellular_null,Icons.signal_cellular_off,Icons.signal_wifi_4_bar,Icons.signal_wifi_4_bar_lock,Icons.signal_wifi_off,Icons.sim_card,Icons.sim_card_alert,Icons.skip_next,Icons.skip_previous,Icons.slideshow,Icons.slow_motion_video,Icons.smartphone,Icons.smoke_free,Icons.smoking_rooms,Icons.sms,Icons.sms_failed,Icons.snooze,Icons.sort,Icons.sort_by_alpha,Icons.spa,Icons.space_bar,Icons.speaker,Icons.speaker_group,Icons.speaker_notes,Icons.speaker_notes_off,Icons.speaker_phone,Icons.spellcheck,Icons.star,Icons.star_border,Icons.star_half,Icons.stars,Icons.stay_current_landscape,Icons.stay_current_portrait,Icons.stay_primary_landscape,Icons.stay_primary_portrait,Icons.stop,Icons.stop_screen_share,Icons.storage,Icons.store,Icons.store_mall_directory,Icons.straighten,Icons.streetview,Icons.strikethrough_s,Icons.style,Icons.subdirectory_arrow_left,Icons.subdirectory_arrow_right,Icons.subject,Icons.subscriptions,Icons.subtitles,Icons.subway,Icons.supervised_user_circle,Icons.supervisor_account,Icons.surround_sound,Icons.swap_calls,Icons.swap_horiz,Icons.swap_horizontal_circle,Icons.swap_vert,Icons.swap_vertical_circle,Icons.switch_camera,Icons.switch_video,Icons.sync,Icons.sync_disabled,Icons.sync_problem,Icons.system_update,Icons.system_update_alt,Icons.tab,Icons.tab_unselected,Icons.table_chart,Icons.tablet,Icons.tablet_android,Icons.tablet_mac,Icons.tag_faces,Icons.tap_and_play,Icons.terrain,Icons.text_fields,Icons.text_format,Icons.text_rotate_up,Icons.text_rotate_vertical,Icons.text_rotation_angledown,Icons.text_rotation_angleup,Icons.text_rotation_down,Icons.text_rotation_none,Icons.textsms,Icons.texture,Icons.theaters,Icons.threed_rotation,Icons.threesixty,Icons.thumb_down,Icons.thumb_up,Icons.thumbs_up_down,Icons.time_to_leave,Icons.timelapse,Icons.timeline,Icons.timer,Icons.timer_3,Icons.timer_10,Icons.timer_off,Icons.title,Icons.toc,Icons.today,Icons.toll,Icons.tonality,Icons.touch_app,Icons.toys,Icons.track_changes,Icons.traffic,Icons.train,Icons.tram,Icons.transfer_within_a_station,Icons.transform,Icons.transit_enterexit,Icons.translate,Icons.trending_down,Icons.trending_flat,Icons.trending_up,Icons.trip_origin,Icons.tune,Icons.turned_in,Icons.turned_in_not,Icons.tv,Icons.unarchive,Icons.undo,Icons.unfold_less,Icons.unfold_more,Icons.update,Icons.usb,Icons.verified_user,Icons.vertical_align_bottom,Icons.vertical_align_center,Icons.vertical_align_top,Icons.vibration,Icons.video_call,Icons.video_label,Icons.video_library,Icons.videocam,Icons.videocam_off,Icons.videogame_asset,Icons.view_agenda,Icons.view_array,Icons.view_carousel,Icons.view_column,Icons.view_comfy,Icons.view_compact,Icons.view_day,Icons.view_headline,Icons.view_list,Icons.view_module,Icons.view_quilt,Icons.view_stream,Icons.view_week,Icons.vignette,Icons.visibility,Icons.visibility_off,Icons.voice_chat,Icons.voicemail,Icons.volume_down,Icons.volume_mute,Icons.volume_off,Icons.volume_up,Icons.vpn_key,Icons.vpn_lock,Icons.wallpaper,Icons.warning,Icons.watch,Icons.watch_later,Icons.wb_auto,Icons.wb_cloudy,Icons.wb_incandescent,Icons.wb_iridescent,Icons.wb_sunny,Icons.wc,Icons.web,Icons.web_asset,Icons.weekend,Icons.whatshot,Icons.widgets,Icons.wifi,Icons.wifi_lock,Icons.wifi_tethering,Icons.work,Icons.wrap_text,Icons.youtube_searched_for,Icons.zoom_in,Icons.zoom_out,Icons.zoom_out_map]; -} - -class CupertinoIIconNames { - static List names = [CupertinoIcons.add,CupertinoIcons.add_circled,CupertinoIcons.add_circled_solid,CupertinoIcons.back,CupertinoIcons.battery_25_percent,CupertinoIcons.battery_75_percent,CupertinoIcons.battery_charging,CupertinoIcons.battery_empty,CupertinoIcons.battery_full,CupertinoIcons.bluetooth,CupertinoIcons.book,CupertinoIcons.book_solid,CupertinoIcons.bookmark,CupertinoIcons.bookmark_solid,CupertinoIcons.check_mark,CupertinoIcons.check_mark_circled,CupertinoIcons.check_mark_circled_solid,CupertinoIcons.clear,CupertinoIcons.clear_circled,CupertinoIcons.clear_circled_solid,CupertinoIcons.clear_thick,CupertinoIcons.clear_thick_circled,CupertinoIcons.clock,CupertinoIcons.clock_solid,CupertinoIcons.collections,CupertinoIcons.collections_solid,CupertinoIcons.conversation_bubble,CupertinoIcons.create,CupertinoIcons.create_solid,CupertinoIcons.delete,CupertinoIcons.delete_simple,CupertinoIcons.delete_solid,CupertinoIcons.down_arrow,CupertinoIcons.ellipsis,CupertinoIcons.eye,CupertinoIcons.eye_solid,CupertinoIcons.flag,CupertinoIcons.folder,CupertinoIcons.folder_open,CupertinoIcons.folder_solid,CupertinoIcons.forward,CupertinoIcons.fullscreen,CupertinoIcons.fullscreen_exit,CupertinoIcons.gear,CupertinoIcons.gear_big,CupertinoIcons.gear_solid,CupertinoIcons.group,CupertinoIcons.group_solid,CupertinoIcons.home,CupertinoIcons.info,CupertinoIcons.left_chevron,CupertinoIcons.location,CupertinoIcons.location_solid,CupertinoIcons.loop,CupertinoIcons.loop_thick,CupertinoIcons.mail,CupertinoIcons.mail_solid,CupertinoIcons.mic,CupertinoIcons.mic_off,CupertinoIcons.mic_solid,CupertinoIcons.minus_circled,CupertinoIcons.music_note,CupertinoIcons.padlock,CupertinoIcons.padlock_solid,CupertinoIcons.pause,CupertinoIcons.pause_solid,CupertinoIcons.pen,CupertinoIcons.pencil,CupertinoIcons.person,CupertinoIcons.person_add,CupertinoIcons.person_add_solid,CupertinoIcons.person_solid,CupertinoIcons.phone,CupertinoIcons.phone_solid,CupertinoIcons.photo_camera,CupertinoIcons.photo_camera_solid,CupertinoIcons.play_arrow,CupertinoIcons.play_arrow_solid,CupertinoIcons.plus_circled,CupertinoIcons.profile_circled,CupertinoIcons.refresh,CupertinoIcons.refresh_bold,CupertinoIcons.refresh_circled,CupertinoIcons.refresh_circled_solid,CupertinoIcons.refresh_thick,CupertinoIcons.refresh_thin,CupertinoIcons.reply,CupertinoIcons.reply_all,CupertinoIcons.reply_thick_solid,CupertinoIcons.restart,CupertinoIcons.right_chevron,CupertinoIcons.search,CupertinoIcons.settings,CupertinoIcons.settings_solid,CupertinoIcons.share,CupertinoIcons.share_solid,CupertinoIcons.share_up,CupertinoIcons.shopping_cart,CupertinoIcons.shuffle_thick,CupertinoIcons.switch_camera,CupertinoIcons.switch_camera_solid,CupertinoIcons.tag,CupertinoIcons.tag_solid,CupertinoIcons.tags,CupertinoIcons.tags_solid,CupertinoIcons.time,CupertinoIcons.time_solid,CupertinoIcons.up_arrow,CupertinoIcons.video_camera,CupertinoIcons.video_camera_solid,CupertinoIcons.volume_down,CupertinoIcons.volume_mute,CupertinoIcons.volume_off,CupertinoIcons.volume_up]; -} \ No newline at end of file diff --git a/lib/resources/shared_preferences_keys.dart b/lib/resources/shared_preferences_keys.dart deleted file mode 100644 index ad7398ae..00000000 --- a/lib/resources/shared_preferences_keys.dart +++ /dev/null @@ -1,38 +0,0 @@ - -// Created with Android Studio. -// User: 三帆 -// Date: 31/01/2019 -// Time: 18:13 -// email: sanfan.hx@alibaba-inc.com -// target: xxx -// - - -//enum DateType { -// Int, -// Double, -// Bool, -// String, -// Dynamic -//} - -//class spKey { -// String name; -// DateType type; -// -// spKey({this.name, this.type}); -//} - -class SharedPreferencesKeys { - /// boolean - /// 用于欢迎页面. 只有第一次访问才会显示. 或者手动将这个值设为false - static String showWelcome = 'loginWelcone'; - /// json - /// 用于存放搜索页的搜索数据. - /// [{ - /// name: 'name' - /// - /// }] - static String searchHistory = 'searchHistory'; -} - diff --git a/lib/resources/widget_name_to_icon.dart b/lib/resources/widget_name_to_icon.dart deleted file mode 100644 index 644d145d..00000000 --- a/lib/resources/widget_name_to_icon.dart +++ /dev/null @@ -1,171 +0,0 @@ -import 'package:flutter/material.dart'; -class WidgetName2Icon { - static Map icons = { - "Element":Icons.explicit, - "Components":Icons.extension, - "Themes":Icons.filter_b_and_w, - "Form":Icons.table_chart, - "Frame":Icons.aspect_ratio, - "Media":Icons.subscriptions, - "Input":Icons.input, - "TextField":Icons.text_fields, - "Checkbox":Icons.check_box, - "CheckboxListTile":Icons.playlist_add_check, - "Button":Icons.aspect_ratio, - "FlatButton":Icons.outlined_flag, - "RaisedButton":Icons.picture_in_picture_alt, - "IconButton":Icons.import_contacts, - "PopupMenuButton":Icons.power_input, - "FloatingActionButton":Icons.flash_off, - "RawMaterialButton":Icons.rowing, - "DropdownButton":Icons.drag_handle, - "OutlineButton":Icons.done_outline, - "Text":Icons.text_format, - "RichText":Icons.text_rotation_angleup, - "Radio":Icons.radio_button_checked, - "RadioListTile":Icons.list, - "Slider":Icons.slideshow, - "SliderTheme":Icons.theaters, - "SliderComponentShape":Icons.format_shapes, - "SliderThemeData":Icons.data_usage, - "Switch":Icons.switch_camera, - "SwitchListTile":Icons.switch_video, - "AnimatedSwitcher":Icons.airplanemode_active, - "Align":Icons.format_align_left, - "Stack":Icons.storage, - "IndexedStack":Icons.star, - "Layout":Icons.layers, - "Row":Icons.recent_actors, - "Column":Icons.cloud_off, - "Container":Icons.edit_location, - "Center":Icons.gesture, - "Box":Icons.hdr_strong, - "ConstrainedBox":Icons.account_box, - "OverflowBox":Icons.email, - "DecoratedBox":Icons.settings_overscan, - "FittedBox":Icons.data_usage, - "LimitedBox":Icons.format_align_justify, - "RenderBox":Icons.error, - "RotateBox":Icons.navigate_next, - "SizedOverflowBox":Icons.undo, - "TextBox":Icons.wallpaper, - "UnconstrainedBox":Icons.account_box, - "Axis":Icons.access_alarm, - "MainAxis":Icons.add_circle, - "CrossAxis":Icons.dehaze, - "FlipAxis":Icons.zoom_out, - "Expanded":Icons.all_out, - "Spacing":Icons.crop_free, - "Padding":Icons.crop, - "SliverPadding":Icons.euro_symbol, - "AnimatedPadding":Icons.zoom_out_map, - "Table":Icons.table_chart, - "Image":Icons.image, - "AssetImage":Icons.image_aspect_ratio, - "DecorationImage":Icons.picture_in_picture, - "DecorationImagePainter":Icons.image, - "ExactAssetImage":Icons.assessment, - "FadeInImage":Icons.flip, - "FileImage":Icons.filter, - "NetworkImage":Icons.network_wifi, - "RawImage":Icons.text_rotation_down, - "PaintImage":Icons.format_paint, - "PrecacheImage":Icons.perm_camera_mic, - "MemoryImage":Icons.memory, - "Icon":Icons.event_available, - "ImageIcon":Icons.image, - "IconTheme":Icons.table_chart, - "IconData":Icons.date_range, - "IconThemeData":Icons.insert_comment, - "Canvas":Icons.edit, - "PainterPath":Icons.gesture, - "CircleProgressBarPainter":Icons.av_timer, - "PainterSketch":Icons.touch_app, - "Material":Icons.android, - "MaterialApp":Icons.android, - "MaterialButton":Icons.speaker, - "MaterialGap":Icons.view_week, - "MaterialSlice":Icons.format_list_numbered_rtl , - "MaterialColor":Icons.color_lens, - "Cupertino":Icons.phone_iphone, - "Scroll":Icons.swap_vertical_circle, - "Tab":Icons.tab, - "Menu":Icons.menu, - "PopupMenuDivider":Icons.remove, - "PopupMenuEntry":Icons.menu, - "CheckedPopupMenuItem":Icons.playlist_add_check, - "DropdownMenuItem":Icons.playlist_play, - "Grid":Icons.grid_on, - "Scaffold":Icons.local_convenience_store, - "Dialog":Icons.add_alert, - "Bar":Icons.border_horizontal, - "Card":Icons.credit_card, - "Panel":Icons.video_label, - "Navigation":Icons.navigation, - "List":Icons.list, - "ScrollView":Icons.move_to_inbox, - "Scrollable":Icons.swap_vertical_circle, - "ScrollbarPainter":Icons.format_paint, - "ScrollMetrics":Icons.camera, - "ScrollPhysics":Icons.control_point_duplicate, - "BoxScrollView":Icons.inbox, - "Chip":Icons.sim_card, - "ChipTheme":Icons.sd_card, - "CustomScrollView":Icons.autorenew, - "NestedScrollView":Icons.panorama_fish_eye, - "ChipThemeData":Icons.sim_card_alert, - "ChoiceChip":Icons.insert_drive_file, - "FilterChip":Icons.note_add, - "InputChip":Icons.restore_page, - "RawChip":Icons.save, - "LinearProgressIndicator":Icons.trending_flat , - "CircularProgressIndicator":Icons.rotate_left , - "ExpansionPanel":Icons.view_stream, - "ExpansionPanelList":Icons.view_headline, - "BottomNavigationBar":Icons.call_to_action, - "ListView":Icons.view_list , - "ListBody":Icons.list , - "AnimatedList":Icons.format_line_spacing , - "SliverAppBar":Icons.content_paste, - "AppBar":Icons.card_membership, - "BottomAppBar":Icons.call_to_action, - "BottomNavigationBarItem":Icons.crop_original, - "FlexibleSpaceBar":Icons.aspect_ratio, - "ButtonBar":Icons.branding_watermark, - "SnackBar":Icons.sms_failed, - "Progress":Icons.sync, - "Pick":Icons.event_note, - "DayPicker":Icons.calendar_today, - "MonthPicker":Icons.date_range, - "YearPicker":Icons.event_busy, - "ShowdatePicker":Icons.event, - "MaterialPageRoute":Icons.album, - "MaterialAccentColor":Icons.brush, - "SnackBarAction":Icons.assessment, - "TabBar":Icons.burst_mode, - "AlertDialog":Icons.sms_failed, - "AboutDialog":Icons.sms, - "SimpleDialog":Icons.message, - "ScaffoldState":Icons.local_bar, - "GridTile":Icons.apps, - "MergeableMaterialItem":Icons.view_list, - "CupertinoApp":Icons.face, - "CupertinoButton":Icons.crop_7_5, - "CupertinoColors":Icons.color_lens, - "CupertinoIcons":Icons.insert_emoticon, - "CupertinoNavigationBar":Icons.payment, - "CupertinoPageRoute":Icons.router, - "CupertinoPageScaffold":Icons.pages, - "CupertinoPicker":Icons.add_alarm, - "CupertinoPopupSurface":Icons.center_focus_weak, - "CupertinoScrollbar": Icons.fullscreen, - "CupertinoSlider": Icons.switch_camera, - "CupertinoSegmentedControl": Icons.business_center, - "CupertinoSliverNavigationBar": Icons.subtitles, - "CupertinoSwitch": Icons.radio_button_checked, - "CupertinoTabBar": Icons.tab, - "CupertinoTabScaffold": Icons.crop_original, - "CupertinoTabView": Icons.tablet, - "CupertinoTimerPicker": Icons.timer - }; -} diff --git a/lib/routers/application.dart b/lib/routers/application.dart deleted file mode 100644 index 8a03d9c7..00000000 --- a/lib/routers/application.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fluro/fluro.dart'; - -import 'package:flutter_go/utils/shared_preferences.dart'; - -class Application { - static Router router; - static TabController controller; - static SpUtil sharePeferences; - - static Map github = { - '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/', - //'master':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/master/lib/widgets/' - }; - -} diff --git a/lib/routers/router_handler.dart b/lib/routers/router_handler.dart deleted file mode 100644 index 4491ebcb..00000000 --- a/lib/routers/router_handler.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fluro/fluro.dart'; - -import 'package:flutter_go/components/category.dart'; -import '../widgets/404.dart'; -import 'package:flutter_go/components/full_screen_code_dialog.dart'; -import 'package:flutter_go/views/web_page/web_view_page.dart'; -import 'package:flutter_go/views/home.dart'; -import 'package:flutter_go/views/login_page/login_page.dart'; - -// app的首页 -var homeHandler = new Handler( - handlerFunc: (BuildContext context, Map> params) { - return new AppPage(); - }, -); - -var categoryHandler = new Handler( - handlerFunc: (BuildContext context, Map> params) { - String name = params["type"]?.first; - - return new CategoryHome(name); - }, -); - -var widgetNotFoundHandler = new Handler( - handlerFunc: (BuildContext context, Map> params) { - return new WidgetNotFound(); -}); -var loginPageHandler = new Handler( - handlerFunc: (BuildContext context, Map> params) { - return LoginPage(); -}); - -var fullScreenCodeDialog = new Handler( - handlerFunc: (BuildContext context, Map> params) { - String path = params['filePath']?.first; - return new FullScreenCodeDialog( - filePath: path, - ); -}); - -var webViewPageHand = new Handler( - handlerFunc: (BuildContext context, Map> params) { - String title = params['title']?.first; - String url = params['url']?.first; - return new WebViewPage(url, title); -}); diff --git a/lib/routers/routers.dart b/lib/routers/routers.dart deleted file mode 100644 index b433d69c..00000000 --- a/lib/routers/routers.dart +++ /dev/null @@ -1,40 +0,0 @@ - -import 'package:fluro/fluro.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_go/utils/analytics.dart' show analytics; - -import '../widgets/index.dart'; -import './router_handler.dart'; - -class Routes { - static String root = "/"; - static String home = "/home"; - static String widgetDemo = '/widget-demo'; - static String codeView = '/code-view'; - static String webViewPage = '/web-view-page'; - static String loginPage = '/loginpage'; - - static void configureRoutes(Router router) { - List widgetDemosList = new WidgetDemoList().getDemos(); - router.notFoundHandler = new Handler( - handlerFunc: (BuildContext context, Map> params) { - }); - router.define(home, handler: homeHandler); - - router.define('/category/:type', handler: categoryHandler); - router.define('/category/error/404', handler: widgetNotFoundHandler); - router.define(loginPage, handler: loginPageHandler); - router.define(codeView,handler:fullScreenCodeDialog); - router.define(webViewPage,handler:webViewPageHand); - widgetDemosList.forEach((demo) { - Handler handler = new Handler( - handlerFunc: (BuildContext context, Map> params) { - print('组件路由params=$params widgetsItem=${demo.routerName}'); - analytics.logEvent( - name: 'component', parameters: {'name': demo.routerName }); - return demo.buildRouter(context); - }); - router.define('${demo.routerName}', handler: handler); - }); - } -} diff --git a/lib/utils/analytics.dart b/lib/utils/analytics.dart deleted file mode 100644 index 2a7fcf6f..00000000 --- a/lib/utils/analytics.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'package:firebase_analytics/firebase_analytics.dart'; -import 'package:firebase_analytics/observer.dart'; - -//统计 -FirebaseAnalytics analytics = FirebaseAnalytics(); -FirebaseAnalyticsObserver observer = - FirebaseAnalyticsObserver(analytics: analytics); diff --git a/lib/utils/data_utils.dart b/lib/utils/data_utils.dart deleted file mode 100644 index 97858111..00000000 --- a/lib/utils/data_utils.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'dart:async' show Future; - -import './net_utils.dart'; -import '../model/user_info.dart'; -import 'package:flutter_go/api/api.dart'; - - -class DataUtils{ - // 登陆获取用户信息 - static Future doLogin(Map params) async{ - var response = await NetUtils.post(Api.DO_LOGIN, params); - UserInfo userInfo = UserInfo.fromJson(response['data']); - return userInfo; - } - - // 验证登陆 - - static Future checkLogin() async{ - var response = await NetUtils.get(Api.CHECK_LOGIN); - print('验证登陆:$response'); - return response['success']; - } - - // 退出登陆 - static Future logout() async{ - var response = await NetUtils.get(Api.LOGOUT); - print('退出登陆 $response'); - return response['success']; - } -} \ No newline at end of file diff --git a/lib/utils/example_code_parser.dart b/lib/utils/example_code_parser.dart deleted file mode 100644 index 7b09b532..00000000 --- a/lib/utils/example_code_parser.dart +++ /dev/null @@ -1,40 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-14 11:42:36 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-14 16:53:11 - -import 'dart:async'; - -import 'package:flutter/services.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:flutter/material.dart'; - -import 'package:flutter_go/routers/application.dart'; - - -Map _exampleCode; -String _code; - -void _launchURL(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } -} - -Future getExampleCode(context,String filePath, AssetBundle bundle) async { - if (_exampleCode == null) await _parseExampleCode(context,filePath, bundle); - return _code; -} - -Future _parseExampleCode(context,String filePath, AssetBundle bundle) async { - String code; - try { - code = await bundle.loadString('lib/widgets/$filePath'); - } catch (err) { - Navigator.of(context).pop(); - _launchURL(Application.github['widgetsURL'] + filePath); - } - _code = code; -} diff --git a/lib/utils/high_light_code.dart b/lib/utils/high_light_code.dart deleted file mode 100644 index 1ac0fdcd..00000000 --- a/lib/utils/high_light_code.dart +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import 'package:string_scanner/string_scanner.dart'; - -/// final SyntaxHighlighterStyle style = SyntaxHighlighterStyle.lightThemeStyle(); -/// DartSyntaxHighlighter(style).format(source) - -class SyntaxHighlighterStyle { - SyntaxHighlighterStyle({ - this.baseStyle, - this.numberStyle, - this.commentStyle, - this.keywordStyle, - this.stringStyle, - this.punctuationStyle, - this.classStyle, - this.constantStyle - }); - - static SyntaxHighlighterStyle lightThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFF000000)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF9C27B0)), - stringStyle: const TextStyle(color: Color(0xFF43A047)), - punctuationStyle: const TextStyle(color: Color(0xFF000000)), - classStyle: const TextStyle(color: Color(0xFF512DA8)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - static SyntaxHighlighterStyle darkThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFFFFFFFF)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF80CBC4)), - stringStyle: const TextStyle(color: Color(0xFF009688)), - punctuationStyle: const TextStyle(color: Color(0xFFFFFFFF)), - classStyle: const TextStyle(color: Color(0xFF009688)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - final TextStyle baseStyle; - final TextStyle numberStyle; - final TextStyle commentStyle; - final TextStyle keywordStyle; - final TextStyle stringStyle; - final TextStyle punctuationStyle; - final TextStyle classStyle; - final TextStyle constantStyle; -} - -abstract class Highlighter { // ignore: one_member_abstracts - TextSpan format(String src); -} - -class DartSyntaxHighlighter extends Highlighter { - DartSyntaxHighlighter([this._style]) { - _spans = <_HighlightSpan>[]; - _style ??= SyntaxHighlighterStyle.darkThemeStyle(); - } - - SyntaxHighlighterStyle _style; - - static const List _keywords = [ - 'abstract', 'as', 'assert', 'async', 'await', 'break', 'case', 'catch', - 'class', 'const', 'continue', 'default', 'deferred', 'do', 'dynamic', 'else', - 'enum', 'export', 'external', 'extends', 'factory', 'false', 'final', - 'finally', 'for', 'get', 'if', 'implements', 'import', 'in', 'is', 'library', - 'new', 'null', 'operator', 'part', 'rethrow', 'return', 'set', 'static', - 'super', 'switch', 'sync', 'this', 'throw', 'true', 'try', 'typedef', 'var', - 'void', 'while', 'with', 'yield' - ]; - - static const List _builtInTypes = [ - 'int', 'double', 'num', 'bool' - ]; - - String _src; - StringScanner _scanner; - - List<_HighlightSpan> _spans; - - @override - TextSpan format(String src) { - _src = src; - _scanner = StringScanner(_src); - - if (_generateSpans()) { - // Successfully parsed the code - final List formattedText = []; - int currentPosition = 0; - - for (_HighlightSpan span in _spans) { - if (currentPosition != span.start) - formattedText.add(TextSpan(text: _src.substring(currentPosition, span.start))); - - formattedText.add(TextSpan(style: span.textStyle(_style), text: span.textForSpan(_src))); - - currentPosition = span.end; - } - - if (currentPosition != _src.length) - formattedText.add(TextSpan(text: _src.substring(currentPosition, _src.length))); - - return TextSpan(style: _style.baseStyle, children: formattedText); - } else { - // Parsing failed, return with only basic formatting - return TextSpan(style: _style.baseStyle, text: src); - } - } - - bool _generateSpans() { - int lastLoopPosition = _scanner.position; - - while (!_scanner.isDone) { - // Skip White space - _scanner.scan(RegExp(r'\s+')); - - // Block comments - if (_scanner.scan(RegExp(r'/\*(.|\n)*\*/'))) { - _spans.add(_HighlightSpan( - _HighlightType.comment, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Line comments - if (_scanner.scan('//')) { - final int startComment = _scanner.lastMatch.start; - - bool eof = false; - int endComment; - if (_scanner.scan(RegExp(r'.*\n'))) { - endComment = _scanner.lastMatch.end - 1; - } else { - eof = true; - endComment = _src.length; - } - - _spans.add(_HighlightSpan( - _HighlightType.comment, - startComment, - endComment - )); - - if (eof) - break; - - continue; - } - - // Raw r"String" - if (_scanner.scan(RegExp(r'r".*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Raw r'String' - if (_scanner.scan(RegExp(r"r'.*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline """String""" - if (_scanner.scan(RegExp(r'"""(?:[^"\\]|\\(.|\n))*"""'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline '''String''' - if (_scanner.scan(RegExp(r"'''(?:[^'\\]|\\(.|\n))*'''"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // "String" - if (_scanner.scan(RegExp(r'"(?:[^"\\]|\\.)*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // 'String' - if (_scanner.scan(RegExp(r"'(?:[^'\\]|\\.)*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Double - if (_scanner.scan(RegExp(r'\d+\.\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Integer - if (_scanner.scan(RegExp(r'\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end) - ); - continue; - } - - // Punctuation - if (_scanner.scan(RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) { - _spans.add(_HighlightSpan( - _HighlightType.punctuation, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Meta data - if (_scanner.scan(RegExp(r'@\w+'))) { - _spans.add(_HighlightSpan( - _HighlightType.keyword, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Words - if (_scanner.scan(RegExp(r'\w+'))) { - _HighlightType type; - - String word = _scanner.lastMatch[0]; - if (word.startsWith('_')) - word = word.substring(1); - - if (_keywords.contains(word)) - type = _HighlightType.keyword; - else if (_builtInTypes.contains(word)) - type = _HighlightType.keyword; - else if (_firstLetterIsUpperCase(word)) - type = _HighlightType.klass; - else if (word.length >= 2 && word.startsWith('k') && _firstLetterIsUpperCase(word.substring(1))) - type = _HighlightType.constant; - - if (type != null) { - _spans.add(_HighlightSpan( - type, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - } - } - - // Check if this loop did anything - if (lastLoopPosition == _scanner.position) { - // Failed to parse this file, abort gracefully - return false; - } - lastLoopPosition = _scanner.position; - } - - _simplify(); - return true; - } - - void _simplify() { - for (int i = _spans.length - 2; i >= 0; i -= 1) { - if (_spans[i].type == _spans[i + 1].type && _spans[i].end == _spans[i + 1].start) { - _spans[i] = _HighlightSpan( - _spans[i].type, - _spans[i].start, - _spans[i + 1].end - ); - _spans.removeAt(i + 1); - } - } - } - - bool _firstLetterIsUpperCase(String str) { - if (str.isNotEmpty) { - final String first = str.substring(0, 1); - return first == first.toUpperCase(); - } - return false; - } -} - -enum _HighlightType { - number, - comment, - keyword, - string, - punctuation, - klass, - constant -} - -class _HighlightSpan { - _HighlightSpan(this.type, this.start, this.end); - final _HighlightType type; - final int start; - final int end; - - String textForSpan(String src) { - return src.substring(start, end); - } - - TextStyle textStyle(SyntaxHighlighterStyle style) { - if (type == _HighlightType.number) - return style.numberStyle; - else if (type == _HighlightType.comment) - return style.commentStyle; - else if (type == _HighlightType.keyword) - return style.keywordStyle; - else if (type == _HighlightType.string) - return style.stringStyle; - else if (type == _HighlightType.punctuation) - return style.punctuationStyle; - else if (type == _HighlightType.klass) - return style.classStyle; - else if (type == _HighlightType.constant) - return style.constantStyle; - else - return style.baseStyle; - } -} diff --git a/lib/utils/net_utils.dart b/lib/utils/net_utils.dart deleted file mode 100644 index 2f39746c..00000000 --- a/lib/utils/net_utils.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'package:cookie_jar/cookie_jar.dart'; -import 'package:dio/dio.dart'; -import 'package:path_provider/path_provider.dart'; - -Map optHeader = { - 'accept-language':'zh-cn', - 'content-type':'application/json' -}; - -var dio = new Dio(BaseOptions(connectTimeout: 30000,headers: optHeader)); - -class NetUtils { - - static Future get(String url, [Map params]) async { - var response; - - // 设置代理 便于本地 charles 抓包 - // (dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = - // (HttpClient client) { - // client.findProxy = (uri) { - // return "PROXY 30.10.26.193:8888"; - // }; - // }; - - Directory documentsDir = await getApplicationDocumentsDirectory(); - String documentsPath = documentsDir.path; - var dir = new Directory("$documentsPath/cookies"); - await dir.create(); - // print('documentPath:${dir.path}'); - dio.interceptors.add(CookieManager(PersistCookieJar(dir: dir.path))); - if (params != null) { - response = await dio.get(url, queryParameters: params); - } else { - response = await dio.get(url); - } - return response.data; - } - - static Future post(String url, Map params) async { - var response = await dio.post(url, data: params); - return response.data; - } -} diff --git a/lib/utils/provider.dart b/lib/utils/provider.dart deleted file mode 100644 index 89003886..00000000 --- a/lib/utils/provider.dart +++ /dev/null @@ -1,93 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'dart:typed_data'; - -import 'package:path/path.dart'; -import 'package:sqflite/sqflite.dart'; -import 'package:flutter/services.dart' show rootBundle; - -//const createSql = { -// 'cat': """ -// CREATE TABLE "cat" ( -// `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, -// `name` TEXT NOT NULL UNIQUE, -// `depth` INTEGER NOT NULL DEFAULT 1, -// `parentId` INTEGER NOT NULL, -// `desc` TEXT -// ); -// """, -// 'collectio': """ -// CREATE TABLE collection (id INTEGER PRIMARY KEY NOT NULL UNIQUE, name TEXT NOT NULL, router TEXT); -// """, -// 'widget': """ -// CREATE TABLE widget (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, name TEXT NOT NULL, cnName TEXT NOT NULL, image TEXT NOT NULL, doc TEXT, demo TEXT, catId INTEGER NOT NULL REFERENCES cat (id), owner TEXT); -// """; -//}; - -class Provider { - static Database db; - - // 获取数据库中所有的表 - Future getTables() async { - if (db == null) { - return Future.value([]); - } - List tables = await db.rawQuery('SELECT name FROM sqlite_master WHERE type = "table"'); - List targetList = []; - tables.forEach((item) { - targetList.add(item['name']); - }); - return targetList; - } - - // 检查数据库中, 表是否完整, 在部份android中, 会出现表丢失的情况 - Future checkTableIsRight() async { - List expectTables = ['cat', 'widget', 'collection']; - - List tables = await getTables(); - - for(int i = 0; i < expectTables.length; i++) { - if (!tables.contains(expectTables[i])) { - return false; - } - } - return true; - - } - - //初始化数据库 - - Future init(bool isCreate) async { - //Get a location using getDatabasesPath - String databasesPath = await getDatabasesPath(); - String path = join(databasesPath, 'flutter.db'); - print(path); - try { - db = await openDatabase(path); - } catch (e) { - print("Error $e"); - } - bool tableIsRight = await this.checkTableIsRight(); - - if (!tableIsRight) { - // 关闭上面打开的db,否则无法执行open - db.close(); - // Delete the database - await deleteDatabase(path); - ByteData data = await rootBundle.load(join("assets", "app.db")); - List bytes = - data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); - await new File(path).writeAsBytes(bytes); - - db = await openDatabase(path, version: 1, - onCreate: (Database db, int version) async { - print('db created version is $version'); - }, onOpen: (Database db) async { - print('new db opened'); - }); - } else { - print("Opening existing database"); - } - } - -} diff --git a/lib/utils/shared_preferences.dart b/lib/utils/shared_preferences.dart deleted file mode 100644 index 81f7dc70..00000000 --- a/lib/utils/shared_preferences.dart +++ /dev/null @@ -1,120 +0,0 @@ - -import 'dart:async'; - -import 'package:shared_preferences/shared_preferences.dart'; - -export 'package:flutter_go/resources/shared_preferences_keys.dart'; - -/// 用来做shared_preferences的存储 -class SpUtil { - static SpUtil _instance; - static Future get instance async { - return await getInstance(); - } - - static SharedPreferences _spf; - - - SpUtil._(); - - Future _init() async { - _spf = await SharedPreferences.getInstance(); - } - - static Future getInstance() async { - if (_instance == null) { - _instance = new SpUtil._(); - await _instance._init(); - - } - return _instance; - } - - static bool _beforeCheck() { - if (_spf == null) { - return true; - } - return false; - } - // 判断是否存在数据 - bool hasKey(String key) { - Set keys = getKeys(); - return keys.contains(key); - } - - Set getKeys() { - if (_beforeCheck()) return null; - return _spf.getKeys(); - } - - get(String key) { - if (_beforeCheck()) return null; - return _spf.get(key); - } - - getString(String key) { - if (_beforeCheck()) return null; - return _spf.getString(key); - } - - Future putString(String key, String value) { - if (_beforeCheck()) return null; - return _spf.setString(key, value); - } - - bool getBool(String key) { - if (_beforeCheck()) return null; - return _spf.getBool(key); - } - - Future putBool(String key, bool value) { - if (_beforeCheck()) return null; - return _spf.setBool(key, value); - } - - int getInt(String key) { - if (_beforeCheck()) return null; - return _spf.getInt(key); - } - - Future putInt(String key, int value) { - if (_beforeCheck()) return null; - return _spf.setInt(key, value); - } - - double getDouble(String key) { - if (_beforeCheck()) return null; - return _spf.getDouble(key); - } - - Future putDouble(String key, double value) { - if (_beforeCheck()) return null; - return _spf.setDouble(key, value); - } - - List getStringList(String key) { - return _spf.getStringList(key); - } - - Future putStringList(String key, List value) { - if (_beforeCheck()) return null; - return _spf.setStringList(key, value); - } - - dynamic getDynamic(String key) { - if (_beforeCheck()) return null; - return _spf.get(key); - } - - - - Future remove(String key) { - if (_beforeCheck()) return null; - return _spf.remove(key); - } - - Future clear() { - if (_beforeCheck()) return null; - return _spf.clear(); - } -} \ No newline at end of file diff --git a/lib/utils/sql.dart b/lib/utils/sql.dart deleted file mode 100644 index d932415b..00000000 --- a/lib/utils/sql.dart +++ /dev/null @@ -1,101 +0,0 @@ - - -import 'package:sqflite/sqflite.dart'; - -import './provider.dart'; - -class BaseModel{ - Database db; - final String table = ''; - var query; - BaseModel(this.db){ - query = db.query; - } -} - -class Sql extends BaseModel { - final String tableName; - Sql.setTable(String name) - : tableName = name, - super(Provider.db); - - // sdf - Future get() async{ - return await this.query(tableName); - } - String getTableName () { - return tableName; - } - - Future delete(String value,String key) async{ - return await this.db.delete(tableName,where:'$key = ?',whereArgs:[value]); - } - - Future deleteAll() async{ - return await this.db.delete(tableName); - } - - Future getByCondition({Map conditions}) async { - if (conditions == null || conditions.isEmpty) { - return this.get(); - } - String stringConditions = ''; - - int index = 0; - conditions.forEach((key, value) { - if (value == null) { - return ; - } - if (value.runtimeType == String) { - stringConditions = '$stringConditions $key = "$value"'; - } - if (value.runtimeType == int) { - stringConditions = '$stringConditions $key = $value'; - } - - if (index >= 0 && index < conditions.length -1) { - stringConditions = '$stringConditions and'; - } - index++; - }); - // print("this is string condition for sql > $stringConditions"); - return await this.query(tableName, where: stringConditions); - } - Future> insert(Map json) async { - var id = await this.db.insert(tableName, json); - json['id'] = id; - return json; - } - /// - /// 搜索 - /// @param Object condition - /// @mods [And, Or] default is Or - /// search({'name': "hanxu', 'id': 1}; - /// - Future search({Map conditions, String mods = 'Or'}) async { - if (conditions == null || conditions.isEmpty) { - return this.get(); - } - String stringConditions = ''; - int index = 0; - conditions.forEach((key, value) { - if (value == null) { - return ; - } - - if (value.runtimeType == String) { - stringConditions = '$stringConditions $key like "%$value%"'; - } - if (value.runtimeType == int) { - stringConditions = '$stringConditions $key = "%$value%"'; - } - - if (index >= 0 && index < conditions.length -1) { - stringConditions = '$stringConditions $mods'; - } - index++; - }); - - return await this.query(tableName, where: stringConditions); - } -} \ No newline at end of file diff --git a/lib/utils/style.dart b/lib/utils/style.dart deleted file mode 100644 index 31d9bb8d..00000000 --- a/lib/utils/style.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; - -//颜色配置 -class AppColor{ - static const int white = 0xFFFFFFFF; - static const int mainTextColor = 0xFF121917; - static const int subTextColor = 0xff959595; -} - -//文本设置 -class AppText{ - static const middleSize = 16.0; - - static const middleText = TextStyle( - color: Color(AppColor.mainTextColor), - fontSize: middleSize, - ); - - static const middleSubText = TextStyle( - color: Color(AppColor.subTextColor), - fontSize: middleSize, - ); -} -class WidgetDemoColor { - static const int fontColor = 0xFF607173; - static const int iconColor = 0xFF607173; - static const int borderColor = 0xFFEFEFEF; - -} diff --git a/lib/utils/syntax_highlighter.dart b/lib/utils/syntax_highlighter.dart deleted file mode 100644 index 1b36f07c..00000000 --- a/lib/utils/syntax_highlighter.dart +++ /dev/null @@ -1,357 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-14 11:42:39 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-14 11:42:39 - -import 'package:flutter/material.dart'; -import 'package:string_scanner/string_scanner.dart'; - -class SyntaxHighlighterStyle { - SyntaxHighlighterStyle({ - this.baseStyle, - this.numberStyle, - this.commentStyle, - this.keywordStyle, - this.stringStyle, - this.punctuationStyle, - this.classStyle, - this.constantStyle - }); - - static SyntaxHighlighterStyle lightThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFF000000)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF9C27B0)), - stringStyle: const TextStyle(color: Color(0xFF43A047)), - punctuationStyle: const TextStyle(color: Color(0xFF000000)), - classStyle: const TextStyle(color: Color(0xFF512DA8)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - static SyntaxHighlighterStyle darkThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFFFFFFFF)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF80CBC4)), - stringStyle: const TextStyle(color: Color(0xFF009688)), - punctuationStyle: const TextStyle(color: Color(0xFFFFFFFF)), - classStyle: const TextStyle(color: Color(0xFF009688)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - final TextStyle baseStyle; - final TextStyle numberStyle; - final TextStyle commentStyle; - final TextStyle keywordStyle; - final TextStyle stringStyle; - final TextStyle punctuationStyle; - final TextStyle classStyle; - final TextStyle constantStyle; -} - -abstract class SyntaxHighlighter { // ignore: one_member_abstracts - TextSpan format(String src); -} - -class DartSyntaxHighlighter extends SyntaxHighlighter { - DartSyntaxHighlighter([this._style]) { - _spans = <_HighlightSpan>[]; - _style ??= SyntaxHighlighterStyle.darkThemeStyle(); - } - - SyntaxHighlighterStyle _style; - - static const List _keywords = [ - 'abstract', 'as', 'assert', 'async', 'await', 'break', 'case', 'catch', - 'class', 'const', 'continue', 'default', 'deferred', 'do', 'dynamic', 'else', - 'enum', 'export', 'external', 'extends', 'factory', 'false', 'final', - 'finally', 'for', 'get', 'if', 'implements', 'import', 'in', 'is', 'library', - 'new', 'null', 'operator', 'part', 'rethrow', 'return', 'set', 'static', - 'super', 'switch', 'sync', 'this', 'throw', 'true', 'try', 'typedef', 'var', - 'void', 'while', 'with', 'yield' - ]; - - static const List _builtInTypes = [ - 'int', 'double', 'num', 'bool' - ]; - - String _src; - StringScanner _scanner; - - List<_HighlightSpan> _spans; - - @override - TextSpan format(String src) { - _src = src; - _scanner = StringScanner(_src); - - if (_generateSpans()) { - // Successfully parsed the code - final List formattedText = []; - int currentPosition = 0; - - for (_HighlightSpan span in _spans) { - if (currentPosition != span.start) - formattedText.add(TextSpan(text: _src.substring(currentPosition, span.start))); - - formattedText.add(TextSpan(style: span.textStyle(_style), text: span.textForSpan(_src))); - - currentPosition = span.end; - } - - if (currentPosition != _src.length) - formattedText.add(TextSpan(text: _src.substring(currentPosition, _src.length))); - - return TextSpan(style: _style.baseStyle, children: formattedText); - } else { - // Parsing failed, return with only basic formatting - return TextSpan(style: _style.baseStyle, text: src); - } - } - - bool _generateSpans() { - int lastLoopPosition = _scanner.position; - - while (!_scanner.isDone) { - // Skip White space - _scanner.scan(RegExp(r'\s+')); - - // Block comments - if (_scanner.scan(RegExp(r'/\*(.|\n)*\*/'))) { - _spans.add(_HighlightSpan( - _HighlightType.comment, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Line comments - if (_scanner.scan('//')) { - final int startComment = _scanner.lastMatch.start; - - bool eof = false; - int endComment; - if (_scanner.scan(RegExp(r'.*\n'))) { - endComment = _scanner.lastMatch.end - 1; - } else { - eof = true; - endComment = _src.length; - } - - _spans.add(_HighlightSpan( - _HighlightType.comment, - startComment, - endComment - )); - - if (eof) - break; - - continue; - } - - // Raw r"String" - if (_scanner.scan(RegExp(r'r".*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Raw r'String' - if (_scanner.scan(RegExp(r"r'.*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline """String""" - if (_scanner.scan(RegExp(r'"""(?:[^"\\]|\\(.|\n))*"""'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline '''String''' - if (_scanner.scan(RegExp(r"'''(?:[^'\\]|\\(.|\n))*'''"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // "String" - if (_scanner.scan(RegExp(r'"(?:[^"\\]|\\.)*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // 'String' - if (_scanner.scan(RegExp(r"'(?:[^'\\]|\\.)*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Double - if (_scanner.scan(RegExp(r'\d+\.\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Integer - if (_scanner.scan(RegExp(r'\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end) - ); - continue; - } - - // Punctuation - if (_scanner.scan(RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) { - _spans.add(_HighlightSpan( - _HighlightType.punctuation, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Meta data - if (_scanner.scan(RegExp(r'@\w+'))) { - _spans.add(_HighlightSpan( - _HighlightType.keyword, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Words - if (_scanner.scan(RegExp(r'\w+'))) { - _HighlightType type; - - String word = _scanner.lastMatch[0]; - if (word.startsWith('_')) - word = word.substring(1); - - if (_keywords.contains(word)) - type = _HighlightType.keyword; - else if (_builtInTypes.contains(word)) - type = _HighlightType.keyword; - else if (_firstLetterIsUpperCase(word)) - type = _HighlightType.klass; - else if (word.length >= 2 && word.startsWith('k') && _firstLetterIsUpperCase(word.substring(1))) - type = _HighlightType.constant; - - if (type != null) { - _spans.add(_HighlightSpan( - type, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - } - } - - // Check if this loop did anything - if (lastLoopPosition == _scanner.position) { - // Failed to parse this file, abort gracefully - return false; - } - lastLoopPosition = _scanner.position; - } - - _simplify(); - return true; - } - - void _simplify() { - for (int i = _spans.length - 2; i >= 0; i -= 1) { - if (_spans[i].type == _spans[i + 1].type && _spans[i].end == _spans[i + 1].start) { - _spans[i] = _HighlightSpan( - _spans[i].type, - _spans[i].start, - _spans[i + 1].end - ); - _spans.removeAt(i + 1); - } - } - } - - bool _firstLetterIsUpperCase(String str) { - if (str.isNotEmpty) { - final String first = str.substring(0, 1); - return first == first.toUpperCase(); - } - return false; - } -} - -enum _HighlightType { - number, - comment, - keyword, - string, - punctuation, - klass, - constant -} - -class _HighlightSpan { - _HighlightSpan(this.type, this.start, this.end); - final _HighlightType type; - final int start; - final int end; - - String textForSpan(String src) { - return src.substring(start, end); - } - - TextStyle textStyle(SyntaxHighlighterStyle style) { - if (type == _HighlightType.number) - return style.numberStyle; - else if (type == _HighlightType.comment) - return style.commentStyle; - else if (type == _HighlightType.keyword) - return style.keywordStyle; - else if (type == _HighlightType.string) - return style.stringStyle; - else if (type == _HighlightType.punctuation) - return style.punctuationStyle; - else if (type == _HighlightType.klass) - return style.classStyle; - else if (type == _HighlightType.constant) - return style.constantStyle; - else - return style.baseStyle; - } -} diff --git a/lib/utils/util.dart b/lib/utils/util.dart deleted file mode 100644 index 1b9fab38..00000000 --- a/lib/utils/util.dart +++ /dev/null @@ -1,90 +0,0 @@ -import 'package:flutter/material.dart'; - -const Map emumMap = const { - "Objective-C": Color(0xFF438EFF), - "Perl": Color(0xFF0298C3), - "Python": Color(0xFF0298C3), - "JavaScript": Color(0xFFF1E05A), - "PHP": Color(0xFF4F5D95), - "R": Color(0xFF188CE7), - "Lua": Color(0xFFC22D40), - "Scala": Color(0xFF020080), - "Swift": Color(0xFFFFAC45), - "Kotlin": Color(0xFFF18E33), - "Vue": Colors.black, - "Ruby": Color(0xFF701617), - "Shell": Color(0xFF89E051), - "TypeScript": Color(0xFF2B7489), - "C++": Color(0xFFF34B7D), - "CSS": Color(0xFF563C7C), - "Java": Color(0xFFB07219), - "C#": Color(0xFF178600), - "Go": Color(0xFF375EAB), - "Erlang": Color(0xFFB83998), - "C": Color(0xFF555555), -}; - -class Util { - static String getTimeDuration(String comTime) { - var nowTime = DateTime.now(); - var compareTime = DateTime.parse(comTime); - if (nowTime.isAfter(compareTime)) { - if (nowTime.year == compareTime.year) { - if (nowTime.month == compareTime.month) { - if (nowTime.day == compareTime.day) { - if (nowTime.hour == compareTime.hour) { - if (nowTime.minute == compareTime.minute) { - return '片刻之间'; - } - return (nowTime.minute - compareTime.minute).toString() + '分钟前'; - } - return (nowTime.hour - compareTime.hour).toString() + '小时前'; - } - return (nowTime.day - compareTime.day).toString() + '天前'; - } - return (nowTime.month - compareTime.month).toString() + '月前'; - } - return (nowTime.year - compareTime.year).toString() + '年前'; - } - return 'time error'; - } - - static double setPercentage(percentage, context) { - return MediaQuery.of(context).size.width * percentage; - } - - static Color getLangColor(String language) { - if (emumMap.containsKey(language)) { - return emumMap[language]; - } - return Colors.black26; - } - - static String getTimeDate(String comTime) { - var compareTime = DateTime.parse(comTime); - String weekDay = ''; - switch (compareTime.weekday) { - case 2: - weekDay = '周二'; - break; - case 3: - weekDay = '周三'; - break; - case 4: - weekDay = '周四'; - break; - case 5: - weekDay = '周五'; - break; - case 6: - weekDay = '周六'; - break; - case 7: - weekDay = '周日'; - break; - default: - weekDay = '周一'; - } - return '${compareTime.month}-${compareTime.day} $weekDay'; - } -} diff --git a/lib/views/collection_page/collection_page.dart b/lib/views/collection_page/collection_page.dart deleted file mode 100644 index 6b4c609b..00000000 --- a/lib/views/collection_page/collection_page.dart +++ /dev/null @@ -1,152 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-08 17:12:58 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-14 20:13:28 - -import 'package:flutter/material.dart'; -import 'package:event_bus/event_bus.dart'; - -import 'package:flutter_go/model/collection.dart'; -import 'package:flutter_go/routers/application.dart'; -import 'package:flutter_go/routers/routers.dart'; -import 'package:flutter_go/event/event_bus.dart'; -import 'package:flutter_go/event/event_model.dart'; - - -class CollectionPage extends StatefulWidget { - _CollectionPageState createState() => _CollectionPageState(); -} - -class _CollectionPageState extends State { - _CollectionPageState() { - final eventBus = new EventBus(); - ApplicationEvent.event = eventBus; - } - CollectionControlModel _collectionControl = new CollectionControlModel(); - List _collectionList = []; - ScrollController _scrollController = new ScrollController(); - var _icons; - - @override - void initState() { - super.initState(); - _getList(); - ApplicationEvent.event.on().listen((event) { - _getList(); - }); - } - - @override - void dispose() { - _scrollController.dispose(); - super.dispose(); - } - - void _getList() { - _collectionList.clear(); - _collectionControl.getAllCollection().then((resultList) { - resultList.forEach((item) { - _collectionList.add(item); - }); - if (this.mounted) { - setState(() { - _collectionList = _collectionList; - }); - } - }); - } - - Widget _renderList(context, index) { - if (index == 0) { - return Container( - height: 40.0, - padding: const EdgeInsets.only(left: 10.0), - child: Row( - children: [ - Icon( - Icons.warning, - size: 22.0, - ), - SizedBox( - width: 5.0, - ), - Text('模拟器重新运行会丢失收藏'), - ], - ), - ); - } - if (_collectionList[index - 1].router.contains('http')) { - if (_collectionList[index - 1].name.endsWith('Doc')) { - _icons = Icons.library_books; - } else { - _icons = Icons.language; - } - } else { - _icons = Icons.extension; - } - return Container( - padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 5.0), - margin: const EdgeInsets.only(bottom: 7.0), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - new BoxShadow( - color: const Color(0xFFd0d0d0), - blurRadius: 1.0, - spreadRadius: 2.0, - offset: Offset(3.0, 2.0), - ), - ], - ), - child: ListTile( - leading: Icon( - _icons, - size: 30.0, - color: Theme.of(context).primaryColor, - ), - title: Text( - Uri.decodeComponent(_collectionList[index - 1].name), - overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 17.0), - ), - trailing: - Icon(Icons.keyboard_arrow_right, color: Colors.grey, size: 30.0), - onTap: () { - if (_collectionList[index - 1].router.contains('http')) { - // 注意这里title已经转义过了 - Application.router.navigateTo(context, - '${Routes.webViewPage}?title=${_collectionList[index - 1].name}&url=${Uri.encodeComponent(_collectionList[index - 1].router)}'); - } else { - Application.router - .navigateTo(context, "${_collectionList[index - 1].router}"); - } - }, - ), - ); - } - - @override - Widget build(BuildContext context) { - if (_collectionList.length == 0) { - return ListView( - children: [ - Column( - children: [ - Image.asset( - 'assets/images/nothing.png', - fit: BoxFit.contain, - width: MediaQuery.of(context).size.width / 2, - ), - Text('暂无收藏,赶紧去收藏一个吧!'), - ], - ), - ], - ); - } - return ListView.builder( - itemBuilder: _renderList, - itemCount: _collectionList.length + 1, - controller: _scrollController, - ); - } -} diff --git a/lib/views/first_page/first_page.dart b/lib/views/first_page/first_page.dart deleted file mode 100644 index be9de1e5..00000000 --- a/lib/views/first_page/first_page.dart +++ /dev/null @@ -1,138 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import 'package:flutter_go/components/list_view_item.dart'; -import 'package:flutter_go/components/list_refresh.dart' as listComp; -import 'package:flutter_go/components/pagination.dart'; -import 'package:flutter_go/views/first_page/first_page_item.dart'; -import 'package:flutter_go/components/disclaimer_msg.dart'; -import 'package:flutter_go/utils/net_utils.dart'; - -// ValueKey key; - -class FirstPage extends StatefulWidget { - @override - FirstPageState createState() => new FirstPageState(); -} - -class FirstPageState extends State with AutomaticKeepAliveClientMixin{ - Future _prefs = SharedPreferences.getInstance(); - Future _unKnow; - GlobalKey key; - - @override - bool get wantKeepAlive => true; - - - @override - void initState() { - super.initState(); - if (key == null) { - key = GlobalKey(); - // key = const Key('__RIKEY1__'); - //获取sharePre - _unKnow = _prefs.then((SharedPreferences prefs) { - return (prefs.getBool('disclaimer::Boolean') ?? false); - }); - - /// 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹 - _unKnow.then((bool value) { - new Future.delayed(const Duration(seconds: 1),(){ - if (!value && key.currentState is DisclaimerMsgState && key.currentState.showAlertDialog is Function) { - key.currentState.showAlertDialog(context); - } - }); - }); - } - } - - - Future getIndexListData([Map params]) async { - const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; - var pageIndex = (params is Map) ? params['pageIndex'] : 0; - final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; - var responseList = []; - var pageTotal = 0; - - try{ - var response = await NetUtils.get(juejin_flutter, _param); - responseList = response['d']['entrylist']; - pageTotal = response['d']['total']; - if (!(pageTotal is int) || pageTotal <= 0) { - pageTotal = 0; - } - }catch(e){ - - } - pageIndex += 1; - List resultList = new List(); - for (int i = 0; i < responseList.length; i++) { - try { - FirstPageItem cellData = new FirstPageItem.fromJson(responseList[i]); - resultList.add(cellData); - } catch (e) { - // No specified type, handles all - } - } - Map result = {"list":resultList, 'total':pageTotal, 'pageIndex':pageIndex}; - return result; - } - - /// 每个item的样式 - Widget makeCard(index,item){ - var myTitle = '${item.title}'; - var myUsername = '${'👲'}: ${item.username} '; - var codeUrl = '${item.detailUrl}'; - return new ListViewItem(itemUrl:codeUrl,itemTitle: myTitle,data: myUsername,); - } - - headerView(){ - return - Column( - children: [ - Stack( - //alignment: const FractionalOffset(0.9, 0.1),//方法一 - children: [ - Pagination(), - Positioned(//方法二 - top: 10.0, - left: 0.0, - child: DisclaimerMsg(key:key,pWidget:this) - ), - ]), - SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)), - SizedBox(height: 10), - ], - ); - - } - - @override - Widget build(BuildContext context) { - super.build(context); - return new Column( - children: [ -// new Stack( -// //alignment: const FractionalOffset(0.9, 0.1),//方法一 -// children: [ -// Pagination(), -// Positioned(//方法二 -// top: 10.0, -// left: 0.0, -// child: DisclaimerMsg(key:key,pWidget:this) -// ), -// ]), -// SizedBox(height: 2, child:Container(color: Theme.of(context).primaryColor)), - new Expanded( - //child: new List(), - child: listComp.ListRefresh(getIndexListData,makeCard,headerView) - ) - ] - - ); - } -} - - diff --git a/lib/views/first_page/first_page_item.dart b/lib/views/first_page/first_page_item.dart deleted file mode 100644 index bef10315..00000000 --- a/lib/views/first_page/first_page_item.dart +++ /dev/null @@ -1,49 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/5 -/// Time: 下午10:20 -/// email: zhu.yan@alibaba-inc.com -/// target: FirstPageItem - -import 'package:flutter_go/utils/util.dart'; - -class FirstPageItem { - bool hot; - String isCollection; - String tag; - String username; - int collectionCount; - int commentCount; - String title; - String createdTime; - String detailUrl; - - FirstPageItem( - {this.hot, - this.tag, - this.username, - this.collectionCount, - this.createdTime, - this.commentCount, - this.title, - this.detailUrl, - this.isCollection}); - - factory FirstPageItem.fromJson(Map json) { - String _tag = ''; - if(json['tags'].length>0){ - _tag = '${json['tags'][0]['title']}/'; - } - return FirstPageItem( - hot: json['hot'], - collectionCount: json['collectionCount'], - commentCount: json['commentsCount'], - tag: '$_tag${json['category']['name']}', - username: json['user']['username'], - createdTime: Util.getTimeDuration(json['createdAt']), - title: json['title'], - detailUrl: json['originalUrl'], - isCollection: json['type'] , - ); - } -} \ No newline at end of file diff --git a/lib/views/first_page/main_app_bar.dart b/lib/views/first_page/main_app_bar.dart deleted file mode 100644 index c85e4cde..00000000 --- a/lib/views/first_page/main_app_bar.dart +++ /dev/null @@ -1,415 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -const double _kLeadingWidth = - kToolbarHeight; // So the leading button is square. - -// Bottom justify the kToolbarHeight child which may overflow the top. -class _ToolbarContainerLayout extends SingleChildLayoutDelegate { - const _ToolbarContainerLayout(); - - @override - BoxConstraints getConstraintsForChild(BoxConstraints constraints) { - return constraints.tighten(height: kToolbarHeight); - } - - @override - Size getSize(BoxConstraints constraints) { - return Size(constraints.maxWidth, kToolbarHeight); - } - - @override - Offset getPositionForChild(Size size, Size childSize) { - return Offset(0.0, size.height - childSize.height); - } - - @override - bool shouldRelayout(_ToolbarContainerLayout oldDelegate) => false; -} - -class MyAppBar extends StatefulWidget implements PreferredSizeWidget { - /// Creates a material design app bar. - /// - /// The arguments [elevation], [primary], [toolbarOpacity], [bottomOpacity] - /// and [automaticallyImplyLeading] must not be null. - /// - /// Typically used in the [Scaffold.appBar] property. - MyAppBar({ - Key key, - this.leading, - this.automaticallyImplyLeading = true, - this.title, - this.actions, - this.flexibleSpace, - this.bottom, - this.elevation = 4.0, - this.backgroundColor, - this.brightness, - this.iconTheme, - this.textTheme, - this.primary = true, - this.centerTitle, - this.titleSpacing = NavigationToolbar.kMiddleSpacing, - this.toolbarOpacity = 1.0, - this.bottomOpacity = 1.0, - }) : assert(automaticallyImplyLeading != null), - assert(elevation != null), - assert(primary != null), - assert(titleSpacing != null), - assert(toolbarOpacity != null), - assert(bottomOpacity != null), - preferredSize = Size.fromHeight( - kToolbarHeight + (bottom?.preferredSize?.height ?? 0.0)), - super(key: key); - - /// A widget to display before the [title]. - /// - /// If this is null and [automaticallyImplyLeading] is set to true, the - /// [AppBar] will imply an appropriate widget. For example, if the [AppBar] is - /// in a [Scaffold] that also has a [Drawer], the [Scaffold] will fill this - /// widget with an [IconButton] that opens the drawer (using [Icons.menu]). If - /// there's no [Drawer] and the parent [Navigator] can go back, the [AppBar] - /// will use a [BackButton] that calls [Navigator.maybePop]. - final Widget leading; - - /// Controls whether we should try to imply the leading widget if null. - /// - /// If true and [leading] is null, automatically try to deduce what the leading - /// widget should be. If false and [leading] is null, leading space is given to [title]. - /// If leading widget is not null, this parameter has no effect. - final bool automaticallyImplyLeading; - - /// The primary widget displayed in the appbar. - /// - /// Typically a [Text] widget containing a description of the current contents - /// of the app. - final Widget title; - - /// Widgets to display after the [title] widget. - /// - /// Typically these widgets are [IconButton]s representing common operations. - /// For less common operations, consider using a [PopupMenuButton] as the - /// last action. - /// - /// ## Sample code - /// - /// ```dart - /// Scaffold( - /// appBar: AppBar( - /// title: Text('Hello World'), - /// actions: [ - /// IconButton( - /// icon: Icon(Icons.shopping_cart), - /// tooltip: 'Open shopping cart', - /// onPressed: () { - /// // ... - /// }, - /// ), - /// ], - /// ), - /// ) - /// ``` - final List actions; - - /// This widget is stacked behind the toolbar and the tabbar. It's height will - /// be the same as the app bar's overall height. - /// - /// A flexible space isn't actually flexible unless the [AppBar]'s container - /// changes the [AppBar]'s size. A [SliverAppBar] in a [CustomScrollView] - /// changes the [AppBar]'s height when scrolled. - /// - /// Typically a [FlexibleSpaceBar]. See [FlexibleSpaceBar] for details. - final Widget flexibleSpace; - - /// This widget appears across the bottom of the app bar. - /// - /// Typically a [TabBar]. Only widgets that implement [PreferredSizeWidget] can - /// be used at the bottom of an app bar. - /// - /// See also: - /// - /// * [PreferredSize], which can be used to give an arbitrary widget a preferred size. - final PreferredSizeWidget bottom; - - /// The z-coordinate at which to place this app bar. This controls the size of - /// the shadow below the app bar. - /// - /// Defaults to 4, the appropriate elevation for app bars. - final double elevation; - - /// The color to use for the app bar's material. Typically this should be set - /// along with [brightness], [iconTheme], [textTheme]. - /// - /// Defaults to [ThemeData.primaryColor]. - final Color backgroundColor; - - /// The brightness of the app bar's material. Typically this is set along - /// with [backgroundColor], [iconTheme], [textTheme]. - /// - /// Defaults to [ThemeData.primaryColorBrightness]. - final Brightness brightness; - - /// The color, opacity, and size to use for app bar icons. Typically this - /// is set along with [backgroundColor], [brightness], [textTheme]. - /// - /// Defaults to [ThemeData.primaryIconTheme]. - final IconThemeData iconTheme; - - /// The typographic styles to use for text in the app bar. Typically this is - /// set along with [brightness] [backgroundColor], [iconTheme]. - /// - /// Defaults to [ThemeData.primaryTextTheme]. - final TextTheme textTheme; - - /// Whether this app bar is being displayed at the top of the screen. - /// - /// If true, the appbar's toolbar elements and [bottom] widget will be - /// padded on top by the height of the system status bar. The layout - /// of the [flexibleSpace] is not affected by the [primary] property. - final bool primary; - - /// Whether the title should be centered. - /// - /// Defaults to being adapted to the current [TargetPlatform]. - final bool centerTitle; - - /// The spacing around [title] content on the horizontal axis. This spacing is - /// applied even if there is no [leading] content or [actions]. If you want - /// [title] to take all the space available, set this value to 0.0. - /// - /// Defaults to [NavigationToolbar.kMiddleSpacing]. - final double titleSpacing; - - /// How opaque the toolbar part of the app bar is. - /// - /// A value of 1.0 is fully opaque, and a value of 0.0 is fully transparent. - /// - /// Typically, this value is not changed from its default value (1.0). It is - /// used by [SliverAppBar] to animate the opacity of the toolbar when the app - /// bar is scrolled. - final double toolbarOpacity; - - /// How opaque the bottom part of the app bar is. - /// - /// A value of 1.0 is fully opaque, and a value of 0.0 is fully transparent. - /// - /// Typically, this value is not changed from its default value (1.0). It is - /// used by [SliverAppBar] to animate the opacity of the toolbar when the app - /// bar is scrolled. - final double bottomOpacity; - - /// A size whose height is the sum of [kToolbarHeight] and the [bottom] widget's - /// preferred height. - /// - /// [Scaffold] uses this this size to set its app bar's height. - @override - final Size preferredSize; - - bool _getEffectiveCenterTitle(ThemeData themeData) { - if (centerTitle != null) return centerTitle; - assert(themeData.platform != null); - switch (themeData.platform) { - case TargetPlatform.android: - case TargetPlatform.fuchsia: - return false; - case TargetPlatform.iOS: - return actions == null || actions.length < 2; - } - return null; - } - - @override - _MyAppBarState createState() => _MyAppBarState(); -} - -class _MyAppBarState extends State { - void _handleDrawerButton() { - Scaffold.of(context).openDrawer(); - } - - void _handleDrawerButtonEnd() { - Scaffold.of(context).openEndDrawer(); - } - - @override - Widget build(BuildContext context) { - assert(!widget.primary || debugCheckHasMediaQuery(context)); - assert(debugCheckHasMaterialLocalizations(context)); - final ThemeData themeData = Theme.of(context); - final ScaffoldState scaffold = Scaffold.of(context, nullOk: true); - final ModalRoute parentRoute = ModalRoute.of(context); - - final bool hasDrawer = scaffold?.hasDrawer ?? false; - final bool hasEndDrawer = scaffold?.hasEndDrawer ?? false; - final bool canPop = parentRoute?.canPop ?? false; - final bool useCloseButton = - parentRoute is PageRoute && parentRoute.fullscreenDialog; - - IconThemeData appBarIconTheme = - widget.iconTheme ?? themeData.primaryIconTheme; - TextStyle centerStyle = - widget.textTheme?.title ?? themeData.primaryTextTheme.title; - TextStyle sideStyle = - widget.textTheme?.body1 ?? themeData.primaryTextTheme.body1; - - if (widget.toolbarOpacity != 1.0) { - final double opacity = - const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn) - .transform(widget.toolbarOpacity); - if (centerStyle?.color != null) - centerStyle = - centerStyle.copyWith(color: centerStyle.color.withOpacity(opacity)); - if (sideStyle?.color != null) - sideStyle = - sideStyle.copyWith(color: sideStyle.color.withOpacity(opacity)); - appBarIconTheme = appBarIconTheme.copyWith( - opacity: opacity * (appBarIconTheme.opacity ?? 1.0)); - } - - Widget leading = widget.leading; - //if (leading == null && widget.automaticallyImplyLeading) { - if (widget.automaticallyImplyLeading) { - if (hasDrawer) { - leading = IconButton( - //icon: const Icon(Icons.menu), - icon: leading ?? const Icon(Icons.menu), - onPressed: _handleDrawerButton, - tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, - ); - } else { - if (canPop) - leading = useCloseButton ? const CloseButton() : const BackButton(); - } - } - if (leading != null) { - leading = ConstrainedBox( - constraints: const BoxConstraints.tightFor(width: _kLeadingWidth), - child: leading, - ); - } - - Widget title = widget.title; - if (title != null) { - bool namesRoute; - switch (defaultTargetPlatform) { - case TargetPlatform.android: - case TargetPlatform.fuchsia: - namesRoute = true; - break; - case TargetPlatform.iOS: - break; - } - title = DefaultTextStyle( - style: centerStyle, - softWrap: false, - overflow: TextOverflow.ellipsis, - child: Semantics( - namesRoute: namesRoute, - child: title, - header: true, - ), - ); - } - - Widget actions; - if (widget.actions != null && widget.actions.isNotEmpty) { - actions = Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: widget.actions, - ); - } else if (hasEndDrawer) { - actions = IconButton( - icon: const Icon(Icons.menu), - onPressed: _handleDrawerButtonEnd, - tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, - ); - } - - final Widget toolbar = NavigationToolbar( - leading: leading, - middle: title, - trailing: actions, - centerMiddle: widget._getEffectiveCenterTitle(themeData), - middleSpacing: widget.titleSpacing, - ); - - // If the toolbar is allocated less than kToolbarHeight make it - // appear to scroll upwards within its shrinking container. - Widget appBar = ClipRect( - child: CustomSingleChildLayout( - delegate: const _ToolbarContainerLayout(), - child: IconTheme.merge( - data: appBarIconTheme, - child: DefaultTextStyle( - style: sideStyle, - child: toolbar, - ), - ), - ), - ); - if (widget.bottom != null) { - appBar = Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: ConstrainedBox( - constraints: const BoxConstraints(maxHeight: kToolbarHeight), - child: appBar, - ), - ), - widget.bottomOpacity == 1.0 - ? widget.bottom - : Opacity( - opacity: - const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn) - .transform(widget.bottomOpacity), - child: widget.bottom, - ), - ], - ); - } - - // The padding applies to the toolbar and tabbar, not the flexible space. - if (widget.primary) { - appBar = SafeArea( - top: true, - child: appBar, - ); - } - - appBar = Align( - alignment: Alignment.topCenter, - child: appBar, - ); - - if (widget.flexibleSpace != null) { - appBar = Stack( - fit: StackFit.passthrough, - children: [ - widget.flexibleSpace, - appBar, - ], - ); - } - final Brightness brightness = - widget.brightness ?? themeData.primaryColorBrightness; - final SystemUiOverlayStyle overlayStyle = brightness == Brightness.dark - ? SystemUiOverlayStyle.light - : SystemUiOverlayStyle.dark; - - return Semantics( - container: true, - explicitChildNodes: true, - child: AnnotatedRegion( - value: overlayStyle, - child: Material( - color: widget.backgroundColor ?? themeData.primaryColor, - elevation: widget.elevation, - child: appBar, - ), - ), - ); - } -} diff --git a/lib/views/first_page/main_page.dart b/lib/views/first_page/main_page.dart deleted file mode 100644 index 43383a85..00000000 --- a/lib/views/first_page/main_page.dart +++ /dev/null @@ -1,106 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; -import './first_page.dart'; -import './sub_page.dart'; -import './main_app_bar.dart'; -import './search_page.dart'; - -class _Page { - final String labelId; - - _Page(this.labelId); -} - -final List<_Page> _allPages = <_Page>[ - _Page('项目1'), - _Page('项目2'), - _Page('项目3'), - _Page('项目4'), -]; - -class MainPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - print("MainPagess build......"); - return DefaultTabController( - length: _allPages.length, - child: Scaffold( - appBar: new MyAppBar( - leading: Container( - child: new ClipOval( - child: Image.network( - 'https://hbimg.huabanimg.com/9bfa0fad3b1284d652d370fa0a8155e1222c62c0bf9d-YjG0Vt_fw658', - scale: 15.0, - ), - ) - ), - centerTitle: true, - title: TabLayout(), - actions: [ - IconButton( - icon: Icon(Icons.search), - onPressed: () { - pushPage(context, SearchPage(), pageName: "SearchPage"); - }) - ], - ), - body: TabBarViewLayout(), -// drawer: Drawer( -// child: MainLeftPage(), -// ), - )); - } -} - -void pushPage(BuildContext context, Widget page, {String pageName}) { - if (context == null || page == null) return; - Navigator.push(context, CupertinoPageRoute(builder: (ctx) => page)); -} - -class TabLayout extends StatelessWidget { - @override - Widget build(BuildContext context) { - return TabBar( - isScrollable: true, - //labelPadding: EdgeInsets.all(12.0), - labelPadding: EdgeInsets.only(top: 12.0,left: 12.0,right:12.0), - indicatorSize: TabBarIndicatorSize.label, - tabs: _allPages - .map((_Page page) => - Tab(text: page.labelId)) - .toList(), - ); - } -} - -class TabBarViewLayout extends StatelessWidget { - Widget buildTabView(BuildContext context, _Page page) { - String labelId = page.labelId; - switch (labelId) { - case '项目1': - return FirstPage(); - break; - case '项目2': - return SubPage(); - break; - case '项目3': - return SubPage(); - break; - case '项目4': - return SubPage(); - break; - default: - return Container(); - break; - } - } - - @override - Widget build(BuildContext context) { - print("TabBarViewLayout build......."); - return TabBarView( - children: _allPages.map((_Page page) { - return buildTabView(context, page); - }).toList()); - } -} diff --git a/lib/views/first_page/search_page.dart b/lib/views/first_page/search_page.dart deleted file mode 100644 index 6d519738..00000000 --- a/lib/views/first_page/search_page.dart +++ /dev/null @@ -1,189 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter/cupertino.dart'; -import 'dart:ui'; -import 'dart:async'; -import 'package:flutter_go/blocs/industry_main.dart' as Industry; -import 'package:flutter_go/blocs/industry_event.dart'; -import 'package:flutter_go/routers/application.dart'; -import 'package:flutter_go/routers/routers.dart'; - -final _industryPage = Industry.IndustryPage(itemTitle: (state){ - return ListView.builder( - itemBuilder: (BuildContext context, int index) { - return ListTile( - dense: true, - leading: Icon( - Icons.bookmark_border, - size: 32, - ), - title: Text( - state.res[index].title, - overflow: TextOverflow.ellipsis, - ), - subtitle: Text(state.res[index].source), - onTap: () { - // 在这里对选中的结果进行解析,因为我目前是用golang实现的,所以就没贴代码了。 - print(state.res[index].source); - final itemTitle = state.res[index].title; - final itemUrl = state.res[index].source; - Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent(itemTitle)}&url=${Uri.encodeComponent(itemUrl)}'); - }, - ); - }, - itemCount: state.res.length, - ); -}); - -final suggestion = Industry.suggestion; -final searchBarPage = SearchBarPage(); - -class SearchPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - /// print('suggestion::${Industry.suggestion}'); - return Scaffold( - appBar: PreferredSize( - preferredSize: Size(double.infinity, 52), // 44 is the height - child: AppBar(title: searchBarPage) - ), - //body: ProgressView(), - body: _industryPage, - floatingActionButton: FloatingActionButton( - child: const Icon(Icons.search), - onPressed: () { - //print('searchBarPage=====>${controller.text}'); - //print('searchBarPage=====>${that.getResultsDebounced}'); - if(that is _SearchBarPageState && that.getResultsDebounced is Function && controller.text is String ) { - that.getResultsDebounced(controller.text); - } - }, - ), - ); - } -} - -/// 加载loading -class ProgressView extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Center( - child: SizedBox( - width: 24.0, - height: 24.0, - child: CircularProgressIndicator( - strokeWidth: 2.0, - ), - ), - ); - } -} - -class SearchBarPage extends StatefulWidget{ - @override - State createState() => _SearchBarPageState(); -} - - -final TextEditingController controller = TextEditingController(); -var that; -class _SearchBarPageState extends State { - @override - void initState() { - super.initState(); - that = this; - } - - Timer _resultsTimer; - bool _loading = false; - String oldKey; - /// 防抖函数 - Future getResultsDebounced(String text) async { - if(oldKey == text){ - print('请求内容重复'); - return; - } - if (text == '' || !mounted) { - return; - } - _loading = true; - if (_resultsTimer != null && _resultsTimer.isActive) { - _resultsTimer.cancel(); - } - _resultsTimer = new Timer(new Duration(milliseconds: 400), () async { - _loading = true; - if(mounted){ - suggestion.dispatch(SuggestionFetch(query: text)); - } - oldKey = text; - }); - } - - - void onSearchTextChanged(String text){ - print('onSearchTextChanged:${text}'); - //suggestion.dispatch(SuggestionFetch(query: text)); - getResultsDebounced(text); - } - - @override - void dispose() { - print('dispose'); - suggestion.dispatch(SuggestionClearFetch()); - //controller.dispose(); - super.dispose(); - } - - - Widget build(BuildContext context) { - return Container( - color: Theme.of(context).primaryColor, - //color: Colors.amber, - child: Padding( - //padding: EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top,), - padding: EdgeInsets.all(0.0), - child: Container( - //height: 162.0, - child: Padding( - padding: const EdgeInsets.all(6.0), - child: Card( - child: Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox(width: 5.0,), - Icon(Icons.search, color: Colors.grey,size: 18.0,), - Expanded( - child: Container( - alignment: Alignment.center, - child: TextField( - controller: controller, - decoration: InputDecoration( - contentPadding: EdgeInsets.only(top: 0.0), - hintText: '搜索全局flutter知识库', - hintStyle:TextStyle(fontSize: 12.0), - border: InputBorder.none - ), - onChanged: onSearchTextChanged, - ), - ), - ), - IconButton( - icon: Icon(Icons.cancel), - color: Colors.grey, - iconSize: 18.0, - onPressed: () { - controller.clear(); - // onSearchTextChanged(''); - }, - ), - ], - ), - ) - ) - ), - ), - ), - ); - } -} \ No newline at end of file diff --git a/lib/views/first_page/sub_page.dart b/lib/views/first_page/sub_page.dart deleted file mode 100644 index 22325f97..00000000 --- a/lib/views/first_page/sub_page.dart +++ /dev/null @@ -1,125 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import 'package:flutter_go/components/list_view_item.dart'; -import 'package:flutter_go/components/list_refresh.dart' as listComp; -import 'package:flutter_go/components/pagination.dart'; -import 'package:flutter_go/views/first_page/first_page_item.dart'; -import 'package:flutter_go/components/disclaimer_msg.dart'; -import 'package:flutter_go/utils/net_utils.dart'; - -// ValueKey key; - -class SubPage extends StatefulWidget { - @override - SubPageState createState() => SubPageState(); -} - -class SubPageState extends State with AutomaticKeepAliveClientMixin{ - Future _prefs = SharedPreferences.getInstance(); - Future _unKnow; - GlobalKey key; - - @override - bool get wantKeepAlive => true; - - - @override - void initState() { - super.initState(); - if (key == null) { - key = GlobalKey(); - // key = const Key('__RIKEY1__'); - //获取sharePre - _unKnow = _prefs.then((SharedPreferences prefs) { - return (prefs.getBool('disclaimer::Boolean') ?? false); - }); - - /// 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹 - _unKnow.then((bool value) { - new Future.delayed(const Duration(seconds: 1),(){ - if (!value && key.currentState is DisclaimerMsgState && key.currentState.showAlertDialog is Function) { - key.currentState.showAlertDialog(context); - } - }); - }); - } - } - - - Future getIndexListData([Map params]) async { - const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; - var pageIndex = (params is Map) ? params['pageIndex'] : 0; - final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; - var responseList = []; - var pageTotal = 0; - - try{ - var response = await NetUtils.get(juejin_flutter, _param); - responseList = response['d']['entrylist']; - pageTotal = response['d']['total']; - if (!(pageTotal is int) || pageTotal <= 0) { - pageTotal = 0; - } - }catch(e){ - - } - pageIndex += 1; - List resultList = new List(); - for (int i = 0; i < responseList.length; i++) { - try { - FirstPageItem cellData = new FirstPageItem.fromJson(responseList[i]); - resultList.add(cellData); - } catch (e) { - // No specified type, handles all - } - } - Map result = {"list":resultList, 'total':pageTotal, 'pageIndex':pageIndex}; - return result; - } - - Widget makeCard(index,item){ - - var myTitle = '${item.title}'; - var myUsername = '${'👲'}: ${item.username} '; - var codeUrl = '${item.detailUrl}'; - return new ListViewItem(itemUrl:codeUrl,itemTitle: myTitle,data: myUsername,); - } - - headerView(){ - return - Column( - children: [ - Stack( - //alignment: const FractionalOffset(0.9, 0.1),//方法一 - children: [ - Pagination(), - Positioned(//方法二 - top: 10.0, - left: 0.0, - child: DisclaimerMsg(key:key,pWidget:this) - ), - ]), - SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)), - SizedBox(height: 10), - ], - ); - - } - - @override - Widget build(BuildContext context) { - super.build(context); - return new Column( - children: [ - new Expanded( - child: listComp.ListRefresh(getIndexListData,makeCard) - ) - ] - ); - } -} - - diff --git a/lib/views/fourth_page/page_dragger.dart b/lib/views/fourth_page/page_dragger.dart deleted file mode 100644 index e36b8282..00000000 --- a/lib/views/fourth_page/page_dragger.dart +++ /dev/null @@ -1,193 +0,0 @@ - -import 'dart:async'; -import 'dart:ui'; - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/views/fourth_page/pager_indicator.dart'; - -class PageDragger extends StatefulWidget { - - final canDragLeftToRight; - final canDragRightToLeft; - - final StreamController slideUpdateStream; - - - PageDragger({ - this.canDragLeftToRight, - this.canDragRightToLeft, - this.slideUpdateStream, - }); - - @override - _PageDraggerState createState() => _PageDraggerState(); -} - -class _PageDraggerState extends State { - - static const FULL_TRANSTITION_PX = 300.0; - - Offset dragStart; - SlideDirection slideDirection; - double slidePercent = 0.0; - - onDragStart(DragStartDetails details){ - dragStart = details.globalPosition; - } - - onDragUpdate(DragUpdateDetails details) { - if (dragStart != null) { - final newPosition = details.globalPosition; - final dx = dragStart.dx - newPosition.dx; - - if (dx > 0 && widget.canDragRightToLeft) { - slideDirection = SlideDirection.rightToLeft; - } else if (dx < 0 && widget.canDragLeftToRight) { - slideDirection = SlideDirection.leftToRight; - } else { - slideDirection = SlideDirection.none; - } - - if (slideDirection != SlideDirection.none){ - slidePercent = (dx / FULL_TRANSTITION_PX).abs().clamp(0.0, 1.0); - } else { - slidePercent = 0.0; - } - widget.slideUpdateStream.add( - new SlideUpdate( - UpdateType.dragging, - slideDirection, - slidePercent - )); - } - } - - onDragEnd(DragEndDetails details){ - widget.slideUpdateStream.add( - new SlideUpdate( - UpdateType.doneDragging, - SlideDirection.none, - 0.0, - ) - ); - - dragStart = null; - } - - @override - Widget build(BuildContext context) { - return GestureDetector( - onHorizontalDragStart: onDragStart , - onHorizontalDragUpdate: onDragUpdate , - onHorizontalDragEnd: onDragEnd , - ); - } -} - -class AnimatedPageDragger{ - - static const PERCENT_PER_MILLISECOND = 0.005; - - final slideDirection; - final transitionGoal; - - AnimationController completionAnimationController; - - AnimatedPageDragger({ - this.slideDirection, - this.transitionGoal, - slidePercent, - StreamController slideUpdateStream, - TickerProvider vsync, - }) { - final startSlidePercent = slidePercent; - var endSlidePercent; - var duration; - - if ( transitionGoal == TransitionGoal.open){ - endSlidePercent = 1.0; - - final slideRemaining = 1.0 - slidePercent; - - duration = new Duration( - milliseconds: (slideRemaining / PERCENT_PER_MILLISECOND).round() - ); - - } else { - endSlidePercent = 0.0; - duration = new Duration( - milliseconds: (slidePercent / PERCENT_PER_MILLISECOND).round() - ); - } - - completionAnimationController = new AnimationController( - duration: duration, - vsync: vsync - ) - ..addListener((){ - slidePercent = lerpDouble( - startSlidePercent, - endSlidePercent, - completionAnimationController.value - ); - - slideUpdateStream.add( - new SlideUpdate( - UpdateType.animating, - slideDirection, - slidePercent, - ) - ); - - }) - - ..addStatusListener((AnimationStatus status){ - - if(status == AnimationStatus.completed){ - slideUpdateStream.add( - new SlideUpdate( - UpdateType.doneAnimating, - slideDirection, - endSlidePercent, - ) - ); - } - - }); - - } - - run(){ - completionAnimationController.forward(from: 0.0); - } - - dispose(){ - completionAnimationController.dispose(); - } - -} - -enum TransitionGoal{ - open, - close, -} - -enum UpdateType{ - dragging, - doneDragging, - animating, - doneAnimating, -} - -class SlideUpdate { - final updateType; - final direction; - final slidePercent; - - SlideUpdate( - this.updateType, - this.direction, - this.slidePercent - ); -} diff --git a/lib/views/fourth_page/page_reveal.dart b/lib/views/fourth_page/page_reveal.dart deleted file mode 100644 index 4cd5a48a..00000000 --- a/lib/views/fourth_page/page_reveal.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'dart:math'; - -import 'package:flutter/material.dart'; - -class PageReveal extends StatelessWidget { - - final double revealPercent; - final Widget child; - - PageReveal({ - this.revealPercent, - this.child - }); - - @override - Widget build(BuildContext context) { - return ClipOval( - clipper: new CircleRevealClipper(revealPercent), - child: child, - ); - } -} - -class CircleRevealClipper extends CustomClipper{ - - final double revealPercent; - - - CircleRevealClipper( - this.revealPercent - ); - - @override - Rect getClip(Size size) { - - final epicenter = new Offset(size.width / 2, size.height * 0.9); - - double theta = atan(epicenter.dy / epicenter.dx); - final distanceToCorner = epicenter.dy / sin(theta); - - final radius = distanceToCorner * revealPercent; - final diameter = 2 * radius; - - return new Rect.fromLTWH(epicenter.dx - radius, epicenter.dy - radius, diameter, diameter); - } - - @override - bool shouldReclip(CustomClipper oldClipper) { - return true; - } - -} \ No newline at end of file diff --git a/lib/views/fourth_page/pager_indicator.dart b/lib/views/fourth_page/pager_indicator.dart deleted file mode 100644 index c3aa7438..00000000 --- a/lib/views/fourth_page/pager_indicator.dart +++ /dev/null @@ -1,157 +0,0 @@ -import 'dart:ui'; - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/views/fourth_page/pages.dart'; - -class PagerIndicator extends StatelessWidget { - - final PagerIndicatorViewModel viewModel; - - PagerIndicator({ - this.viewModel, - }); - - @override - Widget build(BuildContext context) { - - List bubbles = []; - for(var i = 0; i < viewModel.pages.length; ++i ){ - final page = viewModel.pages[i]; - - var percentActive; - - if(i == viewModel.activeIndex){ - percentActive = 1.0 - viewModel.slidePercent; - } else if (i == viewModel.activeIndex - 1 && viewModel.slideDirection == SlideDirection.leftToRight){ - percentActive = viewModel.slidePercent; - } else if (i == viewModel.activeIndex + 1 && viewModel.slideDirection == SlideDirection.rightToLeft){ - percentActive = viewModel.slidePercent; - }else { - percentActive = 0.0; - } - - bool isHollow = i > viewModel.activeIndex || (i == viewModel.activeIndex && viewModel.slideDirection == SlideDirection.leftToRight); - - - - bubbles.add( - new PageBubble( - viewModel: new PageBubbleViewModel( - page.iconAssetPath, - page.color, - isHollow, - percentActive, - ), - ), - ); - } - - final bubbleWidth = 55.0 ; - final baseTranslation = ((viewModel.pages.length * bubbleWidth) / 2) - (bubbleWidth / 2) ; - var translation = baseTranslation - (viewModel.activeIndex * bubbleWidth); - - if (viewModel.slideDirection == SlideDirection.leftToRight){ - translation = bubbleWidth * viewModel.slidePercent + translation; - }else if (viewModel.slideDirection == SlideDirection.rightToLeft){ - translation = bubbleWidth * viewModel.slidePercent - translation; - } - - return new Column( - children: [ - new Expanded(child: new Container()), - new Transform( - transform: new Matrix4.translationValues(0, 0.0, 0.0), - child: new Row( - mainAxisAlignment: MainAxisAlignment.center, - children: bubbles, - ), - ), - ], - ); - } -} - -enum SlideDirection{ - leftToRight, - rightToLeft, - none, -} - - -class PagerIndicatorViewModel{ - final List pages; - final int activeIndex; - final SlideDirection slideDirection; - final double slidePercent; - - PagerIndicatorViewModel( - this.pages, - this.activeIndex, - this.slideDirection, - this.slidePercent - ); - - -} - -class PageBubble extends StatelessWidget { - - final PageBubbleViewModel viewModel; - - - PageBubble({ - this.viewModel - }); - - @override - Widget build(BuildContext context) { - return new Container( - width: 55.0, - height: 65.0, - child: new Center( - child: new Container( - width: lerpDouble(20.0,45.0,viewModel.activePercent), - height: lerpDouble(20.0,45.0,viewModel.activePercent), - decoration: new BoxDecoration( - shape: BoxShape.circle, - color: viewModel.isHollow - ? const Color(0x88FFFFFF).withAlpha(0x88 * viewModel.activePercent.round()) - : const Color(0x88FFFFFF), - border: new Border.all( - color: viewModel.isHollow - ? const Color(0x88FFFFFF).withAlpha((0x88 * (1.0 - viewModel.activePercent)).round()) - : Colors.transparent, - width: 3.0, - ), - ), - child: new Opacity( - opacity: viewModel.activePercent, - child: Image.asset( - viewModel.iconAssetPath, - color: viewModel.color, - ), - ), - ), - ), - ); - } -} - - -class PageBubbleViewModel { - final String iconAssetPath; - final Color color; - final bool isHollow; - final double activePercent; - - PageBubbleViewModel ( - this.iconAssetPath, - this.color, - this.isHollow, - this.activePercent, - ); - - -} - diff --git a/lib/views/fourth_page/pages.dart b/lib/views/fourth_page/pages.dart deleted file mode 100644 index 5d088e07..00000000 --- a/lib/views/fourth_page/pages.dart +++ /dev/null @@ -1,171 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../../routers/application.dart'; -import '../../routers/routers.dart'; -import '../../utils/shared_preferences.dart'; - -final pages = [ - PageViewModel( - const Color(0xFFcd344f), - //'assets/mountain.png', - 'assets/images/p2.png', - 'FlutterGo是什么?', - '【FlutterGo】 是由"阿里拍卖"前端团队几位 Flutter 粉丝,用业余时间开发的一款,用于 Flutter 教学帮助的App,这里没有高大尚的概念,只有一个一个亲历的尝试,用最直观的方式展示的 Flutter 官方demo', - 'assets/images/plane.png'), - PageViewModel( - const Color(0xFF638de3), - //'assets/world.png', - 'assets/images/p1.png', - 'FLutterGo的背景', - '🐢 官网文档示例较不够健全,不够直观\n🐞 运行widget demo要到处翻阅资料\n🐌 英文文档翻译生涩难懂,学习资料太少\n🚀 需要的效果不知道用哪个widget\n', - 'assets/images/calendar.png'), - PageViewModel( - const Color(0xFFFF682D), - //'assets/home.png', - 'assets/images/p3.png', - 'FlutterGo的特点', - '🐡 详解常用widget多达 140+ 个\n🦋 持续迭代追新官方版本\n🐙 配套Demo详解widget用法\n🚀 一站式搞定所有常用widget,开箱即查\n', - 'assets/images/house.png', - ), -]; -SpUtil sp; - -class Page extends StatelessWidget { - final PageViewModel viewModel; - final double percentVisible; - Page({ - this.viewModel, - this.percentVisible = 1.0, - }); - _goHomePage(context) { - Navigator.of(context) - .pushNamedAndRemoveUntil('/home', (Route route) => false); - } - - Widget creatButton( - BuildContext context, String txt, IconData iconName, String type) { - return RaisedButton.icon( - onPressed: () async { - if (type == 'start') { - await SpUtil.getInstance() - ..putBool(SharedPreferencesKeys.showWelcome, false); - _goHomePage(context); - } else if (type == 'goGithub') { - Application.router.navigateTo(context, - '${Routes.webViewPage}?title=${Uri.encodeComponent(txt)} Doc&&url=${Uri.encodeComponent("https://github.com/alibaba/flutter-go")}'); - } - }, - elevation: 10.0, - color: Colors.black26, - // shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(20.0))), - //如果不手动设置icon和text颜色,则默认使用foregroundColor颜色 - icon: Icon(iconName, color: Colors.white, size: 14.0), - label: Text( - txt, - maxLines: 1, - style: TextStyle( - color: Colors.white, fontSize: 14, fontWeight: FontWeight.w700), - )); - } - - @override - Widget build(BuildContext context) { - return Stack( - //alignment: const Alignment(1.2, 0.6), - children: [ - Container( - width: double.infinity, - /// height:MediaQuery.of(context).size.height-200.0, - color: viewModel.color, - padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - child: Opacity( - opacity: percentVisible, - child: ListView( - children: [ - layout(context), - ], - ), - ) - ), - Positioned( - right: -5.0, - top: 2.0, - child: creatButton(context, 'GitHub', Icons.arrow_forward, 'goGithub') - ), - ] - ); - } - - Column layout(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Transform( - transform: Matrix4.translationValues( - 0.0, 50.0 * (1.0 - percentVisible), 0.0), - child: Padding( - padding: EdgeInsets.only(top: 20.0, bottom: 10.0), - child: Image.asset(viewModel.heroAssetPath, - width: 160.0, height: 160.0), - ), - ), - Transform( - transform: Matrix4.translationValues( - 0.0, 30.0 * (1.0 - percentVisible), 0.0), - child: Padding( - padding: EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Text( - viewModel.title, - style: TextStyle( - color: Colors.white, - fontFamily: 'FlamanteRoma', - fontSize: 28.0, - ), - ), - ), - ), - Transform( - transform: Matrix4.translationValues( - 0.0, 30.0 * (1.0 - percentVisible), 0.0), - child: Padding( - padding: EdgeInsets.only(bottom: 10.0), - child: Text( - viewModel.body, - textAlign: TextAlign.center, - style: TextStyle( - height: 1.2, - color: Colors.white, - fontFamily: 'FlamanteRomaItalic', - fontSize: 18.0, - ), - ), - ), - ), -// ButtonBar( -// alignment: MainAxisAlignment.center, -// children: [ -// creatButton(context, '开始使用', Icons.add_circle_outline, 'start'), -// creatButton(context, 'GitHub', Icons.arrow_forward, 'goGithub'), -// ], -// ) - ]); - } -} - -class PageViewModel { - final Color color; - final String heroAssetPath; - final String title; - final String body; - final String iconAssetPath; - - PageViewModel( - this.color, - this.heroAssetPath, - this.title, - this.body, - this.iconAssetPath, - ); -} diff --git a/lib/views/home.dart b/lib/views/home.dart deleted file mode 100644 index c0f63681..00000000 --- a/lib/views/home.dart +++ /dev/null @@ -1,154 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 16/01/2019 -/// Time: 11:16 -/// email: sanfan.hx@alibaba-inc.com -/// target: app首页 - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter_go/utils/shared_preferences.dart'; -import 'package:flutter_go/views/first_page/first_page.dart'; -import 'package:flutter_go/views/first_page/main_page.dart'; -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/collection_page/collection_page.dart'; -import 'package:flutter_go/routers/application.dart'; -import 'package:flutter_go/utils/provider.dart'; -import 'package:flutter_go/model/widget.dart'; -import 'package:flutter_go/widgets/index.dart'; -import 'package:flutter_go/components/search_input.dart'; -import 'package:flutter_go/model/search_history.dart'; -import 'package:flutter_go/resources/widget_name_to_icon.dart'; - -const int ThemeColor = 0xFFC91B3A; - -class AppPage extends StatefulWidget { - @override - State createState() { - return _MyHomePageState(); - } -} - -class _MyHomePageState extends State - with SingleTickerProviderStateMixin { - SpUtil sp; - WidgetControlModel widgetControl = new WidgetControlModel(); - SearchHistoryList searchHistoryList; - bool isSearch = false; - String appBarTitle = tabData[0]['text']; - List list = List(); - int _currentIndex = 0; - static List tabData = [ - {'text': '业界动态', 'icon': Icon(Icons.language)}, - {'text': 'WIDGET', 'icon': Icon(Icons.extension)}, - {'text': '组件收藏', 'icon': Icon(Icons.favorite)}, - {'text': '关于手册', 'icon': Icon(Icons.import_contacts)} - ]; - - List myTabs = []; - - @override - void initState() { - super.initState(); - initSearchHistory(); - for (int i = 0; i < tabData.length; i++) { - myTabs.add(BottomNavigationBarItem( - icon: tabData[i]['icon'], - title: Text( - tabData[i]['text'], - ), - )); - } - list -// ..add(FirstPage()) - ..add(MainPage()) - ..add(WidgetPage(Provider.db)) - ..add(CollectionPage()) - ..add(FourthPage()); - } - - @override - void dispose() { - super.dispose(); - } - - initSearchHistory() async { - sp = await SpUtil.getInstance(); - String json = sp.getString(SharedPreferencesKeys.searchHistory); - print("json $json"); - searchHistoryList = SearchHistoryList.fromJSON(json); - } - - void onWidgetTap(WidgetPoint widgetPoint, BuildContext context) { - List widgetDemosList = new WidgetDemoList().getDemos(); - String targetName = widgetPoint.name; - String targetRouter = '/category/error/404'; - widgetDemosList.forEach((item) { - if (item.name == targetName) { - targetRouter = item.routerName; - } - }); - searchHistoryList - .add(SearchHistory(name: targetName, targetRouter: targetRouter)); - print("searchHistoryList1 ${searchHistoryList.toString()}"); - print("searchHistoryList2 ${targetRouter}"); - print("searchHistoryList3 ${widgetPoint.name}"); - Application.router.navigateTo(context, "$targetRouter"); - } - - Widget buildSearchInput(BuildContext context) { - return new SearchInput((value) async { - if (value != '') { - List list = await widgetControl.search(value); - return list - .map((item) => new MaterialSearchResult( - value: item.name, - icon: WidgetName2Icon.icons[item.name] ?? null, - text: 'widget', - onTap: () { - onWidgetTap(item, context); - }, - )) - .toList(); - } else { - return null; - } - }, (value) {}, () {}); - } - - renderAppBar(BuildContext context,Widget widget,int index) { - print('renderAppBar=====>>>>>>${index}'); - if(index == 0) { - return null; - } - return AppBar(title: buildSearchInput(context)); - } - - @override - Widget build(BuildContext context) { - return new Scaffold( - appBar: renderAppBar(context,widget,_currentIndex), - body: list[_currentIndex], - bottomNavigationBar: BottomNavigationBar( - items: myTabs, - //高亮 被点击高亮 - currentIndex: _currentIndex, - //修改 页面 - onTap: _ItemTapped, - //shifting :按钮点击移动效果 - //fixed:固定 - type: BottomNavigationBarType.fixed, - - fixedColor: Color(0xFFC91B3A), - ), - ); - } - - void _ItemTapped(int index) { - setState(() { - _currentIndex = index; - appBarTitle = tabData[index]['text']; - }); - } -} diff --git a/lib/views/login_page/login_page.dart b/lib/views/login_page/login_page.dart deleted file mode 100644 index 0e658ec8..00000000 --- a/lib/views/login_page/login_page.dart +++ /dev/null @@ -1,295 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:flutter_go/utils/data_utils.dart'; -import 'package:flutter_go/views/home.dart'; - -import 'package:flutter_go/model/user_info_cache.dart'; - -class LoginPage extends StatefulWidget { - @override - _LoginPageState createState() => _LoginPageState(); -} - -class _LoginPageState extends State { - // 利用FocusNode和_focusScopeNode来控制焦点 可以通过FocusNode.of(context)来获取widget树中默认的_focusScopeNode - FocusNode _emailFocusNode = new FocusNode(); - FocusNode _passwordFocusNode = new FocusNode(); - FocusScopeNode _focusScopeNode = new FocusScopeNode(); - UserInfoControlModel _userInfoControlModel = new UserInfoControlModel(); - - GlobalKey _signInFormKey = new GlobalKey(); - TextEditingController _userNameEditingController = - new TextEditingController(); - TextEditingController _passwordEditingController = - new TextEditingController(); - - bool isShowPassWord = false; - String username = ''; - String password = ''; - bool isLoading = false; - - @override - void initState() { - super.initState(); - try { - _userInfoControlModel.getAllInfo().then((list) { - if (list.length > 0) { - UserInfo _userInfo = list[0]; - print('获取的数据:${_userInfo.username} ${_userInfo.password}'); - setState(() { - _userNameEditingController.text = _userInfo.username; - _passwordEditingController.text = _userInfo.password; - username = _userInfo.username; - password = _userInfo.password; - }); - } - }); - } catch (err) { - print('读取用户本地存储的用户信息出错 $err'); - } - } - -// 创建登录界面的TextForm - Widget buildSignInTextForm() { - return new Container( - decoration: new BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - width: MediaQuery.of(context).size.width * 0.8, - height: 190, - // * Flutter提供了一个Form widget,它可以对输入框进行分组,然后进行一些统一操作,如输入内容校验、输入框重置以及输入内容保存。 - child: new Form( - key: _signInFormKey, - child: new Column( - mainAxisSize: MainAxisSize.min, - children: [ - Flexible( - child: Padding( - padding: const EdgeInsets.only( - left: 25, right: 25, top: 20, bottom: 20), - child: new TextFormField( - controller: _userNameEditingController, - //关联焦点 - focusNode: _emailFocusNode, - onEditingComplete: () { - if (_focusScopeNode == null) { - _focusScopeNode = FocusScope.of(context); - } - _focusScopeNode.requestFocus(_passwordFocusNode); - }, - - decoration: new InputDecoration( - icon: new Icon( - Icons.email, - color: Colors.black, - ), - hintText: "Github 登录名", - border: InputBorder.none), - style: new TextStyle(fontSize: 16, color: Colors.black), - //验证 - validator: (value) { - if (value.isEmpty) { - return "登录名不可为空!"; - } - }, - onSaved: (value) { - setState(() { - username = value; - }); - }, - ), - ), - ), - new Container( - height: 1, - width: MediaQuery.of(context).size.width * 0.75, - color: Colors.grey[400], - ), - Flexible( - child: Padding( - padding: const EdgeInsets.only(left: 25, right: 25, top: 20), - child: new TextFormField( - controller: _passwordEditingController, - focusNode: _passwordFocusNode, - decoration: new InputDecoration( - icon: new Icon( - Icons.lock, - color: Colors.black, - ), - hintText: "Github 登录密码", - border: InputBorder.none, - suffixIcon: new IconButton( - icon: new Icon( - Icons.remove_red_eye, - color: Colors.black, - ), - onPressed: showPassWord, - ), - ), - //输入密码,需要用*****显示 - obscureText: !isShowPassWord, - style: new TextStyle(fontSize: 16, color: Colors.black), - validator: (value) { - if (value == null || value.isEmpty) { - return "密码不可为空!"; - } - }, - onSaved: (value) { - setState(() { - password = value; - }); - }, - ), - ), - ), - new Container( - height: 1, - width: MediaQuery.of(context).size.width * 0.75, - color: Colors.grey[400], - ), - ], - ), - ), - ); - } - - Widget buildSignInButton() { - return new GestureDetector( - child: new Container( - padding: EdgeInsets.only(left: 42, right: 42, top: 10, bottom: 10), - decoration: new BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Theme.of(context).primaryColor), - child: new Text( - "LOGIN", - style: new TextStyle(fontSize: 25, color: Colors.white), - ), - ), - onTap: () { - // 利用key来获取widget的状态FormState,可以用过FormState对Form的子孙FromField进行统一的操作 - if (_signInFormKey.currentState.validate()) { - // 如果输入都检验通过,则进行登录操作 - // Scaffold.of(context) - // .showSnackBar(new SnackBar(content: new Text("执行登录操作"))); - //调用所有自孩子的save回调,保存表单内容 - doLogin(); - } - }, - ); - } - - // 登陆操作 - doLogin() { - _signInFormKey.currentState.save(); - setState(() { - isLoading = true; - }); - DataUtils.doLogin({'username': username, 'password': password}) - .then((result) { - print(result); - setState(() { - isLoading = false; - }); - try { - _userInfoControlModel.deleteAll().then((result) { - // print('删除结果:$result'); - _userInfoControlModel - .insert(UserInfo(password: password, username: username)) - .then((value) { - // print('存储成功:$value'); - Navigator.of(context).pushAndRemoveUntil( - new MaterialPageRoute(builder: (context) => AppPage()), - (route) => route == null); - }); - }); - } catch (err) { - Navigator.of(context).pushAndRemoveUntil( - new MaterialPageRoute(builder: (context) => AppPage()), - (route) => route == null); - } - }).catchError((onError) { - print(onError); - setState(() { - isLoading = false; - }); - }); - } - -// 点击控制密码是否显示 - void showPassWord() { - setState(() { - isShowPassWord = !isShowPassWord; - }); - } - - Widget buildLoading() { - if (isLoading) { - return Opacity( - opacity: .5, - child: Container( - width: MediaQuery.of(context).size.width * 0.85, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(8.0)), - color: Colors.black, - ), - child: SpinKitPouringHourglass(color: Colors.white), - ), - ); - } - return Container(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height, - width: MediaQuery.of(context).size.width, - color: Theme.of(context).primaryColor, - child: Center( - child: Container( - width: MediaQuery.of(context).size.width * 0.85, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(8.0)), - color: Colors.white, - image: DecorationImage( - image: AssetImage( - 'assets/images/paimaiLogo.png', - ), - fit: BoxFit.scaleDown, - alignment: Alignment.bottomRight, - ), - ), - child: Stack( - children: [ - Column( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox(height: 35.0), - Image.asset( - 'assets/images/FlutterGo.png', - fit: BoxFit.contain, - width: 100.0, - height: 100.0, - ), - buildSignInTextForm(), - buildSignInButton(), - SizedBox(height: 35.0), - ], - ), - Positioned( - top: 0, - left: 0, - bottom: 0, - child: buildLoading(), - ) - ], - ), - ), - ), - ), - ), - ); - } -} diff --git a/lib/views/web_page/web_view_page.dart b/lib/views/web_page/web_view_page.dart deleted file mode 100644 index df3793a5..00000000 --- a/lib/views/web_page/web_view_page.dart +++ /dev/null @@ -1,122 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2019-01-14 17:44:47 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-14 19:47:14 - -import 'dart:core'; - -import 'package:flutter/material.dart'; -import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; - -import 'package:flutter_go/model/collection.dart'; -import 'package:flutter_go/event/event_bus.dart'; -import 'package:flutter_go/event/event_model.dart'; - -class WebViewPage extends StatefulWidget { - final String url; - final String title; - - WebViewPage(this.url, this.title); - _WebViewPageState createState() => _WebViewPageState(); -} - -class _WebViewPageState extends State { - bool _hasCollected = false; - String _router = ''; - var _collectionIcons; - CollectionControlModel _collectionControl = new CollectionControlModel(); - - final GlobalKey _scaffoldKey = GlobalKey(); - @override - void initState() { - super.initState(); - _collectionControl - .getRouterByName(Uri.encodeComponent(widget.title.trim())) - .then((list) { - list.forEach((item) { - if (widget.title.trim() == item['name']) { - _router = item['router']; - } - }); - if (mounted) { - setState(() { - _hasCollected = list.length > 0; - }); - } - }); - } - - // 点击收藏按钮 - _getCollection() { - if (_hasCollected) { - // 删除操作 - _collectionControl - .deleteByName(Uri.encodeComponent(widget.title.trim())) - .then((result) { - if (result > 0 && this.mounted) { - setState(() { - _hasCollected = false; - }); - _scaffoldKey.currentState - .showSnackBar(SnackBar(content: Text('已取消收藏'))); - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, true)); - } - return; - } - print('删除错误'); - }); - } else { - // 插入操作 - _collectionControl - .insert(Collection( - name: Uri.encodeComponent(widget.title.trim()), - router: widget.url)) - .then((result) { - if (this.mounted) { - setState(() { - _hasCollected = true; - }); - - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, false)); - } - _scaffoldKey.currentState - .showSnackBar(SnackBar(content: Text('收藏成功'))); - } - }); - } - } - - @override - Widget build(BuildContext context) { - if (_hasCollected) { - _collectionIcons = Icons.favorite; - } else { - _collectionIcons = Icons.favorite_border; - } - return Scaffold( - key: _scaffoldKey, - appBar: AppBar( - title: Text(widget.title), - actions: [ - new IconButton( - tooltip: 'goBack home', - onPressed: _getCollection, - icon: Icon( - _collectionIcons, - ), - ), - ], - ), - body: WebviewScaffold( - url: widget.url, - withZoom: false, - withLocalStorage: true, - withJavascript: true, - ), - ); - } -} diff --git a/lib/views/welcome_page/fourth_page.dart b/lib/views/welcome_page/fourth_page.dart deleted file mode 100644 index 57e0af06..00000000 --- a/lib/views/welcome_page/fourth_page.dart +++ /dev/null @@ -1,123 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter_go/views/fourth_page/page_dragger.dart'; -import 'package:flutter_go/views/fourth_page/page_reveal.dart'; -import 'package:flutter_go/views/fourth_page/pager_indicator.dart'; -import 'package:flutter_go/views/fourth_page/pages.dart'; - -class FourthPage extends StatefulWidget { - @override - FourthPageState createState() => new FourthPageState(); -} - -class FourthPageState extends State with TickerProviderStateMixin { - StreamController slideUpdateStream; - AnimatedPageDragger animatedPageDragger; - - int activeIndex = 0; - SlideDirection slideDirection = SlideDirection.none; - int nextPageIndex = 0; - int waitingNextPageIndex = -1; - - double slidePercent = 0.0; - - FourthPageState() { - slideUpdateStream = new StreamController(); - - slideUpdateStream.stream.listen((SlideUpdate event) { - if (mounted) { - setState(() { - if (event.updateType == UpdateType.dragging) { - slideDirection = event.direction; - slidePercent = event.slidePercent; - - if (slideDirection == SlideDirection.leftToRight) { - nextPageIndex = activeIndex - 1; - } else if (slideDirection == SlideDirection.rightToLeft) { - nextPageIndex = activeIndex + 1; - } else { - nextPageIndex = activeIndex; - } - } else if (event.updateType == UpdateType.doneDragging) { - if (slidePercent > 0.5) { - animatedPageDragger = new AnimatedPageDragger( - slideDirection: slideDirection, - transitionGoal: TransitionGoal.open, - slidePercent: slidePercent, - slideUpdateStream: slideUpdateStream, - vsync: this, - ); - } else { - animatedPageDragger = new AnimatedPageDragger( - slideDirection: slideDirection, - transitionGoal: TransitionGoal.close, - slidePercent: slidePercent, - slideUpdateStream: slideUpdateStream, - vsync: this, - ); - - waitingNextPageIndex = activeIndex; - } - - animatedPageDragger.run(); - } else if (event.updateType == UpdateType.animating) { - slideDirection = event.direction; - slidePercent = event.slidePercent; - } else if (event.updateType == UpdateType.doneAnimating) { - if (waitingNextPageIndex != -1) { - nextPageIndex = waitingNextPageIndex; - waitingNextPageIndex = -1; - } else { - activeIndex = nextPageIndex; - } - - slideDirection = SlideDirection.none; - slidePercent = 0.0; - - animatedPageDragger.dispose(); - } - }); - } - }); - } - - @override - void dispose() { - super.dispose(); - slideUpdateStream.close(); - } - - @override - Widget build(BuildContext context) { - return new Stack( - children: [ - new Page( - // page 的主要内容 - viewModel: pages[activeIndex], - percentVisible: 1.0, - ), - new PageReveal( - revealPercent: slidePercent, - child: new Page( - viewModel: pages[nextPageIndex], - percentVisible: slidePercent, - ), - ), - new PagerIndicator( - viewModel: new PagerIndicatorViewModel( - pages, - activeIndex, - slideDirection, - slidePercent, - ), - ), - new PageDragger( - canDragLeftToRight: activeIndex > 0, - canDragRightToLeft: activeIndex < pages.length - 1, - slideUpdateStream: this.slideUpdateStream, - ) - ], - ); - } -} diff --git a/lib/views/welcome_page/index.dart b/lib/views/welcome_page/index.dart deleted file mode 100644 index 36576bcb..00000000 --- a/lib/views/welcome_page/index.dart +++ /dev/null @@ -1,31 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 14/01/2019 -/// Time: 23:00 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -import 'package:flutter_go/views/welcome_page/fourth_page.dart'; - -class WelcomePage extends StatefulWidget { - WelcomePage({Key key}) : super(key: key); - - @override - _WelcomePageState createState() { - return new _WelcomePageState(); - } -} - -class _WelcomePageState extends State { - - @override - Widget build(BuildContext context) { - return new Container( - color: Colors.white, - child: FourthPage() - ); - } -} diff --git a/lib/views/widget_page/widget_page.dart b/lib/views/widget_page/widget_page.dart deleted file mode 100644 index dc6b0014..00000000 --- a/lib/views/widget_page/widget_page.dart +++ /dev/null @@ -1,76 +0,0 @@ -/// Author: 一凨 -/// Date: 2019-01-11 14:39:48 -/// Last Modified by: 一凨 -/// Last Modified time: 2019-01-11 14:40:09 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/cate_card.dart'; -import 'package:flutter_go/model/cat.dart'; - -class WidgetPage extends StatefulWidget { - final db; - final CatControlModel catModel; - WidgetPage(this.db) - : catModel = new CatControlModel(), - super(); - - @override - SecondPageState createState() => new SecondPageState(catModel); -} - -class SecondPageState extends State with AutomaticKeepAliveClientMixin{ - CatControlModel catModel; - SecondPageState(this.catModel) : super(); - - TextEditingController controller; - String active = 'test'; - String data = '无'; - - List categories = []; - - @override - bool get wantKeepAlive => true; - - @override - void initState() { - super.initState(); - renderCats(); - } - - void renderCats() { - catModel.getList().then((List data) { - if (data.isNotEmpty) { - setState(() { - categories = data; - }); - } - }); - } - - Widget buildGrid() { - // 存放最后的widget - List tiles = []; - for (Cat item in categories) { - tiles.add(new CateCard(category: item)); - } - return new ListView( - children: tiles, - ); - } - - @override - Widget build(BuildContext context) { - super.build(context); - if (categories.length == 0) { - return ListView( - children: [new Container()], - ); - } - return Container( - color: Theme.of(context).backgroundColor, - child: this.buildGrid(), - ); - } - -} diff --git a/lib/widgets/404.dart b/lib/widgets/404.dart deleted file mode 100644 index 52149ac3..00000000 --- a/lib/widgets/404.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter/material.dart'; - -class WidgetNotFound extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("widget not found"), - ), - body: Container( - child: Text("widget not found") - ) - ); - } -} diff --git a/lib/widgets/components/Bar/AppBar/demo.dart b/lib/widgets/components/Bar/AppBar/demo.dart deleted file mode 100644 index a2eb5bd0..00000000 --- a/lib/widgets/components/Bar/AppBar/demo.dart +++ /dev/null @@ -1,129 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午7:33 -/// email: zhu.yan@alibaba-inc.com -/// target: AppBar 的示例 - -import 'package:flutter/material.dart'; - -// 默认 AppBar 的实例 -// index 当前AppBar 的索引值 - -class AppBarLessDefaultComplex extends StatefulWidget { - const AppBarLessDefaultComplex() : super(); - - @override - State createState() => _AppBarLessDefaultComplex(); -} - -// AppBar 默认的实例,有状态 -class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixin { - ScrollController _scrollViewController; - TabController _tabController; - - @override - void initState() { - super.initState(); - _scrollViewController = ScrollController(); - _tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应 - } - - @override - void dispose() { - _scrollViewController.dispose(); - _tabController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 - // 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。 - // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。 - return SizedBox( - height: 500, - child: AppBar( // 大量配置属性参考 SliverAppBar 示例 - title: Text('title'), - leading: Icon(Icons.home), - backgroundColor: Colors.amber[500], - centerTitle: true, - actions: [ - IconButton( - icon: Icon(Icons.add_alarm), - tooltip: 'Add Alarm', - onPressed: () { - // do nothing - }), - PopupMenuButton( - itemBuilder: (BuildContext context) => >[ - PopupMenuItem( - value: "price", child: Text('Sort by price')), - PopupMenuItem( - value: "time", child: Text('Sort by time')), - ], - onSelected: (String action) { - switch (action) { - case "price": - // do nothing - break; - case "time": - // do nothing - break; - } - }) - ], - bottom: TabBar( - isScrollable: true, - controller: _tabController, - tabs: [ - Tab(text: "Tabs 1"), - Tab(text: "Tabs 2"), - Tab(text: "Tabs 3"), - Tab(text: "Tabs 4"), - Tab(text: "Tabs 5"), - Tab(text: "Tabs 6"), - ], - ), - ), - ); - } -} - - -// AppBar 默认的实例,无状态 - -class AppBarLessDefaultSimple extends StatelessWidget { - final widget; - final parent; - - const AppBarLessDefaultSimple([this.widget, this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - return SizedBox( - height: 200, - child:AppBar( - title: Text('My Fancy Dress'), - actions: [ - IconButton( - icon: Icon(Icons.playlist_play), - tooltip: 'Air it', - onPressed: ()=>{}, - ), - IconButton( - icon: Icon(Icons.playlist_add), - tooltip: 'Restitch it', - onPressed: ()=>{}, - ), - IconButton( - icon: Icon(Icons.playlist_add_check), - tooltip: 'Repair it', - onPressed: ()=>{}, - ), - ], - ) - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Bar/AppBar/index.dart b/lib/widgets/components/Bar/AppBar/index.dart deleted file mode 100644 index dac6d0b6..00000000 --- a/lib/widgets/components/Bar/AppBar/index.dart +++ /dev/null @@ -1,71 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午7:30 -/// email: zhu.yan@alibaba-inc.com -/// target: AppBar 的示例 - -import 'package:flutter/material.dart'; - -import './demo.dart' as AppBarDemo; -import 'package:flutter_go/components/widget_demo.dart'; - -const String _Text0 = -"""### **简介** -> AppBar “应用栏” -- 应用栏由工具栏组成,或者是工具栏和其他 widget 组合形成,例如 TabBar和FlexibleSpaceBar; -- 应用栏通常用于 Scaffold.appBar 属性,该属性将应用栏放置在屏幕顶部的固定高度小部件中; -- 对于可滚动的应用栏,请参阅SliverAppBar,它将AppBar嵌入 sliver 中以便在CustomScrollView中使用; -"""; - - -const String _Text1 = -"""### **基本用法** -> AppBar -- AppBar 在底部上方显示工具栏 widget,前导 leading ,标题 title 和操作 actions; -"""; - -const String _Text2 = -"""### **进阶用法** -> AppBar -- 一个完整的 AppBar 的例子, 增加 PopupMenuButton,TabBar 的示例子; -- 所述底部通常用于一个的 TabBar; -- 如果指定了 flexibleSpace 窗口 widget,则它将堆叠在工具栏和底部窗口 widget 后面; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Bar/AppBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'AppBar', - codeUrl: 'components/Bar/AppBar/demo.dart', - contentList: allDomes(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/AppBar-class.html', - ); - } -} - -// 所有的 AppBar widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDomes(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - AppBarDemo.AppBarLessDefaultSimple(), - SizedBox(height: 20.0), // 间距 - _Text2, - SizedBox(height: 20.0), // 间距 - AppBarDemo.AppBarLessDefaultComplex(), - SizedBox(height: 20.0), // 间距 - ]; -} diff --git a/lib/widgets/components/Bar/BottomAppBar/demo.dart b/lib/widgets/components/Bar/BottomAppBar/demo.dart deleted file mode 100644 index 5473e0da..00000000 --- a/lib/widgets/components/Bar/BottomAppBar/demo.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午8:56 -/// email: zhu.yan@alibaba-inc.com -/// target: BottomAppBar 的示例 - -import 'package:flutter/material.dart'; - -// AppBar 默认的实例,无状态 -class AppBarLessDefaultSimple extends StatelessWidget { - final widget; - final parent; - - const AppBarLessDefaultSimple([this.widget, this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - return SizedBox( - height: 100, - child: Scaffold( - //appBar: AppBar(title: const Text('Bottom App Bar')), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - floatingActionButton: FloatingActionButton( - child: const Icon(Icons.add), onPressed: () {},), - bottomNavigationBar: BottomAppBar( - shape: CircularNotchedRectangle(), - notchMargin: 10.0,// FloatingActionButton和BottomAppBar 之间的差距 - color:Colors.pink, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton(icon: Icon(Icons.menu), onPressed: () {},), - IconButton(icon: Icon(Icons.search), onPressed: () {},), - ], - ), - ), - ) - ); -}} \ No newline at end of file diff --git a/lib/widgets/components/Bar/BottomAppBar/index.dart b/lib/widgets/components/Bar/BottomAppBar/index.dart deleted file mode 100644 index 132e2ef1..00000000 --- a/lib/widgets/components/Bar/BottomAppBar/index.dart +++ /dev/null @@ -1,61 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午8:53 -/// email: zhu.yan@alibaba-inc.com -/// target: BottomAppBar 的示例 - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'package:flutter/material.dart'; - -import './demo.dart' as BottomAppBarDemo; - -const String _Text0 = -"""### **简介** -> BottomAppBar “底部应用栏” -- 一个通常与 Scaffold.bottomNavigationBar 一起使用的容器,可以在顶部有一个凹口,为重叠的FloatingActionButton腾出空间; -"""; - - -const String _Text1 = -"""### **基本用法** -> 通常与 Scaffold 和 FloatingActionButton 一起使用; -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components//Bar/BottomAppBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'BottomAppBar', - codeUrl: 'components/Bar/BottomAppBar/demo.dart', - contentList: allDomes(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html', - ); - } -} - -// 所有的 BottomAppBar widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDomes(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - BottomAppBarDemo.AppBarLessDefaultSimple(), - SizedBox(height: 20.0), // 间距 - ]; -} - - - diff --git a/lib/widgets/components/Bar/ButtonBar/demo.dart b/lib/widgets/components/Bar/ButtonBar/demo.dart deleted file mode 100644 index fb78c633..00000000 --- a/lib/widgets/components/Bar/ButtonBar/demo.dart +++ /dev/null @@ -1,66 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午11:11 -/// email: zhu.yan@alibaba-inc.com -/// target: ButtonBar 的示例 - -import 'package:flutter/material.dart'; - -// ButtonBar 默认的实例 -class ButtonBarFullDefault extends StatefulWidget { - const ButtonBarFullDefault() : super(); - - @override - State createState() => _ButtonBarFullDefault(); -} - -// ButtonBar 默认的实例,有状态 -class _ButtonBarFullDefault extends State { - @override - Widget build(BuildContext context) { - return ButtonBar( - // ... // 如果没有,就是不需要有状态的 StatefulWidget - ); - } -} - -// ButtonBar 默认的实例,无状态 -class ButtonBarLessDefault extends StatelessWidget { - final widget; - final parent; - - const ButtonBarLessDefault([this.widget, this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.symmetric(vertical: 0.0), - height: 100.0, - child: Scrollbar(child:ListView( - scrollDirection: Axis.horizontal, // 水平listView - children: [ - ButtonBar( - alignment: MainAxisAlignment.spaceAround, //布局方向,默认MainAxisAlignment.end - mainAxisSize: MainAxisSize.max, //主轴大小,默认MainAxisSize.max - children: [ // Button集合 - RaisedButton(child: Text('ButtonBar1'),color: Colors.red,onPressed: ()=>{},), - RaisedButton(child: Text('ButtonBar2'),color: Colors.red,onPressed: ()=>{},), - RaisedButton(child: Text('ButtonBar3'),color: Colors.red,onPressed: ()=>{},), - ], - ), - ButtonBar( - alignment: MainAxisAlignment.end, //布局方向,默认MainAxisAlignment.end - mainAxisSize: MainAxisSize.min, //主轴大小,默认MainAxisSize.max - children: [ // Button集合 - RaisedButton(child: Text('ButtonBar1'),color: Colors.yellow,onPressed: ()=>{},), - RaisedButton(child: Text('ButtonBar2'),color: Colors.yellow,onPressed: ()=>{},), - RaisedButton(child: Text('ButtonBar3'),color: Colors.yellow,onPressed: ()=>{},), - ], - ) - ] - ) - )); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Bar/ButtonBar/index.dart b/lib/widgets/components/Bar/ButtonBar/index.dart deleted file mode 100644 index 5078804c..00000000 --- a/lib/widgets/components/Bar/ButtonBar/index.dart +++ /dev/null @@ -1,61 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午11:10 -/// email: zhu.yan@alibaba-inc.com -/// target: ButtonBar 的示例 - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'package:flutter/material.dart'; - -import './demo.dart' as ButtonBarDemo; - -const String _Text0 = -"""### **简介** -> ButtonBar “末端对齐的按钮容器” -- 横排的Button布局 -"""; - - -const String _Text1 = -"""### **基本用法** -> 根据当前 ButtonTheme 中的填充水平放置 button -- 子 button 在布置行与 MainAxisAlignment.end; -- 当 Directionality为TextDirection.ltr 时,按钮栏的子项右对齐,最后一个子项成为最右边的子项; -- 当 Directionality TextDirection.rtl 时,子项被左对齐,最后一个子项成为最左边的子项; -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Bar/ButtonBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'ButtonBar', - codeUrl: 'components/Bar/ButtonBar/demo.dart', - contentList: allDomes(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/ButtonBar-class.html', - ); - } -} - -// 所有的 ButtonBar widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDomes(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - //SizedBox(height: 20.0), // 间距 - ButtonBarDemo.ButtonBarLessDefault() - ]; -} - diff --git a/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart b/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart deleted file mode 100644 index 5e5d9eaf..00000000 --- a/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart +++ /dev/null @@ -1,75 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午10:38 -/// email: zhu.yan@alibaba-inc.com -/// target: FlexibleSpaceBar 的示例 - -import 'package:flutter/material.dart'; - -// Checkbox 默认FlexibleSpaceBar的实例 -class FlexibleSpaceBarFullDefault extends StatefulWidget { - const FlexibleSpaceBarFullDefault() : super(); - - @override - State createState() => _FlexibleSpaceBarFullDefault(); -} - -// FlexibleSpaceBar 默认的实例,有状态 -class _FlexibleSpaceBarFullDefault extends State { - @override - Widget build(BuildContext context) { - return FlexibleSpaceBar( - // ... // 如果没有,就是不需要有状态的 StatefulWidget - ); - } -} - -// FlexibleSpaceBar 默认的实例,无状态 -class FlexibleSpaceBarLessDefault extends StatelessWidget { - final widget; - final parent; - - const FlexibleSpaceBarLessDefault([this.widget, this.parent]) : super(); - - @override - Widget build(BuildContext context) { - return SizedBox( - height: 300.0, - child: Scaffold( - body: NestedScrollView( - headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { - return [ - SliverAppBar( - expandedHeight: 150.0, - floating: false, - pinned: true, - flexibleSpace: FlexibleSpaceBar( - centerTitle: true, - title: Text("Collapsing Toolbar", - style: TextStyle( - color: Colors.white, - fontSize: 16.0, - )), - background: Image.network( - "https://images.pexels.com/photos/396547/pexels-photo-396547.jpeg?auto=compress&cs=tinysrgb&h=350", - fit: BoxFit.cover, - - /// 色彩叠加 UI可以理解为两个色彩涂层,在图片混合一个色层 - // color: Colors.redAccent, //混合的颜色 - // colorBlendMode: BlendMode.darken, //混合方式 - - ///图片重复填充容器 - // repeat: ImageRepeat.repeat, - )), - ), - ]; - }, - body: Center( - child: Text("向上提拉 ⬆ 查看效果..."), - ), - ), - )); - } -} diff --git a/lib/widgets/components/Bar/FlexibleSpaceBar/index.dart b/lib/widgets/components/Bar/FlexibleSpaceBar/index.dart deleted file mode 100644 index 078a25b3..00000000 --- a/lib/widgets/components/Bar/FlexibleSpaceBar/index.dart +++ /dev/null @@ -1,61 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午10:38 -/// email: zhu.yan@alibaba-inc.com -/// target: FlexibleSpaceBar 的示例 - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'package:flutter/material.dart'; - -import './demo.dart' as FlexibleSpaceBarDemo; - -const String _Text0 = -"""### **简介** -> FlexibleSpaceBar “扩展和折叠的应用栏” -- AppBar 的一部分,可以扩展和折叠; -"""; - - -const String _Text1 = -"""### **基本用法** -> 最常用于 SliverAppBar.flexibleSpace 字段 -- 灵活的空格键随着应用滚动而扩展和收缩,以便 AppBar 从应用程序的顶部到达应用程序滚动内容的顶部; -- 要调整 AppBar 大小,必须将其包装在 FlexibleSpaceBar.createSettings 返回的 widget 中 ,以将大小调整信息传递给 FlexibleSpaceBar; -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Bar/FlexibleSpaceBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'FlexibleSpaceBar', - codeUrl: 'components/Bar/FlexibleSpaceBar/demo.dart', - contentList: allDomes(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/FlexibleSpaceBar-class.html', - ); - } -} - -// 所有的 FlexibleSpaceBar widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDomes(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - FlexibleSpaceBarDemo.FlexibleSpaceBarLessDefault(), - SizedBox(height: 20.0), // 间距 - ]; -} - diff --git a/lib/widgets/components/Bar/SliverAppBar/demo.dart b/lib/widgets/components/Bar/SliverAppBar/demo.dart deleted file mode 100644 index dec30849..00000000 --- a/lib/widgets/components/Bar/SliverAppBar/demo.dart +++ /dev/null @@ -1,131 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午4:11 -/// email: zhu.yan@alibaba-inc.com -/// target: SliverAppBar 的示例 - -import 'package:flutter/material.dart'; - -// 默认 SliverAppBar 的实例 -class SliverAppBarFullDefault extends StatefulWidget { - const SliverAppBarFullDefault() : super(); - - @override - State createState() => _SliverAppBarFullDefault(); -} - -// SliverAppBar 默认的实例,有状态 -class _SliverAppBarFullDefault extends State { - @override - Widget build(BuildContext context) { - return SliverAppBar( - // ... // 如果没有,就是不需要有状态的 StatefulWidget - ); - } -} - -// SliverAppBar 默认的实例,无状态 -class SliverAppBarLessDefault extends StatelessWidget { -// final widget; -// final parent; -// const SliverAppBarLessDefault([this.widget, this.parent]) -// : super(); - - final List listData = []; - @override - Widget build(BuildContext context) { - for (int i = 0; i < 20; i++) { - listData.add( ListItem("我是测试标题$i", Icons.cake)); - } - return SizedBox( - height: 500.0, - child: NestedScrollView( - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { - return [ - SliverAppBar( - //leading, // 在标题前面显示的一个控件,在首页通常显示应用的 logo;在其他界面通常显示为返回按钮 - //title, // Toolbar 中主要内容,通常显示为当前界面的标题文字 - //actions, // 一个 Widget 列表,代表 Toolbar 中所显示的菜单,对于常用的菜单,通常使用 IconButton 来表示;对于不常用的菜单通常使用 PopupMenuButton 来显示为三个点,点击后弹出二级菜单 - //flexibleSpace, - //bottom, //底部内容区域 - //elevation, //阴影,纸墨设计中控件的 z 坐标顺序,默认值为 4,对于可滚动的 SliverAppBar,当 SliverAppBar 和内容同级的时候,该值为 0, 当内容滚动 SliverAppBar 变为 Toolbar 的时候,修改 elevation 的值 - //flexibleSpace:一个显示在 AppBar 下方的控件,高度和 AppBar 高度一样,可以实现一些特殊的效果,该属性通常在 SliverAppBar 中使用 - //backgroundColor, // 背景色,APP bar 的颜色,默认值为 ThemeData.primaryColor。改值通常和下面的三个属性一起使用 - //brightness, // 主题明亮,App bar 的亮度,有白色和黑色两种主题,默认值为 ThemeData.primaryColorBrightness - //iconTheme, // 图标主题,App bar 上图标的颜色、透明度、和尺寸信息。默认值为 ThemeData.primaryIconTheme - //textTheme, //文字主题, App bar 上的文字样式。默认值为 ThemeData.primaryTextTheme - //centerTitle, //标题是否居中, 标题是否居中显示,默认值根据不同的操作系统,显示方式不一样 - primary: true, //是否预留高度 - forceElevated:false, - automaticallyImplyLeading:true, - titleSpacing: NavigationToolbar.kMiddleSpacing, - snap:false, //与floating结合使用 - expandedHeight: 200.0,//展开高度 - floating: false,//是否随着滑动隐藏标题 - pinned: true,//是否固定在顶部 - flexibleSpace: FlexibleSpaceBar( //可以展开区域,通常是一个FlexibleSpaceBar - centerTitle: true, - title: Text("我是一个帅气的标题", - style: TextStyle( - color: Colors.white, - fontSize: 16.0, - )), - background: Image.network( - //"http://h.hiphotos.baidu.com/image/pic/item/342ac65c103853434cc02dda9f13b07eca80883a.jpg", - "http://b.zol-img.com.cn/desk/bizhi/image/6/960x600/1432800027589.jpg", - //"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531798262708&di=53d278a8427f482c5b836fa0e057f4ea&imgtype=0&src=http%3A%2F%2Fh.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F342ac65c103853434cc02dda9f13b07eca80883a.jpg", - fit: BoxFit.fill, - )), - ), - // SliverPersistentHeader( - // delegate: _SliverAppBarDelegate( - // TabBar( - // controller: TabController(length: 2, vsync: this), - // labelColor: Colors.black87, - // unselectedLabelColor: Colors.grey, - // tabs: [ - // Tab(icon: Icon(Icons.security), text: "security"), - // Tab(icon: Icon(Icons.cake), text: "cake"), - // ], - // ), - // )) - ]; - }, - body: Center( - child: ListView.builder( - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return ListItemWidget(listData[index]); - }, - itemCount: listData.length, - ), - ), - )); - } -} - -class ListItem { - final String title; - final IconData iconData; - - ListItem(this.title, this.iconData); -} - -class ListItemWidget extends StatelessWidget { - final ListItem listItem; - - ListItemWidget(this.listItem); - - @override - Widget build(BuildContext context) { - return InkWell( - child: ListTile( - leading: Icon(listItem.iconData), - title: Text(listItem.title), - ), - onTap: () {}, - ); - } -} - diff --git a/lib/widgets/components/Bar/SliverAppBar/index.dart b/lib/widgets/components/Bar/SliverAppBar/index.dart deleted file mode 100644 index 9ca28d7f..00000000 --- a/lib/widgets/components/Bar/SliverAppBar/index.dart +++ /dev/null @@ -1,60 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午4:10 -/// email: zhu.yan@alibaba-inc.com -/// target: SliverAppBar 的示例 - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'package:flutter/material.dart'; - -import './demo.dart' as SliverAppBarDemo; - -const String _Text0 = -"""### **简介** -> SliverAppBar “应用栏” -- 它类似于Android中的toolbar; -"""; - - -const String _Text1 = -"""### **基本用法** -> 虽然基本相同,构造方法也是非常的简单,但是却不能直接使用它,由官方文档可以看到通常结合 ScrollView 来使用它; -- AppBar 和 SliverAppBar 都是继承StatefulWidget 类,都代表 Toobar; -- 二者的区别在于 AppBar 位置的固定的应用最上面的;而 SliverAppBar 是可以跟随内容滚动的; -- 下面的示例,放在 NestedScrollView 实现上提到顶的悬停; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Bar/SliverAppBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SliverAppBar', - codeUrl: 'components/Bar/SliverAppBar/demo.dart', - contentList: allDomes(context, this), - docUrl: 'https://docs.flutter.io/flutter/widgets/SliverAppBar-class.html', - ); - } -} - -// 所有的 SliverAppBar widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDomes(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - SliverAppBarDemo.SliverAppBarLessDefault() - ]; -} - diff --git a/lib/widgets/components/Bar/SnackBar/demo.dart b/lib/widgets/components/Bar/SnackBar/demo.dart deleted file mode 100644 index 0f463371..00000000 --- a/lib/widgets/components/Bar/SnackBar/demo.dart +++ /dev/null @@ -1,59 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/2 -/// Time: 上午12:07 -/// email: zhu.yan@alibaba-inc.com -/// target: SnackBar 的示例 - -import 'package:flutter/material.dart'; - -// SnackBar 默认的实例,无状态 -class SnackBarLessDefault extends StatelessWidget { - final widget; - final parent; - - const SnackBarLessDefault([this.widget, this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - // 当BuildContext在Scaffold之前时,调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决 - return Center( - child: Column( - children: [ - GestureDetector( - onTap: () { - final snackBar = SnackBar( - content: Text('这是一个SnackBar, 右侧有SnackBarAction'), - backgroundColor:Colors.red, - action: SnackBarAction( // 提示信息上添加一个撤消的按钮 - textColor:Colors.black, - label: '撤消', - onPressed: () { - // Some code to undo the change! - }, - ), - duration:Duration(minutes: 1),// 持续时间 - //animation, - ); - Scaffold.of(context).showSnackBar(snackBar); - }, - child: Text('显示SnackBar'), - ), - GestureDetector( - onTap: () { - final snackBar = SnackBar( - content: Text('右侧无SnackBarAction'), - backgroundColor:Colors.red, - duration:Duration(minutes: 1),// 持续时间 - //animation, - ); - Scaffold.of(context).showSnackBar(snackBar); - }, - child: Text('显示无SnackBarAction的SnackBar'), - ), - ], - ) - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Bar/SnackBar/index.dart b/lib/widgets/components/Bar/SnackBar/index.dart deleted file mode 100644 index e476237b..00000000 --- a/lib/widgets/components/Bar/SnackBar/index.dart +++ /dev/null @@ -1,58 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/2 -/// Time: 上午12:06 -/// email: zhu.yan@alibaba-inc.com -/// target: SnackBar 的示例 -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as SnackBarDemo; - -const String _Text0 = -"""### **简介** -> SnackBar “屏幕底部消息” -- 带有可选操作的轻量级消息,短暂显示在屏幕底部 -- SnackBar是用户操作后,显示提示信息的一个控件,类似Toast,会自动隐藏; -"""; - - -const String _Text1 = -"""### **基本用法** -> Scaffold.of(context).showSnackBar(),传递描述消息的 SnackBar 实例; -- 要控制SnackBar保持可见的时间,请指定持续时间。 -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components//Bar/SnackBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SnackBar', - codeUrl: 'components/Bar/SnackBar/demo.dart', - contentList: allDomes(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html', - ); - } -} - -// 所有的 SnackBar widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDomes(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - SnackBarDemo.SnackBarLessDefault(), - SizedBox(height: 20.0), // 间距 - ]; -} \ No newline at end of file diff --git a/lib/widgets/components/Bar/SnackBarAction/demo.dart b/lib/widgets/components/Bar/SnackBarAction/demo.dart deleted file mode 100644 index 9db5b0a6..00000000 --- a/lib/widgets/components/Bar/SnackBarAction/demo.dart +++ /dev/null @@ -1,56 +0,0 @@ -/// Created with Android Studio. -/// User: sanfan.hx -/// Date: 2019/1/6 -/// Time: 下午17:08 -/// email: sanfan.hx@alibaba-inc.com -/// target: SnackBarAction 的示例 - -import 'package:flutter/material.dart'; - -class SnackBarActionDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - Widget build(BuildContext context) { - return Center( - child: Column( - children: [ - new RaisedButton( - onPressed: () { - final snackBar = new SnackBar( - content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'), - backgroundColor:Color(0xffc91b3a), - action: SnackBarAction( // 提示信息上添加一个撤消的按钮 - textColor:Colors.white, - label: '撤消', - onPressed: () { - // Some code to undo the change! - }, - ), - duration:Duration(seconds: 3),// 持续时间 - //animation, - ); - Scaffold.of(context).showSnackBar(snackBar); - }, - - child: Text('点我显示有action的SnackBar'), - ), - new RaisedButton( - onPressed: () async { - final snackBar = new SnackBar( - content: new Text('右侧无SnackBarAction, 3秒后消失'), - backgroundColor:Color(0xffc91b3a), - duration:Duration(seconds: 3),// 持续时间 - //animation, - ); - Scaffold.of(context).showSnackBar(snackBar); - }, - child: Text('点我显示无SnackBarAction的SnackBar'), - ), - ], - ) - ); - } - -} diff --git a/lib/widgets/components/Bar/SnackBarAction/index.dart b/lib/widgets/components/Bar/SnackBarAction/index.dart deleted file mode 100644 index 7920ea7c..00000000 --- a/lib/widgets/components/Bar/SnackBarAction/index.dart +++ /dev/null @@ -1,46 +0,0 @@ -/// Created with Android Studio. -/// User: sanfan.hx -/// Date: 2019/1/6 -/// Time: 下午17:08 -/// email: sanfan.hx@alibaba-inc.com -/// target: SnackBarAction 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as SnackBarDemo; - -const String _Text0 = """ -### **简介** -> SnackBarAction “屏幕底部消息右侧可操作的行为” - -- 带有可选操作的轻量级消息,短暂显示在屏幕底部, 并提供按钮交互。 - -### **基本用法** - -> 为SnackBar加入action[SnackBarAction]显示按区, 默认下是隐藏的 - -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Bar/SnackBarAction'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SnackBarAction', - codeUrl: 'components/Bar/SnackBarAction/demo.dart', - contentList: [ - _Text0, - SnackBarDemo.SnackBarActionDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/material/SnackBarAction-class.html', - ); - } -} diff --git a/lib/widgets/components/Bar/TabBar/demo.dart b/lib/widgets/components/Bar/TabBar/demo.dart deleted file mode 100644 index 6b706862..00000000 --- a/lib/widgets/components/Bar/TabBar/demo.dart +++ /dev/null @@ -1,73 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/6 -/// Time: 下午7:33 -/// email: sanfann@alibaba-inc.com -/// target: TabBar 的示例 - -import 'package:flutter/material.dart'; - -class TabBarDemo extends StatefulWidget { - const TabBarDemo() : super(); - - @override - State createState() => _TabBarDemo(); -} - -// AppBar 默认的实例,有状态 -class _TabBarDemo extends State with SingleTickerProviderStateMixin { - ScrollController _scrollViewController; - TabController _tabController; - - @override - void initState() { - super.initState(); - _scrollViewController = ScrollController(); - _tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应 - } - - @override - void dispose() { - _scrollViewController.dispose(); - _tabController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 - // 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。 - // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。 - return SizedBox( - height: 500, - child: Scaffold( - appBar: AppBar( // 大量配置属性参考 SliverAppBar 示例 - title: Text('TabBar'), - leading: Icon(Icons.home), - backgroundColor: Colors.amber[1000], - bottom: TabBar( - isScrollable: true, - controller: _tabController, - tabs: [ - Tab(text: "Tabs 1"), - Tab(text: "Tabs 2"), - Tab(text: "Tabs 3"), - Tab(text: "Tabs 4"), - Tab(text: "Tabs 5"), - Tab(text: "Tabs 6"), - ], - ), - ), - body: TabBarView(controller: _tabController, children: [ - Text('TabsView 1'), - Text('TabsView 2'), - Text('TabsView 3'), - Text('TabsView 4'), - Text('TabsView 5'), - Text('TabsView 6'), - ]), - ) - - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Bar/TabBar/index.dart b/lib/widgets/components/Bar/TabBar/index.dart deleted file mode 100644 index f4c16731..00000000 --- a/lib/widgets/components/Bar/TabBar/index.dart +++ /dev/null @@ -1,67 +0,0 @@ -/// Created with Android Studio. -/// User: sanfan.hx -/// Date: 2019/1/6 -/// Time: 下午17:08 -/// email: sanfan.hx@alibaba-inc.com -/// target: SnackBarAction 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String _Text0 = """ -### **简介** -> SnackBarAction 来实现并行界面的横向滑动展示 - -- TabBar,是材料设计中很常用的一种横向标签. 来实现并行界面的横向滑动展示,在Flutter的世界中,TabBar有着相同的作用。通常,我们会在AppBar的底部部分结合TabBarView来使用TabBar; - - - -### **基本用法** - -> 在容器顶部或者底部配置, TabBar组件, 横向切换视口窗口中的内容 - - -**TabBar** 有以下几项属性 - -- tabs 一般使用Tab对象,当然也可以是其他的Widget -- controller TabController对象 -- isScrollable 是否可滚动 -- indicatorColor 指示器颜色 -- indicatorWeight 指示器厚度 -- indicatorPadding 底部指示器的Padding -- indicator 指示器decoration,例如边框等 -- indicatorSize 指示器大小计算方式 -- labelColor 选中Tab文字颜色 -- labelStyle 选中Tab文字Style -- unselectedLabelColor 未选中Tab中文字颜色 -- unselectedLabelStyle 未选中Tab中文字style - -**TabBarView** 有以下几项属性 -- children tabBar中对象分别对应的视图窗口内容, children的长度通常与tabs中的tab对象长度相同 -- controller TabController对象 -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Bar/TabBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'TabBar', - codeUrl: 'components/Bar/TabBar/demo.dart', - contentList: [ - _Text0, - TabBarDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/SnackBarAction-class.html', - ); - } -} diff --git a/lib/widgets/components/Bar/index.dart b/lib/widgets/components/Bar/index.dart deleted file mode 100644 index b93f7f68..00000000 --- a/lib/widgets/components/Bar/index.dart +++ /dev/null @@ -1,68 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/27 -/// Time: 下午2:50 -/// email: zhu.yan@alibaba-inc.com -/// target: Bar 的示例 - -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'AppBar/index.dart' as AppBar; -import 'BottomAppBar/index.dart' as BottomAppBar; -import 'ButtonBar/index.dart' as ButtonBar; -import 'FlexibleSpaceBar/index.dart' as FlexibleSpaceBar; -import 'SliverAppBar/index.dart' as SliverAppBar; -import 'SnackBar/index.dart' as SnackBar; -import 'SnackBarAction/index.dart' as SnackBarAction; -import 'TabBar/index.dart' as TabBar; - - - -List widgetPoints = [ - WidgetPoint( - name: 'AppBar', - routerName: AppBar.Demo.routeName, - buildRouter: (BuildContext context) => AppBar.Demo(), - ), - WidgetPoint( - name: 'SliverAppBar', - routerName: SliverAppBar.Demo.routeName, - buildRouter: (BuildContext context) => SliverAppBar.Demo(), - ), - WidgetPoint( - name: 'BottomAppBar', - routerName: BottomAppBar.Demo.routeName, - buildRouter: (BuildContext context) => BottomAppBar.Demo(), - ), - WidgetPoint( - name: 'FlexibleSpaceBar', - routerName: FlexibleSpaceBar.Demo.routeName, - buildRouter: (BuildContext context) => FlexibleSpaceBar.Demo(), - ), - WidgetPoint( - name: 'ButtonBar', - routerName: ButtonBar.Demo.routeName, - buildRouter: (BuildContext context) => ButtonBar.Demo(), - ), - WidgetPoint( - name: 'SnackBar', - routerName: SnackBar.Demo.routeName, - buildRouter: (BuildContext context) => SnackBar.Demo(), - ), - WidgetPoint( - name: 'SnackBarAction', - routerName: SnackBarAction.Demo.routeName, - buildRouter: (BuildContext context) => SnackBarAction.Demo(), - ), - WidgetPoint( - name: 'TabBar', - routerName: TabBar.Demo.routeName, - buildRouter: (BuildContext context) => TabBar.Demo(), - ), - WidgetPoint( - name: 'TabBarView', - routerName: TabBar.Demo.routeName, - buildRouter: (BuildContext context) => TabBar.Demo(), - ), -]; diff --git a/lib/widgets/components/Card/Card/demo.dart b/lib/widgets/components/Card/Card/demo.dart deleted file mode 100644 index 3a1d4269..00000000 --- a/lib/widgets/components/Card/Card/demo.dart +++ /dev/null @@ -1,78 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午2:57 -/// email: zhu.yan@alibaba-inc.com -/// target: Card 的示例 - -import 'package:flutter/material.dart'; - - -/// Checkbox 默认Card的实例 -class CardFullDefault extends StatefulWidget { - const CardFullDefault() : super(); - - @override - State createState() => _CardFullDefault(); -} - - -/// Card 默认的实例,有状态 -class _CardFullDefault extends State { - @override - Widget build(BuildContext context) { - return Card( - // ... // 如果没有,就是不需要有状态的 StatefulWidget - ); - } -} - -/// Card 默认的实例,无状态 -class CardLessDefault extends StatelessWidget { - final widget; - final parent; - - const CardLessDefault([this.widget, this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - return Card( - clipBehavior:Clip.antiAlias,// 根据设置裁剪内容 - color:Colors.green, // 卡片背景颜色 - elevation:20.0, // 卡片的z坐标,控制卡片下面的阴影大小 - margin:EdgeInsets.all(20.0), - // margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距 - semanticContainer:true, // 表示单个语义容器,还是false表示单个语义节点的集合,接受单个child,但该child可以是Row,Column或其他包含子级列表的widget -// shape: Border.all( -// color: Colors.indigo, width: 1.0, style: BorderStyle.solid), // 卡片材质的形状,以及边框 - shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), // 圆角 - //borderRadius: BorderRadius.all(Radius.circular(8.0)), - child: Column( //card里面的子控件 - mainAxisSize: MainAxisSize.min, - children: [ - const ListTile( - leading: Icon(Icons.access_time), - title: Text('The Enchanted Nightingale',style: TextStyle(color: Colors.white, fontSize: 40.0)), - subtitle: Text('Music by Julie Gable. Lyrics by Sidney Stein.',style: TextStyle(color: Colors.yellow, fontSize: 16.0)), - contentPadding: EdgeInsets.all(20.0),// item 内容内边距 - ), - ButtonTheme.bar( // make buttons use the appropriate styles for cards - child: ButtonBar( - children: [ - FlatButton( - child: const Text('BUY TICKETS',style: TextStyle(color: Colors.black, fontSize: 14.0)), - onPressed: () { }, - ), - FlatButton( - child: const Text('LISTEN',style: TextStyle(color: Colors.black, fontSize: 14.0)), - onPressed: () { }, - ), - ], - ), - ), - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Card/Card/index.dart b/lib/widgets/components/Card/Card/index.dart deleted file mode 100644 index be83fe19..00000000 --- a/lib/widgets/components/Card/Card/index.dart +++ /dev/null @@ -1,58 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午2:56 -/// email: zhu.yan@alibaba-inc.com -/// target: Card 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as CardDemo; - -const String _Text0 = -"""### **简介** -> Card “卡片” -- 卡片用于表示一些相关信息,例如相册,地理位置,用餐,联系方式等 -"""; - - -const String _Text1 = -"""### **基本用法** -> 此示例显示了创建卡片窗口组件,其中显示了相册信息和两个操作 -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Card/Card'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Card', - codeUrl: 'components/Card/Card/demo.dart', - contentList: allDomes(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/Card-class.html', - ); - } -} - - -/// 所有的 Card widget -/// context: 运行上下文 -/// that: 指向有状态的 StatefulWidget -List allDomes(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - CardDemo.CardLessDefault() - ]; -} - diff --git a/lib/widgets/components/Card/index.dart b/lib/widgets/components/Card/index.dart deleted file mode 100644 index 91a73932..00000000 --- a/lib/widgets/components/Card/index.dart +++ /dev/null @@ -1,19 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/27 -/// Time: 下午2:50 -/// email: zhu.yan@alibaba-inc.com -/// target: Card 的示例 - -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'Card/index.dart' as Card; - -List widgetPoints = [ - WidgetPoint( - name: 'Card', - routerName: Card.Demo.routeName, - buildRouter: (BuildContext context) => Card.Demo(), - ) -]; diff --git a/lib/widgets/components/Chip/Chip/demo.dart b/lib/widgets/components/Chip/Chip/demo.dart deleted file mode 100644 index 3ba411cb..00000000 --- a/lib/widgets/components/Chip/Chip/demo.dart +++ /dev/null @@ -1,90 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-18 11:40:57 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-14 16:50:43 - -import 'package:flutter/material.dart'; - -class ChipDemo extends StatefulWidget { - _ChipDemoState createState() => _ChipDemoState(); -} - -class _ChipDemoState extends State { - String dec = '点击回收'; - int count = 0; - _modifty() { - setState(() { - dec = 'delete success: $count'; - }); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - child: Chip( - padding: EdgeInsets.only( - right: 100.0, - ), - //标签前面的小widget - avatar: CircleAvatar( - backgroundColor: Colors.red.shade200, - child: Text( - 'A', - style: TextStyle(color: Colors.white), - ), - ), - label: Text( - 'pai mai ', - style: TextStyle(color: Colors.white, fontSize: 18.0), - ), - backgroundColor: Colors.red.shade100, - labelPadding: EdgeInsets.all(6.0), - ), - ), - Container( - height: 100.0, - child: Chip( - //头像 - avatar: CircleAvatar( - child: Icon( - Icons.account_circle, - color: Colors.red.shade200, - ), - backgroundColor: Colors.white, - ), - //设置widget背景颜色 - backgroundColor: Colors.red.shade100, - //剪辑窗口widget内容 - // antiAlias:剪辑具有抗锯齿功能,它比antiAliasWithSaveLayer快得多,但比hardEdge慢。 - //antiAliasWithSaveLayer:立即剪辑具有抗锯齿,并且可以分配屏幕外缓冲区,后续涂料都在该缓冲区完成,然后再进行修剪和合成 - clipBehavior: Clip.antiAlias, - - //设置padding值 - labelPadding: EdgeInsets.all(8.0), - label: Text(dec), - //设置onDeleted时候显示的图标 - deleteIcon: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - onDeleted: () { - count++; - _modifty(); - }, - deleteButtonTooltipMessage: '删除', - deleteIconColor: Colors.blueGrey.shade100, - //将最小点击目标大小扩展到48*48px - materialTapTargetSize: MaterialTapTargetSize.padded, - padding: EdgeInsets.all(2.0), - //修改字体格式 - labelStyle: TextStyle(fontWeight: FontWeight.bold), - // shape: _MyBorder(), - ), - ) - ], - ); - } -} diff --git a/lib/widgets/components/Chip/Chip/index.dart b/lib/widgets/components/Chip/Chip/index.dart deleted file mode 100644 index 709e5fac..00000000 --- a/lib/widgets/components/Chip/Chip/index.dart +++ /dev/null @@ -1,41 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-18 11:40:57 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-18 15:13:23 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> chip是表示属性,文本,实体或动作的元素 -- 需要在Material wedige 中。 -'''; -const String content1 = ''' -### **基本用法** -- 需要Material widget. -- 这个label和clipBehavior参数不能为空 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/Chip'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ChipDemo(), - ], - codeUrl: 'components/Chip/Chip/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/Chip-class.html', - title: 'Chip'); - } -} diff --git a/lib/widgets/components/Chip/ChipTheme/demo.dart b/lib/widgets/components/Chip/ChipTheme/demo.dart deleted file mode 100644 index a764a58d..00000000 --- a/lib/widgets/components/Chip/ChipTheme/demo.dart +++ /dev/null @@ -1,59 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-18 15:14:10 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-18 19:15:25 - -import 'package:flutter/material.dart'; - -class ChipThemeDemo extends StatefulWidget { - _ChipThemeDemoState createState() => _ChipThemeDemoState(); -} - -class _ChipThemeDemoState extends State { - Color _color = Colors.red; - - @override - Widget build(BuildContext context) { - return ChipTheme( - data: ChipTheme.of(context).copyWith(backgroundColor:Colors.red.shade800 ), - child: ChoiceChip( - padding: EdgeInsets.only(left: 100.0,right: 100.0,top: 10.0,bottom: 10.0), - label: Text('down'), - labelStyle: TextStyle(color: Colors.white), - onSelected: (bool value) { - setState(() { - _color = value ? Colors.lightBlue : Colors.red; - }); - }, - selected: _color == Colors.lightBlue, - ), - ); - } -} - - // Widget build(BuildContext context) { - - // return Container( - // child: ChipTheme( - // data: ChipThemeData( - // backgroundColor: Colors.red.shade500, - // //描述颜色对比度(暗,亮,设置固定值) - // brightness : Brightness.dark, - // deleteIconColor: Colors.red.shade200, - // //背景颜色,表示它被禁用 - // disabledColor: Colors.grey.shade50, - // labelPadding: EdgeInsets.all(10.0), - // labelStyle: TextStyle(fontSize: 15.0,fontStyle: FontStyle.italic), - // padding: EdgeInsets.all(2.0), - // //用于另一种chip widget 标签样式 - // secondaryLabelStyle: TextStyle(fontSize: 20.0,fontStyle: FontStyle.normal), - // selectedColor: Colors.yellow, - // //表示已经选中度颜色 - // secondarySelectedColor: Colors.black - // // shape: - // ), - // ), - // ); - - - // } diff --git a/lib/widgets/components/Chip/ChipTheme/index.dart b/lib/widgets/components/Chip/ChipTheme/index.dart deleted file mode 100644 index cc0814f7..00000000 --- a/lib/widgets/components/Chip/ChipTheme/index.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-18 15:14:03 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-18 15:14:03 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 基于 RawChip-based widgets,如chip,inputChip,ChoiceChip,FilterChip等 -- chipTheme描述了应用它的chip的颜色,形状和文本样式 - -'''; -const String content1 = ''' -### **基本用法** -- 可通过chipTheme.of获取当前主题的ChipThemeData对象 -- 当widget使用ChipTheme.of时,如果主题稍后更改,则会自动重建。 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/ChipTheme'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ChipThemeDemo(), - ], - codeUrl: 'components/Chip/ChipTheme/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/ChipTheme-class.html', - title: 'ChipTheme'); - } -} diff --git a/lib/widgets/components/Chip/ChipThemeData/demo.dart b/lib/widgets/components/Chip/ChipThemeData/demo.dart deleted file mode 100644 index 9cb2021d..00000000 --- a/lib/widgets/components/Chip/ChipThemeData/demo.dart +++ /dev/null @@ -1,37 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-18 15:14:10 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-18 19:39:41 - -import 'package:flutter/material.dart'; - -class ChipThemeDemo extends StatefulWidget { - _ChipThemeDemoState createState() => _ChipThemeDemoState(); -} - -class _ChipThemeDemoState extends State { - Color _color = Colors.red; - - @override - Widget build(BuildContext context) { - return ChipTheme( - data: ChipThemeData.fromDefaults( - // brightness: Brightness.dark, - labelStyle: TextStyle(fontSize: 15.0), - primaryColor: Colors.red,secondaryColor: Colors.red.shade800), - child: ChoiceChip( - padding: EdgeInsets.only(left: 100.0,right: 100.0,top: 10.0,bottom: 10.0), - label: Text('down'), - onSelected: (bool value) { - setState(() { - _color = value ? Colors.black : Colors.red; - }); - }, - selected: _color == Colors.black, - ), - ); - } -} - - - diff --git a/lib/widgets/components/Chip/ChipThemeData/index.dart b/lib/widgets/components/Chip/ChipThemeData/index.dart deleted file mode 100644 index 86c9690c..00000000 --- a/lib/widgets/components/Chip/ChipThemeData/index.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-18 15:14:03 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-18 17:38:56 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 保存chip主题的颜色,形状和文本样式 -- 使用它配置chipTheme widget,或者为Theme widget小部件设置 ThemeData.chipTheme。 - -'''; -const String content1 = ''' -### **基本用法** -- 创建ChipThemeData最简单的方法是使用copyWith您从得到一个ChipTheme.of, -或创建一个全新的一个具有 ChipThemeData..fromDefaults -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/ChipThemeData'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ChipThemeDemo(), - ], - codeUrl: 'components/Chip/ChipThemeData/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/ChipThemeData-class.html', - title: 'ChipThemeData'); - } -} diff --git a/lib/widgets/components/Chip/ChoiceChip/demo.dart b/lib/widgets/components/Chip/ChoiceChip/demo.dart deleted file mode 100644 index 3aabd30f..00000000 --- a/lib/widgets/components/Chip/ChoiceChip/demo.dart +++ /dev/null @@ -1,60 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-19 15:13:24 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-20 19:32:10 - -import 'package:flutter/material.dart'; - -class ChoiceChipDemo extends StatefulWidget { - _ChoiceChipDemoState createState() => _ChoiceChipDemoState(); -} - -class _ChoiceChipDemoState extends State { - String _selected = ''; - - List _sub=[ - 'java','web','android' -]; - - Iterable get actorWidgets sync*{ - for(String choiceSub in _sub){ - yield Padding( - padding:EdgeInsets.all(15.0) , - child: ChoiceChip( - // avatar: Icon(Icons.access_alarm,size: 20.0,color: Colors.white,), - //未选定的时候背景 - backgroundColor:Colors.red, - //被禁用得时候背景 - disabledColor: Colors.blue, - label: Text(choiceSub), - labelStyle: TextStyle(fontWeight: FontWeight.w200,fontSize: 15.0), - labelPadding: EdgeInsets.only(left: 20.0,right: 20.0), - - materialTapTargetSize: MaterialTapTargetSize.padded, - onSelected: (bool value) { - setState(() { - _selected = value ? choiceSub : 'Colors.red'; - }); - }, - selected: _selected == choiceSub,) - ); - - } - } - - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Wrap( - children: actorWidgets.toList(), - ), - ], - ); - - } -} - - - diff --git a/lib/widgets/components/Chip/ChoiceChip/index.dart b/lib/widgets/components/Chip/ChoiceChip/index.dart deleted file mode 100644 index fcc53af4..00000000 --- a/lib/widgets/components/Chip/ChoiceChip/index.dart +++ /dev/null @@ -1,39 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-19 15:13:29 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 10:22:57 - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 允许从一组选项中进行单一的选择 -- ChoiceChip包含相关的描述性文本或者类别 - -'''; -const String content1 = ''' -### **基本用法** -- onSelected : 选择或者取消选择状态间切换调用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/ChoiceChip'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ChoiceChipDemo(), - ], - codeUrl: 'components/Chip/ChoiceChip/demo.dart', - docUrl:'https://docs.flutter.io/flutter/material/ChoiceChip-class.html', - title: 'ChoiceChip'); - } -} diff --git a/lib/widgets/components/Chip/FilterChip/demo.dart b/lib/widgets/components/Chip/FilterChip/demo.dart deleted file mode 100644 index ccac842a..00000000 --- a/lib/widgets/components/Chip/FilterChip/demo.dart +++ /dev/null @@ -1,68 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 10:19:46 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-20 14:09:31 - -import 'package:flutter/material.dart'; - -class FilterChipDemo extends StatefulWidget { - _FilterChipDemoState createState() => _FilterChipDemoState(); -} - -class ActorFilerEntry{ - final String name; - final String initials; - const ActorFilerEntry(this.name,this.initials); -} - - -class _FilterChipDemoState extends State { - final List _list=[ - const ActorFilerEntry('android', 'ad'), - const ActorFilerEntry('java', 'ja'), - const ActorFilerEntry('php', 'ph'), - const ActorFilerEntry('web', 'wb'), - ]; - - List _filters=[]; - Iterable get actorWidgets sync*{ - for(ActorFilerEntry actor in _list){ - yield Padding( - padding: const EdgeInsets.all(4.0), - child: FilterChip( - // avatar: CircleAvatar(child: Text(actor.initials),), - label: Text(actor.name), - selected: _filters.contains(actor.name), - onSelected: (bool value){ - setState(() { - if(value){ - _filters.add(actor.name); - }else{ - _filters.retainWhere((String name){ - return name==actor.name; - }); - } - }); - }, - ), - ); - } - } - - - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Wrap( - children: actorWidgets.toList(), - ), - Text('look for :${_filters.join(',')}') - ], - ); - } -} - - - diff --git a/lib/widgets/components/Chip/FilterChip/index.dart b/lib/widgets/components/Chip/FilterChip/index.dart deleted file mode 100644 index eb069e7f..00000000 --- a/lib/widgets/components/Chip/FilterChip/index.dart +++ /dev/null @@ -1,40 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 10:19:55 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 10:25:22 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 通过使用标签或者描述性词语来过滤内容 -- FilterChip 是 checkbox 或 switch widget 的替换品。 - -'''; -const String content1 = ''' -### **基本用法** -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/FilterChip'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - FilterChipDemo(), - ], - codeUrl: 'components/Chip/FilterChip/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/FilterChip-class.html', - title: 'FilterChip'); - } -} diff --git a/lib/widgets/components/Chip/InputChip/demo.dart b/lib/widgets/components/Chip/InputChip/demo.dart deleted file mode 100644 index 04739e70..00000000 --- a/lib/widgets/components/Chip/InputChip/demo.dart +++ /dev/null @@ -1,74 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 13:32:22 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 11:31:12 - -import 'package:flutter/material.dart'; - -class FilterChipDemo extends StatefulWidget { - _FilterChipDemoState createState() => _FilterChipDemoState(); -} - -class InputEntry{ - final String name; - final String initials; - const InputEntry(this.name,this.initials); - -} - -class _FilterChipDemoState extends State { - -final List _lists=[ - const InputEntry('android', 'A'), - const InputEntry('java', 'J'), - const InputEntry('php', 'P'), - const InputEntry('web', 'W'), -]; - -List _inputLists=[]; -Iterable get inputWidget sync*{ - for(InputEntry value in _lists){ - _inputLists.add(value); - yield Padding( - padding: const EdgeInsets.all(4.0), - child: InputChip( - avatar: CircleAvatar( - backgroundColor: Colors.redAccent.shade400, - child: Text(value.initials), - ), - label: Text(value.name), - onDeleted: (){ - setState(() { - _lists.remove(value); - }); - - }, - - ), - ); - } -} - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Wrap( - children: inputWidget.toList(), - ), - // InputChip( - // label: Text('刷新'), - // onSelected: (bool value){ - - // }, - // ) - ], - - - - ); - } -} - - - diff --git a/lib/widgets/components/Chip/InputChip/index.dart b/lib/widgets/components/Chip/InputChip/index.dart deleted file mode 100644 index f7d0a84b..00000000 --- a/lib/widgets/components/Chip/InputChip/index.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 13:32:15 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 10:42:05 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 输入型chip -- 以紧凑的形式表现复杂的信息,例如:实体(人,地点,或者事物)或者会话文本 - -'''; -const String content1 = ''' -### **基本用法** -- inputChip可以通过设置进行选择onSelected,通过设置onDeleted可以删除,并且可以通过OnPressed表现按压效果 -- inputChip 有一个前导图标和尾随图标,填充颜色可以订制 -- inputChip 可以和其他UI元素搭配使用,比如:wrap,ListView(scrollDirection为Axis.horizo​​ntal) -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/InputChip'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - FilterChipDemo(), - ], - codeUrl: 'components/Chip/FilterChip/demo.dart', - docUrl:'https://docs.flutter.io/flutter/material/InputChip-class.html', - title: 'InputChip'); - } -} diff --git a/lib/widgets/components/Chip/RawChip/demo.dart b/lib/widgets/components/Chip/RawChip/demo.dart deleted file mode 100644 index f6d37f3b..00000000 --- a/lib/widgets/components/Chip/RawChip/demo.dart +++ /dev/null @@ -1,64 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 20:30:36 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 11:23:21 - -import 'package:flutter/material.dart'; - -class FilterChipDemo extends StatefulWidget { - _FilterChipDemoState createState() => _FilterChipDemoState(); -} - -class InputEntry{ - final String name; - final String initials; - const InputEntry(this.name,this.initials); -} - -class _FilterChipDemoState extends State { - -final List _lists=[ - const InputEntry('android', 'A'), - const InputEntry('java', 'J'), - const InputEntry('php', 'P'), - const InputEntry('web', 'W'), -]; - -Iterable get _rawChipWidget sync*{ - for(InputEntry value in _lists){ - yield Padding( - padding: const EdgeInsets.all(4.0), - child: RawChip( - avatar: CircleAvatar( - backgroundColor: Colors.redAccent.shade400, - child: Text(value.initials), - ), - label: Text(value.name), - onDeleted: (){ - // _inputs.add(value.name); - setState(() { - _lists.remove(value); - - }); - }, - - ), - ); - } -} - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Wrap( - children: _rawChipWidget.toList(), - ), - - ], - ); - } -} - - - diff --git a/lib/widgets/components/Chip/RawChip/index.dart b/lib/widgets/components/Chip/RawChip/index.dart deleted file mode 100644 index c57c49ca..00000000 --- a/lib/widgets/components/Chip/RawChip/index.dart +++ /dev/null @@ -1,46 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 20:30:41 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 11:35:51 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 所有chip widget类型的基础,集合所有功能,我们通常不是直接使用它,而是根据自己需要选择chi, 比如: -- chip ,一个简单的芯片,只能显示信息,并被删除 -- inputChip,以紧凑的形式表现复杂的信息,例如:实体(人,地点,或者事物)或者会话文本 -- choiceChip,允许从一组选项中进行单一的选择 -- FilterChip,使用标签或描述作为过滤内容的方式 - - -'''; -const String content1 = ''' -### **基本用法** -- inputChip可以通过设置进行选择onSelected,通过设置onDeleted可以删除,并且可以通过OnPressed表现按压效果 -- inputChip 有一个前导图标和尾随图标,填充颜色可以订制 -- inputChip 可以和其他UI元素搭配使用,比如:wrap,ListView(scrollDirection为Axis.horizo​​ntal) -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/RawChip'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - FilterChipDemo(), - ], - codeUrl: 'components/Chip/RawChip/demo.dart', - docUrl:'https://docs.flutter.io/flutter/material/RawChip-class.html', - title: 'RawChip'); - } -} diff --git a/lib/widgets/components/Chip/index.dart b/lib/widgets/components/Chip/index.dart deleted file mode 100644 index 053c51ab..00000000 --- a/lib/widgets/components/Chip/index.dart +++ /dev/null @@ -1,48 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'Chip/index.dart' as Chip; -import 'ChipTheme/index.dart' as ChipTheme; -import 'ChipThemeData/index.dart' as ChipThemeData; -import 'ChoiceChip/index.dart' as ChoiceChip; -import 'FilterChip/index.dart' as FilterChip; -import 'InputChip/index.dart' as InputChip; -import 'RawChip/index.dart' as RawChip; - -List widgetPoints = [ - WidgetPoint( - name: 'Chip', - routerName: Chip.Demo.routeName, - buildRouter: (BuildContext context) => Chip.Demo(), - ), - WidgetPoint( - name: 'ChipTheme', - routerName: ChipTheme.Demo.routeName, - buildRouter: (BuildContext context) => ChipTheme.Demo(), - ), - WidgetPoint( - name: 'ChipThemeData', - routerName: ChipThemeData.Demo.routeName, - buildRouter: (BuildContext context) => ChipThemeData.Demo(), - ), - WidgetPoint( - name: 'ChoiceChip', - routerName: ChoiceChip.Demo.routeName, - buildRouter: (BuildContext context) => ChoiceChip.Demo(), - ), - WidgetPoint( - name: 'FilterChip', - routerName: FilterChip.Demo.routeName, - buildRouter: (BuildContext context) => FilterChip.Demo(), - ), - WidgetPoint( - name: 'InputChip', - routerName: InputChip.Demo.routeName, - buildRouter: (BuildContext context) => InputChip.Demo(), - ), - WidgetPoint( - name: 'RawChip', - routerName: RawChip.Demo.routeName, - buildRouter: (BuildContext context) => RawChip.Demo(), - ), -]; diff --git a/lib/widgets/components/Dialog/AboutDialog/demo.dart b/lib/widgets/components/Dialog/AboutDialog/demo.dart deleted file mode 100644 index 5f980907..00000000 --- a/lib/widgets/components/Dialog/AboutDialog/demo.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class AboutDialogDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - - void showAlertDialog(BuildContext context) { - showDialog( - context: context, - builder: (_) => AboutDialog( - applicationName: '名称', - applicationIcon: Icon(Icons.ac_unit), - applicationVersion: 'V1.0', - children: [ - Text('我是一个关于的dialog') - ] - )); - } - Widget build(BuildContext context) { - return RaisedButton( - padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), - //padding - child: Text( - 'show aboutDialog', - style: TextStyle( - fontSize: 18.0, //textsize - color: Colors.white, // textcolor - ), - ), - color: Theme.of(context).accentColor, - elevation: 4.0, - //shadow - splashColor: Colors.blueGrey, - onPressed: () { - showAlertDialog(context); - }); - } -} diff --git a/lib/widgets/components/Dialog/AboutDialog/index.dart b/lib/widgets/components/Dialog/AboutDialog/index.dart deleted file mode 100644 index 718b582b..00000000 --- a/lib/widgets/components/Dialog/AboutDialog/index.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> AboutDialog 通常用于传递企业或者app的官方信息 -- 这个对话框包含应用程序的图标,名称,版本号,版权和应用程序使用到的软件许可证的按钮 - - -### **基本用法** -> 要显示的AboutDialog,使用showAboutDialog。 -- 如果应用程序具有Drawer,则AboutListTile可以使显示AboutDialog的过程更简单。 -- AboutDialog通过showAboutDialog 显示按钮调用 showLicensePage。 - -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Dialog/AboutDialog'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'AboutDialog', - codeUrl: 'components/Dialog/AboutDialog/demo.dart', - contentList: [ - _Text0, - AboutDialogDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/AboutDialog-class.html', - ); - } -} diff --git a/lib/widgets/components/Dialog/AlertDialog/demo.dart b/lib/widgets/components/Dialog/AlertDialog/demo.dart deleted file mode 100644 index 616aa135..00000000 --- a/lib/widgets/components/Dialog/AlertDialog/demo.dart +++ /dev/null @@ -1,137 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class AlertDialogDemo extends StatelessWidget{ - - void showAlertDialog(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, // user must tap button! - builder: (BuildContext context) { - return AlertDialog( - title: Text('title'), - content: SingleChildScrollView( - child: ListBody( - children: [ - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - Text('too long~~~'), - - ], - ), - ), - actions: [ - FlatButton( - child: Text('关闭'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); - } - Widget build(BuildContext context) { - return RaisedButton( - padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), - //padding - child: Text( - '点我显示 AlertDialog', - style: TextStyle( - fontSize: 18.0, //textsize - color: Colors.white, // textcolor - ), - ), - color: Theme.of(context).accentColor, - elevation: 4.0, - //shadow - splashColor: Colors.blueGrey, - onPressed: () { - showAlertDialog(context); - }); - } -} - diff --git a/lib/widgets/components/Dialog/AlertDialog/index.dart b/lib/widgets/components/Dialog/AlertDialog/index.dart deleted file mode 100644 index a067842c..00000000 --- a/lib/widgets/components/Dialog/AlertDialog/index.dart +++ /dev/null @@ -1,46 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> AlertDialog 向用户传递信息的弹出层。警报对话框 -- 一般使用在通知用户需要确认的情况,具有可选标题和可选的操纵列表。标题显示在上方,操纵内容显示在内容区域,即下方 - -### **基本用法** -> 通常作为子窗口小部件传递给showDialog,后者显示对话框。 -- 当**AlertDialog**的的元素过多过长时, 请优先考虑**SingleChildScrollView** 用来避免内容溢出 -- 需要注意的是,由于AlertDialog 通常使用child的大小来调整自身大小,所以使用一些widget(如ListView,GridView和CustomScrollView)将无法正常工作 -- 当需要给用户提供多个选项的供选择时,请使用SimpleDialog -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Dialog/AlertDialog'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'AlertDialog', - codeUrl: 'components/Dialog/AlertDialog/demo.dart', - contentList: [ - _Text0, - AlertDialogDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/AlertDialog-class.html', - ); - } -} diff --git a/lib/widgets/components/Dialog/Dialog/demo.dart b/lib/widgets/components/Dialog/Dialog/demo.dart deleted file mode 100644 index 31d1385c..00000000 --- a/lib/widgets/components/Dialog/Dialog/demo.dart +++ /dev/null @@ -1,132 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class DialogDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - - void showAlertDialog(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, // user must tap button! - builder: (BuildContext context) { - return Dialog( - child: Container( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text('我是一个dialog'), - RaisedButton( - child: Text('取消'), - onPressed: () { - Navigator.of(context).pop(); - }, - ) - ], - ), - ) - ); - }, - ); - } - Widget build(BuildContext context) { - return RaisedButton( - padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), - //padding - child: Text( - '点我显示 Dialog', - style: TextStyle( - fontSize: 18.0, //textsize - color: Colors.white, // textcolor - ), - ), - color: Theme.of(context).accentColor, - elevation: 4.0, - //shadow - splashColor: Colors.blueGrey, - onPressed: () { - showAlertDialog(context); - }); - } -} - - -class DialogMoreDemo extends StatefulWidget { - _DialogMoreDemo createState() => _DialogMoreDemo(); -} - -class _DialogMoreDemo extends State { - int value = 0; - void showCommonDialog(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, // user must tap button! - builder: (context) { - return StatefulBuilder( - builder: (context, state) { - return Dialog( - child: Container( - height: 150, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text('我是一个dialog'), - RaisedButton( - onPressed: () { - state(() { - value += 1; - }); - }, - child: Text("我是一个Dialog, 点我更新value: $value"), - ), - RaisedButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text("取消"), - ) - ], - ), - ), - - ); - } - ); - } - ); - } - Widget build(BuildContext context) { - return Column( - children: [ - RaisedButton( - padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), - //padding - child: Text( - '点我显示Dialog', - style: TextStyle( - fontSize: 18.0, //textsize - color: Colors.white, // textcolor - ), - ), - color: Theme.of(context).accentColor, - elevation: 4.0, - //shadow - splashColor: Colors.blueGrey, - onPressed: () { - showCommonDialog(context); - } - ) - ], - ); - } -} - diff --git a/lib/widgets/components/Dialog/Dialog/index.dart b/lib/widgets/components/Dialog/Dialog/index.dart deleted file mode 100644 index 8df84a94..00000000 --- a/lib/widgets/components/Dialog/Dialog/index.dart +++ /dev/null @@ -1,56 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> Dialog 向用户传递信息的弹出层。 --这个组件没有任何可操作的选项. 相比使用这个组件, 通常我们更喜欢使用 **AlertDialog**或者**SimpleDialog** - - - -### **基本用法** -> 通常作为子窗口小部件传递给showDialog,后者显示对话框。 - -"""; - -const String _Text1 = """ -### **进阶用法** - -> 犹豫当前组件没有任何可选项目, 我们可以通过自定义样式, 去完成自己想要的各种样式的弹框, 满足我们的个性化需求 - -注意事项: 当前弹出的dialog并非是一个单纯的组件, 而是一个新路由界面, 如果我想通过操作dialog中的内容, 直接使用setState触发的是原界面中的状态 -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Dialog/Dialog'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Dialog', - codeUrl: 'components/Dialog/Dialog/demo.dart', - contentList: [ - _Text0, - DialogDemo(), - _Text1, - DialogMoreDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/Dialog-class.html', - ); - } -} diff --git a/lib/widgets/components/Dialog/SimpleDialog/demo.dart b/lib/widgets/components/Dialog/SimpleDialog/demo.dart deleted file mode 100644 index 58f41ad1..00000000 --- a/lib/widgets/components/Dialog/SimpleDialog/demo.dart +++ /dev/null @@ -1,60 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class SimpleDialogDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - - void showAlertDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return SimpleDialog( - title: Text('选择'), - children: [ - SimpleDialogOption( - child: Text('选项 1'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - SimpleDialogOption( - child: Text('选项 2'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); - } - Widget build(BuildContext context) { - return RaisedButton( - padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), - //padding - child: Text( - 'show SimpleDialog', - style: TextStyle( - fontSize: 18.0, //textsize - color: Colors.white, // textcolor - ), - ), - color: Theme.of(context).accentColor, - elevation: 4.0, - //shadow - splashColor: Colors.blueGrey, - onPressed: () { - showAlertDialog(context); - }); - } - -} diff --git a/lib/widgets/components/Dialog/SimpleDialog/index.dart b/lib/widgets/components/Dialog/SimpleDialog/index.dart deleted file mode 100644 index 44a94023..00000000 --- a/lib/widgets/components/Dialog/SimpleDialog/index.dart +++ /dev/null @@ -1,49 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> SimpleDialog 是一个用于向用户传递确定信息并提供选项的弹出层 -- SimpleDialog 可为用户提供多个选项选择。有一个可选的标题,显示在选项上方 - - - -### **基本用法** - -> 通常作为子窗口小部件传递给showDialog,后者显示对话框。 -- 选择通常使用SimpleDialogOption表示 -- 对于通知用户情况的对话框,请考虑使用 AlertDialog。 - -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Dialog/SimpleDialog'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SimpleDialog', - codeUrl: 'components/Dialog/SimpleDialog/demo.dart', - contentList: [ - _Text0, - SimpleDialogDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/SimpleDialog-class.html', - ); - } -} diff --git a/lib/widgets/components/Dialog/index.dart b/lib/widgets/components/Dialog/index.dart deleted file mode 100644 index 91c5d133..00000000 --- a/lib/widgets/components/Dialog/index.dart +++ /dev/null @@ -1,30 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'AlertDialog/index.dart' as AlertDialog; -import 'Dialog/index.dart' as Dialog; -import 'SimpleDialog/index.dart' as SimpleDialog; -import 'AboutDialog/index.dart' as AboutDialog; - -List widgetPoints = [ - WidgetPoint( - name: 'AlertDialog', - routerName: AlertDialog.Demo.routeName, - buildRouter: (BuildContext context) => AlertDialog.Demo(), - ), - WidgetPoint( - name: 'Dialog', - routerName: Dialog.Demo.routeName, - buildRouter: (BuildContext context) => Dialog.Demo(), - ), - WidgetPoint( - name: 'SimpleDialog', - routerName: SimpleDialog.Demo.routeName, - buildRouter: (BuildContext context) => SimpleDialog.Demo(), - ), - WidgetPoint( - name: 'AboutDialog', - routerName: AboutDialog.Demo.routeName, - buildRouter: (BuildContext context) => AboutDialog.Demo(), - ), -]; diff --git a/lib/widgets/components/Grid/GridPaper/demo.dart b/lib/widgets/components/Grid/GridPaper/demo.dart deleted file mode 100644 index 129f9324..00000000 --- a/lib/widgets/components/Grid/GridPaper/demo.dart +++ /dev/null @@ -1,59 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class GridPaperDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - - - Widget build(BuildContext context) { - return Container( - height: 400, - color: Color(0xffc91b3a), - child: GridView.count( - crossAxisCount: 2, - mainAxisSpacing: 10.0, - crossAxisSpacing: 4.0, - padding: const EdgeInsets.all(4.0), - childAspectRatio: 1.3, - children: [ - GridTile( - header: GridTileBar( - title: Text('title'), - subtitle: Text('subtitle'), - leading: Icon(Icons.add), - trailing: Text("trailing"), - ), - child: Container(), - - ), - GridPaper( - color: Colors.red, - child: 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), - 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), - 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), - 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), - 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), - 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), - 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), - ], - ) - ); - } -} diff --git a/lib/widgets/components/Grid/GridPaper/index.dart b/lib/widgets/components/Grid/GridPaper/index.dart deleted file mode 100644 index abc6eabc..00000000 --- a/lib/widgets/components/Grid/GridPaper/index.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> GridViewPaper是GridView中的item的一种展现形式, 会在上层浮现一层网络. - -"""; - - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Grid/GridPaper'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'GridPaper', - codeUrl: 'components/Grid/GridPaper/demo.dart', - contentList: [ - _Text0, - GridPaperDemo(), - SizedBox( - height: 100.0, - ) - ], - docUrl: 'https://docs.flutter.io/flutter/material/GridPaper-class.html', - ); - } -} diff --git a/lib/widgets/components/Grid/GridTile/demo.dart b/lib/widgets/components/Grid/GridTile/demo.dart deleted file mode 100644 index 06e3fcec..00000000 --- a/lib/widgets/components/Grid/GridTile/demo.dart +++ /dev/null @@ -1,53 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class GridTileDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - Widget build(BuildContext context) { - return Container( - height: 400, - color: Color(0xffc91b3a), - child: GridView.count( - crossAxisCount: 2, - mainAxisSpacing: 10.0, - crossAxisSpacing: 4.0, - padding: const EdgeInsets.all(4.0), - childAspectRatio: 1.3, - children: [ - GridTile( - header: Text("GridTile header", style: TextStyle(color: Colors.white)), - child: Container( - padding: EdgeInsets.fromLTRB(0, 30, 0, 0), - child: Text("GridTile child", style: TextStyle(color: Colors.white)), - ), - footer: Text("GridTile footer", style: TextStyle(color: Colors.white)), - ), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), - ], - ) - ); - } -} diff --git a/lib/widgets/components/Grid/GridTile/index.dart b/lib/widgets/components/Grid/GridTile/index.dart deleted file mode 100644 index 1f4f809f..00000000 --- a/lib/widgets/components/Grid/GridTile/index.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> GridTile 是GridList中的一种瓷片组件;包含header, body, footer三部份; - - -### **基本用法** - -> 一个grid列表包含多个Item, 每个Item通常包含一些视觉丰富的内容(例如,图像), 我们可以用GridTileBar去定义他的页眉与页脚。 - -如下实例中, 第一个是item便是GridTile组件构成. 包含header, body, footer; -"""; - - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Grid/GridTile'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'GridTile', - codeUrl: 'components/Grid/GridTile/demo.dart', - contentList: [ - _Text0, - GridTileDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/material/Dialog-class.html', - ); - } -} diff --git a/lib/widgets/components/Grid/GridTileBar/demo.dart b/lib/widgets/components/Grid/GridTileBar/demo.dart deleted file mode 100644 index 22628299..00000000 --- a/lib/widgets/components/Grid/GridTileBar/demo.dart +++ /dev/null @@ -1,55 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class GridTileDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - Widget build(BuildContext context) { - return Container( - height: 400, - color: Color(0xffc91b3a), - child: GridView.count( - crossAxisCount: 2, - mainAxisSpacing: 10.0, - crossAxisSpacing: 4.0, - padding: const EdgeInsets.all(4.0), - childAspectRatio: 1.3, - children: [ - GridTile( - header: GridTileBar( - title: Text('title'), - subtitle: Text('subtitle'), - leading: Icon(Icons.add), - trailing: Text("trailing"), - ), - child: Container(), - - ), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), - ], - ) - ); - } -} diff --git a/lib/widgets/components/Grid/GridTileBar/index.dart b/lib/widgets/components/Grid/GridTileBar/index.dart deleted file mode 100644 index 3579656b..00000000 --- a/lib/widgets/components/Grid/GridTileBar/index.dart +++ /dev/null @@ -1,51 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> GridTileBar 通常用来做GridTile的header与footer组件; - - -### **基本用法** - -> GridTileBar含有五个属性 - -- backgroundColor 描述GridTileBar的背景颜色 -- leading GridTileBar左侧的widget, 通常我们用图标来占位 -- subtitle 次标题 -- title 主标题 -- trailing GridTileBar右侧的widgett, 通常我们用来做交互操作类的组件 -"""; - - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Grid/GridTileBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'GridTileBar', - codeUrl: 'components/Grid/GridTileBar/demo.dart', - contentList: [ - _Text0, - GridTileDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/material/GridTileBar-class.html', - ); - } -} diff --git a/lib/widgets/components/Grid/GridView/demo.dart b/lib/widgets/components/Grid/GridView/demo.dart deleted file mode 100644 index 6246c433..00000000 --- a/lib/widgets/components/Grid/GridView/demo.dart +++ /dev/null @@ -1,87 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class GridTileDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - - Widget build(BuildContext context) { - return Container( - height: 400, - color: Color(0xffc91b3a), - child: GridView.count( - crossAxisCount: 2, - mainAxisSpacing: 10.0, - crossAxisSpacing: 4.0, - padding: const EdgeInsets.all(4.0), - childAspectRatio: 1.3, - children: [ - GridTile( - header: GridTileBar( - title: Text('title'), - subtitle: Text('subtitle'), - leading: Icon(Icons.add), - trailing: Text("trailing"), - ), - child: Container(), - - ), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), - ], - ) - ); - } -} - - -class GridViewDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - height: 200, - color: Color(0xffc91b3a), - child: GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - ///列数 - crossAxisCount: 3, - ///列间距 - mainAxisSpacing: 10.0, - ///横轴距离 - crossAxisSpacing: 4.0, - ///缩放比例 - childAspectRatio: 1.3,), - padding: const EdgeInsets.only(left: 10,right: 10,top: 10), - children: [ - 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), - 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), - 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), - ],), - ); - } - -} \ No newline at end of file diff --git a/lib/widgets/components/Grid/GridView/index.dart b/lib/widgets/components/Grid/GridView/index.dart deleted file mode 100644 index d00925e9..00000000 --- a/lib/widgets/components/Grid/GridView/index.dart +++ /dev/null @@ -1,86 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> GridView在移动端上非常的常见的滚动列表, 会占满给出的空间区域. - - -### **基本用法** - -> 创建一个列表 - -属性介绍 - -- scrollDirection:滚动的方向,有垂直和水平两种,默认为垂直方向(Axis.vertical)。 - -- reverse:默认是从上或者左向下或者右滚动的,这个属性控制是否反向,默认值为false,不反向滚动。 - -- controller:控制child滚动时候的位置。 - -- primary:是否是与父节点的PrimaryScrollController所关联的主滚动视图。 - -- physics:滚动的视图如何响应用户的输入。 - -- shrinkWrap:滚动方向的滚动视图内容是否应该由正在查看的内容所决定。 - -- padding:四周的空白区域。 - -- gridDelegate:控制GridView中子节点布局的delegate。 - -- cacheExtent:缓存区域。 - -### **进阶用法** - -> GridView 提供其他四种构造方法 - -- GridView.builder -- GridView.custom -- GridView.count -- GridView.extent -"""; - -const Text1=""" -### -> SliverGridDelegateWithFixedCrossAxisCount - -gridDelegate: SliverGridDelegateWithFixedCrossAxisCount,实现网格 -"""; - - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Grid/GridView'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'GridView', - codeUrl: 'components/Grid/GridView/demo.dart', - contentList: [ - _Text0, - GridTileDemo(), - SizedBox( - height: 10.0, - ), - Text1, - GridViewDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/material/GridView-class.html', - ); - } -} diff --git a/lib/widgets/components/Grid/SliverGrid/demo.dart b/lib/widgets/components/Grid/SliverGrid/demo.dart deleted file mode 100644 index f8bfb19a..00000000 --- a/lib/widgets/components/Grid/SliverGrid/demo.dart +++ /dev/null @@ -1,60 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class SliverGridDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - - Widget showCustomScrollView() { - return CustomScrollView( - slivers: [ - SliverGrid( - gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: 200.0, - mainAxisSpacing: 10.0, - crossAxisSpacing: 10.0, - childAspectRatio: 4.0, - ), - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return Container( - alignment: Alignment.center, - color: Colors.cyan[100 * (index % 5)], - child: Text('grid item $index'), - ); - }, - childCount: 20, - ), - ), -// SliverFixedExtentList( -// itemExtent: 100.0, -// delegate: SliverChildBuilderDelegate( -// (BuildContext context, int index) { -// return Container( -// alignment: Alignment.center, -// color: Colors.lightBlue[100 * (index % 9)], -// child: Text('list item $index'), -// ); -// }, -// ), -// ), - ], - ); - } - - Widget build(BuildContext context) { - return Container( - height: 400, - color: Color(0xffc91b3a), - child: showCustomScrollView() - ); - } -} diff --git a/lib/widgets/components/Grid/SliverGrid/index.dart b/lib/widgets/components/Grid/SliverGrid/index.dart deleted file mode 100644 index c3a50dcf..00000000 --- a/lib/widgets/components/Grid/SliverGrid/index.dart +++ /dev/null @@ -1,54 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> SliverGrid 将多个item以每行二个的形式, 进行排列. - -### **基本用法** - -> 创建 - -在排列列表时,将基于现有的小部件, 延迟创建可见子项的元素、状态和呈现对象。 也就是只有视口中的元素, 才会被创建, 类似于我们网页中的懒加载. - -> 销毁 - -当元素滚动到视图之外时,关联的元素子树、状态和渲染对象将被销毁, 进入视觉窗口的元素将以懒加载的形式进行创建。 - -"""; - - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Grid/SliverGrid'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SliverGrid', - codeUrl: 'components/Grid/SliverGrid/demo.dart', - contentList: [ - _Text0, - SliverGridDemo(), - SizedBox( - height: 100.0, - ) - ], - docUrl: 'https://docs.flutter.io/flutter/material/SliverGrid-class.html', - ); - } -} diff --git a/lib/widgets/components/Grid/index.dart b/lib/widgets/components/Grid/index.dart deleted file mode 100644 index 4d58edb0..00000000 --- a/lib/widgets/components/Grid/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:31 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'GridTile/index.dart' as GridTile; -import 'GridView/index.dart' as GridView; -import 'GridTileBar/index.dart' as GridTileBar; -import 'GridPaper/index.dart' as GridPaper; -import 'SliverGrid/index.dart' as SliverGrid; - -List widgetPoints = [ - WidgetPoint( - name: 'GridTile', - routerName: GridTile.Demo.routeName, - buildRouter: (BuildContext context) => GridTile.Demo(), - ), - WidgetPoint( - name: 'GridTileBar', - routerName: GridTileBar.Demo.routeName, - buildRouter: (BuildContext context) => GridTileBar.Demo(), - ), - WidgetPoint( - name: 'GridView', - routerName: GridView.Demo.routeName, - buildRouter: (BuildContext context) => GridView.Demo(), - ), - WidgetPoint( - name: 'GridPaper', - routerName: GridPaper.Demo.routeName, - buildRouter: (BuildContext context) => GridPaper.Demo(), - ), - WidgetPoint( - name: 'SliverGrid', - routerName: SliverGrid.Demo.routeName, - buildRouter: (BuildContext context) => SliverGrid.Demo(), - ) -]; diff --git a/lib/widgets/components/List/AnimatedList/demo.dart b/lib/widgets/components/List/AnimatedList/demo.dart deleted file mode 100644 index a4c328f3..00000000 --- a/lib/widgets/components/List/AnimatedList/demo.dart +++ /dev/null @@ -1,131 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/widgets/components/List/AnimatedList/model.dart'; - -class AnimatedListFullDefault extends StatefulWidget { - AnimatedListFullDefault({Key key, this.parent}) : super(key: key); - final parent; - - @override - _AnimatedListFullDefault createState() => _AnimatedListFullDefault(); -} - - -/// AnimatedList 默认的实例,有状态 -class _AnimatedListFullDefault extends State { - final GlobalKey _listKey = GlobalKey(); - ListModel _list; - int _selectedItem; - int _nextItem; // The next item inserted when the user presses the '+' button. - - @override - void initState() { - super.initState(); - if (widget.parent is State) { - widget.parent.animatedList = this; // 修改父级的对象引用 - } - _list = ListModel( - listKey: _listKey, - initialItems: [0, 1, 2], - removedItemBuilder: _buildRemovedItem, - ); - _nextItem = 3; - } - - void insert() { - final int index = _selectedItem == null ? _list.length : _list.indexOf(_selectedItem); - _list.insert(index, _nextItem++); - } - - // Remove the selected item from the list model. - void remove() { - if (_selectedItem != null) { - _list.removeAt(_list.indexOf(_selectedItem)); - if(mounted) { - setState(() { - _selectedItem = null; - }); - } - } - } - - Widget _buildItem(BuildContext context, int index, Animation animation) { - return CardItem( - animation: animation, - item: _list[index], - selected: _selectedItem == _list[index], - onTap: () { - setState(() { - _selectedItem = _selectedItem == _list[index] ? null : _list[index]; - }); - }, - ); - } - - Widget _buildRemovedItem(int item, BuildContext context, Animation animation) { - return CardItem( - animation: animation, - item: item, - selected: false, - // No gesture detector here: we don't want removed items to be interactive. - ); - } - - @override - Widget build(BuildContext context) { - return SizedBox( - height: 500.0, - child:AnimatedList( - //shrinkWrap: true, - key: _listKey, - initialItemCount: _list.length, - itemBuilder: _buildItem, - )); - } - void methodA() {} -} - -class CardItem extends StatelessWidget { - const CardItem({ - Key key, - @required this.animation, - this.onTap, - @required this.item, - this.selected: false - }) : assert(animation != null), - assert(item != null && item >= 0), - assert(selected != null), - super(key: key); - - final Animation animation; - final VoidCallback onTap; - final int item; - final bool selected; - - @override - Widget build(BuildContext context) { - TextStyle textStyle = Theme.of(context).textTheme.display1; - if (selected) - textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]); - return Padding( - padding: const EdgeInsets.all(2.0), - child: SizeTransition( - axis: Axis.vertical, - sizeFactor: animation, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: onTap, - child: SizedBox( - height: 128.0, - child: Card( - color: Colors.primaries[item % Colors.primaries.length], - child: Center( - child: Text('Item $item', style: textStyle), - ), - ), - ), - ), - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/List/AnimatedList/index.dart b/lib/widgets/components/List/AnimatedList/index.dart deleted file mode 100644 index 23992c1e..00000000 --- a/lib/widgets/components/List/AnimatedList/index.dart +++ /dev/null @@ -1,105 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/31 -/// Time: 下午9:48 -/// email: zhu.yan@alibaba-inc.com -/// target: AnimatedList 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -//var _AnimatedListFullDefault = AnimatedListDemo.AnimatedListFullDefault; -GlobalKey globalKey = GlobalKey(); - -const String _Text0 = -"""### **简介** -> AnimatedList “动画滚动容器” -- 一个滚动容器,可在插入或移除项目时为其设置动画 -"""; - - -const String _Text1 = -"""### **基本用法** -> AnimatedList -- AnimatedListState 可用于动态插入或删除项目。 -- 下面示例展示效果:点击+号增加 card, 点击 card 保持激活状态,再点击-号,减少 card。 -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/List/AnimatedList'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - State animatedList; - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'AnimatedList', - codeUrl: 'components/List/AnimatedList/demo.dart', - contentList: allDemoBoxs(context, this), - docUrl: 'https://docs.flutter.io/flutter/widgets/AnimatedList-class.html', - ); - } -} - - -/// 所有的 AnimatedList widget -/// context: 运行上下文 -/// that: 指向有状态的 StatefulWidget -List allDemoBoxs(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), - // 间距 - _Text1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - assistButtonLeft(that), - SizedBox(width: 20.0), // 间距 - assistButtonRight(that), - ], - ), - //AnimatedListDemo.AnimatedListFullDefault(key:globalKey,parent:context), - AnimatedListFullDefault(key: globalKey, parent: that), - SizedBox(height: 20.0), // 间距 - ]; -} - - -// 演示辅助按钮 -Widget assistButtonLeft(that) { - return FloatingActionButton( - // 文本内容 - backgroundColor:Colors.red, - child: const Icon(Icons.add_circle_outline), - heroTag: null, // 不加这个参数会黑屏... - onPressed: () { - //demo.insert(); - //print('${globalKey.currentState}'); - that.animatedList.insert(); - } - ); -} - - -// 演示辅助按钮 -Widget assistButtonRight(that) { - return FloatingActionButton( - // 文本内容 - backgroundColor:Colors.green, - child: const Icon(Icons.remove_circle_outline), - heroTag: null, // 不加这个参数会黑屏... - onPressed: () { - that.animatedList.remove(); - } - ); -} - diff --git a/lib/widgets/components/List/AnimatedList/model.dart b/lib/widgets/components/List/AnimatedList/model.dart deleted file mode 100644 index 3b0b3d59..00000000 --- a/lib/widgets/components/List/AnimatedList/model.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/31 -/// Time: 下午10:15 -/// email: zhu.yan@alibaba-inc.com -/// target: model 的示例 - -import 'package:flutter/material.dart'; - -class ListModel { - ListModel({ - @required this.listKey, - @required this.removedItemBuilder, - Iterable initialItems, - }) : assert(listKey != null), - assert(removedItemBuilder != null), - _items = List.from(initialItems ?? []); - - final GlobalKey listKey; - final dynamic removedItemBuilder; - final List _items; - - AnimatedListState get _animatedList => listKey.currentState; - - void insert(int index, E item) { - _items.insert(index, item); - _animatedList.insertItem(index); - } - - E removeAt(int index) { - final E removedItem = _items.removeAt(index); - if (removedItem != null) { - _animatedList.removeItem(index, (BuildContext context, Animation animation) { - return removedItemBuilder(removedItem, context, animation); - }); - } - return removedItem; - } - - int get length => _items.length; - E operator [](int index) => _items[index]; - int indexOf(E item) => _items.indexOf(item); -} \ No newline at end of file diff --git a/lib/widgets/components/List/ListBody/demo.dart b/lib/widgets/components/List/ListBody/demo.dart deleted file mode 100644 index 038c69b2..00000000 --- a/lib/widgets/components/List/ListBody/demo.dart +++ /dev/null @@ -1,66 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/31 -/// Time: 下午2:42 -/// email: zhu.yan@alibaba-inc.com -/// target: ListBody 的示例 - -import 'package:flutter/material.dart'; - -/// Checkbox 默认ListBody的实例 -class ListBodyFullDefault extends StatefulWidget { - const ListBodyFullDefault() : super(); - - @override - State createState() => _ListBodyFullDefault(); -} - - -/// ListBody 默认的实例,有状态 -class _ListBodyFullDefault extends State { - @override - Widget build(BuildContext context) { - return ListBody( - // ... // 如果没有,就是不需要有状态的 StatefulWidget - ); - } -} - -/// ListBody 默认的实例,无状态 -class ListBodyLessDefault extends StatelessWidget { - final widget; - final parent; - - const ListBodyLessDefault([this.widget, this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - return ListBody( - mainAxis: Axis.vertical, // 排列的主轴方向 - reverse: false, // 是否反向 - children: [ - Container(color: Colors.red, - width: 50.0, - height: 150.0, - child: Text('标题1', style: TextStyle(color: Color(0xffffffff)))), - Container(color: Colors.yellow, - width: 50.0, - height: 50.0, - child: Text('标题2', style: TextStyle(color: Color(0xffffffff)))), - Container(color: Colors.green, - width: 50.0, - height: 50.0, - child: Text('标题3', style: TextStyle(color: Color(0xffffffff)))), - Container(color: Colors.blue, - width: 50.0, - height: 50.0, - child: Text('标题4', style: TextStyle(color: Color(0xffffffff)))), - Container(color: Colors.black, - width: 50.0, - height: 50.0, - child: Text('标题5', style: TextStyle(color: Color(0xffffffff)))) - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/List/ListBody/index.dart b/lib/widgets/components/List/ListBody/index.dart deleted file mode 100644 index 5b5bdb56..00000000 --- a/lib/widgets/components/List/ListBody/index.dart +++ /dev/null @@ -1,62 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/31 -/// Time: 下午2:38 -/// email: zhu.yan@alibaba-inc.com -/// target: ListBody 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -import './demo.dart' as ListBodyDemo; - -const String _Text0 = -"""### **简介** -> ListBody “列表组件” -- 作用是按给定的轴方向,按照顺序排列子节点。 -- 是一个不常直接使用的控件,一般都会配合ListView或者Column等控件使用。 -"""; - - -const String _Text1 = -"""### **基本用法** -> 布局行为 -- 在主轴上,子节点按照顺序进行布局,在交叉轴上,子节点尺寸会被拉伸,以适应交叉轴的区域。 -- 在主轴上,给予子节点的空间必须是不受限制的(unlimited),使得子节点可以全部被容纳,ListBody不会去裁剪或者缩放其子节点。 -- ListBody的布局代码非常简单,根据主轴的方向,对子节点依次排布。 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/components//List/ListBody'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'ListBody', - codeUrl: 'components/List/ListBody/demo.dart', - contentList: allDomeBox(context, this), - docUrl: 'https://docs.flutter.io/flutter/widgets/ListBody-class.html', - ); - } -} - - -/// 所有的 ListBody widget -/// context: 运行上下文 -/// that: 指向有状态的 StatefulWidget -List allDomeBox(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - ListBodyDemo.ListBodyLessDefault(), - SizedBox(height: 20.0), // 间距 - ]; -} diff --git a/lib/widgets/components/List/ListView/demo.dart b/lib/widgets/components/List/ListView/demo.dart deleted file mode 100644 index 4e31f69f..00000000 --- a/lib/widgets/components/List/ListView/demo.dart +++ /dev/null @@ -1,136 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/31 -/// Time: 下午2:27 -/// email: zhu.yan@alibaba-inc.com -/// target: ListView 的示例 - -import 'package:flutter/material.dart'; - -/// ListView 默认ListView的实例 -class ListViewFullDefault extends StatefulWidget { - const ListViewFullDefault() : super(); - - @override - State createState() => _ListViewFullDefault(); -} - - -/// ListView 默认的实例,有状态 -class _ListViewFullDefault extends State { - @override - Widget build(BuildContext context) { - return ListView( - ); - } -} - - -/// ListView 默认的实例,无状态 -class ListViewLessDefault extends StatelessWidget { - final widget; - final parent; - final index; - - const ListViewLessDefault([this.index, this.widget, this.parent,]) - : super(); - - @override - Widget build(BuildContext context) { - switch(index){ - case 0: - return ListView( - shrinkWrap: true, - padding: EdgeInsets.all(20.0), - children: [ - Text('I\'m dedicating every day to you'), - ListTile( - leading: Icon(Icons.map), - title: Text('Maps'), - ), - Text('Domestic life was never quite my style'), - ListTile( - leading: Icon(Icons.photo_album), - title: Text('Album'), - ), - Text('When you smile, you knock me out, I fall apart'), - ListTile( - leading: Icon(Icons.phone), - title: Text('Phone'), - ), - Text('And I thought I was so smart'), - ], - ); - break; - case 1: - return SizedBox( - height: 300.0, - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: 10, // item 的个数 - itemExtent: 50.0, // 如果为非null,则强制子项在滚动方向上具有给定范围 - itemBuilder: (BuildContext context, int index) { - return ListTile( - title: Text("title $index"), // item 标题 - leading: Icon(Icons.keyboard), // item 前置图标 - subtitle: Text("subtitle $index"), // item 副标题 - trailing: Icon(Icons.keyboard_arrow_right),// item 后置图标 - isThreeLine:false, // item 是否三行显示 - dense:true, // item 直观感受是整体大小 - contentPadding: EdgeInsets.all(10.0),// item 内容内边距 - enabled:true, - onTap:(){print('点击:$index');},// item onTap 点击事件 - onLongPress:(){print('长按:$index');},// item onLongPress 长按事件 - selected:false, // item 是否选中状态 - ); - }, - ), - ); - break; - case 2: - return SizedBox( - height: 300.0, - child: ListView.separated( - scrollDirection: Axis.vertical, - itemCount: 100, // item 的个数 - separatorBuilder: (BuildContext context, int index) => Divider(height:1.0,color: Colors.blue), // 添加分割线 - itemBuilder: (BuildContext context, int index) { - return ListTile( - title: Text("title $index"), // item 标题 - leading: Icon(Icons.keyboard), // item 前置图标 - subtitle: Text("subtitle $index"), // item 副标题 - trailing: Icon(Icons.keyboard_arrow_right),// item 后置图标 - isThreeLine:false, // item 是否三行显示 - dense:true, // item 直观感受是整体大小 - contentPadding: EdgeInsets.all(10.0),// item 内容内边距 - enabled:true, - onTap:(){print('点击:$index');},// item onTap 点击事件 - onLongPress:(){print('长按:$index');},// item onLongPress 长按事件 - selected:false, // item 是否选中状态 - ); - }, - ), - ); - break; - case 3: - return SizedBox( - height: 300.0, - child: ListView.custom( - scrollDirection: Axis.vertical, - childrenDelegate:SliverChildBuilderDelegate((BuildContext context, int index) { - return Container( - height: 50.0, - alignment: Alignment.center, - color: Colors.lightBlue[100 * (index % 9)], - child: Text('list item $index'), - ); - }, childCount: 10), - ), - ); - break; - default: - return null; - break; - } - } -} \ No newline at end of file diff --git a/lib/widgets/components/List/ListView/index.dart b/lib/widgets/components/List/ListView/index.dart deleted file mode 100644 index a953337d..00000000 --- a/lib/widgets/components/List/ListView/index.dart +++ /dev/null @@ -1,98 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/31 -/// Time: 下午2:25 -/// email: zhu.yan@alibaba-inc.com -/// target: ListView 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -import './demo.dart' as ListViewDemo; - -const String _Text0 = -"""### **简介** -> ListView “滚动列表” -- 一个非常常用的控件,涉及到数据列表展示的,一般情况下都会选用该控件。 -- 跟GridView相似,基本上是一个slivers里面只包含一个SliverList的CustomScrollView。 -"""; - - -const String _Text1 = -"""### **基本用法** -> 布局行为 - -- ListView在主轴方向可以滚动,在交叉轴方向,则是填满ListView。 -- 一个组合控件。ListView跟GridView类似,都是继承自BoxScrollView。 -- ### 在Flutter中有几种构建ListView的方式,分别是: **默认List,ListView.builder, ListView.separated,ListView.custom**。 -"""; - -const String _Text2 = -""" -> ListView() -- 默认 List 方式,是把数据 Iterable 添加到列表中,之后直接添加到 ListView 即可。 -- Tips: 如果需要设置分割线,需要对列表 item 添加处理,ListTile.divideTiles。 -- 仅适用于内容较少的情形,因为它是一次性渲染所有的 items ,当 items 的数目较多时,很容易出现卡顿现象的,导致滑动不流畅。 -"""; - -const String _Text3 = -""" -> ListView.builder() -- 设置单个item的属性,懒加载的,假如有 1000 个列表,初始渲染时并不会所有都渲染,而只会特定数量的 item ,这对于性能和用户体验来说,是很好的提升。 -"""; - -const String _Text4 = -""" -> 官方示例 ListView.separated() -- 带分割线的item,separated 相比较于 builder,又多了一个参数 separatorBuilder ,用于控制列表各个元素的间隔如何渲染。 -"""; - -const String _Text5 = -""" -> 官方示例 ListView.custom() -- 必须的参数就是 childrenDelegate , 然后传入一个 实现了 SliverChildDelegate 的组件,如 SliverChildListDelegate 和 SliverChildBuilderDelegate。 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/components/List/ListView'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'ListView', - codeUrl: 'components/List/ListView/demo.dart', - contentList: allDomeBox(context, this), - docUrl: 'https://docs.flutter.io/flutter/widgets/ListView-class.html', - ); - } -} - -/// 所有的 ListView widget -/// context: 运行上下文 -/// that: 指向有状态的 StatefulWidget -List allDomeBox(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - _Text2, - ListViewDemo.ListViewLessDefault(0), - _Text3, - ListViewDemo.ListViewLessDefault(1), - SizedBox(height: 20.0), // 间距 - _Text4, - ListViewDemo.ListViewLessDefault(2), - SizedBox(height: 20.0), // 间距 - _Text5, - ListViewDemo.ListViewLessDefault(3), - ]; -} - - diff --git a/lib/widgets/components/List/index.dart b/lib/widgets/components/List/index.dart deleted file mode 100644 index b2670ac5..00000000 --- a/lib/widgets/components/List/index.dart +++ /dev/null @@ -1,31 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/27 -/// Time: 下午2:50 -/// email: zhu.yan@alibaba-inc.com -/// target: List 的示例 - -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'ListBody/index.dart' as ListBody; -import 'ListView/index.dart' as ListView; -import 'AnimatedList/index.dart' as AnimatedList; - -List widgetPoints = [ - WidgetPoint( - name: 'ListBody', - routerName: ListBody.Demo.routeName, - buildRouter: (BuildContext context) => ListBody.Demo(), - ), - WidgetPoint( - name: 'ListView', - routerName: ListView.Demo.routeName, - buildRouter: (BuildContext context) => ListView.Demo(), - ), - WidgetPoint( - name: 'AnimatedList', - routerName: AnimatedList.Demo.routeName, - buildRouter: (BuildContext context) => AnimatedList.Demo(), - ) -]; diff --git a/lib/widgets/components/Menu/CheckedPopupMenuItem/demo.dart b/lib/widgets/components/Menu/CheckedPopupMenuItem/demo.dart deleted file mode 100644 index 967381f5..00000000 --- a/lib/widgets/components/Menu/CheckedPopupMenuItem/demo.dart +++ /dev/null @@ -1,78 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-22 21:01:51 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 15:37:04 - -import 'package:flutter/material.dart'; - -class CheckedPopupMenuItemDemo extends StatefulWidget { - _CheckedPopupMenuItemDemoState createState() => - _CheckedPopupMenuItemDemoState(); -} - -class _CheckedPopupMenuItemDemoState extends State { - List _checkedValues; - - final String _checkedValue1 = 'One'; - final String _checkedValue2 = 'Two'; - final String _checkedValue3 = 'Free'; - final String _checkedValue4 = 'Four'; - - @override - void initState() { - super.initState(); - _checkedValues = [_checkedValue3]; - } - - - bool isChecked(String value) => _checkedValues.contains(value); - - void showCheckedMenuSelections(String value){ - if(_checkedValues.contains(value)){ - _checkedValues.remove(value); - }else{ - _checkedValues.add(value); - } - - Scaffold.of(context).showSnackBar( SnackBar( - content: Text('Checked $_checkedValues'))); - } - - @override - Widget build(BuildContext context) { - return Container( - color: Theme.of(context).primaryColor, - child: ListTile( - title: const Text('CheckedPopupMenuItem Demo',style: TextStyle(color: Colors.white),), - trailing: PopupMenuButton( - padding: EdgeInsets.zero, - onSelected: showCheckedMenuSelections, - icon: Icon(Icons.menu,color: Colors.white,), - itemBuilder: (BuildContext context)=>>[ - CheckedPopupMenuItem( - value: _checkedValue1, - checked: isChecked(_checkedValue1), - child: Text(_checkedValue1) - ), - CheckedPopupMenuItem( - value: _checkedValue2, - enabled: false, - checked: isChecked(_checkedValue2), - child: Text(_checkedValue2) - ), - CheckedPopupMenuItem( - value: _checkedValue3, - checked: isChecked(_checkedValue3), - child: Text(_checkedValue3) - ), - CheckedPopupMenuItem( - value: _checkedValue4, - checked: isChecked(_checkedValue4), - child: Text(_checkedValue4) - ) - ], - ), - ), - ); - } -} diff --git a/lib/widgets/components/Menu/CheckedPopupMenuItem/index.dart b/lib/widgets/components/Menu/CheckedPopupMenuItem/index.dart deleted file mode 100644 index 9d6fb700..00000000 --- a/lib/widgets/components/Menu/CheckedPopupMenuItem/index.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-22 21:01:45 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-22 21:26:54 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 带有选中标记的 Material 设计风格的弹出菜单 -- 默认高度为48px,水平布局使用 ListTile 复选标记是 Icons.done 图标,显示在 leading 位置 -- 只有在状态为选中时才会显示图标 -'''; - -const String content1 = ''' -### **基本用法** -> 配合 PopupMenuButton 使用 -- enabled 属性控制item是否为可点击 -- checked 标识item是否为选中状态 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Menu/CheckedPopupMenuItem'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'components/Menu/CheckedPopupMenuItem/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/material/CheckedPopupMenuItem-class.html', - title: 'CheckedPopupMenuItem', - contentList: [ - content0, - content1, - CheckedPopupMenuItemDemo(), - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Menu/DropdownMenuItem/demo.dart b/lib/widgets/components/Menu/DropdownMenuItem/demo.dart deleted file mode 100644 index 9c3e423f..00000000 --- a/lib/widgets/components/Menu/DropdownMenuItem/demo.dart +++ /dev/null @@ -1,93 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 14:05:32 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 14:05:52 - -import 'package:flutter/material.dart'; - -class DropdownMenuItemDemo extends StatefulWidget { - _DropdownMenuItemDemoState createState() => _DropdownMenuItemDemoState(); -} - -class _DropdownMenuItemDemoState extends State { - - String dropdown1Value = 'Free'; - String dropdown2Value; - String dropdown3Value = 'Four'; - - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(24.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - ListTile( - title: const Text('Simple dropdown:'), - trailing: DropdownButton( - value: dropdown1Value, - onChanged: (String newValue) { - setState(() { - dropdown1Value = newValue; - }); - }, - items: ['One', 'Two', 'Free', 'Four'].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - ), - const SizedBox( - height: 24.0, - ), - ListTile( - title: const Text('Dropdown with a hint:'), - trailing: DropdownButton( - value: dropdown2Value, - hint: const Text('Choose'), - onChanged: (String newValue) { - setState(() { - dropdown2Value = newValue; - }); - }, - items: ['One', 'Two', 'Free', 'Four'].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - ), - const SizedBox( - height: 24.0, - ), - ListTile( - title: const Text('Scrollable dropdown:'), - trailing: DropdownButton( - value: dropdown3Value, - onChanged: (String newValue) { - setState(() { - dropdown3Value = newValue; - }); - }, - items: [ - 'One', 'Two', 'Free', 'Four', 'Can', 'I', 'Have', 'A', 'Little', - 'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten' - ] - .map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }) - .toList(), - ), - ), - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Menu/DropdownMenuItem/index.dart b/lib/widgets/components/Menu/DropdownMenuItem/index.dart deleted file mode 100644 index c378f5b6..00000000 --- a/lib/widgets/components/Menu/DropdownMenuItem/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 11:20:07 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 14:51:44 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> DropdownButton 创建的一个菜单项 -- DropdownButton 是 Material 设计风格中的一个从列表中选择某一个item的按钮 -- DropdownButton 按钮显示选定的Item的值以及打开用于选择其他item的菜单箭头 -- DropdownMenuItem 这里面的T代表入参的类型,注意在给定菜单中,所有的item的类型要保持一致 -'''; - -const String content1 = ''' -### **基本用法** -> 配合 DropdownButton 使用 -- value 选中返回的值 -- child 子Widget项 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Menu/DropdownMenuItem'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - DropdownMenuItemDemo(), - ], - title: 'DropdownMenuItem', - docUrl: 'https://docs.flutter.io/flutter/material/DropdownMenuItem-class.html', - codeUrl: 'components/Menu/DropdownMenuItem/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Menu/PopupMenuButton/demo.dart b/lib/widgets/components/Menu/PopupMenuButton/demo.dart deleted file mode 100644 index b290c760..00000000 --- a/lib/widgets/components/Menu/PopupMenuButton/demo.dart +++ /dev/null @@ -1,144 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 15:17:10 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 15:39:35 - -import 'package:flutter/material.dart'; - -class PopupMenuButtonDemo extends StatefulWidget { - _PopupMenuButtonDemoState createState() => _PopupMenuButtonDemoState(); -} - -class _PopupMenuButtonDemoState extends State { - final String _simpleValue1 = 'Menu item value one'; - final String _simpleValue2 = 'Menu item value two'; - final String _simpleValue3 = 'Menu item value three'; - String _simpleValue; - - void showMenuSelection(String value) { - if ([_simpleValue1, _simpleValue2, _simpleValue3].contains(value)) - _simpleValue = value; - Scaffold.of(context).showSnackBar( SnackBar( - content: Text('You selected: $value'))); - } - - - - @override - void initState() { - super.initState(); - _simpleValue = _simpleValue2; - } - - - - @override - Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - ListTile( - title: const Text('An item with a context menu button'), - trailing: PopupMenuButton( - padding: EdgeInsets.zero, - onSelected: showMenuSelection, - itemBuilder: (BuildContext context) => >[ - PopupMenuItem( - value: _simpleValue1, - child: const Text('Context menu item one')), - const PopupMenuItem( - enabled: false, child: Text('A disabled menu item')), - PopupMenuItem( - value: _simpleValue3, - child: const Text('Context menu item three')), - ], - ), - ), - ListTile( - title: const Text('An item with a sectioned menu'), - trailing: PopupMenuButton( - padding: EdgeInsets.zero, - onSelected: showMenuSelection, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 'Preview', - child: ListTile( - leading: Icon(Icons.visibility), - title: Text('Preview'))), - const PopupMenuItem( - value: 'Share', - child: ListTile( - leading: Icon(Icons.person_add), - title: Text('Share'))), - const PopupMenuItem( - value: 'Get Link', - child: ListTile( - leading: Icon(Icons.link), - title: Text('Get link'))), - const PopupMenuDivider(), - const PopupMenuItem( - value: 'Remove', - child: ListTile( - leading: Icon(Icons.delete), title: Text('Remove'))) - ], - ), - ), - PopupMenuButton( - padding: EdgeInsets.zero, - initialValue: _simpleValue, - onSelected: showMenuSelection, - child: ListTile( - title: const Text('An item with a simple menu'), - subtitle: Text(_simpleValue)), - itemBuilder: (BuildContext context) => >[ - PopupMenuItem( - value: _simpleValue1, child: Text(_simpleValue1)), - PopupMenuItem( - value: _simpleValue2, child: Text(_simpleValue2)), - PopupMenuItem( - value: _simpleValue3, child: Text(_simpleValue3)) - ], - ), - ListTile( - title: const Text('An item with a sectioned menu'), - trailing: PopupMenuButton( - padding: EdgeInsets.zero, - onSelected: showMenuSelection, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 'Preview', - child: ListTile( - leading: Icon(Icons.visibility), - title: Text('Preview') - ) - ), - const PopupMenuItem( - value: 'Share', - child: ListTile( - leading: Icon(Icons.person_add), - title: Text('Share') - ) - ), - const PopupMenuItem( - value: 'Get Link', - child: ListTile( - leading: Icon(Icons.link), - title: Text('Get link') - ) - ), - const PopupMenuDivider(), - const PopupMenuItem( - value: 'Remove', - child: ListTile( - leading: Icon(Icons.delete), - title: Text('Remove') - ) - ) - ] - ) - ), - ], - ), - ); - } -} diff --git a/lib/widgets/components/Menu/PopupMenuButton/index.dart b/lib/widgets/components/Menu/PopupMenuButton/index.dart deleted file mode 100644 index cd81f7d5..00000000 --- a/lib/widgets/components/Menu/PopupMenuButton/index.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 14:43:50 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 15:44:31 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 一个提供菜单栏弹出对话框的按钮 -- 点击的时候弹出菜单栏对话框,当选择其中一项后会调用 onSelected方法。传递其所选的菜单项的值 -- 可以提供一个child widget或者提供一个icon给它,但是并不能两者都提供 -- 如果什么都没有提供给 PopupMenuButton ,则会根据运行平台创建一个overflow icon - -'''; - -const String content1 = ''' -### **基本用法** -> PopupMenuButton 通常配合 PopupMenuItem 一起使用 -- enabled 标识当前item是否可点击 -- PopupMenuItem 可以在child中传入带有Icon的widget -- 可以指定 PopupMenuButton 的 初始值 initialValue -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Menu/PopupMenuButton'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - PopupMenuButtonDemo(), - ], - codeUrl: 'components/Menu/PopupMenuButton/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuButton-class.html', - title: 'PopupMenuButton', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Menu/PopupMenuDivider/demo.dart b/lib/widgets/components/Menu/PopupMenuDivider/demo.dart deleted file mode 100644 index 3b578b53..00000000 --- a/lib/widgets/components/Menu/PopupMenuDivider/demo.dart +++ /dev/null @@ -1,50 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 15:45:26 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 15:45:26 - -import 'package:flutter/material.dart'; - -class PopupMenuDividerDemo extends StatefulWidget { - _PopupMenuDividerDemoState createState() => _PopupMenuDividerDemoState(); -} - -class _PopupMenuDividerDemoState extends State { - void showInSnackBar(String value) { - Scaffold.of(context) - .showSnackBar( SnackBar(content: Text('You selected: $value'))); - } - - @override - Widget build(BuildContext context) { - return Container( - child: ListTile( - title: const Text('An item with a sectioned menu'), - trailing: PopupMenuButton( - padding: EdgeInsets.zero, - onSelected: showInSnackBar, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 'Preview', - child: ListTile( - leading: Icon(Icons.visibility), - title: Text('Preview'))), - const PopupMenuItem( - value: 'Share', - child: ListTile( - leading: Icon(Icons.person_add), - title: Text('Share'))), - const PopupMenuItem( - value: 'Get Link', - child: ListTile( - leading: Icon(Icons.link), - title: Text('Get link'))), - const PopupMenuDivider(), - const PopupMenuItem( - value: 'Remove', - child: ListTile( - leading: Icon(Icons.delete), title: Text('Remove'))) - ])), - ); - } -} diff --git a/lib/widgets/components/Menu/PopupMenuDivider/index.dart b/lib/widgets/components/Menu/PopupMenuDivider/index.dart deleted file mode 100644 index f6c2fd68..00000000 --- a/lib/widgets/components/Menu/PopupMenuDivider/index.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 14:51:58 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 15:55:22 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 一个提供菜单栏弹出对话框中每一项的水平线 -- 配合 PopupMenuItem 和 PopupMenuButton 使用 -- PopupMenuDivider 可以调整高度,但无法调整颜色 -'''; - -const String content1 = ''' -### **基本用法** -> 此widget通过调整Divider widget 来适应于弹出菜单中 -- 在 PopupMenuButton 中直接 PopupMenuDivider() 即可 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Menu/PopupMenuDivider'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - PopupMenuDividerDemo(), - ], - codeUrl: 'components/Menu/PopupMenuDivider/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/PopupMenuDivider-class.html', - title: 'PopupMenuDivider', - ); - } -} diff --git a/lib/widgets/components/Menu/PopupMenuEntry/index.dart b/lib/widgets/components/Menu/PopupMenuEntry/index.dart deleted file mode 100644 index 54b15669..00000000 --- a/lib/widgets/components/Menu/PopupMenuEntry/index.dart +++ /dev/null @@ -1,41 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 14:51:58 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 16:06:20 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import '../PopupMenuDivider/demo.dart'; - -const String content0 = ''' -### **简介** -> Material 风格中 弹出菜单的一个基类 -- 如果需要创建一个显示弹出菜单的按钮,请考虑使用 PopupMenuButton. -'''; - -const String content1 = ''' -### **基本用法** -- PopupMenuDivider 是一条水平分割线,注意数组要使用父类 PopupMenuEntry,配合其他 item 样式共同使用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Menu/PopupMenuEntry'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - PopupMenuDividerDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuEntry-class.html', - codeUrl: 'components/Menu/PopupMenuDivider/demo.dart', - title: 'PopupMenuEntry', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Menu/PopupMenuItem/index.dart b/lib/widgets/components/Menu/PopupMenuItem/index.dart deleted file mode 100644 index dbb05dc9..00000000 --- a/lib/widgets/components/Menu/PopupMenuItem/index.dart +++ /dev/null @@ -1,41 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-29 15:04:51 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-29 15:07:16 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import '../PopupMenuDivider/demo.dart'; - -const String content0 = ''' -### **简介** -> Material 中窗口弹出的菜单 -- 如果需要创建一个显示弹出菜单的按钮,请考虑使用 PopupMenuButton. -'''; - -const String content1 = ''' -### **基本用法** -- PopupMenuDivider 是一条水平分割线,注意数组要使用父类 PopupMenuEntry,配合其他 item 样式共同使用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Menu/PopupMenuItem'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - PopupMenuDividerDemo() - ], - docUrl: "https://docs.flutter.io/flutter/material/PopupMenuItem-class.html", - codeUrl: 'components/Menu/PopupMenuDivider/demo.dart', - title: 'PopupMenuItem', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Menu/PopupMenuItemState/index.dart b/lib/widgets/components/Menu/PopupMenuItemState/index.dart deleted file mode 100644 index 327724b4..00000000 --- a/lib/widgets/components/Menu/PopupMenuItemState/index.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-29 15:04:51 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-29 16:22:06 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import '../PopupMenuDivider/demo.dart'; - -const String content0 = ''' -### **简介** -> 这个state 是 PopupMenuItem 子类 -- 默认情况下,它实现了Material Design弹出菜单项的基本样式和布局,然而这个buidlChild方法可以重写,以调整放置在菜单中的位置。默认它返回PopupMenuItem.child。 - -'''; - -const String content1 = ''' -### **基本用法** -- PopupMenuDivider 是一条水平分割线,注意数组要使用父类 PopupMenuEntry,配合其他 item 样式共同使用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Menu/PopupMenuItem'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - PopupMenuDividerDemo() - ], - docUrl: "https://docs.flutter.io/flutter/material/PopupMenuItem-class.html", - codeUrl: 'components/Menu/PopupMenuEntry/demo.dart', - title: 'PopupMenuItem', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Menu/index.dart b/lib/widgets/components/Menu/index.dart deleted file mode 100644 index ce1de856..00000000 --- a/lib/widgets/components/Menu/index.dart +++ /dev/null @@ -1,54 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-22 21:01:42 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 14:53:04 - -import 'package:flutter/material.dart'; - -import '../../../model/widget.dart'; -import './CheckedPopupMenuItem/index.dart' as CheckedPopupMenuItem; -import './DropdownMenuItem/index.dart' as DropdownMenuItem; -import './PopupMenuButton/index.dart' as PopupMenuButton; -import './PopupMenuDivider/index.dart' as PopupMenuDivider; -import './PopupMenuEntry/index.dart' as PopupMenuEntry; -import './PopupMenuItemState/index.dart' as PopupMenuItemState; -import './PopupMenuItem/index.dart' as PopupMenuItem; - - -List widgetPoints = [ - WidgetPoint( - name:'CheckedPopupMenuItem', - routerName: CheckedPopupMenuItem.Demo.routeName, - buildRouter: (BuildContext context) => CheckedPopupMenuItem.Demo(), - ), - WidgetPoint( - name:'DropdownMenuItem', - routerName: DropdownMenuItem.Demo.routeName, - buildRouter: (BuildContext context) => DropdownMenuItem.Demo(), - ), - WidgetPoint( - name:'PopupMenuButton', - routerName: PopupMenuButton.Demo.routeName, - buildRouter: (BuildContext context) => PopupMenuButton.Demo(), - ), - WidgetPoint( - name:'PopupMenuDivider', - routerName: PopupMenuDivider.Demo.routeName, - buildRouter: (BuildContext context) => PopupMenuDivider.Demo(), - ), - WidgetPoint( - name:'PopupMenuEntry', - routerName: PopupMenuEntry.Demo.routeName, - buildRouter: (BuildContext context) => PopupMenuEntry.Demo(), - ), - WidgetPoint( - name:'PopupMenuItemState', - routerName: PopupMenuItemState.Demo.routeName, - buildRouter: (BuildContext context) => PopupMenuItemState.Demo(), - ), - WidgetPoint( - name:'PopupMenuItem', - routerName: PopupMenuItem.Demo.routeName, - buildRouter: (BuildContext context) => PopupMenuItem.Demo(), - ), -]; \ No newline at end of file diff --git a/lib/widgets/components/Navigation/BottomNavigationBar/demo.dart b/lib/widgets/components/Navigation/BottomNavigationBar/demo.dart deleted file mode 100644 index 6771263b..00000000 --- a/lib/widgets/components/Navigation/BottomNavigationBar/demo.dart +++ /dev/null @@ -1,57 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/27 -/// Time: 下午6:27 -/// email: zhu.yan@alibaba-inc.com -/// target: BottomNavigationBar 的示例 - -import 'package:flutter/material.dart'; - - -// BottomNavigationBar 默认的实例 -class BottomNavigationBarFullDefault extends StatefulWidget { - const BottomNavigationBarFullDefault() : super(); - @override - State createState() => _BottomNavigationBarFullDefault(); -} - - -// BottomNavigationBar 默认的实例,有状态 -class _BottomNavigationBarFullDefault extends State { - int _currentIndex = 1; - - void _onItemTapped(int index) { - if(mounted) { - setState(() { - _currentIndex = index; - }); - } - } - - @override - Widget build(BuildContext context) { - return BottomNavigationBar( - type: BottomNavigationBarType.fixed, // BottomNavigationBarType 中定义的类型,有 fixed 和 shifting 两种类型 - iconSize: 24.0, // BottomNavigationBarItem 中 icon 的大小 - currentIndex: _currentIndex, // 当前所高亮的按钮index - onTap: _onItemTapped, // 点击里面的按钮的回调函数,参数为当前点击的按钮 index - fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed,则通过 fixedColor 设置选中 item 的颜色 - items: [ - BottomNavigationBarItem( - title: Text("Home"), icon: Icon(Icons.home)), - BottomNavigationBarItem( - title: Text("List"), icon: Icon(Icons.list)), - BottomNavigationBarItem( - title: Text("Message"), icon: Icon(Icons.message)), - BottomNavigationBarItem( - title: Text("add"), icon: Icon(Icons.add)), - BottomNavigationBarItem( - title: Text("menu"), icon: Icon(Icons.menu)), - BottomNavigationBarItem( - title: Text("other"), icon: Icon(Icons.devices_other)), - - ], - ); - } -} - diff --git a/lib/widgets/components/Navigation/BottomNavigationBar/index.dart b/lib/widgets/components/Navigation/BottomNavigationBar/index.dart deleted file mode 100644 index 019ea65b..00000000 --- a/lib/widgets/components/Navigation/BottomNavigationBar/index.dart +++ /dev/null @@ -1,70 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/27 -/// Time: 下午6:28 -/// email: zhu.yan@alibaba-inc.com -/// target: BottomNavigationBar 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -import './demo.dart' as BottomNavigationBarDemo; - -const String _text0 = -"""### **简介** -> BottomNavigationBar “底部导航栏” -- 显示在应用程序底部的导航栏,由文本标签,图标或两者形式的多个项目组成; -- 它提供了应用程序顶级视图之间的快速导航; -"""; - - -const String _text1 = -"""### **基本用法** -> BottomNavigationBar 底部导航栏通常与Scaffold结合使用 -- 它作为 Scaffold.bottomNavigationBar 参数; -- BottomNavigationBar 3-5个之间个底部按钮数量是合理的,理论上 icon 大小合适,可以支持更多; -- 默认0-3个底部按钮数量时,BottomNavigationBar采用fixed的模式摆放底部按钮,当有4个时默认使用 BottomNavigationBarType.shifting 模式摆放底部按钮; -- 下面的底部导航即是效果; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Navigation/BottomNavigationBar'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'BottomNavigationBar', - codeUrl: 'components/Navigation/BottomNavigationBar/demo.dart', - contentList: allDemoBoxs(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/BottomNavigationBar-class.html', - bottomNaviBar:BottomNavigationBarDemo.BottomNavigationBarFullDefault() - ); - } -} - - -// 所有的 BottomNavigationBar widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDemoBoxs(BuildContext context, _DemoState that) { - return [ - _text0, - _text1, - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - //BottomNavigationBarDemo.BottomNavigationBarFullDefault(); - ], - ), - SizedBox(width: 20.0), // 间距 - ]; -} - - diff --git a/lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart b/lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart deleted file mode 100644 index 1cebb426..00000000 --- a/lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart +++ /dev/null @@ -1,41 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午10:00 -/// email: zhu.yan@alibaba-inc.com -/// target: BottomNavigationBarItem 的示例 - -import 'package:flutter/material.dart'; - -// BottomNavigationBarItem 默认的实例,无状态 -class BottomNavigationBarItemLessDefault extends StatelessWidget { - final widget; - final parent; - - const BottomNavigationBarItemLessDefault([this.widget, this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - return SizedBox( - height: 100, - child: Scaffold( - bottomNavigationBar: BottomNavigationBar(items: [ - BottomNavigationBarItem( - icon: Icon(Icons.laptop_chromebook), - title: Text("主页"), - backgroundColor: Colors.red - ), - BottomNavigationBarItem( - icon: Icon(Icons.list), title: Text("分类"),backgroundColor: Colors.grey), - BottomNavigationBarItem( - icon: Icon(Icons.local_grocery_store), title: Text("购物车")), - BottomNavigationBarItem(icon: Icon(Icons.person), title: Text("我的")) - ], - //onTap: onTap, - //currentIndex: page - ), - ) - ); - } -} diff --git a/lib/widgets/components/Navigation/BottomNavigationBarItem/index.dart b/lib/widgets/components/Navigation/BottomNavigationBarItem/index.dart deleted file mode 100644 index 3ff65af9..00000000 --- a/lib/widgets/components/Navigation/BottomNavigationBarItem/index.dart +++ /dev/null @@ -1,60 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/1 -/// Time: 下午9:55 -/// email: zhu.yan@alibaba-inc.com -/// target: BottomNavigationBarItem 的示例 - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'package:flutter/material.dart'; - -import './demo.dart' as BottomNavigationBarItemDemo; - -const String _Text0 = -"""### **简介** -> BottomNavigationBarItem “底部导航应用栏” -- material 的 BottomNavigationBar 或带有图标和标题的 iOS主题 CupertinoTabBar 中的交互式按钮; -"""; - -const String _Text1 = -"""### **基本用法** -> 这个类很少单独使用。通常嵌入在上面的一个底部 bottom navigation widgets 中; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Navigation/BottomNavigationBarItem'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'BottomNavigationBarItem', - codeUrl: 'components/Navigation/BottomNavigationBarItem/demo.dart', - contentList: allDomeBox(context, this), - docUrl: 'https://docs.flutter.io/flutter/widgets/BottomNavigationBarItem-class.html', - ); - } -} - - -// 所有的 BottomNavigationBarItem widget -// context: 运行上下文 -// that: 指向有状态的 StatefulWidget -List allDomeBox(BuildContext context, _DemoState that) { - return [ - _Text0, - SizedBox(height: 20.0), // 间距 - _Text1, - SizedBox(height: 20.0), // 间距 - BottomNavigationBarItemDemo.BottomNavigationBarItemLessDefault(), - SizedBox(height: 20.0), // 间距 - ]; -} - - - diff --git a/lib/widgets/components/Navigation/index.dart b/lib/widgets/components/Navigation/index.dart deleted file mode 100644 index 569112d5..00000000 --- a/lib/widgets/components/Navigation/index.dart +++ /dev/null @@ -1,25 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/27 -/// Time: 下午2:50 -/// email: zhu.yan@alibaba-inc.com -/// target: Navigation 的示例 - -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'BottomNavigationBar/index.dart' as BottomNavigationBar; -import 'BottomNavigationBarItem/index.dart' as BottomNavigationBarItem; - -List widgetPoints = [ - WidgetPoint( - name: 'BottomNavigationBar', - routerName: BottomNavigationBar.Demo.routeName, - buildRouter: (BuildContext context) => BottomNavigationBar.Demo(), - ), - WidgetPoint( - name: 'BottomNavigationBarItem', - routerName: BottomNavigationBarItem.Demo.routeName, - buildRouter: (BuildContext context) => BottomNavigationBarItem.Demo(), - ) -]; diff --git a/lib/widgets/components/Panel/ExpansionPanel/demo.dart b/lib/widgets/components/Panel/ExpansionPanel/demo.dart deleted file mode 100644 index 716abd43..00000000 --- a/lib/widgets/components/Panel/ExpansionPanel/demo.dart +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; - - -@visibleForTesting -enum Location { - Barbados, - Bahamas, - Bermuda -} - -typedef DemoItemBodyBuilder = Widget Function(DemoItem item); -typedef ValueToString = String Function(T value); - -class DualHeaderWithHint extends StatelessWidget { - const DualHeaderWithHint({ - this.name, - this.value, - this.hint, - this.showHint - }); - - final String name; - final String value; - final String hint; - final bool showHint; - - Widget _crossFade(Widget first, Widget second, bool isExpanded) { - return AnimatedCrossFade( - firstChild: first, - secondChild: second, - firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), - secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), - sizeCurve: Curves.fastOutSlowIn, - crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst, - duration: const Duration(milliseconds: 200), - ); - } - - @override - Widget build(BuildContext context) { - final ThemeData theme = Theme.of(context); - final TextTheme textTheme = theme.textTheme; - - return Row( - children: [ - Expanded( - flex: 2, - child: Container( - margin: const EdgeInsets.only(left: 24.0), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerLeft, - child: Text( - name, - style: textTheme.body1.copyWith(fontSize: 15.0), - ), - ), - ), - ), - Expanded( - flex: 3, - child: Container( - margin: const EdgeInsets.only(left: 24.0), - child: _crossFade( - Text(value, style: textTheme.caption.copyWith(fontSize: 15.0)), - Text(hint, style: textTheme.caption.copyWith(fontSize: 15.0)), - showHint - ) - ) - ) - ] - ); - } -} - -class CollapsibleBody extends StatelessWidget { - const CollapsibleBody({ - this.margin = EdgeInsets.zero, - this.child, - this.onSave, - this.onCancel - }); - - final EdgeInsets margin; - final Widget child; - final VoidCallback onSave; - final VoidCallback onCancel; - - @override - Widget build(BuildContext context) { - final ThemeData theme = Theme.of(context); - final TextTheme textTheme = theme.textTheme; - - return Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 24.0, - right: 24.0, - bottom: 24.0 - ) - margin, - child: Center( - child: DefaultTextStyle( - style: textTheme.caption.copyWith(fontSize: 15.0), - child: child - ) - ) - ), - const Divider(height: 1.0), - Container( - padding: const EdgeInsets.symmetric(vertical: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - margin: const EdgeInsets.only(right: 8.0), - child: FlatButton( - onPressed: onCancel, - child: const Text('CANCEL', style: TextStyle( - color: Colors.black54, - fontSize: 15.0, - fontWeight: FontWeight.w500 - )) - ) - ), - Container( - margin: const EdgeInsets.only(right: 8.0), - child: FlatButton( - onPressed: onSave, - textTheme: ButtonTextTheme.accent, - child: const Text('SAVE') - ) - ) - ] - ) - ) - ] - ); - } -} - -class DemoItem { - DemoItem({ - this.name, - this.value, - this.hint, - this.builder, - this.valueToString - }) : textController = TextEditingController(text: valueToString(value)); - - final String name; - final String hint; - final TextEditingController textController; - final DemoItemBodyBuilder builder; - final ValueToString valueToString; - T value; - bool isExpanded = false; - - ExpansionPanelHeaderBuilder get headerBuilder { - return (BuildContext context, bool isExpanded) { - return DualHeaderWithHint( - name: name, - value: valueToString(value), - hint: hint, - showHint: isExpanded - ); - }; - } - - Widget build() => builder(this); -} - -class ExpansionPanelsDemo extends StatefulWidget { - static const String routeName = '/material/expansion_panels'; - - @override - _ExpansionPanelsDemoState createState() => _ExpansionPanelsDemoState(); -} - -class _ExpansionPanelsDemoState extends State { - List> _demoItems; - - @override - void initState() { - super.initState(); - - _demoItems = >[ - - DemoItem( - name: 'Location', - value: Location.Bahamas, - hint: 'Select location', - valueToString: (Location location) => location.toString().split('.')[1], - builder: (DemoItem item) { - void close() { - setState(() { - item.isExpanded = false; - }); - } - return Form( - child: Builder( - builder: (BuildContext context) { - return CollapsibleBody( - onSave: () { Form.of(context).save(); close(); }, - onCancel: () { Form.of(context).reset(); close(); }, - child: FormField( - initialValue: item.value, - onSaved: (Location result) { item.value = result; }, - builder: (FormFieldState field) { - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - RadioListTile( - value: Location.Bahamas, - title: const Text('Bahamas'), - groupValue: field.value, - onChanged: field.didChange, - ), - RadioListTile( - value: Location.Barbados, - title: const Text('Barbados'), - groupValue: field.value, - onChanged: field.didChange, - ), - RadioListTile( - value: Location.Bermuda, - title: const Text('Bermuda'), - groupValue: field.value, - onChanged: field.didChange, - ), - ] - ); - } - ), - ); - } - ) - ); - } - ), - ]; - } - - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: SafeArea( - top: false, - bottom: false, - child: Container( - margin: const EdgeInsets.all(24.0), - child: ExpansionPanelList( - expansionCallback: (int index, bool isExpanded) { - setState(() { - _demoItems[index].isExpanded = !isExpanded; - }); - }, - children: _demoItems.map((DemoItem item) { - return ExpansionPanel( - isExpanded: true, - headerBuilder: item.headerBuilder, - body: item.build() - ); - }).toList() - ), - ), - ), - ); - } -} diff --git a/lib/widgets/components/Panel/ExpansionPanel/index.dart b/lib/widgets/components/Panel/ExpansionPanel/index.dart deleted file mode 100644 index b39aa257..00000000 --- a/lib/widgets/components/Panel/ExpansionPanel/index.dart +++ /dev/null @@ -1,40 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-21 11:35:39 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 11:36:23 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 扩展面板,包含一个标题和一个正文,可以展开或者折叠。面板展开,主体可见。 - - -'''; -const String content1 = ''' -### **基本用法** - -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Panel/ExpansionPanel'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ExpansionPanelsDemo(), - ], - codeUrl: 'widgets/components/Panel/ExpansionPanel/demo.dart', - docUrl:'https://docs.flutter.io/flutter/material/RawChip-class.html', - title: 'ExpansionPanel'); - } -} diff --git a/lib/widgets/components/Panel/ExpansionPanelList/demo.dart b/lib/widgets/components/Panel/ExpansionPanelList/demo.dart deleted file mode 100644 index 8d8259e5..00000000 --- a/lib/widgets/components/Panel/ExpansionPanelList/demo.dart +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; - -@visibleForTesting -enum Location { - Barbados, - Bahamas, - Bermuda -} - -typedef DemoItemBodyBuilder = Widget Function(DemoItem item); -typedef ValueToString = String Function(T value); - -// google flutter 详情多个例子地址: -// https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart - -class DualHeaderWithHint extends StatelessWidget { - const DualHeaderWithHint({ - this.name, - this.value, - this.hint, - this.showHint - }); - - final String name; - final String value; - final String hint; - final bool showHint; - - Widget _crossFade(Widget first, Widget second, bool isExpanded) { - return AnimatedCrossFade( - firstChild: first, - secondChild: second, - firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), - secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), - sizeCurve: Curves.fastOutSlowIn, - crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst, - duration: const Duration(milliseconds: 200), - ); - } - - @override - Widget build(BuildContext context) { - final ThemeData theme = Theme.of(context); - final TextTheme textTheme = theme.textTheme; - - return Row( - children: [ - Expanded( - flex: 2, - child: Container( - margin: const EdgeInsets.only(left: 24.0), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerLeft, - child: Text( - name, - style: textTheme.body1.copyWith(fontSize: 15.0), - ), - ), - ), - ), - Expanded( - flex: 3, - child: Container( - margin: const EdgeInsets.only(left: 24.0), - child: _crossFade( - Text(value, style: textTheme.caption.copyWith(fontSize: 15.0)), - Text(hint, style: textTheme.caption.copyWith(fontSize: 15.0)), - showHint - ) - ) - ) - ] - ); - } -} - - -class DemoItem { - DemoItem({ - this.name, - this.value, - this.hint, - this.builder, - this.valueToString - }) : textController = TextEditingController(text: valueToString(value)); - - final String name; - final String hint; - final TextEditingController textController; - final DemoItemBodyBuilder builder; - final ValueToString valueToString; - T value; - bool isExpanded = true; - - ExpansionPanelHeaderBuilder get headerBuilder { - return (BuildContext context, bool isExpanded) { - return DualHeaderWithHint( - name: name, - value: valueToString(value), - hint: hint, - showHint: isExpanded - ); - }; - } - - Widget build() => builder(this); -} - -class ExpansionPanelsDemo extends StatefulWidget { - // static const String routeName = '/material/expansion_panels'; - - @override - _ExpansionPanelsDemoState createState() => _ExpansionPanelsDemoState(); -} - -class _ExpansionPanelsDemoState extends State { - List> _demoItems; - - @override - void initState() { - super.initState(); - - _demoItems = >[ - - DemoItem( - name: 'Location', - value: Location.Bahamas, - hint: 'Select location', - valueToString: (Location location) => location.toString().split('.')[1], - builder: (DemoItem item) { - return Form( - child: Builder( - builder: (BuildContext context) { - return FormField( - initialValue: item.value, - onSaved: (Location result) { item.value = result; }, - builder: (FormFieldState field) { - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - RadioListTile( - value: Location.Bahamas, - title: const Text('Bahamas'), - groupValue: field.value, - onChanged: field.didChange, - ), - RadioListTile( - value: Location.Barbados, - title: const Text('Barbados'), - groupValue: field.value, - onChanged: field.didChange, - ), - RadioListTile( - value: Location.Bermuda, - title: const Text('Bermuda'), - groupValue: field.value, - onChanged: field.didChange, - ), - ] - ); - } - ); - } - ) - ); - } - ), - ]; - } - - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: SafeArea( - top: false, - bottom: false, - child: Container( - margin: const EdgeInsets.all(24.0), - child: ExpansionPanelList( - expansionCallback: (int index, bool isExpanded) { - setState(() { - _demoItems[index].isExpanded = !isExpanded; - }); - }, - children: _demoItems.map((DemoItem item) { - return ExpansionPanel( - isExpanded: true, - headerBuilder: item.headerBuilder, - body: item.build() - ); - }).toList() - ), - ), - ), - ); - } -} diff --git a/lib/widgets/components/Panel/ExpansionPanelList/index.dart b/lib/widgets/components/Panel/ExpansionPanelList/index.dart deleted file mode 100644 index f9c3657c..00000000 --- a/lib/widgets/components/Panel/ExpansionPanelList/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 20:30:41 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2019-01-08 16:15:20 - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 所有chip widget类型的基础,集合所有功能,我们通常不是直接使用它,而是根据自己需要选择chi, 比如: -- chip ,一个简单的芯片,只能显示信息,并被删除 -- inputChip,以紧凑的形式表现复杂的信息,例如:实体(人,地点,或者事物)或者会话文本 -- choiceChip,允许从一组选项中进行单一的选择 -- FilterChip,使用标签或描述作为过滤内容的方式 - - -'''; -const String content1 = ''' -### **基本用法** -- inputChip可以通过设置进行选择onSelected,通过设置onDeleted可以删除,并且可以通过OnPressed表现按压效果 -- inputChip 有一个前导图标和尾随图标,填充颜色可以订制 -- inputChip 可以和其他UI元素搭配使用,比如:wrap,ListView(scrollDirection为Axis.horizo​​ntal) -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Panel/ExpansionPanel'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ExpansionPanelsDemo(), - ], - codeUrl: 'components/Panel/ExpansionPanelList/demo.dart', - docUrl:'https://docs.flutter.io/flutter/material/RawChip-class.html', - title: 'RawChip'); - } -} diff --git a/lib/widgets/components/Panel/ExpansionPanelRadio/index.dart b/lib/widgets/components/Panel/ExpansionPanelRadio/index.dart deleted file mode 100644 index df757027..00000000 --- a/lib/widgets/components/Panel/ExpansionPanelRadio/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-20 20:30:41 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 11:35:48 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -const String content0 = ''' -### **简介** -> 所有chip widget类型的基础,集合所有功能,我们通常不是直接使用它,而是根据自己需要选择chi, 比如: -- chip ,一个简单的芯片,只能显示信息,并被删除 -- inputChip,以紧凑的形式表现复杂的信息,例如:实体(人,地点,或者事物)或者会话文本 -- choiceChip,允许从一组选项中进行单一的选择 -- FilterChip,使用标签或描述作为过滤内容的方式 - - -'''; -const String content1 = ''' -### **基本用法** -- inputChip可以通过设置进行选择onSelected,通过设置onDeleted可以删除,并且可以通过OnPressed表现按压效果 -- inputChip 有一个前导图标和尾随图标,填充颜色可以订制 -- inputChip 可以和其他UI元素搭配使用,比如:wrap,ListView(scrollDirection为Axis.horizo​​ntal) -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Chip/RawChip'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - // FilterChipDemo(), - ], - codeUrl: 'components/Chip/RawChip/demo.dart', - docUrl:'https://docs.flutter.io/flutter/material/RawChip-class.html', - title: 'RawChip'); - } -} diff --git a/lib/widgets/components/Panel/index.dart b/lib/widgets/components/Panel/index.dart deleted file mode 100644 index dc8f3fae..00000000 --- a/lib/widgets/components/Panel/index.dart +++ /dev/null @@ -1,25 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'ExpansionPanel/index.dart' as ExpansionPanel; -import 'ExpansionPanelList/index.dart' as ExpansionPanelList; -import 'ExpansionPanelRadio/index.dart' as ExpansionPanelRadio; - -List widgetPoints = [ - WidgetPoint( - name: 'ExpansionPanel', - routerName: ExpansionPanel.Demo.routeName, - buildRouter: (BuildContext context) => ExpansionPanel.Demo(), - ), - WidgetPoint( - name: 'ExpansionPanelRadio', - routerName: ExpansionPanelRadio.Demo.routeName, - buildRouter: (BuildContext context) => ExpansionPanelRadio.Demo(), - ), - WidgetPoint( - name: 'ExpansionPanelList', - routerName: ExpansionPanelList.Demo.routeName, - buildRouter: (BuildContext context) => ExpansionPanelList.Demo(), - ), - -]; diff --git a/lib/widgets/components/Pick/CityPIcker/demo.dart b/lib/widgets/components/Pick/CityPIcker/demo.dart deleted file mode 100644 index 4e39b2d2..00000000 --- a/lib/widgets/components/Pick/CityPIcker/demo.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 05/02/2019 -/// Time: 22:06 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; -import 'package:city_pickers/city_pickers.dart'; - -class CityPickerDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - String _result; - show(context) async { - Result temp = await CityPickers.showCityPicker( - context: context, - // locationCode: '640221', - height: 400, - ); - setState(() { - _result = "${temp.toString()}"; - }); - } - - Widget build(BuildContext context) { - return Center( - child: Column( - children: [ - Text("result: ${_result.toString()}"), - RaisedButton( - onPressed: () {this.show(context); - }, - child: Text("select"), - ), - ], - ) - ); - } -} diff --git a/lib/widgets/components/Pick/CityPIcker/index.dart b/lib/widgets/components/Pick/CityPIcker/index.dart deleted file mode 100644 index 066b3aae..00000000 --- a/lib/widgets/components/Pick/CityPIcker/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 05/02/2019 -/// Time: 22:06 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 显示中国的省市县地区 -通过函数 **showCityPicker** 调用, 在容器窗口上弹出遮罩层 -'''; -const String content1 = ''' -### **基本用法** -- locationCode 初始化地区选择 -- height 弹出层高度 -- context 上下文对象 -'''; -class Demo extends StatefulWidget { - static const String routeName = '/components/Pick/CityPicker'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CityPicker', - codeUrl: '', - docUrl: '', - contentList: [ - content0, - content1, - CityPickerDemo() - ], - ); - } -} diff --git a/lib/widgets/components/Pick/DayPicker/demo.dart b/lib/widgets/components/Pick/DayPicker/demo.dart deleted file mode 100644 index 2ba81f04..00000000 --- a/lib/widgets/components/Pick/DayPicker/demo.dart +++ /dev/null @@ -1,66 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:32 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-18 19:12:32 - -import 'dart:async'; - -import 'package:flutter/material.dart'; - -class DayPickerDemo extends StatefulWidget { - @override - State createState() => _DayPickerState(); -} - -class _DayPickerState extends State { - DateTime _date = DateTime.now(); - TimeOfDay _time = TimeOfDay.now(); - - Future _selectDate(BuildContext context) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: _date, - firstDate: DateTime(2015, 8), - lastDate: DateTime(2101)); - if (picked != null && picked != _date) - print("data selectied :${_date.toString()}"); - setState(() { - _date = picked; - }); - - if (picked == null) _date = DateTime.now(); - } - - Future _selectTime(BuildContext context) async { - final TimeOfDay picked = - await showTimePicker(context: context, initialTime: _time); - if (picked != null && picked != _time) - print("data selectied :${_time.toString()}"); - setState(() { - _time = picked; - }); - if (picked == null) _time = TimeOfDay.now(); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Text('日期选择'), - RaisedButton( - child: Text('date selected:${_date.toString()}'), - onPressed: () { - _selectDate(context); - }, - ), - Text('时间选择'), - RaisedButton( - child: Text('date selected:${_time.toString()}'), - onPressed: () { - _selectTime(context); - }, - ) - ], - ); - } -} diff --git a/lib/widgets/components/Pick/DayPicker/index.dart b/lib/widgets/components/Pick/DayPicker/index.dart deleted file mode 100644 index 72cdc9ed..00000000 --- a/lib/widgets/components/Pick/DayPicker/index.dart +++ /dev/null @@ -1,40 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:16 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-17 15:50:02 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 显示给定月份的日期,并可以选择一天 -- 该选择器widget很少使用,相反,请考虑使用showDatePicker,它会创建一个日期选择器对话框 -'''; -const String content1 = ''' -### **基本用法** -- currentDate,设置显示器当前显示时间 -- displayedMonth ,设置选择器显示天数的月份 -- firstDate,设置选择的最早日期 -- lastDate,设置可选择的最晚日期 -- selectedDate,设置当前选择的日期 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Pick/DayPicker'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [content0, content1, DayPickerDemo()], - codeUrl: 'components/Pick/DayPicker/demo.dart', - docUrl: "https://docs.flutter.io/flutter/material/DayPicker-class.html", - title: 'DayPicker'); - } -} diff --git a/lib/widgets/components/Pick/MonthPicker/demo.dart b/lib/widgets/components/Pick/MonthPicker/demo.dart deleted file mode 100644 index bf4584c5..00000000 --- a/lib/widgets/components/Pick/MonthPicker/demo.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:32 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-21 11:26:21 - -import 'dart:async'; - -import 'package:flutter/material.dart'; - -class MothPickerDemo extends StatefulWidget { - @override - State createState() => _MothPickerState(); -} - -class _MothPickerState extends State { - DateTime _date = DateTime.now(); - - Future _selectDate(BuildContext context) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: _date, - firstDate: DateTime(2015, 8), - lastDate: DateTime(2101)); - if (picked != null && picked != _date) - print("data selectied :${_date.toString()}"); - setState(() { - _date = picked; - }); - - if (picked == null) _date = DateTime.now(); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Text('日期选择'), - RaisedButton( - child: Text('date selected:${_date.toString()}'), - onPressed: () { - _selectDate(context); - }, - ), - ], - ); - } -} diff --git a/lib/widgets/components/Pick/MonthPicker/index.dart b/lib/widgets/components/Pick/MonthPicker/index.dart deleted file mode 100644 index 4f4f864d..00000000 --- a/lib/widgets/components/Pick/MonthPicker/index.dart +++ /dev/null @@ -1,40 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:16 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-17 17:06:34 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 运行选择一个月的可滚动月份列表 -- 年份选择器widget很少使用,相反,请考虑使用showDatePicker,它会创建一个日期选择器对话框 -'''; -const String content1 = ''' -### **基本用法** -- firstData,设置用户选择的最早日期 -- lastData,设置用户可选择的最晚日期 -- selectedDate,设置当前选择的日期 -- onchanged,当用户选择一个月的时候调用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Pick/MonthPicker'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [content0, content1, MothPickerDemo()], - codeUrl: 'components/Pick/MonthPicker/demo.dart', - docUrl: - "https://docs.flutter.io/flutter/material/MonthPicker-class.html", - title: 'MonthPicker'); - } -} diff --git a/lib/widgets/components/Pick/ShowdatePicker/demo.dart b/lib/widgets/components/Pick/ShowdatePicker/demo.dart deleted file mode 100644 index c5c2c147..00000000 --- a/lib/widgets/components/Pick/ShowdatePicker/demo.dart +++ /dev/null @@ -1,66 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:32 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-18 19:12:32 - -import 'dart:async'; - -import 'package:flutter/material.dart'; - -class ShowDatePickerDemo extends StatefulWidget { - @override - State createState() => _ShowDatePickerState(); -} - -class _ShowDatePickerState extends State { - DateTime _date = DateTime.now(); - TimeOfDay _time = TimeOfDay.now(); - - Future _selectDate(BuildContext context) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: _date, - firstDate: DateTime(2015, 8), - lastDate: DateTime(2101)); - if (picked != null && picked != _date) - print("data selectied :${_date.toString()}"); - setState(() { - _date = picked; - }); - - if (picked == null) _date = DateTime.now(); - } - - Future _selectTime(BuildContext context) async { - final TimeOfDay picked = - await showTimePicker(context: context, initialTime: _time); - if (picked != null && picked != _time) - print("data selectied :${_time.toString()}"); - setState(() { - _time = picked; - }); - if (picked == null) _time = TimeOfDay.now(); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Text('日期选择'), - RaisedButton( - child: Text('date selected:${_date.toString()}'), - onPressed: () { - _selectDate(context); - }, - ), - Text('时间选择'), - RaisedButton( - child: Text('date selected:${_time.toString()}'), - onPressed: () { - _selectTime(context); - }, - ) - ], - ); - } -} diff --git a/lib/widgets/components/Pick/ShowdatePicker/index.dart b/lib/widgets/components/Pick/ShowdatePicker/index.dart deleted file mode 100644 index fd2fe108..00000000 --- a/lib/widgets/components/Pick/ShowdatePicker/index.dart +++ /dev/null @@ -1,38 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:16 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-17 16:00:07 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 日期选择器的对话框 -- 返回为Futer,为用户关闭对话框时用户选择的日期。如果用户取消该对话框,则返回为null -'''; -const String content1 = ''' -### **基本用法** -- selectableDayPredicate可以传入自定义选择的天数。 -- 可选initialDatePickerMode参数可用于最初在年或月+日选择器模式中显示日期选择器。默认为月+日,且不能为空。 -- 可选locale参数可用于设置日期选择器的区域设置 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Pick/ShowdatePicker'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [content0, content1, ShowDatePickerDemo()], - codeUrl: 'components/Pick/ShowdatePicker/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/material/showDatePicker.html', - title: 'ShowDatePicker'); - } -} diff --git a/lib/widgets/components/Pick/YearPicker/demo.dart b/lib/widgets/components/Pick/YearPicker/demo.dart deleted file mode 100644 index b6a74d2c..00000000 --- a/lib/widgets/components/Pick/YearPicker/demo.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:32 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-11 15:17:26 - -import 'dart:async'; - -import 'package:flutter/material.dart'; - -class YearPickerDemo extends StatefulWidget { - @override - State createState() => _YearPickerDemoState(); -} - -class _YearPickerDemoState extends State { - DateTime _date = DateTime.now(); - - Future _selectDate(BuildContext context) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: _date, - firstDate: DateTime(2015, 8), - lastDate: DateTime(2101)); - if (picked != null && picked != _date) - print("data selectied :${_date.toString()}"); - setState(() { - _date = picked; - }); - - if (picked == null) _date = DateTime.now(); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Text('日期选择'), - RaisedButton( - child: Text('date selected:${_date.toString()}'), - onPressed: () { - _selectDate(context); - }, - ), - ], - ); - } -} diff --git a/lib/widgets/components/Pick/YearPicker/index.dart b/lib/widgets/components/Pick/YearPicker/index.dart deleted file mode 100644 index 9177677a..00000000 --- a/lib/widgets/components/Pick/YearPicker/index.dart +++ /dev/null @@ -1,39 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:16 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-17 16:00:07 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 运行选择一年的可滚动年份列表 -- 年份选择器widget很少使用,相反,请考虑使用showDatePicker,它会创建一个日期选择器对话框 -'''; -const String content1 = ''' -### **基本用法** -- 使用firstData,设置用户选择的最早日期 -- 使用lastData,设置用户可选择的最晚日期 -- 使用selectedDate,设置当前选择的日期 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Pick/YearPicker'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [content0, content1, YearPickerDemo()], - codeUrl: 'components/Pick/YearPicker/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/YearPicker-class.html', - title: 'YearPicker'); - } -} diff --git a/lib/widgets/components/Pick/index.dart b/lib/widgets/components/Pick/index.dart deleted file mode 100644 index 3e61a2ed..00000000 --- a/lib/widgets/components/Pick/index.dart +++ /dev/null @@ -1,37 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'YearPicker/index.dart' as YearPicker; -import 'DayPicker/index.dart' as DayPicker; -import 'MonthPicker/index.dart' as MonthPicker; -import 'ShowdatePicker/index.dart' as ShowdatePicker; -import 'CityPIcker/index.dart' as CityPicker; - -List widgetPoints = [ - WidgetPoint( - name: 'YearPicker', - routerName: YearPicker.Demo.routeName, - buildRouter: (BuildContext context) => YearPicker.Demo(), - ), - WidgetPoint( - name: 'MonthPicker', - routerName: MonthPicker.Demo.routeName, - buildRouter: (BuildContext context) => MonthPicker.Demo(), - ), - WidgetPoint( - name: 'DayPicker', - routerName: DayPicker.Demo.routeName, - buildRouter: (BuildContext context) => DayPicker.Demo(), - ), - WidgetPoint( - name: 'ShowdatePicker', - routerName: ShowdatePicker.Demo.routeName, - buildRouter: (BuildContext context) => ShowdatePicker.Demo(), - ), - WidgetPoint( - name: 'CityPicker', - routerName: CityPicker.Demo.routeName, - buildRouter: (BuildContext context) => CityPicker.Demo(), - ), - -]; diff --git a/lib/widgets/components/Progress/CircularProgressIndicator/demo.dart b/lib/widgets/components/Progress/CircularProgressIndicator/demo.dart deleted file mode 100644 index dd90c0e9..00000000 --- a/lib/widgets/components/Progress/CircularProgressIndicator/demo.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:flutter/material.dart'; - -class CircularDemo extends StatefulWidget { - @override - _CircularDemoState createState() => _CircularDemoState(); -} - -class _CircularDemoState extends State { - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - SizedBox( - height: 20, - width: 20, - child: CircularProgressIndicator( - backgroundColor: Colors.red, - ), - ), - SizedBox( - height: 30, - width: 30, - child: CircularProgressIndicator( - backgroundColor: Colors.red, - ), - ), - CircularProgressIndicator( - backgroundColor: Colors.redAccent, - ), - SizedBox( - height: 50, - width: 50, - child: CircularProgressIndicator( - backgroundColor: Colors.red, - ), - ), - ], - ); - } -} diff --git a/lib/widgets/components/Progress/CircularProgressIndicator/index.dart b/lib/widgets/components/Progress/CircularProgressIndicator/index.dart deleted file mode 100644 index c7579ad9..00000000 --- a/lib/widgets/components/Progress/CircularProgressIndicator/index.dart +++ /dev/null @@ -1,46 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:16 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-17 16:00:07 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 循环进度条,旋转表示进度 -- 有两种线性进度条:确定和不确定。 -- 确定:确定进度条在每个时间点都有一个特定的值,并且该值应该是0.0递增到1.0。 -- 不确定:不确定的进度条在每一个时间点都没有特定到值。只是表明此时取得的进度,没有表明多少未完成。 - -'''; -const String content1 = ''' -### **基本用法** -- 创建确定进度条,需要使用介于0.0和1.0的非空值 -- 要创建不确定的进度条,需要使用空值 -'''; - -class Demo extends StatefulWidget { - static const String routeName = - '/components/Progress/CircularProgressIndicator'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - CircularDemo(), - ], - codeUrl: 'components/Progress/CircularProgressIndicator/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html', - title: 'CircularProgressIndicator'); - } -} diff --git a/lib/widgets/components/Progress/LinearProgressIndicator/demo.dart b/lib/widgets/components/Progress/LinearProgressIndicator/demo.dart deleted file mode 100644 index 924e07e2..00000000 --- a/lib/widgets/components/Progress/LinearProgressIndicator/demo.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter/material.dart'; - -class LinearProgressIndicatorDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - width: 200.0, - child: LinearProgressIndicator(), - ); - } -} diff --git a/lib/widgets/components/Progress/LinearProgressIndicator/index.dart b/lib/widgets/components/Progress/LinearProgressIndicator/index.dart deleted file mode 100644 index dffc8dfb..00000000 --- a/lib/widgets/components/Progress/LinearProgressIndicator/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:16 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-17 16:00:07 - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String content0 = ''' -### **简介** -> 一个线性进度条 -- 有两种线性进度条:确定和不确定。 -- 确定:确定进度条在每个时间点都有一个特定的值,并且该值应该是0.0递增到1.0。 -- 不确定:不确定的进度条在每一个时间点都没有特定到值。只是表明此时取得的进度,没有表明多少未完成。 - -'''; -const String content1 = ''' -### **基本用法** -- 创建确定进度条,需要使用介于0.0和1.0的非空值 -- 要创建不确定的进度条,需要使用空值 -'''; - -class Demo extends StatefulWidget { - static const String routeName = - '/components/Progress/LinearProgressIndicator'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - LinearProgressIndicatorDemo(), - ], - codeUrl: 'components/Progress/LinearProgressIndicator/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html', - title: 'LinearProgressIndicator'); - } -} diff --git a/lib/widgets/components/Progress/RefreshProgressIndicator/demo.dart b/lib/widgets/components/Progress/RefreshProgressIndicator/demo.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/widgets/components/Progress/RefreshProgressIndicator/index.dart b/lib/widgets/components/Progress/RefreshProgressIndicator/index.dart deleted file mode 100644 index 92cce808..00000000 --- a/lib/widgets/components/Progress/RefreshProgressIndicator/index.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-17 15:37:16 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-17 16:00:07 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -const String content0 = ''' -### **简介** -> 一个线性进度条 -- 有两种线性进度条:确定和不确定。 -- 确定:确定进度条在每个时间点都有一个特定的值,并且该值应该是0.0递增到1.0。 -- 不确定:不确定的进度条在每一个时间点都没有特定到值。只是表明此时取得的进度,没有表明多少未完成。 - -'''; -const String content1 = ''' -### **基本用法** -- 创建确定进度条,需要使用介于0.0和1.0的非空值 -- 要创建不确定的进度条,需要使用空值 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Progress/RefreshProgressIndicator'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - // LinearProgressIndicatorDemo(), - ], - codeUrl: 'components/Progress/RefreshProgressIndicator/demo.dart', - docUrl:'https://docs.flutter.io/flutter/material/RefreshProgressIndicator-class.html', - title: 'RefreshProgressIndicator'); - } -} diff --git a/lib/widgets/components/Progress/index.dart b/lib/widgets/components/Progress/index.dart deleted file mode 100644 index c7587c12..00000000 --- a/lib/widgets/components/Progress/index.dart +++ /dev/null @@ -1,18 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'LinearProgressIndicator/index.dart' as LinearProgressIndicator; -import 'CircularProgressIndicator/index.dart' as CircularProgressIndicator; - -List widgetPoints = [ - WidgetPoint( - name: 'LinearProgressIndicator', - routerName: LinearProgressIndicator.Demo.routeName, - buildRouter: (BuildContext context) => LinearProgressIndicator.Demo(), - ), - WidgetPoint( - name: 'CircularProgressIndicator', - routerName: CircularProgressIndicator.Demo.routeName, - buildRouter: (BuildContext context) => CircularProgressIndicator.Demo(), - ), -]; diff --git a/lib/widgets/components/Scaffold/Scaffold/demo.dart b/lib/widgets/components/Scaffold/Scaffold/demo.dart deleted file mode 100644 index cd65e73e..00000000 --- a/lib/widgets/components/Scaffold/Scaffold/demo.dart +++ /dev/null @@ -1,56 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 2019/1/6 -/// Time: 下午7:33 -/// email: sanfann@alibaba-inc.com -/// target: Scaffold 的示例 - -import 'package:flutter/material.dart'; - -class ScaffoldDemo extends StatefulWidget { - const ScaffoldDemo() : super(); - - @override - State createState() => _ScaffoldDemo(); -} - -// AppBar 默认的实例,有状态 -class _ScaffoldDemo extends State with SingleTickerProviderStateMixin { - int count = 0; - - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 - // 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。 - // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。 - return SizedBox( - height: 500, - child: Scaffold( - appBar: AppBar( - title: Text('Sample Code'), - ), - body: Center( - child: Text('You have pressed the button times. $count'), - ), - floatingActionButtonLocation: - FloatingActionButtonLocation.centerDocked, - floatingActionButton: FloatingActionButton( - onPressed: () => setState(() { - count += 1; - }), - tooltip: 'Increment Counter', - child: Icon(Icons.add), - ), - )); - } -} diff --git a/lib/widgets/components/Scaffold/Scaffold/index.dart b/lib/widgets/components/Scaffold/Scaffold/index.dart deleted file mode 100644 index f90e562c..00000000 --- a/lib/widgets/components/Scaffold/Scaffold/index.dart +++ /dev/null @@ -1,64 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> Scaffold 实现了基本的Material Design布局结构 - -在Material设计中定义的单个界面上的各种布局元素,在 Scaffold 中都有支持,比如 左边栏(Drawers)、snack bars、以及 bottom sheets。 - - - -### **基本用法** - -Scaffold 有下面几个主要属性: - -- appBar:显示在界面顶部的一个 AppBar - -- body:当前界面所显示的主要内容 Widget - -- floatingActionButton:Material设计中所定义的 FAB,界面的主要功能按钮 - -- persistentFooterButtons:固定在下方显示的按钮,比如对话框下方的确定、取消按钮 - -- drawer:侧边栏控件 - -- backgroundColor: 内容的背景颜色,默认使用的是 ThemeData.scaffoldBackgroundColor 的值 - -- bottomNavigationBar: 显示在页面底部的导航栏 - -- resizeToAvoidBottomPadding:控制界面内容 body 是否重新布局来避免底部被覆盖了,比如当键盘显示的时候,重新布局避免被键盘盖住内容。默认值为 true。 - -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scaffold/Scaffold'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Scaffold', - codeUrl: 'components/Scaffold/Scaffold/demo.dart', - contentList: [ - _Text0, - ScaffoldDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html', - ); - } -} diff --git a/lib/widgets/components/Scaffold/ScaffoldState/demo.dart b/lib/widgets/components/Scaffold/ScaffoldState/demo.dart deleted file mode 100644 index 79f6aea0..00000000 --- a/lib/widgets/components/Scaffold/ScaffoldState/demo.dart +++ /dev/null @@ -1,80 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/6 -/// Time: 下午7:33 -/// email: sanfann@alibaba-inc.com -/// target: ScaffoldState 的示例 - -import 'package:flutter/material.dart'; - -class ScaffoldStateDemo extends StatefulWidget { - const ScaffoldStateDemo() : super(); - - @override - State createState() => _ScaffoldStateDemo(); -} - -// AppBar 默认的实例,有状态 -class _ScaffoldStateDemo extends State with SingleTickerProviderStateMixin { - - int count = 0; - final GlobalKey _scaffoldKey = GlobalKey(); - @override - Widget build(BuildContext context) { - // 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。 - // 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。 - // 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。 - return SizedBox( - height: 500, - child: Scaffold( - key:_scaffoldKey, - appBar: AppBar( - title: Text('ScaffoldState Demo'), - ), - body: Center( - child: Column( - children: [ - RaisedButton( - child: Text('点我试试呼出SnackBar&Drawer'), - onPressed: () { - _scaffoldKey.currentState.openDrawer(); - _scaffoldKey.currentState.showSnackBar(const SnackBar( - content: Text("我是通过ScaffoldState的方式呼出的SnackBar.") - )); - }, - ) - ], - ), - ), - drawer: Drawer( - child: Column( - children: [ - const UserAccountsDrawerHeader( - accountName: Text('Peter Widget'), - accountEmail: Text('peter.widget@example.com'), - currentAccountPicture: CircleAvatar( - backgroundImage: AssetImage( - 'people/square/peter.png', - package: 'flutter_gallery_assets', - ), - ), - margin: EdgeInsets.zero, - ), -// MediaQuery.removePadding( -// context: context, -// // DrawerHeader consumes top MediaQuery padding. -// removeTop: true, -// child: const ListTile( -// leading: Icon(Icons.payment), -// title: Text('Placeholder'), -// ), -// ), - ], - ), - ), - - ) - - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Scaffold/ScaffoldState/index.dart b/lib/widgets/components/Scaffold/ScaffoldState/index.dart deleted file mode 100644 index 00dc10b0..00000000 --- a/lib/widgets/components/Scaffold/ScaffoldState/index.dart +++ /dev/null @@ -1,48 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 10:26 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text0 = """ -### **简介** -> Scaffold的State对象 - -通常用来控制**SnackBars**和**BottomSheets**和**Drawer**的显示与隐藏. - - - -### **基本用法** -- 通过为Scaffold定义key属性, 声明_scaffoldState, 通过_scaffoldState直接调用scaffoldState方法 -- 当组件无法直接为Scaffold定义key属性时, 可以通过 **Context**与**Scaffold.of**获取父级scaffoldState - -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scaffold/ScaffoldState'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'ScaffoldState', - codeUrl: 'components/Scaffold/ScaffoldState/demo.dart', - contentList: [ - _Text0, - ScaffoldStateDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/ScaffoldState-class.html', - ); - } -} diff --git a/lib/widgets/components/Scaffold/index.dart b/lib/widgets/components/Scaffold/index.dart deleted file mode 100644 index 53ba01d3..00000000 --- a/lib/widgets/components/Scaffold/index.dart +++ /dev/null @@ -1,25 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 07/01/2019 -/// Time: 14:53 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'Scaffold/index.dart' as Scaffold; -import 'ScaffoldState/index.dart' as ScaffoldState; - -List widgetPoints = [ - WidgetPoint( - name: 'Scaffold', - routerName: Scaffold.Demo.routeName, - buildRouter: (BuildContext context) => Scaffold.Demo(), - ), - WidgetPoint( - name: 'ScaffoldState', - routerName: ScaffoldState.Demo.routeName, - buildRouter: (BuildContext context) => ScaffoldState.Demo(), - ), -]; diff --git a/lib/widgets/components/Scroll/BoxScrollView/demo.dart b/lib/widgets/components/Scroll/BoxScrollView/demo.dart deleted file mode 100644 index 9562295e..00000000 --- a/lib/widgets/components/Scroll/BoxScrollView/demo.dart +++ /dev/null @@ -1,104 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-17 13:16:29 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-17 13:43:01 - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; - -class BoxScrollViewDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Center( - child: Column( - children: [ - Text('滚动一下就看看吧 s( ̄▽ ̄)~*'), - Container( - height: 300.0, - child: ListViewDemo( - children: [ - BoxItem(), - BoxItem(), - BoxItem(), - BoxItem(), - BoxItem(), - BoxItem(), - BoxItem(), - BoxItem(), - BoxItem(), - ], - ), - ) - ], - ), - ); - } -} - -class BoxItem extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - height: 60.0, - margin: const EdgeInsets.symmetric(vertical: 20.0), - color: Theme.of(context).primaryColor, - child: Text( - '测试继承BoxScrollView', - style: TextStyle(color: Colors.white), - ), - ); - } -} - -class ListViewDemo extends BoxScrollView { - // 构造函数 - ListViewDemo({ - Key key, - Axis scrollDirection = Axis.vertical, - bool reverse = false, - ScrollController controller, - bool primary, - ScrollPhysics physics, - bool shrinkWrap = false, - EdgeInsetsGeometry padding, - this.itemExtent, - bool addAutomaticKeepAlives = true, - bool addRepaintBoundaries = true, - bool addSemanticIndexes = true, - double cacheExtent, - List children = const [], - int semanticChildCount, - }) : childrenDelegate = SliverChildListDelegate( - children, - addAutomaticKeepAlives: addAutomaticKeepAlives, - addRepaintBoundaries: addRepaintBoundaries, - addSemanticIndexes: addSemanticIndexes, - ), - super( - key: key, - scrollDirection: scrollDirection, - reverse: reverse, - controller: controller, - primary: primary, - physics: physics, - shrinkWrap: shrinkWrap, - padding: padding, - cacheExtent: cacheExtent, - semanticChildCount: semanticChildCount ?? children.length, - ); - - final double itemExtent; - final SliverChildDelegate childrenDelegate; - -// 子类应重写此方法以构建布局模型。 - @override - Widget buildChildLayout(BuildContext context) { - if (itemExtent != null) { - return SliverFixedExtentList( - delegate: childrenDelegate, - itemExtent: itemExtent, - ); - } - return SliverList(delegate: childrenDelegate); - } -} diff --git a/lib/widgets/components/Scroll/BoxScrollView/index.dart b/lib/widgets/components/Scroll/BoxScrollView/index.dart deleted file mode 100644 index a696fba1..00000000 --- a/lib/widgets/components/Scroll/BoxScrollView/index.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-17 13:16:46 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-17 13:34:46 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 使用单个子布局模型的ScrollView -- ListView:一个使用的线性布局的BoxScrollView -- GridView:一个使用二维布局模型的BoxScrollView -- CustomScrollView:可以将多个子布局模型组合到一个滚动视图中 -'''; -const String content1 = ''' -### **基本用法** -> 由于是抽象类,所以不能直接实例化 -- 如上简介,我们可以写一个类继承BoxScrollView -- Demo中,演示ListView的部分源码,用以实现继承BoxScrollView的代码编写,效果和ListView并无两样 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/BoxScrollView'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - BoxScrollViewDemo() - ], - codeUrl: 'components/Scroll/BoxScrollView/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/widgets/BoxScrollView-class.html', - title: 'BoxScrollView'); - } -} diff --git a/lib/widgets/components/Scroll/CustomScrollView/demo.dart b/lib/widgets/components/Scroll/CustomScrollView/demo.dart deleted file mode 100644 index b06e2dbb..00000000 --- a/lib/widgets/components/Scroll/CustomScrollView/demo.dart +++ /dev/null @@ -1,75 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-20 13:40:58 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-20 14:06:31 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/widgets/components/Scroll/CustomScrollView/product_list.dart'; - -class CustomScrollViewDemo extends StatelessWidget { - Widget _buildItem(BuildContext context, ProductItem product) { - return Container( - height: 100.0, - margin: const EdgeInsets.only(bottom: 5.0), - padding: const EdgeInsets.only(left: 10.0), - color: Colors.blueGrey, - child: Stack( - alignment: AlignmentDirectional.centerStart, - children: [ - Positioned( - right: 40.0, - child: Card( - child: Center( - child: Text( - product.name, - style: Theme.of(context).textTheme.title, - textAlign: TextAlign.center, - ), - ), - )), - ClipRRect( - child: SizedBox( - width: 70.0, - height: 70.0, - child: Image.asset( - product.asset, - fit: BoxFit.cover, - ), - ), - borderRadius: BorderRadius.all(Radius.circular(8.0)), - ), - ], - ), - ); - } - - @override - Widget build(BuildContext context) { - return Container( - height: 400.0, - child: CustomScrollView( - slivers: [ - SliverAppBar( - actions: [ - // _buildAction(), - ], - title: Text('CustomScrollView'), - backgroundColor: Theme.of(context).primaryColor, - expandedHeight: 200.0, - flexibleSpace: FlexibleSpaceBar( - background: Image.asset('assets/images/food01.jpeg', fit: BoxFit.cover), - ), - pinned: true,//固定导航 - ), - SliverFixedExtentList( - delegate: SliverChildListDelegate(products.map((product) { - return _buildItem(context, product); - }).toList()), - itemExtent: 120.0, - ) - ], - ), - ); - } -} diff --git a/lib/widgets/components/Scroll/CustomScrollView/index.dart b/lib/widgets/components/Scroll/CustomScrollView/index.dart deleted file mode 100644 index cb466740..00000000 --- a/lib/widgets/components/Scroll/CustomScrollView/index.dart +++ /dev/null @@ -1,46 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-20 13:21:36 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-20 14:08:29 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 使用Slivers创建自定义滚动效果的ScrollView -- CustomScrollView 主要是配合Slivers大家族使用,创建自定义的滚动效果 -- 如果需要创建可展开的AppBar,后跟list和grid,可使用这三种Slivers:SliverAppBar、SliverList和SliverGrid -- 这些Slivers必须生成RenderSliver对象 -'''; - -const String content1 = ''' -### **基本用法** -> 配合 Slivers使用 -- slivers 属性中我们添加SliverAppBar -- SliverAppBar下方放置SliverFixedExtentList,注意此处并没有滚动冲突 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/CustomScrollView'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - CustomScrollViewDemo(), - ], - codeUrl: 'components/Scroll/CustomScrollView/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/CustomScrollView-class.html', - title: 'CustomScrollView', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Scroll/CustomScrollView/product_list.dart b/lib/widgets/components/Scroll/CustomScrollView/product_list.dart deleted file mode 100644 index 0c802382..00000000 --- a/lib/widgets/components/Scroll/CustomScrollView/product_list.dart +++ /dev/null @@ -1,56 +0,0 @@ - - -class ProductItem { - final String name; - final String tag; - final String asset; - final int stock; - final double price; - - ProductItem({ - this.name, - this.tag, - this.asset, - this.stock, - this.price, - }); -} - -final List products = [ - ProductItem( - name: 'Bueno Chocolate', - tag: '1', - asset: 'assets/images/food01.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Chocolate with berries', - tag: '2', - asset: 'assets/images/food02.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Trumoo Candies', - tag: '3', - asset: 'assets/images/food03.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Choco-coko', - tag: '4', - asset: 'assets/images/food04.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Chocolate tree', - tag: '5', - asset: 'assets/images/food05.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Chocolate', - tag: '6', - asset: 'assets/images/food06.jpeg', - stock: 1, - price: 71.0), -]; diff --git a/lib/widgets/components/Scroll/NestedScrollView/demo.dart b/lib/widgets/components/Scroll/NestedScrollView/demo.dart deleted file mode 100644 index cdb38f89..00000000 --- a/lib/widgets/components/Scroll/NestedScrollView/demo.dart +++ /dev/null @@ -1,133 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-20 14:19:26 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-22 20:50:36 - -import 'package:flutter/material.dart'; - -class NestedScrollViewDemo extends StatefulWidget { - _NestedScrollViewDemoState createState() => _NestedScrollViewDemoState(); -} - -class _NestedScrollViewDemoState extends State - with SingleTickerProviderStateMixin { - TabController _tabController; - ScrollController _scrollViewController; - - @override - void initState() { - super.initState(); - _tabController = TabController(vsync: this, length: 2); - _scrollViewController = ScrollController(initialScrollOffset: 0.0); - } - - @override - void dispose() { - _tabController.dispose(); - _scrollViewController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Container( - height: 700.0, - child: Scaffold( - body: NestedScrollView( - controller: _scrollViewController, - headerSliverBuilder: (BuildContext context, bool boxIsScrolled) { - return [ - SliverAppBar( - title: Text('Tab Controller'), - pinned: true, - floating: true, - forceElevated: boxIsScrolled, - expandedHeight: 200.0, - flexibleSpace: Container( - child: Image.asset( - 'assets/images/timg.jpeg', - width: double.infinity, - repeat: ImageRepeat.repeat, - height: double.infinity, - ), - ), - bottom: TabBar( - controller: _tabController, - tabs: [ - Tab( - text: "Home", - icon: Icon(Icons.home), - ), - Tab( - text: "Help", - icon: Icon(Icons.help), - ), - ], - ), - ) - ]; - }, - body: TabBarView( - children: [ - PageOne(), - PageTwo(), - ], - controller: _tabController, - ), - ), - floatingActionButton: FloatingActionButton( - child: Icon(Icons.control_point), - onPressed: () { - _tabController.animateTo(1, - curve: Curves.bounceInOut, - duration: Duration(milliseconds: 10)); - _scrollViewController - .jumpTo(_scrollViewController.position.maxScrollExtent); - }, - ), - ), - ); - } -} - -class PageOne extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Image.asset( - 'assets/images/food06.jpeg', - width: 300.0, - fit: BoxFit.contain, - ), - Image.asset( - 'assets/images/food02.jpeg', - width: 300.0, - fit: BoxFit.contain, - ), - ], - )); - } -} - -class PageTwo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return ListView.builder( - itemExtent: 250.0, - itemBuilder: (context, index) => Container( - padding: EdgeInsets.all(10.0), - child: Material( - elevation: 4.0, - borderRadius: BorderRadius.circular(5.0), - color: index % 2 == 0 ? Colors.cyan : Colors.deepOrange, - child: Center( - child: Text(index.toString()), - ), - ), - ), - ); - } -} diff --git a/lib/widgets/components/Scroll/NestedScrollView/index.dart b/lib/widgets/components/Scroll/NestedScrollView/index.dart deleted file mode 100644 index 6ea21f59..00000000 --- a/lib/widgets/components/Scroll/NestedScrollView/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-20 14:18:36 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-20 14:19:15 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 一个可以嵌在另一个滚动视图中的Scroll view,本质上,他们的滚动是连接着的 -- 最常见的用例就是一个可滚动的视图,包含一个 flexible SliverAppBar,并且包含TabBar和TabBarView -- 在普通的ScrollView中包含一系列 slivers ,会出现滚动冲突的问题 -- NestedScrollView 通过为外部ScrollView和内部的ScrollViews提供自定义的ScrollController来解决滚动冲突的问题,将他们“连接”起来,以便他们滚动时看起来更像是一个整体 -'''; -const String content1 = ''' -### **基本用法** -> Demo演示NestedScrollView最常见的使用实例 -- 头部为一个SliverAppBar,折叠部分的内容都放在了flexibleSpace中 -- 由 headerSliverBuilder 构建出来一个包含TabBar的SliverAppBar,并且在body中包含 TabBarView -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/NestedScrollView'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'components/Scroll/NestedScrollView/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/widgets/NestedScrollView-class.html', - contentList: [ - content0, - content1, - NestedScrollViewDemo(), - ], - title: 'NestedScrollView', - ); - } -} diff --git a/lib/widgets/components/Scroll/ScrollMetrics/demo.dart b/lib/widgets/components/Scroll/ScrollMetrics/demo.dart deleted file mode 100644 index db2f8aca..00000000 --- a/lib/widgets/components/Scroll/ScrollMetrics/demo.dart +++ /dev/null @@ -1,62 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-15 19:43:41 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 21:37:03 - -import 'package:flutter/material.dart'; - -class ScrollMetricsDemo extends StatefulWidget { - _ScrollMetricsDemoState createState() => _ScrollMetricsDemoState(); -} - -class _ScrollMetricsDemoState extends State { - String _progress = "0%"; - - @override - Widget build(BuildContext context) { - return Container( - height: 400.0, - child: Scrollbar( - child: NotificationListener( - onNotification: (ScrollNotification notification) { - double progress = notification.metrics.pixels / - notification.metrics.maxScrollExtent; - //重新构建 - setState(() { - _progress = "${(progress * 100).toInt()}%"; - }); - print("BottomEdge: ${notification.metrics.extentAfter == 0}"); - //return true; //放开此行注释后,进度条将失效 - }, - child: Stack( - alignment: Alignment.center, - children: [ - ListView.builder( - itemCount: 100, - itemExtent: 50.0, - itemBuilder: (context, index) { - return Container( - color: Theme.of(context).primaryColor, - margin: const EdgeInsets.symmetric(vertical: 10.0), - child: Text( - 'test$index', - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - color: Colors.white), - ), - ); - }), - CircleAvatar( - //显示进度百分比 - radius: 30.0, - child: Text(_progress), - backgroundColor: Colors.black54, - ) - ], - ), - ), - ), - ); - } -} diff --git a/lib/widgets/components/Scroll/ScrollMetrics/index.dart b/lib/widgets/components/Scroll/ScrollMetrics/index.dart deleted file mode 100644 index b0a50565..00000000 --- a/lib/widgets/components/Scroll/ScrollMetrics/index.dart +++ /dev/null @@ -1,48 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-15 19:44:12 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 20:33:47 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 包含当前ViewPort及滚动位置等信息 -- pixels:当前滚动位置 -- maxScrollExtent:最大可滚动长度。 -- extentBefore:滑出ViewPort顶部的长度; -- extentInside:ViewPort内部长度;此示例中屏幕显示的列表部分的长度 -- extentAfter:列表中未滑入ViewPort部分的长度;此示例中列表底部未显示到屏幕范围部分的长度 -- atEdge:是否滑到了Scrollable Widget的边界 -'''; - -const String content1 = ''' -### **基本用法** -> 抽象类,不可被实例化 -- FixedScrollMetrics,它是实现此接口的不可变对象 -- 下方Demo中,在接收到滚动事件时,参数类型为ScrollNotification,它包括一个metrics属性,它的类型是ScrollMetrics -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/ScrollMetrics'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'ScrollMetrics', - docUrl: 'https://docs.flutter.io/flutter/widgets/ScrollMetrics-class.html', - codeUrl: 'components/Scroll/ScrollMetrics/demo.dart', - contentList: [ - content0, - content1, - ScrollMetricsDemo(), - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Scroll/ScrollPhysics/demo.dart b/lib/widgets/components/Scroll/ScrollPhysics/demo.dart deleted file mode 100644 index e4208050..00000000 --- a/lib/widgets/components/Scroll/ScrollPhysics/demo.dart +++ /dev/null @@ -1,78 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-15 20:39:14 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 21:27:39 - -import 'package:flutter/material.dart'; - -class ScrollPhysicsDemo extends StatefulWidget { - _ScrollPhysicsDemoState createState() => _ScrollPhysicsDemoState(); -} - -class _ScrollPhysicsDemoState extends State { - final PageController _pageController = PageController(); - double _currentPage = 0.0; - - @override - Widget build(BuildContext context) { - return Container( - height: 300.0, - width: MediaQuery.of(context).size.width, - child: LayoutBuilder( - builder: (context, constraints) => NotificationListener( - onNotification: (ScrollNotification note) { - setState(() { - _currentPage = _pageController.page; - }); - }, - child: PageView.custom( - physics: const PageScrollPhysics( - parent: const BouncingScrollPhysics()), - controller: _pageController, - childrenDelegate: SliverChildBuilderDelegate( - (context, index) => _SimplePage( - '$index', - parallaxOffset: - constraints.maxWidth / 2.0 * (index - _currentPage), - // 小字 Text 在页面滑动时要比整体移动速度快一倍,所以小字的 translate X 为 \tt{pageWidth / 2 * progress} 。 - ), - childCount: 10, - ), - ), - ), - ), - ); - } -} - -class _SimplePage extends StatelessWidget { - _SimplePage(this.data, {Key key, this.parallaxOffset = 0.0}) - : super(key: key); - - final String data; - final double parallaxOffset; - - @override - Widget build(BuildContext context) => Center( - child: Container( - color: Theme.of(context).primaryColor, - child: Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - data, - style: const TextStyle(fontSize: 60.0,color: Colors.white), - ), - SizedBox(height: 40.0), - Transform( - transform: - Matrix4.translationValues(parallaxOffset, 0.0, 0.0), - child: const Text('左右滑动,这是第二行滚动速度更快的小字',style: const TextStyle(fontSize: 16.0,color: Colors.white),), - ), - ], - ), - ), - ), - ); -} diff --git a/lib/widgets/components/Scroll/ScrollPhysics/index.dart b/lib/widgets/components/Scroll/ScrollPhysics/index.dart deleted file mode 100644 index 1fd5afd6..00000000 --- a/lib/widgets/components/Scroll/ScrollPhysics/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-15 20:39:18 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 21:26:11 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 确定滚动组件的物理属性 -- 例如,确定当用户达到最大滚动范围或者停止滚动时,Scrollable的一些滚动行为 -- 当启动物理 [Simulation](https://docs.flutter.io/flutter/physics/Simulation-class.html) 时,当前滚动位置和速度将作为初始条件。 -- 使用simulation中的模拟移动来确定widget的滚动位置 -'''; -const String content1 = ''' -### **基本用法** -> 该widget不能赋值给参数类型为Widget的组件 -- 下方Demo,我们设置PageView的physics属性,滑动感受下下方小字自定义的滚动 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/ScrollPhysics'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ScrollPhysicsDemo(), - ], - codeUrl: 'components/Scroll/ScrollPhysics/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/ScrollPhysics-class.html', - title: 'ScrollPhysics', - ); - } -} diff --git a/lib/widgets/components/Scroll/ScrollView/demo.dart b/lib/widgets/components/Scroll/ScrollView/demo.dart deleted file mode 100644 index f305971a..00000000 --- a/lib/widgets/components/Scroll/ScrollView/demo.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-10 21:15:27 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-10 21:16:05 - -import 'package:flutter/material.dart'; - -class ScrollViewDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - height: 400.0,//注意这里的高度必须得指定 - child: PageView( - children: [ - Container( - color: Colors.yellow, - child: Center( - child: Text( - '这是一个PageView的示例', - style: TextStyle(color: Colors.white, fontSize: 20.0), - ), - ), - ), - Container( - color: Colors.red, - child: Center( - child: Text( - '这是PageView第二个子widget', - style: TextStyle(color: Colors.white, fontSize: 20.0), - ), - ), - ), - Container( - color: Colors.green, - child: Center( - child: Text( - '这是PageView第三个子widget', - style: TextStyle(color: Colors.white, fontSize: 20.0), - ), - ), - ), - ], - scrollDirection: Axis.vertical, - ), - ); - } -} diff --git a/lib/widgets/components/Scroll/ScrollView/index.dart b/lib/widgets/components/Scroll/ScrollView/index.dart deleted file mode 100644 index 465e6a4a..00000000 --- a/lib/widgets/components/Scroll/ScrollView/index.dart +++ /dev/null @@ -1,54 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-10 20:30:53 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-14 20:36:57 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - - -const String contentText0 = ''' -### **简介** -> 一个可以使内容滚动的Widget -可滚动的 widget 包含三部分 -- 一个Scrollable的widget,可以用来监听用户的一些手势事件 -- 例如Viewport和ShrinkWrappingViewport的视图widget,可以通过在滚动视图中仅展示部分widget来进行可视化设计 -- 一个或者多个组件,可以通过组合来实现各种滚动效果。例如列表、网格等 -'''; - -const String contentText1 = ''' -### **基本用法** -> ScrollView 属于抽象类,不能直接实例化. - -例如ListView widget是通过继承 BoxScrollView 然后BoxScrollView通过继承ScrollView来实现继承 - -- ListView : 一个常用的ScrollView,它显示子窗口小部件的滚动线性列表 -- PageView:同样是一个可滚动的视图列表,但是他每一个子widget都是视口窗口的大小 -- GridView: 一个显示二维子widget的ScrollView -- CustomScrollView: 一个使用 Slivers来创建各种自定义滚动效果的ScrollView -- SingleChildScrollView:一个只有一个子widget的ScrollView -- ScrollNotification、NotificationListener:它可以用于在不使用ScrollController的情况下查看滚动位置的widget -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/ScrollView'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'components/Scroll/ScrollView/demo.dart', - contentList: [ - contentText0, - contentText1, - ScrollViewDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/ScrollView-class.html', - title: 'ScrollView', - ); - } -} diff --git a/lib/widgets/components/Scroll/Scrollable/demo.dart b/lib/widgets/components/Scroll/Scrollable/demo.dart deleted file mode 100644 index 1ab53c44..00000000 --- a/lib/widgets/components/Scroll/Scrollable/demo.dart +++ /dev/null @@ -1,22 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-10 21:32:07 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 16:26:20 - -import 'package:flutter/material.dart'; - -class ScrollableDemo extends StatefulWidget { - _ScrollableDemoState createState() => _ScrollableDemoState(); -} - -class _ScrollableDemoState extends State { - @override - Widget build(BuildContext context) { - return Container( - child: Container( - height: 100.0, - child: Text('暂无Demo'), - ), - ); - } -} diff --git a/lib/widgets/components/Scroll/Scrollable/index.dart b/lib/widgets/components/Scroll/Scrollable/index.dart deleted file mode 100644 index 82c07fe0..00000000 --- a/lib/widgets/components/Scroll/Scrollable/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-10 21:31:24 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 17:05:20 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String contentText0 = ''' -### **简介** -> 一个可以使内容滚动的Widget -- 实现了可滚动widget的交互模型,但不包含UI显示相关的逻辑 -- 很难直接构造Scrollable。当然,我们可以考虑使用ListView或者GridView,他们结合了滚动、视口以及布局模型。如果需要自定义布局模型,可以考虑使用 CustomScrollView 。 -'''; - -const String contentText1 = ''' -### **基本用法** -- 静态方法 Scrollable.of 和 Scrollable.ensureVisible 通常用于ListView或者GridView中的Scrollable小部件进行交互 -- 你可以提供自定义的ScrollController,以创建自定义ScrollPosition子类。 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/Scrollable'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'components/Scroll/Scrollable/demo.dart', - contentList: [ - contentText0, - contentText1, - ScrollableDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/Scrollable-class.html', - title: 'Scrollable', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Scroll/ScrollbarPainter/demo.dart b/lib/widgets/components/Scroll/ScrollbarPainter/demo.dart deleted file mode 100644 index 7698eef5..00000000 --- a/lib/widgets/components/Scroll/ScrollbarPainter/demo.dart +++ /dev/null @@ -1,161 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-15 16:25:39 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 19:36:43 - -import 'dart:async'; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter/material.dart'; - -const double _kScrollbarThickness = 16.0; -const Duration _kScrollbarFadeDuration = Duration(milliseconds: 300); -const Duration _kScrollbarTimeToFade = Duration(milliseconds: 600); - -class PaintDemo extends StatelessWidget { - - @override - Widget build(BuildContext context) { - return Container( - height: 300.0, - child: ScrollbarPainterDemo( - child: ListView.builder( - itemCount: 10, - itemBuilder: (context, index) { - return Container( - height: 100.0, - color: Colors.blue, - margin: const EdgeInsets.symmetric(vertical: 10.0), - child: Text( - 'test$index', - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - color: Colors.white), - ), - ); - }, - )), - ); - } -} - -class ScrollbarPainterDemo extends StatefulWidget { - const ScrollbarPainterDemo({ - Key key, - @required this.child, - }) : super(key: key); - final Widget child; - @override - _ScrollbarPainterDemoState createState() => _ScrollbarPainterDemoState(); -} - -class _ScrollbarPainterDemoState extends State - with TickerProviderStateMixin { - ScrollbarPainter _materialPainter; - TargetPlatform _currentPlatform; - TextDirection _textDirection; - Color _themeColor; - - AnimationController _fadeoutAnimationController; - Animation _fadeoutOpacityAnimation; - Timer _fadeoutTimer; - - @override - void initState() { - super.initState(); - _fadeoutAnimationController = AnimationController( - vsync: this, - duration: _kScrollbarFadeDuration, - ); - _fadeoutOpacityAnimation = CurvedAnimation( - parent: _fadeoutAnimationController, curve: Curves.fastOutSlowIn); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - - final ThemeData theme = Theme.of(context); - _currentPlatform = theme.platform; - - switch (_currentPlatform) { - case TargetPlatform.iOS: - // On iOS, stop all local animations. CupertinoScrollbar has its own - // animations. - _fadeoutTimer?.cancel(); - _fadeoutTimer = null; - _fadeoutAnimationController.reset(); - break; - case TargetPlatform.android: - case TargetPlatform.fuchsia: - _themeColor = theme.primaryColor.withOpacity(1.0); - _textDirection = Directionality.of(context); - _materialPainter = _buildMaterialScrollbarPainter(); - break; - } - } - - ScrollbarPainter _buildMaterialScrollbarPainter() { - return ScrollbarPainter( - color: _themeColor, - textDirection: _textDirection, - thickness: _kScrollbarThickness, - fadeoutOpacityAnimation: _fadeoutOpacityAnimation, - ); - } - - bool _handleScrollNotification(ScrollNotification notification) { - // iOS sub-delegates to the CupertinoScrollbar instead and doesn't handle - // scroll notifications here. - if (_currentPlatform != TargetPlatform.iOS && - (notification is ScrollUpdateNotification || - notification is OverscrollNotification)) { - if (_fadeoutAnimationController.status != AnimationStatus.forward) { - _fadeoutAnimationController.forward(); - } - - _materialPainter.update( - notification.metrics, notification.metrics.axisDirection); - _fadeoutTimer?.cancel(); - _fadeoutTimer = Timer(_kScrollbarTimeToFade, () { - _fadeoutAnimationController.reverse(); - _fadeoutTimer = null; - }); - } - return false; - } - - @override - void dispose() { - _fadeoutAnimationController.dispose(); - _fadeoutTimer?.cancel(); - _materialPainter?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - switch (_currentPlatform) { - case TargetPlatform.iOS: - return CupertinoScrollbar( - child: widget.child, - ); - case TargetPlatform.android: - case TargetPlatform.fuchsia: - return NotificationListener( - onNotification: _handleScrollNotification, - child: RepaintBoundary( - child: CustomPaint( - foregroundPainter: _materialPainter, - child: RepaintBoundary( - child: widget.child, - ), - ), - ), - ); - } - throw FlutterError('Unknown platform for scrollbar insertion'); - } -} diff --git a/lib/widgets/components/Scroll/ScrollbarPainter/index.dart b/lib/widgets/components/Scroll/ScrollbarPainter/index.dart deleted file mode 100644 index faf72744..00000000 --- a/lib/widgets/components/Scroll/ScrollbarPainter/index.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-15 16:25:36 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-15 19:38:18 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String contentText0 = ''' -### **简介** -> 用于绘制滚动条的CustomPainter。 -- 与CustomPainter子类化的CustomPainters不同,只有当shouldRepaint返回true时才重绘 -- 当滚动条消失和滚动位置发生变化的时候painter需要重绘而不是重新构建 -'''; - -const String contentText1 = ''' -### **基本使用** -> 当ScrollbarPainter不再使用的时候,必须在ScrollbarPainter上调用dispose -- 除非自定制Scrollbar的需求,基本上我们都可以使用Scrollbar -- Scrollbar的源码其实就是基于ScrollbarPainter封装的 -- demo中将Scrollbar源码进行提取使用 -- CupertinoScrollbar 同样也是使用ScrollbarPainter的最好学习示例 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Scroll/ScrollbarPainter'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'components/Scroll/ScrollbarPainter/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/widgets/ScrollbarPainter-class.html', - contentList: [ - contentText0, - contentText1, - PaintDemo(), - ], - title: 'ScrollbarPainter', - ); - } -} diff --git a/lib/widgets/components/Scroll/index.dart b/lib/widgets/components/Scroll/index.dart deleted file mode 100644 index 0bdf7d15..00000000 --- a/lib/widgets/components/Scroll/index.dart +++ /dev/null @@ -1,59 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-22 20:37:51 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-22 20:37:51 - -import 'package:flutter/material.dart'; - -import '../../../model/widget.dart'; -import './ScrollView/index.dart' as ScrollView; -import './Scrollable/index.dart' as Scrollable; -import './ScrollbarPainter/index.dart' as ScrollbarPainter; -import './ScrollMetrics/index.dart' as ScrollMetrics; -import './ScrollPhysics/index.dart' as ScrollPhysics; -import './BoxScrollView/index.dart' as BoxScrollView; -import './CustomScrollView/index.dart' as CustomScrollView; -import './NestedScrollView/index.dart' as NestedScrollView; - -List widgetPoints = [ - WidgetPoint( - name: 'ScrollView', - routerName: ScrollView.Demo.routeName, - buildRouter: (BuildContext context) => ScrollView.Demo(), - ), - WidgetPoint( - name: 'Scrollable', - routerName: Scrollable.Demo.routeName, - buildRouter: (BuildContext context) => Scrollable.Demo(), - ), - WidgetPoint( - name: 'ScrollbarPainter', - routerName: ScrollbarPainter.Demo.routeName, - buildRouter: (BuildContext context) => ScrollbarPainter.Demo(), - ), - WidgetPoint( - name: 'ScrollMetrics', - routerName: ScrollMetrics.Demo.routeName, - buildRouter: (BuildContext context) => ScrollMetrics.Demo(), - ), - WidgetPoint( - name: 'ScrollPhysics', - routerName: ScrollPhysics.Demo.routeName, - buildRouter: (BuildContext context) => ScrollPhysics.Demo(), - ), - WidgetPoint( - name: 'BoxScrollView', - routerName: BoxScrollView.Demo.routeName, - buildRouter: (BuildContext context) => BoxScrollView.Demo(), - ), - WidgetPoint( - name: 'CustomScrollView', - routerName: CustomScrollView.Demo.routeName, - buildRouter: (BuildContext context) => CustomScrollView.Demo(), - ), - WidgetPoint( - name: 'NestedScrollView', - routerName: NestedScrollView.Demo.routeName, - buildRouter: (BuildContext context) => NestedScrollView.Demo(), - ), -]; \ No newline at end of file diff --git a/lib/widgets/components/Tab/Tab/demo.dart b/lib/widgets/components/Tab/Tab/demo.dart deleted file mode 100644 index d5d5774e..00000000 --- a/lib/widgets/components/Tab/Tab/demo.dart +++ /dev/null @@ -1,61 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-22 20:38:01 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-22 20:51:47 - -import 'package:flutter/material.dart'; - -class TabDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - height: 500.0, - child: MyTabbedPage(), - ); - } -} - -class MyTabbedPage extends StatefulWidget { - const MyTabbedPage({ Key key }) : super(key: key); - @override - _MyTabbedPageState createState() => _MyTabbedPageState(); -} - -class _MyTabbedPageState extends State with SingleTickerProviderStateMixin { - final List myTabs = [ - Tab(text: 'LEFT'), - Tab(text: 'RIGHT'), - ]; - - TabController _tabController; - - @override - void initState() { - super.initState(); - _tabController = TabController(vsync: this, length: myTabs.length); - } - - @override - void dispose() { - _tabController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - bottom: TabBar( - controller: _tabController, - tabs: myTabs, - ), - ), - body: TabBarView( - controller: _tabController, - children: myTabs.map((Tab tab) { - return Center(child: Text(tab.text)); - }).toList(), - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Tab/Tab/index.dart b/lib/widgets/components/Tab/Tab/index.dart deleted file mode 100644 index 02a80d98..00000000 --- a/lib/widgets/components/Tab/Tab/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-22 20:37:58 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-22 20:49:56 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 属于 Material 风格下的一个widget -- 如果同时给Tab传入icon和text,text将会被展现在icon的下面 -'''; - -const String content1 = ''' -### **基本用法** -> 通常需要配合TabBar TabBarView使用 -- TabBar中的children和TabBarView中的数组成一一对应关系 -- TabController 可以协调TabBarView和Tab之间的选择和个数等 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/components/Tab/Tab'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'components/Tab/Tab/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/material/Tab-class.html', - title: 'Tab', - contentList: [ - content0, - content1, - TabDemo(), - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/components/Tab/index.dart b/lib/widgets/components/Tab/index.dart deleted file mode 100644 index 866d9c8d..00000000 --- a/lib/widgets/components/Tab/index.dart +++ /dev/null @@ -1,17 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-22 20:37:45 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-22 20:43:15 - -import 'package:flutter/material.dart'; - -import '../../../model/widget.dart'; -import './Tab/index.dart' as Tab; - -List widgetPoints = [ - WidgetPoint( - name:'Tab', - routerName: Tab.Demo.routeName, - buildRouter: (BuildContext context) => Tab.Demo(), - ), -]; \ No newline at end of file diff --git a/lib/widgets/components/index.dart b/lib/widgets/components/index.dart deleted file mode 100644 index 2077b0da..00000000 --- a/lib/widgets/components/index.dart +++ /dev/null @@ -1,39 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-10 20:34:18 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-22 21:25:40 - -import 'Scroll/index.dart' as Scroll; -import 'Pick/index.dart' as Pick; -import 'Chip/index.dart' as Chip; -import 'Panel/index.dart' as Panel; -import 'Progress/index.dart' as Progress; -import 'Tab/index.dart' as Ta; -import 'Menu/index.dart' as Menu; -import 'Navigation/index.dart' as Navigation; -import 'List/index.dart' as Li; -import 'Card/index.dart' as Card; -import 'Bar/index.dart' as Bar; -import 'Dialog/index.dart' as Dialog; -import 'Scaffold/index.dart' as Scaffold; -import 'Grid/index.dart' as GridTile; - - -List getWidgets() { - List result = []; - result.addAll(Scroll.widgetPoints); - result.addAll(Pick.widgetPoints); - result.addAll(Chip.widgetPoints); - result.addAll(Panel.widgetPoints); - result.addAll(Progress.widgetPoints); - result.addAll(Ta.widgetPoints); - result.addAll(Menu.widgetPoints); - result.addAll(Navigation.widgetPoints); - result.addAll(Li.widgetPoints); - result.addAll(Card.widgetPoints); - result.addAll(Bar.widgetPoints); - result.addAll(Dialog.widgetPoints); - result.addAll(Scaffold.widgetPoints); - result.addAll(GridTile.widgetPoints); - return result; -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Button/DropdownButton/demo.dart b/lib/widgets/elements/Form/Button/DropdownButton/demo.dart deleted file mode 100644 index 42450c81..00000000 --- a/lib/widgets/elements/Form/Button/DropdownButton/demo.dart +++ /dev/null @@ -1,139 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: DropdownButton 的示例 - -import 'package:flutter/material.dart'; - -// DropdownButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true -var selectItValue; -var selectItemValue; - -class DropdownButtonDefault extends StatelessWidget { - List generateItemList() { - final List items = List(); - final DropdownMenuItem item1 = DropdownMenuItem( - value: '张三', child: Text('张三')); - final DropdownMenuItem item2 = DropdownMenuItem( - value: '李四', child: Text('李四')); - final DropdownMenuItem item3 = DropdownMenuItem( - value: '王二', child: Text('王二')); - final DropdownMenuItem item4 = DropdownMenuItem( - value: '麻子', child: Text('麻子')); - items.add(item1); - items.add(item2); - items.add(item3); - items.add(item4); - return items; - } - - @override - Widget build(BuildContext context) { - return DropdownButton( - hint: Text('下拉菜单选择一个人名'), - //设置这个value之后,选中对应位置的item, - //再次呼出下拉菜单,会自动定位item位置在当前按钮显示的位置处 - value: selectItValue, - items: generateItemList(), - onChanged: (T){ -// setState(() { -// selectItemValue=T; -// }); - }, - ); - } -} - -List getListData(){ - List items= List(); - DropdownMenuItem dropdownMenuItem1= DropdownMenuItem( - child: Text('1'), - value: '1', - ); - items.add(dropdownMenuItem1); - DropdownMenuItem dropdownMenuItem2= DropdownMenuItem( - child: Text('2'), - value: '2', - ); - items.add(dropdownMenuItem2); - DropdownMenuItem dropdownMenuItem3= DropdownMenuItem( - child: Text('3'), - value: '3', - ); - items.add(dropdownMenuItem3); - DropdownMenuItem dropdownMenuItem4= DropdownMenuItem( - child: Text('4'), - value: '4', - ); - items.add(dropdownMenuItem4); - DropdownMenuItem dropdownMenuItem5= DropdownMenuItem( - child: Text('5'), - value: '5', - ); - items.add(dropdownMenuItem5); - DropdownMenuItem dropdownMenuItem6= DropdownMenuItem( - child: Text('6'), - value: '6', - ); - items.add(dropdownMenuItem6); - DropdownMenuItem dropdownMenuItem7= DropdownMenuItem( - child: Text('7'), - value: '7', - ); - items.add(dropdownMenuItem7); - DropdownMenuItem dropdownMenuItem8= DropdownMenuItem( - child: Text('8'), - value: '8', - ); - items.add(dropdownMenuItem8); - DropdownMenuItem dropdownMenuItem9= DropdownMenuItem( - child: Text('9'), - value: '9', - ); - items.add(dropdownMenuItem9); - DropdownMenuItem dropdownMenuItem10= DropdownMenuItem( - child: Text('10'), - value: '10', - ); - items.add(dropdownMenuItem10); - return items; -} - -// DropdownButton 自定义的实例 -class DropdownButtonCustom extends StatelessWidget { - final widget; - final parent; - const DropdownButtonCustom([this.widget,this.parent]) - : super(); - - @override - Widget build(BuildContext context) { - return DropdownButton( - items: getListData(), - //当没有默认值的时候可以设置的提示 - hint:Text('下拉选择你想要的数据'), - //下拉菜单选择完之后显示给用户的值 - value: selectItemValue, - //下拉菜单item点击之后的回调 - onChanged: (T){ - if (parent.mounted) { - parent.setState(() { - selectItemValue = T; - }); - } - }, - //设置阴影的高度 - elevation: 24, - style: TextStyle(//设置文本框里面文字的样式 - color: Colors.red - ), - // isDense: true,//减少按钮的高度。默认情况下,此按钮的高度与其菜单项的高度相同。如果isDense为true,则按钮的高度减少约一半。 这个当按钮嵌入添加的容器中时,非常有用 - // 将下拉列表的内部内容设置为水平填充其父级 - isExpanded:true, - iconSize: 50.0,//设置三角标icon的大小 - ); - } -} diff --git a/lib/widgets/elements/Form/Button/DropdownButton/index.dart b/lib/widgets/elements/Form/Button/DropdownButton/index.dart deleted file mode 100644 index f6d1ae8a..00000000 --- a/lib/widgets/elements/Form/Button/DropdownButton/index.dart +++ /dev/null @@ -1,74 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: DropdownButton 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/DropdownButton-class.html - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart' as dropdownButton; - -const String _dropdownText0 = -"""### **简介** -> Dropdown button “用于从项目列表中进行选择的按钮” -- 参数类型 T 是下拉菜单表示的值的类型。给定菜单中的所有条目必须表示具有一致类型的值。通常,使用枚举。每个DropdownMenuItem在项目必须专门与同类型的说法; -"""; - -const String _dropdownText1 = -"""### **基本用法** -> 此示例显示一个包含四个项目的菜单 -"""; - -const String _dropdownText2 = -"""### **进阶用法** -> 此示例尝试调整所有属性,展示出效果 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/DropdownButton'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType(){ - //String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; - this.setState((){ - //buttonShapeType = _buttonShapeType; - }); - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'DropdownButton', - codeUrl: 'elements/Form/Button/DropdownButton/demo.dart', - contentList: allDropdownButtons(context,this), - docUrl: 'https://docs.flutter.io/flutter/material/DropdownButton-class.html', - ); - } -} - -// 所有的 DropdownButton 按钮 -List allDropdownButtons(BuildContext context,_DemoState that){ - return [ - _dropdownText0, - _dropdownText1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - dropdownButton.DropdownButtonDefault(), - ], - ), - _dropdownText2, - SizedBox(height: 10.0), - dropdownButton.DropdownButtonCustom(context.widget, that), - SizedBox(height: 20.0) - ]; -} - diff --git a/lib/widgets/elements/Form/Button/FlatButton/demo.dart b/lib/widgets/elements/Form/Button/FlatButton/demo.dart deleted file mode 100644 index 94cbcb50..00000000 --- a/lib/widgets/elements/Form/Button/FlatButton/demo.dart +++ /dev/null @@ -1,126 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: FlatButton 的示例 - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -// FlatButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true -class FlatButtonDefault extends StatelessWidget { - final bool isDisabled; - - const FlatButtonDefault([ this.isDisabled = true]) - : assert(isDisabled != null), - super(); - - @override - Widget build(BuildContext context) { - return FlatButton( - // 文本内容 - child: const Text('默认按钮', semanticsLabel: 'FLAT BUTTON 1'), - onPressed: isDisabled ? () {} : null); - } -} - - -// FlatButton.icon 默认按钮的实例 -// Create a text button from a pair of widgets that serve as the button's icon and label -// isDisabled:是否是禁用 -class FlatButtonIconDefault extends StatelessWidget { - final bool isDisabled; - final IconData icon; - - const FlatButtonIconDefault( - [ this.isDisabled = true, this.icon = Icons.add_circle]) - : super(); - - Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); - } - - @override - Widget build(BuildContext context) { - return FlatButton.icon( - // 文本内容 - icon: Icon(icon, size: 25.0, color: _randomColor()), - label: Text('默认按钮', semanticsLabel: 'FLAT BUTTON 2'), - onPressed: isDisabled - ? () { - //_showMessage('点击了 FLAT BUTTON ', context); - } - : null); - } -} - - -// FlatButton 自定义的实例 - -class FlatButtonCustom extends StatelessWidget { - final String txt; - final Color color; - final ShapeBorder shape; - final VoidCallback onPressed; - - const FlatButtonCustom([ - this.txt = '自定义按钮', - this.color = Colors.blueAccent, - this.shape, - this.onPressed - ]) :super(); - - @override - Widget build(BuildContext context) { - final _onPressed = onPressed; - return FlatButton( - // 文本内容 - child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'), - // 按钮颜色 - color: color, - // 按钮亮度 - colorBrightness: Brightness.dark, - // 高亮时的背景色 - //highlightColor: Colors.yellow, - // 失效时的背景色 - disabledColor: Colors.grey, - // 该按钮上的文字颜色,但是前提是不设置字体自身的颜色时才会起作用 - textColor: Colors.white, - // 按钮失效时的文字颜色,同样的不能使用文本自己的样式或者颜色时才会起作用 - disabledTextColor: Colors.grey, - // 按钮主题,主要用于与ButtonTheme和ButtonThemeData一起使用来定义按钮的基色,RaisedButton,FlatButton,OutlineButton,它们是基于环境ButtonTheme配置的 - //ButtonTextTheme.accent,使用模版颜色的;ButtonTextTheme.normal,按钮文本是黑色或白色取决于。ThemeData.brightness;ButtonTextTheme.primary,按钮文本基于。ThemeData.primaryColor. - textTheme: ButtonTextTheme.normal, - // 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚 - splashColor: Colors.deepPurple, - // 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias - clipBehavior: Clip.antiAlias, - padding: EdgeInsets.only( - bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), - shape: (shape is ShapeBorder) ? shape : Border.all( - // 设置边框样式 - color: Colors.grey, - width: 2.0, - style: BorderStyle.solid, - ), - // FlatButton 的点击事件 - onPressed: () { - // Perform some action - if (_onPressed is VoidCallback) { - _onPressed(); - } - }, - // 改变高亮颜色回掉函数,一个按钮会触发两次,按下后改变时触发一次,松手后恢复原始颜色触发一次 - // 参数 bool,按下后true,恢复false - onHighlightChanged: (isClick) { - print(isClick); - } - ); - } -} diff --git a/lib/widgets/elements/Form/Button/FlatButton/index.dart b/lib/widgets/elements/Form/Button/FlatButton/index.dart deleted file mode 100644 index d7e5ba73..00000000 --- a/lib/widgets/elements/Form/Button/FlatButton/index.dart +++ /dev/null @@ -1,128 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: FlatButton 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/FlatButton-class.html - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; - -import './demo.dart' as flatButton; - -const String _flatText0 = -"""### **简介** -> FlatButton 是显示在(零高程)material widget 上的文本标签 -- 通过填充颜色对触摸作出反应在工具栏上; -- FlatButtons 故意不具有可见边框,因此必须依赖于它们相对于其他内容的位置以用于上下文; -- 在对话框和卡片中,它们应该组合在一个底角中。避免使用平面按钮,它们会与其他内容混合,例如在列表中间;"""; - -const String _flatText1 = -"""### **基本用法** -> 参数的默认的 button 和禁用 button -- 如果 onPressed 回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色; -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;。"""; - - -const String _flatText2 = -"""### **进阶用法1** -> FlatButton.icon ,button 图标和标签的 widget 创建文本按钮;"""; - -const String _flatText3 = -"""### **进阶用法2** -> 更改参数的自定义,比如:边框,点击效果,内容文字颜色等; -- 要使应用程序的一部分具有交互式,使用 ink splashes,请考虑使用InkWell; -- Flat button 的最小尺寸为88.0×36.0,可以用 ButtonTheme 覆盖。该clipBehavior参数不能为空;"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/FlatButton'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'FlatButton', - codeUrl: 'elements/Form/Button/FlatButton/demo.dart', - contentList: allFlatButtons(context), - docUrl: 'https://docs.flutter.io/flutter/material/FlatButton-class.html', - ); - } -} - - // 所有的 FlatButton 按钮 -List allFlatButtons(BuildContext context){ - return [ - _flatText0, - _flatText1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - flatButton.FlatButtonDefault(), - SizedBox(width: 20.0), // 间距 - flatButton.FlatButtonDefault(false), - ], - ), - _flatText2, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - //mainAxisSize: MainAxisSize.min, - children: [ - flatButton.FlatButtonIconDefault(), - flatButton.FlatButtonIconDefault(false), - ], - ), - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - //mainAxisSize: MainAxisSize.min, - children: [ - flatButton.FlatButtonIconDefault(true, Icons.android), - flatButton.FlatButtonIconDefault(true, Icons.announcement), - ], - ), - _flatText3, - //flatButton.FlatButtonCustom(context,'主要按钮',Colors.blue), - flatButton.FlatButtonCustom('主要按钮',Colors.blue), - SizedBox(height: 10.0), - flatButton.FlatButtonCustom('成功按钮',Colors.green), - SizedBox(height: 10.0), - flatButton.FlatButtonCustom('信息按钮',Colors.grey), - SizedBox(height: 10.0), - flatButton.FlatButtonCustom('警告按钮',Colors.orange), - SizedBox(height: 10.0), - flatButton.FlatButtonCustom('危险按钮',Colors.pink), - SizedBox(height: 10.0), - flatButton.FlatButtonCustom('点击我试试!', Colors.red, - Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid), - () => _showMessage('点击了 FLAT BUTTON ', context)), - SizedBox(height: 20.0) - ]; -} - - // alert 弹框 - // context:容器的父级 -void _showMessage(String name, BuildContext context) { - showDialog( - // alert 的父级 - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text('提示'), - content: Text(name), - actions: [ - FlatButton( - // alert 的取消按钮 - onPressed: () { - // 取消的事件 - Navigator.of(context).pop(true); - }, - child: Text('取消')) - ]); - } - ); -} diff --git a/lib/widgets/elements/Form/Button/FloatingActionButton/demo.dart b/lib/widgets/elements/Form/Button/FloatingActionButton/demo.dart deleted file mode 100644 index 95303b83..00000000 --- a/lib/widgets/elements/Form/Button/FloatingActionButton/demo.dart +++ /dev/null @@ -1,109 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: OutlineButton 的示例 - -import 'package:flutter/material.dart'; - -// OutlineButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true -class FloatingActionButtonDefault extends StatelessWidget { - final bool isDisabled; - - const FloatingActionButtonDefault([ this.isDisabled = true]) - : assert(isDisabled != null), - super(); - - @override - Widget build(BuildContext context) { - return FloatingActionButton( - // 文本内容 - backgroundColor:Colors.red, - child: const Icon(Icons.add), - heroTag: null, // 不加这个参数会黑屏... - onPressed: isDisabled ? () {} : null); - } -} - -// OutlineButton 自定义的实例 -class FloatingActionButtonCustom extends StatelessWidget { - final String txt; - final Color color; - final ShapeBorder shape; - final VoidCallback onPressed; - - const FloatingActionButtonCustom( - [ this.txt = '自定义按钮', - this.color = Colors.orange, - this.shape, - this.onPressed]) - : super(); - - @override - Widget build(BuildContext context) { - final _onPressed = (onPressed is Function) ? onPressed : ()=>{}; - return FloatingActionButton( - // 子视图,一般为Icon,不推荐使用文字 - child: const Icon(Icons.refresh), - // FAB的文字解释,FAB被长按时显示,也是无障碍功能 - tooltip: txt, - // 前景色 - foregroundColor: Colors.white, - // 背景色 - backgroundColor: color, - // hero效果使用的tag,系统默认会给所有FAB使用同一个tag,方便做动画效果,简单理解为两个界面内拥有同样tag的元素在界面切换过程中,会有动画效果,是界面切换不再那么生硬。 - heroTag: null, - // 未点击时阴影值,默认6.0 - elevation: 7.0, - // 点击时阴影值,默认12.0 - highlightElevation: 14.0, - // 点击事件回调 - onPressed: () { - Scaffold.of(context).showSnackBar( SnackBar( - content: Text("FAB is Clicked"), - )); - _onPressed(); - }, - // 是否为“mini”类型,默认为false,FAB 分为三种类型:regular, mini, and extended - mini: false, - // 定义FAB的shape,设置shape时,默认的elevation将会失效,默认为CircleBorder - //shape: CircleBorder(), - shape: shape, - // 是否为”extended”类型 - isExtended: true - ); - } -} - -// OutlineButton 自定义的实例2 -class FloatingActionButtonCustom2 extends StatelessWidget { - final String txt; - final Color color; - final ShapeBorder shape; - final VoidCallback onPressed; - - const FloatingActionButtonCustom2( - [ this.txt = '自定义按钮', - this.color = Colors.orange, - this.shape, - this.onPressed]) - : super(); - - @override - Widget build(BuildContext context) { - final _onPressed = onPressed; - return FloatingActionButton.extended( - onPressed: () { - print('button click'); - _onPressed(); - }, - foregroundColor: Colors.white, - backgroundColor: Colors.amber, - //如果不手动设置icon和text颜色,则默认使用foregroundColor颜色 - icon: Icon(Icons.flag,color: Colors.red), - label: Text('FloatingActionButton.extended', maxLines: 1), - ); - } -} diff --git a/lib/widgets/elements/Form/Button/FloatingActionButton/index.dart b/lib/widgets/elements/Form/Button/FloatingActionButton/index.dart deleted file mode 100644 index 71e5b8ea..00000000 --- a/lib/widgets/elements/Form/Button/FloatingActionButton/index.dart +++ /dev/null @@ -1,140 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: FloatingActionButton 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/FloatingActionButton-class.html - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as floatingActionButton; - - -const String _floatingActionText0 = -"""### **简介** -> FloatingAction Button “浮动动作按钮” -- FloatingActionButton 按钮是一个圆形图标按钮,悬停在内容上以提升应用程序中的主要操作。浮动操作按钮最常用于Scaffold.floatingActionButton字段中; -- 每个屏幕最多使用一个浮动操作按钮。浮动操作按钮应用于积极操作,例如“创建”,“共享”或“导航”; -- 一般用来处理界面中最常用,最基础的用户动作。它一般出现在屏幕内容的前面,通常是一个圆形,中间有一个图标。 FAB有三种类型:regular, mini, extended。不要强行使用FAB,只有当使用场景符合FAB功能的时候使用才最为恰当; -"""; - -const String _floatingActionText1 = -"""### **基本用法** -> 默认参数的 button 和禁用 button -- 如果 onPressed 回调为null,则该 button 将被禁用,并且不会对触摸作出反应,不会变成灰色; -"""; - -const String _floatingActionText2 = -"""### **进阶用法1** -> 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等 -"""; - -const String _floatingActionText3 = -"""### **进阶用法2** -> 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/FloatingActionButton'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType(){ - String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; - if(mounted) { - this.setState(() { - buttonShapeType = _buttonShapeType; - }); - } - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'FloatingActionButton', - // desc: _floatingActionTitle, - codeUrl: 'elements/Form/Button/FloatingActionButton/demo.dart', - contentList: allFloatingActionButtons(context,this), - docUrl: 'https://docs.flutter.io/flutter/material/FloatingActionButton-class.html', - ); - } -} - - // 所有的 FloatingActionButton 按钮 -List allFloatingActionButtons(BuildContext context,_DemoState that){ - final ShapeBorder buttonShape = drawShape(that.buttonShapeType); - return [ - _floatingActionText0, - _floatingActionText1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - floatingActionButton.FloatingActionButtonDefault(), - SizedBox(width: 20.0), // 间距 - floatingActionButton.FloatingActionButtonDefault(false), - ], - ), - _floatingActionText2, - SizedBox(height: 10.0), - floatingActionButton.FloatingActionButtonCustom( - '主要按钮', Colors.deepOrangeAccent, buttonShape), - SizedBox(height: 20.0), - _floatingActionText3, - SizedBox(height: 20.0), - floatingActionButton.FloatingActionButtonCustom2( - '扩展按钮', Colors.deepOrangeAccent, buttonShape), - SizedBox(height: 20.0) - ]; -} - -// 绘制边框信息,比如是否有边框,是否是圆角 -ShapeBorder drawShape(String type){ - final Color _color = _randomColor(); - final borderWidth = Random.secure().nextInt(5).toDouble(); - final radiusWidth = Random.secure().nextInt(50).toDouble(); - - switch(type){ - case 'border': - return Border.all( - // 设置边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ); - break; - case 'radius': - return RoundedRectangleBorder( - side: BorderSide( // 保留原来的边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ), - borderRadius: BorderRadius.only( - topRight: Radius.circular(radiusWidth), - topLeft: Radius.circular(radiusWidth), - bottomLeft: Radius.circular(radiusWidth), - bottomRight: Radius.circular(radiusWidth), - ), - ); - break; - default: - return null; - } -} - -// 取随机颜色 -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} - diff --git a/lib/widgets/elements/Form/Button/IconButton/demo.dart b/lib/widgets/elements/Form/Button/IconButton/demo.dart deleted file mode 100644 index 69915c84..00000000 --- a/lib/widgets/elements/Form/Button/IconButton/demo.dart +++ /dev/null @@ -1,92 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: IconButton 的示例 - -import 'dart:math'; -import 'package:flutter/material.dart'; - -import 'package:flutter_go/resources/icon_names.dart'; - - -final int len = IconNames.names.length; - - -// IconButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true -class IconButtonDefault extends StatelessWidget { - final bool isDisabled; - - const IconButtonDefault([ this.isDisabled = true]) - : assert(isDisabled != null), - super(); - - @override - Widget build(BuildContext context) { - return IconButton( - // 文本内容 - icon: Icon(Icons.volume_up), - tooltip: 'Increase volume by 10%', - onPressed: isDisabled ? () {} : null); - } -} - -// IconButton 自定义的实例 -class IconButtonCustom extends StatelessWidget { - final String txt; - final Color color; - final ShapeBorder shape; - final VoidCallback onPressed; - - const IconButtonCustom( - [ this.txt = '自定义按钮', - this.color = Colors.blueAccent, - this.shape, - this.onPressed]) - : super(); - - getIcons(){ - return Icons; - } - - @override - Widget build(BuildContext context) { - final int iconIndex = Random.secure().nextInt(len); - final IconData type = IconNames.names[iconIndex]; - final _onPressed = onPressed; - return IconButton( - // 定义图标在IconButton中的定位方式,AlignmentGeometry 如果父Widget尺寸大于child Widget尺寸,这个属性设置会起作用,有很多种对齐方式。 - alignment:AlignmentDirectional.center, - // 按钮颜色 - color: _randomColor(), - // 如果图标被禁用,则用于按钮内图标的颜色。默认为当前主题的ThemeData.disabledColor - disabledColor:_randomColor(), - // 高亮时的背景色 - highlightColor: Colors.yellow, - // 按钮内图标的大小 - icon:Icon(type), - // 图标尺寸 - iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小 - // 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚 - splashColor: _randomColor(), - padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), - // 描述按下按钮时将发生的操作的文本 - tooltip:'这是${ type.codePoint }信息', - // IconButton 的点击事件 - onPressed: () { - // Perform some action - if (_onPressed is VoidCallback) { - _onPressed(); - } - }); - } -} - -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} diff --git a/lib/widgets/elements/Form/Button/IconButton/index.dart b/lib/widgets/elements/Form/Button/IconButton/index.dart deleted file mode 100644 index e15147df..00000000 --- a/lib/widgets/elements/Form/Button/IconButton/index.dart +++ /dev/null @@ -1,141 +0,0 @@ - - /// Created with FlutterGo. - /// User: 一晟 - /// Date: 2018/11/14 - /// Time: 下午4:31 - /// email: zhu.yan@alibaba-inc.com - /// target: IconButton 的示例 - /// 对应文档地址:https://docs.flutter.io/flutter/material/IconButton-class.html - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as iconButton; - -const String _iconText0 = -"""### **简介** -> Icon button “图标按钮” -- IconButton widget上的图片,通过填充颜色(墨水)来对触摸作出反应; -"""; - -const String _iconText1 = -"""### **基本用法** -> 参数的默认的按钮和禁用按钮 -- 图标按钮通常在AppBar.actions字段中使用,但它们也可以在许多其他地方使用; -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;"""; - -const String _iconText2 = -"""### **进阶用法** -> 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等; -- 如果可能,图标按钮的命中区域的大小至少为48.0像素,与实际的iconSize无关,以满足 Material Design规范中的触摸目标大小要求。的对准控制图标本身如何定位命中区域内; -- ** 长按可弹出 tip 文字 ** -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/IconButton'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType(){ - String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; - if(mounted) { - this.setState(() { - buttonShapeType = _buttonShapeType; - }); - } - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'IconButton', - codeUrl: 'elements/Form/Button/IconButton/demo.dart', - contentList: allIconButtons(context,this), - docUrl: 'https://docs.flutter.io/flutter/material/IconButton-class.html', - ); - } -} - -// 所有的 IconButton 按钮 -List allIconButtons(BuildContext context,_DemoState that){ - final ShapeBorder buttonShape = drawShape(that.buttonShapeType); - return [ - _iconText0, - _iconText1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - iconButton.IconButtonDefault(), - SizedBox(width: 20.0), // 间距 - iconButton.IconButtonDefault(false), - ], - ), - _iconText2, - SizedBox(height: 10.0), - iconButton.IconButtonCustom('主要按钮', Colors.blue, buttonShape), - SizedBox(height: 10.0), - iconButton.IconButtonCustom('成功按钮', Colors.green, buttonShape), - SizedBox(height: 10.0), - iconButton.IconButtonCustom('信息按钮', Colors.grey, buttonShape), - SizedBox(height: 10.0), - iconButton.IconButtonCustom('警告按钮', Colors.orange, buttonShape), - SizedBox(height: 10.0), - iconButton.IconButtonCustom('危险按钮', Colors.pink, buttonShape), - SizedBox(height: 10.0), - RaisedButton( - // 文本内容 - child: const Text('点击切换,图标按钮', semanticsLabel: 'FLAT BUTTON 1'), - onPressed: () => that.setButtonShapeType()), - SizedBox(height: 20.0) - ]; -} - -// 绘制边框信息,比如是否有边框,是否是圆角 -ShapeBorder drawShape(String type){ - final Color _color = _randomColor(); - final borderWidth = Random.secure().nextInt(5).toDouble(); - final radiusWidth = Random.secure().nextInt(50).toDouble(); - - switch(type){ - case 'border': - return Border.all( - // 设置边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ); - break; - case 'radius': - return RoundedRectangleBorder( - side: BorderSide( // 保留原来的边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ), - borderRadius: BorderRadius.only( - topRight: Radius.circular(radiusWidth), - topLeft: Radius.circular(radiusWidth), - bottomLeft: Radius.circular(radiusWidth), - bottomRight: Radius.circular(radiusWidth), - ), - ); - break; - default: - return null; - } -} - -// 取随机颜色 -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} - diff --git a/lib/widgets/elements/Form/Button/OutlineButton/demo.dart b/lib/widgets/elements/Form/Button/OutlineButton/demo.dart deleted file mode 100644 index 5f169f1c..00000000 --- a/lib/widgets/elements/Form/Button/OutlineButton/demo.dart +++ /dev/null @@ -1,116 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: OutlineButton 的示例 - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -// OutlineButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true -class OutlineButtonDefault extends StatelessWidget { - final bool isDisabled; - - const OutlineButtonDefault([ this.isDisabled = true]) - : assert(isDisabled != null), - super(); - - @override - Widget build(BuildContext context) { - return OutlineButton( - // 文本内容 - child: const Text('默认按钮', semanticsLabel: 'FLAT BUTTON 1'), - onPressed: isDisabled ? () {} : null); - } -} - -// OutlineButton.icon 默认按钮的实例 -// Create a text button from a pair of widgets that serve as the button's icon and label -// isDisabled:是否是禁用 -class OutlineButtonIconDefault extends StatelessWidget { - final bool isDisabled; - final IconData icon; - - const OutlineButtonIconDefault( - [ this.isDisabled = true, this.icon = Icons.add_circle]) - : super(); - - @override - Widget build(BuildContext context) { - return OutlineButton.icon( - // 文本内容 - icon: Icon(icon, size: 25.0, color: _randomColor()), - label: Text('默认按钮', semanticsLabel: 'FLAT BUTTON 2'), - onPressed: isDisabled - ? () { - //_showMessage('点击了 FLAT BUTTON ', context); - } - : null); - } -} - -// OutlineButton 自定义的实例 -class OutlineButtonCustom extends StatelessWidget { - final String txt; - final Color color; - final ShapeBorder shape; - final VoidCallback onPressed; - - const OutlineButtonCustom( - [ this.txt = '自定义按钮', - this.color = Colors.blueAccent, - this.shape, - this.onPressed]) - : super(); - - @override - Widget build(BuildContext context) { - final _onPressed = onPressed; - return OutlineButton( - // 文本内容 - child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'), - // 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor - borderSide: BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()), - // 按钮颜色 - color: _randomColor(), - // 按钮失效时边框颜色 - disabledBorderColor: Colors.red, - highlightedBorderColor:Colors.black54, - // 高亮时的背景色 - highlightColor: Colors.yellow, - // 失效时的背景色 - //disabledColor: Colors.grey, - // 该按钮上的文字颜色,但是前提是不设置字体自身的颜色时才会起作用 - textColor: _randomColor(), - // 按钮失效时的文字颜色,同样的不能使用文本自己的样式或者颜色时才会起作用 - disabledTextColor: _randomColor(), - // 按钮主题,主要用于与ButtonTheme和ButtonThemeData一起使用来定义按钮的基色,OutlineButton,OutlineButton,OutlineButton,它们是基于环境ButtonTheme配置的 - //ButtonTextTheme.accent,使用模版颜色的;ButtonTextTheme.normal,按钮文本是黑色或白色取决于。ThemeData.brightness;ButtonTextTheme.primary,按钮文本基于。ThemeData.primaryColor. - textTheme: ButtonTextTheme.normal, - // 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚 - splashColor: _randomColor(), - // 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias - clipBehavior: Clip.antiAlias, - padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), - //高亮时候的阴影 - highlightElevation: 10.0, - shape: shape, // 在Outline 里只能设置圆角,边框用borderSide - // OutlineButton 的点击事件 - onPressed: () { - // Perform some action - if (_onPressed is VoidCallback) { - _onPressed(); - } - }); - } -} - -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} diff --git a/lib/widgets/elements/Form/Button/OutlineButton/index.dart b/lib/widgets/elements/Form/Button/OutlineButton/index.dart deleted file mode 100644 index eb31d1e6..00000000 --- a/lib/widgets/elements/Form/Button/OutlineButton/index.dart +++ /dev/null @@ -1,165 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: OutlineButton 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/OutlineButton-class.html - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as outlineButton; - -const String _outlineText0 = -"""### **简介** -> Outline button “边框按钮” -- RaisedButton和FlatButton之间的交叉:一个有边框的按钮,当按下按钮时,其高度增加,背景变得不透明; -- 高程最初为0.0,其背景颜色 为透明。按下按钮时,其背景变为不透明,然后其高程增加到highlightElevation; -"""; - -const String _outlineText1 = -"""### **基本用法** -> 参数的默认的 button 和禁用 button -- 如果onPressed回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色; -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;"""; - - -const String _outlineText2 = -"""### **进阶用法1** -> OutlineButton.icon 的用法,按钮图标和标签的widget创建文本按钮"""; - -const String _outlineText3 = -"""### **进阶用法2** -> 更改参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等; -- Outline buttons 按钮有一个边框,其形状由形状定义 ,其外观由borderSide,disabledBorderColor 和 highlightedBorderColor 定义; -- 如果您想要 ink-splash 效果,但又不想使用 button ,请考虑直接使用 InkWell; -- Outline buttons 的最小尺寸为88.0×36.0,可以用 ButtonTheme 覆盖; -- 通过 shape 属性的设置,改变边框样式和圆角; -- 可以尝试长按按钮,button 突出显示; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/OutlineButton'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType(){ - String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; - if (mounted) { - this.setState(() { - buttonShapeType = _buttonShapeType; - }); - } - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'OutlineButton', - codeUrl: 'elements/Form/Button/OutlineButton/demo.dart', - contentList: allOutlineButtons(context,this), - docUrl: 'https://docs.flutter.io/flutter/material/OutlineButton-class.html', - ); - } -} - - // 所有的 OutlineButton 按钮 -List allOutlineButtons(BuildContext context,_DemoState that){ - final ShapeBorder buttonShape = drawShape(that.buttonShapeType); - return [ - _outlineText0, - _outlineText1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - outlineButton.OutlineButtonDefault(), - SizedBox(width: 20.0), // 间距 - outlineButton.OutlineButtonDefault(false), - ], - ), - _outlineText2, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - //mainAxisSize: MainAxisSize.min, - children: [ - outlineButton.OutlineButtonIconDefault(), - outlineButton.OutlineButtonIconDefault(false), - ], - ), - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - //mainAxisSize: MainAxisSize.min, - children: [ - outlineButton.OutlineButtonIconDefault(true, Icons.android), - outlineButton.OutlineButtonIconDefault(true, Icons.announcement), - ], - ), - _outlineText3, - SizedBox(height: 10.0), - outlineButton.OutlineButtonCustom('主要按钮', Colors.blue, buttonShape), - SizedBox(height: 10.0), - outlineButton.OutlineButtonCustom('成功按钮', Colors.green, buttonShape), - SizedBox(height: 10.0), - outlineButton.OutlineButtonCustom('信息按钮', Colors.grey, buttonShape), - SizedBox(height: 10.0), - outlineButton.OutlineButtonCustom('警告按钮', Colors.orange, buttonShape), - SizedBox(height: 10.0), - outlineButton.OutlineButtonCustom('危险按钮', Colors.pink, buttonShape), - SizedBox(height: 10.0), - outlineButton.OutlineButtonCustom( - '点击切换,随机改变按钮的圆角,边框样式', Colors.blue, buttonShape, - () => that.setButtonShapeType()), - SizedBox(height: 20.0) - ]; -} - -// 绘制边框信息,比如是否有边框,是否是圆角 -ShapeBorder drawShape(String type){ - final Color _color = _randomColor(); - final borderWidth = Random.secure().nextInt(5).toDouble(); - final radiusWidth = Random.secure().nextInt(50).toDouble(); - - switch(type){ - case 'border': - return Border.all( - // 设置边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ); - break; - case 'radius': - return RoundedRectangleBorder( - side: BorderSide( // 保留原来的边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ), - borderRadius: BorderRadius.only( - topRight: Radius.circular(radiusWidth), - topLeft: Radius.circular(radiusWidth), - bottomLeft: Radius.circular(radiusWidth), - bottomRight: Radius.circular(radiusWidth), - ), - ); - break; - default: - return null; - } -} - -// 取随机颜色 -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} - diff --git a/lib/widgets/elements/Form/Button/PopupMenuButton/demo.dart b/lib/widgets/elements/Form/Button/PopupMenuButton/demo.dart deleted file mode 100644 index 839f51c6..00000000 --- a/lib/widgets/elements/Form/Button/PopupMenuButton/demo.dart +++ /dev/null @@ -1,139 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: PopupMenuButton 的示例 - -import 'package:flutter/material.dart'; - -// RaisedButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true -enum WhyFarther { harder, smarter, selfStarter, tradingCharter } - -class PopupMenuButtonDefault extends StatelessWidget { - final bool isDisabled; - final String type; - - const PopupMenuButtonDefault( - [ this.type = 'default1', this.isDisabled = true]) - : assert(isDisabled != null), - super(); - - @override - Widget build(BuildContext context) { - switch (type) { - case 'default1': - return default1(context); - break; - case 'default2': - return default2(context); - break; - case 'default3': - return default3(context); - break; - default: - return default1(context); - } - } - - Widget default1(BuildContext context) { - return PopupMenuButton( - onSelected: (WhyFarther result) { - // setState(() { _selection = result; }); - }, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: WhyFarther.harder, - child: Text('Working a lot harder'), - ), - const PopupMenuItem( - value: WhyFarther.smarter, - child: Text('Being a lot smarter'), - ), - const PopupMenuItem( - value: WhyFarther.selfStarter, - child: Text('Being a self-starter'), - ), - const PopupMenuItem( - value: WhyFarther.tradingCharter, - child: Text('Placed in charge of trading charter'), - ), - ], - ); - } - - Widget default2(BuildContext context) { - return PopupMenuButton( - child: Text('点我试试'), - onSelected: (String value) {}, - itemBuilder: (BuildContext context) => >[ - PopupMenuItem(value: "选项一的内容", child: Text("选项一")), - PopupMenuItem(value: "选项二的内容", child: Text("选项二")) - ]); - } - - Widget default3(BuildContext context) { - return PopupMenuButton( - //child: Text('点我试试'),// child 和 icon 不能同时用 - icon: Icon(Icons.menu), - onSelected: (String value) {}, - itemBuilder: (BuildContext context) => >[ - PopupMenuItem(value: "选项一的内容", child: Text("选项一")), - PopupMenuItem(value: "选项二的内容", child: Text("选项二")) - ]); - } -} - - -class PopupMenuButtonCustom extends StatelessWidget { - final widget; - final parent; - const PopupMenuButtonCustom([this.widget,this.parent]) - : super(); - @override - Widget build(BuildContext context) { - final String selectStr = widget.options['defaultSelect']; - return PopupMenuButton( - //如果提供,则用于此按钮的widget。 - child: RaisedButton.icon( - disabledColor:Colors.red, - icon: Icon(Icons.message, size: 25.0,color:Colors.yellow), - label: Text( - '自定义按钮', style: TextStyle(color: Colors.white), - semanticsLabel: 'FLAT BUTTON'), - onPressed:(){} // 激活状态按钮 - ), - // 打开时放置菜单的z坐标。这可以控制菜单下方阴影的大小。 - elevation:10.0, - // 如果提供,则用于此按钮的图标。 - //icon - // 菜单项的值(如果有),在菜单打开时应突出显示。 - //initialValue:options['defaultSelect'], - initialValue:selectStr, - // 按下按钮时调用以创建要在菜单中显示的项目。 - itemBuilder: (BuildContext context) => >[ - PopupMenuItem(value: "选项一的内容", child: Text("选项一")), - PopupMenuItem(value: "选项二的内容", child: Text("选项二")), - PopupMenuItem(value: "选项三的内容", child: Text("选项三")), - PopupMenuItem(value: "选项四的内容", child: Text("选项四")) - ], - // 应用于弹出菜单按钮的偏移量(x,y)。 - offset:Offset(0.0,50.0), - // 当用户在不选择项目的情况下关闭弹出菜单时调用。 - onCanceled:()=> - print('onCanceled'), - // 当用户从此按钮创建的弹出菜单中选择一个值时调用。 - onSelected:(String value){ - print('onSelected:${parent.setState}'); - parent.setState((){ - widget.options['defaultSelect']= value; - }); - }, - // 默认情况下匹配IconButton的8 dps填充。在某些情况下,特别是在此按钮作为列表项的尾随元素出现的情况下,能够将填充设置为零是有用的。 - padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0), - //描述按下按钮时将发生的操作的文本。 - tooltip:'这是信息' - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Button/PopupMenuButton/index.dart b/lib/widgets/elements/Form/Button/PopupMenuButton/index.dart deleted file mode 100644 index a40e704d..00000000 --- a/lib/widgets/elements/Form/Button/PopupMenuButton/index.dart +++ /dev/null @@ -1,82 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/24 -/// Time: 下午5:25 -/// email: zhu.yan@alibaba-inc.com -/// target: PopupMenusButton 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/PopupMenuButton-class.html - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as popupMenuButton; - -const String _titleText0 = """ -### **简介** -> 按下时显示菜单 -- 当菜单因为选择了项目而被解除时调用onSelected。传递给onSelected的值是所选菜单项的值; -- 可以提供 `child` 或 `icon` 中的一个,但不是能同时设置两者。如果提供了 `icon` ,则 `PopupMenuButton` 的行为类似于 `IconButton`; -- 如果两者都为null,则创建一个标准 overflow icon(取决于平台); -"""; -const String _titleText1 = """ -### **基本用法** -> 此示例显示一个包含四个项目的菜单 -- 在枚举值之间进行选择,并_selection根据选择设置字段; -"""; - -const String _titleText2 = """ -### **进阶用法** -> 此示例尝试调整所有属性,展示出效果 -- 默认选择第二个; -- 再次打开,`PopupMenuItem` 保留上次的选择结果; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/PopupMenuButton'; - final Map options = {'defaultSelect': '选项二的内容'}; - final _DemoState self = _DemoState(); - - @override - _DemoState createState() => self; -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType(){ - String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; - this.setState((){ - buttonShapeType = _buttonShapeType; - }); - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'PopupMenuButton', - codeUrl: 'elements/Form/Button/RaisedButton/demo.dart', - contentList: allPopupMenuButton(widget,this), - docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuButton-class.html', - ); - } -} - -List allPopupMenuButton(Demo widget, State parent) { - return [ - _titleText0, - SizedBox(height: 20.0), - _titleText1, - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - popupMenuButton.PopupMenuButtonDefault('default1'), - popupMenuButton.PopupMenuButtonDefault('default2'), - popupMenuButton.PopupMenuButtonDefault('default3'), - ], - ), - SizedBox(height: 20.0), - _titleText2, - SizedBox(height: 20.0), - popupMenuButton.PopupMenuButtonCustom(widget, parent), - SizedBox(height: 40.0) - ]; -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Button/RaisedButton/demo.dart b/lib/widgets/elements/Form/Button/RaisedButton/demo.dart deleted file mode 100644 index b386be84..00000000 --- a/lib/widgets/elements/Form/Button/RaisedButton/demo.dart +++ /dev/null @@ -1,124 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: RaisedButton 的示例 - -import 'dart:math'; -import 'package:flutter/material.dart'; - -// RaisedButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true -class RaisedButtonDefault extends StatelessWidget { - final bool isDisabled; - - const RaisedButtonDefault([ this.isDisabled = true]) - : assert(isDisabled != null), - super(); - - @override - Widget build(BuildContext context) { - return RaisedButton( - // 文本内容 - child: const Text('默认按钮', semanticsLabel: 'FLAT BUTTON 1'), - onPressed: isDisabled ? () {} : null); - } -} - -// RaisedButton.icon 默认按钮的实例 -// Create a text button from a pair of widgets that serve as the button's icon and label -// isDisabled:是否是禁用 -class RaisedButtonIconDefault extends StatelessWidget { - final bool isDisabled; - final IconData icon; - - const RaisedButtonIconDefault( - [ this.isDisabled = true, this.icon = Icons.add_circle]) - : super(); - - Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); - } - - @override - Widget build(BuildContext context) { - return RaisedButton.icon( - // 文本内容 - icon: Icon(icon, size: 25.0, color: _randomColor()), - label: Text('默认按钮', semanticsLabel: 'FLAT BUTTON 2'), - onPressed: isDisabled - ? () { - //_showMessage('点击了 FLAT BUTTON ', context); - } - : null); - } -} - - -// RaisedButton 自定义的实例 -class RaisedButtonCustom extends StatelessWidget { - final String txt; - final Color color; - final ShapeBorder shape; - final VoidCallback onPressed; - - const RaisedButtonCustom( - [ this.txt = '自定义按钮', - this.color = Colors.blueAccent, - this.shape, - this.onPressed]) - : super(); - - @override - Widget build(BuildContext context) { - final _onPressed = onPressed; - return RaisedButton( - // 文本内容 - child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'), - // 按钮颜色 - color: color, - // 按钮亮度 - colorBrightness: Brightness.dark, - // 高亮时的背景色 - //highlightColor: Colors.yellow, - // 失效时的背景色 - disabledColor: Colors.grey, - // 该按钮上的文字颜色,但是前提是不设置字体自身的颜色时才会起作用 - textColor: Colors.white, - // 按钮失效时的文字颜色,同样的不能使用文本自己的样式或者颜色时才会起作用 - disabledTextColor: Colors.grey, - // 按钮主题,主要用于与ButtonTheme和ButtonThemeData一起使用来定义按钮的基色,RaisedButton,RaisedButton,OutlineButton,它们是基于环境ButtonTheme配置的 - //ButtonTextTheme.accent,使用模版颜色的;ButtonTextTheme.normal,按钮文本是黑色或白色取决于。ThemeData.brightness;ButtonTextTheme.primary,按钮文本基于。ThemeData.primaryColor. - textTheme: ButtonTextTheme.normal, - // 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚 - splashColor: Colors.deepPurple, - // 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias - clipBehavior: Clip.antiAlias, - padding: - EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), - shape: (shape is ShapeBorder) - ? shape - : Border.all( - // 设置边框样式 - color: Colors.grey, - width: 2.0, - style: BorderStyle.solid, - ), - // RaisedButton 的点击事件 - onPressed: () { - // Perform some action - if (_onPressed is VoidCallback) { - _onPressed(); - } - }, - // 改变高亮颜色回掉函数,一个按钮会触发两次,按下后改变时触发一次,松手后恢复原始颜色触发一次 - // 参数 bool,按下后true,恢复false - onHighlightChanged: (isClick) { - print(isClick); - }); - } -} diff --git a/lib/widgets/elements/Form/Button/RaisedButton/index.dart b/lib/widgets/elements/Form/Button/RaisedButton/index.dart deleted file mode 100644 index 87caba25..00000000 --- a/lib/widgets/elements/Form/Button/RaisedButton/index.dart +++ /dev/null @@ -1,164 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: RaisedButton 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/RaisedButton-class.html - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as raisedButton; - - -const String _raisedText0 = -"""### **简介** -> Raised button “凸起按钮” -- Raised button 基于 a Material widget 窗口widget,按下 button 时,Material.elevation 会增加; -- 使用 Raised button 可将尺寸添加到大多数平面布局中; -- 例如在复杂的内容列表中,或在宽阔的空间中。避免在已经提出的内容(例如对话框或卡片)上使用 Raised button; -"""; - -const String _raisedText1 = -"""### **基本用法** -> 参数的默认的 button 和禁用 button; -- 如果onPressed回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色; -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;"""; - - -const String _raisedText2 = -"""### **进阶用法1** -> RaisedButton.icon 的用方法,按钮图标和标签的widget创建文本按钮;"""; - -const String _raisedText3 = -"""### **进阶用法2** -> 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等 -- 如果您想要 ink-splash 的墨水效果,但又不想使用按钮,请考虑直接使用InkWell; -- Raised buttons 的最小尺寸为88.0×36.0,可以用 ButtonTheme 覆盖; -- 通过 shape 属性的设置,改变边框样式和圆角; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/RaisedButton'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType(){ - String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; - if(mounted) { - this.setState(() { - buttonShapeType = _buttonShapeType; - }); - } - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'RaisedButton', - codeUrl: 'elements/Form/Button/RaisedButton/demo.dart', - contentList: allRaisedButtons(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/RaisedButton-class.html', - ); - } -} - - // 所有的 RaisedButton 按钮 -List allRaisedButtons(BuildContext context,_DemoState that){ - final ShapeBorder buttonShape = drawShape(that.buttonShapeType); - return [ - _raisedText0, - _raisedText1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - raisedButton.RaisedButtonDefault(), - SizedBox(width: 20.0), // 间距 - raisedButton.RaisedButtonDefault(false), - ], - ), - _raisedText2, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - //mainAxisSize: MainAxisSize.min, - children: [ - raisedButton.RaisedButtonIconDefault(), - raisedButton.RaisedButtonIconDefault(false), - ], - ), - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - //mainAxisSize: MainAxisSize.min, - children: [ - raisedButton.RaisedButtonIconDefault(true, Icons.android), - raisedButton.RaisedButtonIconDefault(true, Icons.announcement), - ], - ), - _raisedText3, - SizedBox(height: 10.0), - raisedButton.RaisedButtonCustom('主要按钮', Colors.blue, buttonShape), - SizedBox(height: 10.0), - raisedButton.RaisedButtonCustom('成功按钮', Colors.green, buttonShape), - SizedBox(height: 10.0), - raisedButton.RaisedButtonCustom('信息按钮', Colors.grey, buttonShape), - SizedBox(height: 10.0), - raisedButton.RaisedButtonCustom('警告按钮', Colors.orange, buttonShape), - SizedBox(height: 10.0), - raisedButton.RaisedButtonCustom('危险按钮', Colors.pink, buttonShape), - SizedBox(height: 10.0), - raisedButton.RaisedButtonCustom('点击切换,按钮的圆角', Colors.blue, buttonShape, - () => that.setButtonShapeType()), - SizedBox(height: 20.0) - ]; -} - -// 绘制边框信息,比如是否有边框,是否是圆角 -ShapeBorder drawShape(String type){ - final Color _color = _randomColor(); - final borderWidth = Random.secure().nextInt(5).toDouble(); - final radiusWidth = Random.secure().nextInt(50).toDouble(); - - switch(type){ - case 'border': - return Border.all( - // 设置边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ); - break; - case 'radius': - return RoundedRectangleBorder( - side: BorderSide( // 保留原来的边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ), - borderRadius: BorderRadius.only( - topRight: Radius.circular(radiusWidth), - topLeft: Radius.circular(radiusWidth), - bottomLeft: Radius.circular(radiusWidth), - bottomRight: Radius.circular(radiusWidth), - ), - ); - break; - default: - return null; - } -} - -// 取随机颜色 -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} - diff --git a/lib/widgets/elements/Form/Button/RawMaterialButton/demo.dart b/lib/widgets/elements/Form/Button/RawMaterialButton/demo.dart deleted file mode 100644 index a763504c..00000000 --- a/lib/widgets/elements/Form/Button/RawMaterialButton/demo.dart +++ /dev/null @@ -1,82 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: RawMaterialButton 的示例 - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -// RawMaterialButton 默认按钮的实例 -// isDisabled:是否是禁用,isDisabled 默认为true - -class RawMaterialButtonDefault extends StatelessWidget { - final bool isDisabled; - - const RawMaterialButtonDefault([ this.isDisabled = true]) - : assert(isDisabled != null), - super(); - - @override - Widget build(BuildContext context) { - return RawMaterialButton( - // 文本内容 - child: const Text('默认按钮', semanticsLabel: 'FLAT BUTTON 1'), - onPressed: isDisabled ? () {} : null); - } -} - -// RawMaterialButton 自定义的实例 -class RawMaterialButtonCustom extends StatelessWidget { - final String txt; - final Color color; - final ShapeBorder shape; - final VoidCallback onPressed; - - const RawMaterialButtonCustom( - [ this.txt = '自定义按钮', - this.color = Colors.blueAccent, - this.shape, - this.onPressed]) - : super(); - - @override - Widget build(BuildContext context) { - final _onPressed = onPressed; - final _fontSize = (Random.secure().nextInt(10)+15).toDouble(); - return RawMaterialButton( - // 使用Material.textStyle为按钮的子项定义默认文本样式。 - textStyle:TextStyle(color: _randomColor(),fontSize: _fontSize), - // 定义形状和高程的动画更改的持续时间 - animationDuration:Duration(seconds: 1), - // 文本内容 - child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'), - // 高亮时的背景色 - highlightColor: Colors.yellow, - // 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚 - splashColor: _randomColor(), - // 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias - clipBehavior: Clip.antiAlias, - padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0), - //高亮时候的阴影 - highlightElevation: 10.0, - // 按钮材质的形状 - // shape: shape, - // RawMaterialButton 的点击事件 - onPressed: () { - // Perform some action - if (_onPressed is VoidCallback) { - _onPressed(); - } - }); - } -} - -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} diff --git a/lib/widgets/elements/Form/Button/RawMaterialButton/index.dart b/lib/widgets/elements/Form/Button/RawMaterialButton/index.dart deleted file mode 100644 index b17bf1fa..00000000 --- a/lib/widgets/elements/Form/Button/RawMaterialButton/index.dart +++ /dev/null @@ -1,140 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: RawMaterialButton 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/RawMaterialButton-class.html - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as rawMaterialButton; - -const String _rawMaterialText0 = -"""### **简介** -> RawMaterial button “RawMaterial 按钮” -- 基于 Semantics,Material 和InkWell 小部件创建按钮; -- 此类不使用当前 Theme 或 ButtonTheme 来计算未指定参数的默认值。它旨在用于自定义 Material button,可选择包含主题或特定于应用程序源的默认值; -"""; - -const String _rawMaterialText1 = -"""### **基本用法** -> 参数的默认的 button 和禁用 button -"""; - -const String _rawMaterialText2 = -"""### **进阶用法** -> 更改项参数的自定义 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Button/RawMaterialButton'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType(){ - //String _buttonShapeType = (buttonShapeType == 'border') ? 'radius' : 'border'; - if( mounted ) { - this.setState(() { - //buttonShapeType = _buttonShapeType; - }); - } - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'RawMaterialButton', - codeUrl: 'elements/Form/Button/RawMaterialButton/demo.dart', - contentList: allRawMaterialButtons(context,this), - docUrl: 'https://docs.flutter.io/flutter/material/RawMaterialButton-class.html', - ); - } -} - - -// 所有的 RawMaterialButton 按钮 -List allRawMaterialButtons(BuildContext context,_DemoState that){ - final ShapeBorder buttonShape = drawShape(that.buttonShapeType); - return [ - _rawMaterialText0, - _rawMaterialText1, - ButtonBar( - alignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - rawMaterialButton.RawMaterialButtonDefault(), - SizedBox(width: 20.0), // 间距 - rawMaterialButton.RawMaterialButtonDefault(false), - ], - ), - _rawMaterialText2, - SizedBox(height: 10.0), - rawMaterialButton.RawMaterialButtonCustom('主要按钮', Colors.blue, buttonShape), - SizedBox(height: 10.0), - rawMaterialButton.RawMaterialButtonCustom( - '成功按钮', Colors.green, buttonShape), - SizedBox(height: 10.0), - rawMaterialButton.RawMaterialButtonCustom('信息按钮', Colors.grey, buttonShape), - SizedBox(height: 10.0), - rawMaterialButton.RawMaterialButtonCustom( - '警告按钮', Colors.orange, buttonShape), - SizedBox(height: 10.0), - rawMaterialButton.RawMaterialButtonCustom('危险按钮', Colors.pink, buttonShape), - SizedBox(height: 10.0), - rawMaterialButton.RawMaterialButtonCustom( - '点击切换,观察字体变化', Colors.blue, buttonShape, - () => that.setButtonShapeType()), - SizedBox(height: 20.0) - ]; -} - -// 绘制边框信息,比如是否有边框,是否是圆角 -ShapeBorder drawShape(String type){ - final Color _color = _randomColor(); - final borderWidth = Random.secure().nextInt(5).toDouble(); - final radiusWidth = Random.secure().nextInt(50).toDouble(); - - switch(type){ - case 'border': - return Border.all( - // 设置边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ); - break; - case 'radius': - return RoundedRectangleBorder( - side: BorderSide( // 保留原来的边框样式 - width: borderWidth, - color: _color, - style: BorderStyle.solid, - ), - borderRadius: BorderRadius.only( - topRight: Radius.circular(radiusWidth), - topLeft: Radius.circular(radiusWidth), - bottomLeft: Radius.circular(radiusWidth), - bottomRight: Radius.circular(radiusWidth), - ), - ); - break; - default: - return null; - } -} - -// 取随机颜色 -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} - diff --git a/lib/widgets/elements/Form/Button/index.dart b/lib/widgets/elements/Form/Button/index.dart deleted file mode 100644 index b5cda7e7..00000000 --- a/lib/widgets/elements/Form/Button/index.dart +++ /dev/null @@ -1,55 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import 'FlatButton/index.dart' as FlatButton; -import 'RaisedButton/index.dart' as RaisedButton; -import 'OutlineButton/index.dart' as OutlineButton; -import 'IconButton/index.dart' as IconButton; -import 'PopupMenuButton/index.dart' as PopupMenuButton; -import 'FloatingActionButton/index.dart' as FloatingActionButton; -import 'RawMaterialButton/index.dart' as RawMaterialButton; -import 'DropdownButton/index.dart' as DropdownButton; - - -List widgetPoints = [ - WidgetPoint( - name: 'FlatButton', - routerName: FlatButton.Demo.routeName, - buildRouter: (BuildContext context) => FlatButton.Demo(), - ), - WidgetPoint( - name: 'RaisedButton', - routerName: RaisedButton.Demo.routeName, - buildRouter: (BuildContext context) => RaisedButton.Demo(), - ), - WidgetPoint( - name: 'OutlineButton', - routerName: OutlineButton.Demo.routeName, - buildRouter: (BuildContext context) => OutlineButton.Demo(), - ), - WidgetPoint( - name: 'IconButton', - routerName: IconButton.Demo.routeName, - buildRouter: (BuildContext context) => IconButton.Demo(), - ), - WidgetPoint( - name: 'PopupMenuButton', - routerName: PopupMenuButton.Demo.routeName, - buildRouter: (BuildContext context) => PopupMenuButton.Demo(), - ), - WidgetPoint( - name: 'FloatingActionButton', - routerName: FloatingActionButton.Demo.routeName, - buildRouter: (BuildContext context) => FloatingActionButton.Demo(), - ), - WidgetPoint( - name: 'RawMaterialButton', - routerName: RawMaterialButton.Demo.routeName, - buildRouter: (BuildContext context) => RawMaterialButton.Demo(), - ), - WidgetPoint( - name: 'DropdownButton', - routerName: DropdownButton.Demo.routeName, - buildRouter: (BuildContext context) => DropdownButton.Demo(), - ) -]; \ No newline at end of file diff --git a/lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart b/lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart deleted file mode 100644 index 7cd4037f..00000000 --- a/lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart +++ /dev/null @@ -1,74 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/11/22 -/// Time: 上午12:03 -/// email: zhu.yan@alibaba-inc.com -/// target: Checkbox 的示例 - -import 'dart:math'; - -import 'package:flutter/material.dart'; - -/// Checkbox 默认的实例 -/// index 当前checkbox 的索引值 -class CheckboxDefault extends StatefulWidget{ - final int index; - final parent; - const CheckboxDefault([this.parent, this.index = -1]) : super(); - @override - State createState() =>_CheckboxDefault(); -} -class _CheckboxDefault extends State { - bool isChecked=false; - Color color = _randomColor(); // 注意和下面的 StatelessWidget 里的 _randomColor 区别 - @override - Widget build(BuildContext context) { - return Checkbox( - activeColor: color, - tristate:false, - value: isChecked, - onChanged: (bool bol) { - if(mounted) { - setState(() { - isChecked = bol; - }); - } - } - ); - } -} - -/// Checkbox 默认的实例 -/// index 当前checkbox 的索引值 -class CheckboxSelect extends StatelessWidget { - final int index; - final widget; - final parent; - - const CheckboxSelect([this.widget,this.parent, this.index = -1]) - : super(); - - @override - Widget build(BuildContext context) { - Color color = _randomColor(); - return Checkbox( - activeColor: color, - tristate:false, - value: parent.selectValue == this.index, - onChanged: (bool bol) { - if(parent.mounted) { - parent.setState(() { - parent.selectValue = bol ? this.index : -1; - }); - } - } - ); - } -} - -Color _randomColor() { - var red = Random.secure().nextInt(255); - var greed = Random.secure().nextInt(255); - var blue = Random.secure().nextInt(255); - return Color.fromARGB(255, red, greed, blue); -} diff --git a/lib/widgets/elements/Form/CheckBox/Checkbox/index.dart b/lib/widgets/elements/Form/CheckBox/Checkbox/index.dart deleted file mode 100644 index 2a65383f..00000000 --- a/lib/widgets/elements/Form/CheckBox/Checkbox/index.dart +++ /dev/null @@ -1,86 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: Checkbox 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/Checkbox-class.html - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as checkbox; - -const String _checkboxText0 = -"""### **简介** -> checkbox “复选框” -- 复选框本身不保持任何状态; -- 当复选框的状态发生变化时,窗口小部件会调用onChanged回调; -- 大多数使用复选框的小部件将侦听onChanged回调,并使用新值重建复选框以更新复选框的可视外观;"""; - - -const String _checkboxText1 = -"""### **基本用法** -> 下面示例展示多个颜色(随机)样式的 `checkbox` -- 一个多选的 `checkbox`; -"""; - -const String _checkboxText2 = -"""### **进阶用法** -> 下面示例展示多个颜色(随机)样式的 `checkbox` -- 一个单选 `checkbox` 操作; -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/CheckBox/Checkbox'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - int selectValue = -1; - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Checkbox', - codeUrl: 'elements/Form/CheckBox/Checkbox/demo.dart', - contentList: allCheckboxs(context,this), - docUrl: 'https://docs.flutter.io/flutter/material/Checkbox-class.html', - ); - } -} - - // 所有的 Checkbox 按钮 -List allCheckboxs(BuildContext context,_DemoState that){ - return [ - _checkboxText0, - _checkboxText1, - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - checkbox.CheckboxDefault(that, 0), - checkbox.CheckboxDefault(that, 1), - checkbox.CheckboxDefault(that, 2), - checkbox.CheckboxDefault(that, 3), - checkbox.CheckboxDefault(that, 4), - ], - ), - _checkboxText2, - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - mainAxisSize: MainAxisSize.max, - children: [ - checkbox.CheckboxSelect(context.widget, that, 0), - checkbox.CheckboxSelect(context.widget, that, 1), - checkbox.CheckboxSelect(context.widget, that, 2), - checkbox.CheckboxSelect(context.widget, that, 3), - checkbox.CheckboxSelect(context.widget, that, 4), - ], - ), - SizedBox(width: 20.0), // 间距 - ]; -} - - diff --git a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart deleted file mode 100644 index a302b59c..00000000 --- a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart +++ /dev/null @@ -1,125 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/23 -/// Time: 下午6:08 -/// email: zhu.yan@alibaba-inc.com -/// target: CheckboxListTile 的示例 - -import 'package:flutter/material.dart'; - -// Checkbox 默认的实例 -// index 当前checkbox 的索引值 -class CheckboxListTileStateDefault extends StatefulWidget { - const CheckboxListTileStateDefault() : super(); - - @override - State createState() => _CheckboxListTileStateDefault(); -} - -// CheckboxListTile 默认的实例,有状态 -class _CheckboxListTileStateDefault extends State { - bool _value = false; - void _valueChanged(bool value) { - for (var i = 0; i < isChecks.length; i++) { - isChecks[i] = value; - } - if(mounted) { - setState(() => _value = value); - } - } - bool isCheck=false; - List isChecks=[false,false,false,false]; - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Center( - child: CheckboxListTile( - value: _value, - selected:true,// 默认文字是否高亮 - onChanged: _valueChanged, - dense: false,// 文字是否对齐 图标高度 - isThreeLine: false,// 文字是否三行显示 - title: Text('全部'), // 主标题 - controlAffinity: ListTileControlAffinity.trailing, // 将控件放在何处相对于文本,leading 按钮显示在文字后面,platform,trailing 按钮显示在文字前面 - subtitle: Text('勾选下列全部结果'), // 标题下方显示的副标题 - secondary: Icon(Icons.archive), // 从复选框显示在磁贴另一侧的小组件 - activeColor: Colors.red, // 选中此复选框时要使用的颜色 - ), - ), - Center( - child: CheckboxListTile( - value: isChecks[0], - title: Text('选项1'), - activeColor: _value ? Colors.red : Colors.green, - controlAffinity: ListTileControlAffinity.platform, - onChanged: (bool){ - if(mounted) { - setState(() { - isChecks[0] = bool; - }); - } - }), - ), - Center( - child: CheckboxListTile( - value: isChecks[1], - title: Text('选项2'), - activeColor: _value ? Colors.red : Colors.green, - controlAffinity: ListTileControlAffinity.platform, - onChanged: (bool){ - setState(() { - isChecks[1]=bool; - }); - }), - ), - Center( - child: CheckboxListTile( - value: isChecks[2], - title: Text('选项3'), - activeColor: _value ? Colors.red : Colors.green, - controlAffinity: ListTileControlAffinity.platform, - onChanged: (bool){ - setState(() { - isChecks[2]=bool; - }); - }), - ), - Center( - child: CheckboxListTile( - value: isChecks[3], - title: Text('选项4'), - activeColor: _value ? Colors.red : Colors.green, - controlAffinity: ListTileControlAffinity.platform, - onChanged: (bool){ - setState(() { - isChecks[3]=bool; - }); - }), - ) - ], - ); - } -} - -// CheckboxListTile 默认的实例,无状态 -class CheckboxListTileDefault extends StatelessWidget { - final widget; - final parant; - const CheckboxListTileDefault ([this.widget,this.parant]) - : super(); - - @override - Widget build(BuildContext context) { - return CheckboxListTile( - title: Text('一个简单的例子'), - activeColor: Colors.red, - value: widget.valBool['val'], - onChanged: (bool value) { - parant.setState(()=> widget.valBool['val'] = value); - }, - secondary: const Icon(Icons.hourglass_empty), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart deleted file mode 100644 index 47605144..00000000 --- a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart +++ /dev/null @@ -1,68 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2018/12/23 -/// Time: 下午6:07 -/// email: zhu.yan@alibaba-inc.com -/// target: CheckboxListTile 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as CheckboxListTileDemo; - -const String _CheckboxListTileText0 = -"""### **简介** -> CheckboxListTile “下拉复选框” -- 带有复选框的 ListTile,带有标签的 ListTile; -- 整个列表图块是交互式的:点击图块中的任意位置可切换复选框; -"""; - - -const String _CheckboxListTileText1 = -"""### **基本用法** -> CheckboxListTile 的属性特征 -- 与 Checkbox 类似的命名属性,比如:onChanged 和 activeColor; -- 和 ListTile 类似的命名属性,比如:title, subtitle, isThreeLine,dense; -- selected 属性和 ListTile.selected 属性类似,但使用的颜色是 activeColor 属性,默认为当前 Theme 的颜色; -- onChanged 回调函数为 null,显示禁用; -"""; - -const String _CheckboxListTileText2 = -"""### **进阶用法** -> CheckboxListTile 单选和全选的示例 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Checkbox/CheckboxListTile'; - final Map valBool = {'val':true}; - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CheckboxListTile', - codeUrl: 'elements/Form/CheckBox/CheckboxListTile/demo.dart', - contentList: allCheckboxs(context, this), - docUrl: 'https://docs.flutter.io/flutter/material/CheckboxListTile-class.html', - ); - } -} - - // 所有的 CheckboxListTile widget - // context: 运行上下文 - // that: 指向有状态的 StatefulWidget -List allCheckboxs(BuildContext context, _DemoState that) { - return [ - _CheckboxListTileText0, - _CheckboxListTileText1, - CheckboxListTileDemo.CheckboxListTileDefault(context.widget, that), - // CheckboxListTile 不能放在 Row 里... - _CheckboxListTileText2, - CheckboxListTileDemo.CheckboxListTileStateDefault(), - SizedBox(height: 20.0), - ]; -} - diff --git a/lib/widgets/elements/Form/CheckBox/index.dart b/lib/widgets/elements/Form/CheckBox/index.dart deleted file mode 100644 index 6c26b47d..00000000 --- a/lib/widgets/elements/Form/CheckBox/index.dart +++ /dev/null @@ -1,19 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import 'Checkbox/index.dart' as Checkbox; -import 'CheckboxListTile/index.dart' as CheckboxListTile; - - -List widgetPoints = [ - WidgetPoint( - name: 'Checkbox', - routerName: Checkbox.Demo.routeName, - buildRouter: (BuildContext context) => Checkbox.Demo(), - ), - WidgetPoint( - name: 'CheckboxListTile', - routerName: CheckboxListTile.Demo.routeName, - buildRouter: (BuildContext context) => CheckboxListTile.Demo(), - ) -]; \ No newline at end of file diff --git a/lib/widgets/elements/Form/Input/TextField/index.dart b/lib/widgets/elements/Form/Input/TextField/index.dart deleted file mode 100644 index fe5fe77b..00000000 --- a/lib/widgets/elements/Form/Input/TextField/index.dart +++ /dev/null @@ -1,68 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: TextField 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/TextField-class.html - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './text_field_demo.dart'; - -const String _textFieldText0 = """### **简介** -> TextField 最常用的文本输入widget -- 该 widget 作为文本输入框,可以接收用户以屏幕按键或者键盘输入的文本信息,该信息可以用于消息传递,搜索体验等 -- 用户修改文本信息时,Onchange会被调用,获取到最新的文本信息 -- 已知用户输入的字段文本输入完毕时(例如,通过按软键盘上的按钮确认输入完毕),该widget会调用onSubmitted回调 -"""; - -const String _textFieldText1 = """### **基本用法** -> 参数控制默认的按钮和禁用按钮 -- 默认情况下,TextField 下方有一个下划线进行修饰。 -- 您可以使用decoration属性来控制该widget样式,例如通过添加标签或图标。如果将decoration属性设置为空,则将完全删除装饰,包括装饰引入的额外填充,以节省标签的空间。 -- 如果decoration属性是非null(这是默认的),文本字段需要它的父类是一个Material widget。当文本字段被点击时,会出发被点击的效果。 -- 若要将TextField和其他FormFild集成到Form中,请考虑使用TeTFrimeField。"""; - -const String _textFieldText2 = """### **进阶用法** -> 实现稍微复杂点的效果,TextField 的输入以数字优先,为输入框做一些其他的效果,如提示文字,icon、标签文字等 -- 增加一个keyboardType属性,把keyboardType设置为 TextInputType.number ,让TextField获得焦点的时候弹出的键盘就变成了数字优先。 -- 新增decoration属性,设置相关属性,可以发现当我们的TextField获得焦点时,图标会自动变色,提示文字会自动上移。 -- onChanged是输入框内每次文字变更触发的回调方法,onSubmitted是用户提交而触发的回调方法。 -- 每当用户改变输入框内的文字,都会在控制台输出现在的字符串.与onSubmitted用法相同。 -"""; - -class Demo extends StatefulWidget { - static const String routeName = 'elements/Form/Input/TextField'; - - @override - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - String buttonShapeType = 'border'; // 边框类型 - void setButtonShapeType() { - String _buttonShapeType = - (buttonShapeType == 'border') ? 'radius' : 'border'; - this.setState(() { - buttonShapeType = _buttonShapeType; - }); - } - - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'TextField', - codeUrl: 'elements/Form/Input/TextField/text_field_demo.dart', - contentList: [ - _textFieldText0, - _textFieldText1, - DefaultTextField(), - _textFieldText2, - CustomTextField() - ], - docUrl: 'https://docs.flutter.io/flutter/material/TextField-class.html', - ); - } -} diff --git a/lib/widgets/elements/Form/Input/TextField/text_field_demo.dart b/lib/widgets/elements/Form/Input/TextField/text_field_demo.dart deleted file mode 100644 index f028bfe0..00000000 --- a/lib/widgets/elements/Form/Input/TextField/text_field_demo.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:flutter/material.dart'; - -// 基本示例 -class DefaultTextField extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.all(30.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, //文本是起始端对齐 - children: [ - Text('下面是基本输入框:', - style: TextStyle(fontSize: 15.5, height: 1.2, color: Colors.blue), - textAlign: TextAlign.left), - TextField() - ], - ), - ); - } -} - -/// 稍微复杂些的 TextField -class CustomTextField extends StatelessWidget { - void _textFieldChanged(String str) { - print(str); - } - - @override - Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.all(30.0), - child: TextField( - keyboardType: TextInputType.number, - decoration: InputDecoration( - contentPadding: EdgeInsets.all(10.0), - icon: Icon(Icons.text_fields), - labelText: '请输入你的姓名)', - helperText: '请输入你的真实姓名', - ), - onChanged: _textFieldChanged, - autofocus: false, - )); - } -} diff --git a/lib/widgets/elements/Form/Input/index.dart b/lib/widgets/elements/Form/Input/index.dart deleted file mode 100644 index b03845c4..00000000 --- a/lib/widgets/elements/Form/Input/index.dart +++ /dev/null @@ -1,20 +0,0 @@ -/// Created with FlutterGo. -/// User: 一晟 -/// Date: 2018/11/14 -/// Time: 下午4:31 -/// email: zhu.yan@alibaba-inc.com -/// target: Input 的示例 -/// 对应文档地址:https://docs.flutter.io/flutter/material/RaisedButton-class.html - -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import './TextField/index.dart' as TextField; - -List widgetPoints = [ - WidgetPoint( - name: 'TextField', - routerName: TextField.Demo.routeName, - buildRouter: (BuildContext context) => TextField.Demo(), - ), -]; diff --git a/lib/widgets/elements/Form/Radio/Radio/demo.dart b/lib/widgets/elements/Form/Radio/Radio/demo.dart deleted file mode 100644 index 2e5df8df..00000000 --- a/lib/widgets/elements/Form/Radio/Radio/demo.dart +++ /dev/null @@ -1,55 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 22/11/2018 - /// Time: 19:37 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; - -class RadioADemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - int groupValue = 1; - onChange(val) { - this.setState(() { - groupValue = val; - }); - } - Widget build(BuildContext context) { - return ( - Container( - alignment: Alignment.centerLeft, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Radio( - value: 1, - groupValue: groupValue,//当value和groupValue一致的时候则选中 - onChanged: (T){ - onChange(T); - } - ), - Radio( - value: 2, - groupValue: groupValue, - onChanged: (T){ - onChange(T); - } - ), - Radio( - value: 3, - groupValue: groupValue, - onChanged: (T){ - onChange(T); - } - ) - ], - ), - ) - ); - } -} diff --git a/lib/widgets/elements/Form/Radio/Radio/index.dart b/lib/widgets/elements/Form/Radio/Radio/index.dart deleted file mode 100644 index 8ec9dd9f..00000000 --- a/lib/widgets/elements/Form/Radio/Radio/index.dart +++ /dev/null @@ -1,46 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 22/11/2018 - /// Time: 19:17 - /// email: sanfan.hx@alibaba-inc.com - /// target: Radio相关 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const content1 = """ -### **简介** -> material design 风格的单选按钮 - -Radio widget 代表表单中的单选按钮, 当groupValue = value时代表组件被选中。 - -在表单中, 单选按钮是表示一组互斥选项按钮中的一个。当一个按钮被选中,之前选中的按钮就变为非选中的。 - -### **基本用法** -以下是Radio的属性主产明 -- activeColor → Color - 激活时的颜色。 -- groupValue → T - 选择组的值。 -- onChanged → ValueChanged - 改变时触发。 -- value → T - 单选的值。 -"""; -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Radio/index'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content1, - new RadioADemo(), - ], - title: 'Radio', - docUrl: 'https://docs.flutter.io/flutter/material/Radio-class.html', - codeUrl: 'elements/Form/Radio/Radio/index.dart', - ); - } -} diff --git a/lib/widgets/elements/Form/Radio/RadioListTile/demo.dart b/lib/widgets/elements/Form/Radio/RadioListTile/demo.dart deleted file mode 100644 index 7bd16122..00000000 --- a/lib/widgets/elements/Form/Radio/RadioListTile/demo.dart +++ /dev/null @@ -1,45 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 20/12/2018 - /// Time: 14:32 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; - - -class DemoA extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - String value = ''; - - onChange(v) { - this.setState(() { - value = v; - }); - } - Widget build(BuildContext context) { - - return Column( - children: [ - RadioListTile( - title: const Text('A'), - value: "A", - groupValue: this.value, - isThreeLine: false, - subtitle: const Text("subtitleA"), - onChanged:onChange - ), - RadioListTile( - title: const Text('B'), - value: "B", - subtitle: const Text("subtitleB"), - groupValue: this.value, - onChanged: onChange - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Form/Radio/RadioListTile/index.dart b/lib/widgets/elements/Form/Radio/RadioListTile/index.dart deleted file mode 100644 index 603451c7..00000000 --- a/lib/widgets/elements/Form/Radio/RadioListTile/index.dart +++ /dev/null @@ -1,43 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 22/11/2018 - /// Time: 19:17 - /// email: sanfan.hx@alibaba-inc.com - /// target: Radio相关 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const content1 = """ -### **简介** -> material design 风格的单选按钮附加文字label - -点击文字的同时 , 将会触发Radio的点击效果. - -功能同 @Radio - -### **基本用法** -Radio是单选框,和checkbox一样本身不包含状态,当groupValue = value时代表选中状态 -"""; -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/RadioListTile/index'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content1, - new DemoA() - - ], - title: 'RadioListTile', - docUrl: 'https://docs.flutter.io/flutter/material/RadioListTile-class.html', - codeUrl: 'elements/Form/Radio/RadioListTile/demo.dart', - ); - } -} diff --git a/lib/widgets/elements/Form/Radio/index.dart b/lib/widgets/elements/Form/Radio/index.dart deleted file mode 100644 index f987d9ed..00000000 --- a/lib/widgets/elements/Form/Radio/index.dart +++ /dev/null @@ -1,20 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import 'Radio/index.dart' as Radio; -import 'RadioListTile/index.dart' as RadioTile; - - -List widgetPoints = [ - WidgetPoint( - name: 'Radio', - routerName: Radio.Demo.routeName, - buildRouter: (BuildContext context) => Radio.Demo(), - ), - WidgetPoint( - name: 'RadioListTile', - routerName: RadioTile.Demo.routeName, - buildRouter: (BuildContext context) => RadioTile.Demo(), - ), - -]; \ No newline at end of file diff --git a/lib/widgets/elements/Form/Slider/Slider/demo.dart b/lib/widgets/elements/Form/Slider/Slider/demo.dart deleted file mode 100644 index 9e596828..00000000 --- a/lib/widgets/elements/Form/Slider/Slider/demo.dart +++ /dev/null @@ -1,96 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/12/2018 -/// Time: 17:51 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - - -class SliderDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - double value = 0.0; - @override - Widget build(BuildContext context) { - return Slider( - value: value, - //实际进度的位置 - inactiveColor: Colors.black12, - //进度中不活动部分的颜色 - label: 'value: $value', - min: 0.0, - max: 100.0, - divisions: 1000, - activeColor: Colors.blue, - //进度中活动部分的颜色 - onChanged: (double) { - setState(() { - value = double.roundToDouble(); - }); - }, - ); - } -} - -class SliderThemeDemo extends StatefulWidget { - _SliderThemeDemo createState() => _SliderThemeDemo(); -} - -class _SliderThemeDemo extends State { - double value = 0.0; - @override - Widget build(BuildContext context) { - return Container( - child: SliderTheme( - data: SliderTheme.of(context).copyWith( -// activeTickMarkColor:Colors.yellowAccent, - 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: Container( - width: 340.0, - margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0), - child: Row( - children: [ - Text('0.0'), - Expanded( - flex: 1, - child: Slider( - value: value, - label: '$value', - divisions: 10, - onChanged: (double) { - setState(() { - value = double.floorToDouble(); //转化成double - }); - }, - min: 0.0, - max: 100.0, - ), - ), - Text('100.0'), - ], - ), - ), - ), - ); - } -} diff --git a/lib/widgets/elements/Form/Slider/Slider/index.dart b/lib/widgets/elements/Form/Slider/Slider/index.dart deleted file mode 100644 index 9862e916..00000000 --- a/lib/widgets/elements/Form/Slider/Slider/index.dart +++ /dev/null @@ -1,92 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/12/2018 -/// Time: 17:43 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const contentA = ''' -### **简介** -> 用来选择范围性的数据 - -slider 用来选择连续性的或者非连续性的数据. 默认是在一段最大值最小值间做任意值的选择. 如果你想选择间隔性的值, 例如0.0到50.0间,选择10, 15,...50.0这样的值, 给divisions设定一个非空的整数5,, 去分割区间范围. - -### **基本用法** - -关于slider有以下的术语: - -* **thumb** 滑块 用户可以水平拖拽移动的区域 - -* **track** 滑轨 thumb 可以滑动的线条区域 - -* **value indicator** 值指示器 当用户拖拽thumb的时候. 显示用户当前所选的属性值 - -* **active** 选中区 - -* **inactive** 非选中区 - -如果**onChanged**属性为空或者**min** .. **max**给出的范围 为空(例如如果min等于max),则将禁用滑块。 - -滑块小部件本身不保持任何状态State。相反,当滑块状态发生变化时,窗口小部件会调用 **onChanged** 回调。大多数使用滑块的小部件将侦听 **onChanged** 回调并使用新值重建滑块以更新滑块的视觉外观。要知道值何时开始更改,或何时更改,请设置可选回调**onChangeStart**或**onChangeEnd**。 - -默认情况下,滑块将尽可能宽,垂直居中。当给定无限制约束时,它将尝试使轨道宽144像素(每边有边距)并垂直收缩。 - -### **基本实例** - -'''; - - -const contentB = ''' -### **高级用法** -> 自定义Slider 样式 - -如果当前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() -) - -``` - -### **基本实例** - -'''; - -class Demo extends StatefulWidget { - static const String routeName = 'elements/Form/Slider/Slider'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Slider', - codeUrl: 'elements/Form/Slider/Slider/demo.dart', - contentList: [ - contentA, - SliderDemo(), - contentB, - SliderThemeDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/Slider-class.html', - ); - } -} diff --git a/lib/widgets/elements/Form/Slider/SliderTheme/demo.dart b/lib/widgets/elements/Form/Slider/SliderTheme/demo.dart deleted file mode 100644 index babb65c5..00000000 --- a/lib/widgets/elements/Form/Slider/SliderTheme/demo.dart +++ /dev/null @@ -1,62 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 27/12/2018 - /// Time: 14:40 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; - - -class SliderThemeDemo extends StatefulWidget { - _SliderThemeDemo createState() => _SliderThemeDemo(); -} - -class _SliderThemeDemo extends State { - double value = 0.0; - @override - Widget build(BuildContext context) { - return Container( - child: SliderTheme( - data: SliderTheme.of(context).copyWith( -// activeTickMarkColor:Colors.yellowAccent, - 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: Container( - width: 340.0, - margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0), - child: Row( - children: [ - Text('0.0'), - Expanded( - flex: 1, - child: Slider( - value: value, - label: '$value', - divisions: 10, - onChanged: (double){ - setState(() { - value=double.floorToDouble();//转化成double - }); - }, - min: 0.0, - max: 100.0, - ), - ), - Text('100.0'), - ], - ), - ), - ), - ); - } -} diff --git a/lib/widgets/elements/Form/Slider/SliderTheme/index.dart b/lib/widgets/elements/Form/Slider/SliderTheme/index.dart deleted file mode 100644 index 8b8e8b2a..00000000 --- a/lib/widgets/elements/Form/Slider/SliderTheme/index.dart +++ /dev/null @@ -1,74 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 20/12/2018 - /// Time: 17:43 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const contentA = ''' -### **简介** -> 用来更改Slider样式的上层部件 - -将滑块主题应用于后代Slider小部件。 - -### **基本用法** - -> 通过更改sliderTheme.data, 修改Slider总体样式 - -基本属性参考以下代码: - -``` - 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容器窗口 -), - -``` - -### **基本实例** - - -'''; - - -class Demo extends StatefulWidget { - static const String routeName = 'elements/Form/Slider/SliderTheme'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SliderTheme', - codeUrl: 'elements/Form/Slider/SliderTheme/demo.dart', - contentList: [ - contentA, - SliderThemeDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/material/SliderTheme-class.html', - ); - } -} diff --git a/lib/widgets/elements/Form/Slider/SliderThemeData/demo.dart b/lib/widgets/elements/Form/Slider/SliderThemeData/demo.dart deleted file mode 100644 index babb65c5..00000000 --- a/lib/widgets/elements/Form/Slider/SliderThemeData/demo.dart +++ /dev/null @@ -1,62 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 27/12/2018 - /// Time: 14:40 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; - - -class SliderThemeDemo extends StatefulWidget { - _SliderThemeDemo createState() => _SliderThemeDemo(); -} - -class _SliderThemeDemo extends State { - double value = 0.0; - @override - Widget build(BuildContext context) { - return Container( - child: SliderTheme( - data: SliderTheme.of(context).copyWith( -// activeTickMarkColor:Colors.yellowAccent, - 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: Container( - width: 340.0, - margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0), - child: Row( - children: [ - Text('0.0'), - Expanded( - flex: 1, - child: Slider( - value: value, - label: '$value', - divisions: 10, - onChanged: (double){ - setState(() { - value=double.floorToDouble();//转化成double - }); - }, - min: 0.0, - max: 100.0, - ), - ), - Text('100.0'), - ], - ), - ), - ), - ); - } -} diff --git a/lib/widgets/elements/Form/Slider/SliderThemeData/index.dart b/lib/widgets/elements/Form/Slider/SliderThemeData/index.dart deleted file mode 100644 index b28e578a..00000000 --- a/lib/widgets/elements/Form/Slider/SliderThemeData/index.dart +++ /dev/null @@ -1,48 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 20/12/2018 - /// Time: 17:43 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const contentA = ''' -### **简介** -> SliderTheme的data修饰属性 **SliderThemeData** - - - -### **基本用法** - -> 配合SliderTheme, 修改slider组件各个部件的样式, 参照@Slider的各组件命名, 修改各部件样式 - - - -'''; - - -class Demo extends StatefulWidget { - static const String routeName = 'elements/Form/Slider/SliderThemeData'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - Color c = CupertinoColors.activeBlue; - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SliderThemeData', - codeUrl: 'elements/Form/Slider/SliderThemeData/demo.dart', - contentList: [ - contentA, - SliderThemeDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/SliderThemeData-class.html', - ); - } -} diff --git a/lib/widgets/elements/Form/Slider/index.dart b/lib/widgets/elements/Form/Slider/index.dart deleted file mode 100644 index c715e101..00000000 --- a/lib/widgets/elements/Form/Slider/index.dart +++ /dev/null @@ -1,24 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import "Slider/index.dart" as Slider; -import "SliderTheme/index.dart" as SliderTheme; -import "SliderThemeData/index.dart" as SliderThemeData; - -List widgetPoints = [ - WidgetPoint( - name: 'Slider', - routerName: Slider.Demo.routeName, - buildRouter: (BuildContext context) => Slider.Demo(), - ), - WidgetPoint( - name: 'SliderTheme', - routerName: SliderTheme.Demo.routeName, - buildRouter: (BuildContext context) => SliderTheme.Demo(), - ), - WidgetPoint( - name: 'SliderThemeData', - routerName: SliderThemeData.Demo.routeName, - buildRouter: (BuildContext context) => SliderThemeData.Demo(), - ) -]; diff --git a/lib/widgets/elements/Form/Switch/AnimatedSwitcher/demo.dart b/lib/widgets/elements/Form/Switch/AnimatedSwitcher/demo.dart deleted file mode 100644 index 1ec3e50a..00000000 --- a/lib/widgets/elements/Form/Switch/AnimatedSwitcher/demo.dart +++ /dev/null @@ -1,50 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 28/12/2018 - /// Time: 19:58 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; - -class AnimatedSwitcherDemo extends StatefulWidget { - const AnimatedSwitcherDemo({Key key}) : super(key: key); - - @override - _ClickCounterState createState() => _ClickCounterState(); -} - -class _ClickCounterState extends State { - int _count = 0; - - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AnimatedSwitcher( - duration: const Duration(milliseconds: 500), - transitionBuilder: (Widget child, Animation animation) { - return ScaleTransition(child: child, scale: animation); - }, - child: Text( - '$_count', - // This key causes the AnimatedSwitcher to interpret this as a "new" - // child each time the count changes, so that it will begin its animation - // when the count changes. - key: ValueKey(_count), - style: Theme.of(context).textTheme.display4, - ), - ), - RaisedButton( - child: const Text('Increment'), - onPressed: () { - setState(() { - _count += 1; - }); - }, - ), - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Switch/AnimatedSwitcher/index.dart b/lib/widgets/elements/Form/Switch/AnimatedSwitcher/index.dart deleted file mode 100644 index 1f90412a..00000000 --- a/lib/widgets/elements/Form/Switch/AnimatedSwitcher/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 28/12/2018 -/// Time: 19:54 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'demo.dart'; - -const contentA = ''' -### **简介** -> 一个在新旧组件. 做渐变切换的组件. 有一定的动画效果 - -*注意*: -- 如果你切换的足够快.超过了间隔时间, 组件只会隐藏第一个 .并渐渐显示最后一个生效的组件. -- 如果你变更的组件.只是同一个组件, 不同的state或者不同的显示数据与状态. 请为当前组件每一个状态加入一个Key. 强制生效动画效果. - - - -### **基本实例** - -'''; - -class Demo extends StatefulWidget { - static const String routeName = 'elements/Form/Switch/AnimatedSwitcher'; - - _Demo createState() => _Demo(); -} - -class _Demo extends State { - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SwitchListTile', - codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart', - contentList: [contentA, AnimatedSwitcherDemo()], - docUrl: '', - ); - } -} diff --git a/lib/widgets/elements/Form/Switch/Switch/demo.dart b/lib/widgets/elements/Form/Switch/Switch/demo.dart deleted file mode 100644 index a575b718..00000000 --- a/lib/widgets/elements/Form/Switch/Switch/demo.dart +++ /dev/null @@ -1,75 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 27/12/2018 -/// Time: 17:30 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class SwitchDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - bool check = false; - @override - Widget build(BuildContext context) { - return Switch( - value: this.check, - onChanged: (bool val) { - this.setState(() { - this.check = !this.check; - }); - }, - ); - } -} - -class SwitchHighDemo extends StatefulWidget { - _SwitchHighDemo createState() => _SwitchHighDemo(); -} - -class _SwitchHighDemo extends State { - bool check = false; - @override - Widget build(BuildContext context) { - return Switch.adaptive( - value: this.check, - activeColor: Colors.blue, // 激活时原点颜色 - onChanged: (bool val) { - this.setState(() { - this.check = !this.check; - }); - }, - ); - } -} - - -class SwitchTypesDemo extends StatefulWidget { - _SwitchTypesDemo createState() => _SwitchTypesDemo(); -} - -class _SwitchTypesDemo extends State { - bool check = false; - @override - Widget build(BuildContext context) { - return Switch( - value: this.check, - activeTrackColor:Colors.green, - inactiveThumbColor: Colors.black, - inactiveThumbImage: NetworkImage('https://flutter.io/images/homepage/header-illustration.png'), - activeThumbImage: NetworkImage( - "https://flutter.io/images/homepage/screenshot-2.png" - ), - inactiveTrackColor: Colors.yellow, - activeColor: Colors.blue, // 激活时原点颜色 - onChanged: (bool val) { - this.setState(() { - this.check = !this.check; - }); - }, - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Switch/Switch/index.dart b/lib/widgets/elements/Form/Switch/Switch/index.dart deleted file mode 100644 index c7ce8dff..00000000 --- a/lib/widgets/elements/Form/Switch/Switch/index.dart +++ /dev/null @@ -1,71 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/12/2018 -/// Time: 17:43 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const contentA = ''' -### **简介** -> Switch 是一个切换按钮组件,通常用于设置的选项里。 - - -### **基本用法** -通常用于Bool值参数的设置. - -'''; - - -const contentB = ''' - -ios 风格的实例 - -如果需要ios风格下的实例, 我们可以使用**Switch**的子类**adaptive**,参数使用与Switch相同, 实例如下: - -'''; - -const contentC = ''' -### **高级用法** - -当默认的样式无法满足需求时, 我们可以通过自定义各部件样式. - -- activeColor[**Color**] 当按钮状态通激活态时, 按钮的背景颜色 -- activeThumbImage [**ImageProvider**] 当按钮状态处于激活态时, 按钮的背景图像 -- activeTrackColor [**Color**] 当按钮状态处于激活态时, 滑轨的颜色 -- inactiveThumbColor [**Color**] 当按钮处于非激活状态时, 按钮的背景颜色, 与activeColor正好状态相反 -- inactiveThumbImage [**ImageProvider**] 当按钮状态处于非激活态时, 按钮的背景图像 -- inactiveTrackColor [**Color**] 当按钮状态处于非激活态时, 滑轨的颜色 - -下面是自定义, 更改了以上属性的实例 - -'''; - - -class Demo extends StatefulWidget { - static const String routeName = 'elements/Form/Switch/Switch'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Switch', - codeUrl: '/elements/Form/Switch/Switch/demo.dart', - contentList: [ - contentA, - SwitchDemo(), - contentB, - SwitchHighDemo(), - contentC, - SwitchTypesDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/material/Switch-class.html', - ); - } -} diff --git a/lib/widgets/elements/Form/Switch/SwitchListTile/demo.dart b/lib/widgets/elements/Form/Switch/SwitchListTile/demo.dart deleted file mode 100644 index 57b21ea1..00000000 --- a/lib/widgets/elements/Form/Switch/SwitchListTile/demo.dart +++ /dev/null @@ -1,25 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 28/12/2018 - /// Time: 15:48 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx - -import 'package:flutter/material.dart'; - -class SwitchListTileDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - bool _lights = false; - @override - Widget build(BuildContext context) { - return SwitchListTile( - title: const Text('Lights'), - value: _lights, - onChanged: (bool value) { setState(() { _lights = value; }); }, - secondary: const Icon(Icons.lightbulb_outline), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Switch/SwitchListTile/index.dart b/lib/widgets/elements/Form/Switch/SwitchListTile/index.dart deleted file mode 100644 index bc4adbcb..00000000 --- a/lib/widgets/elements/Form/Switch/SwitchListTile/index.dart +++ /dev/null @@ -1,43 +0,0 @@ - /// Created with Android Studio. - /// User: 三帆 - /// Date: 28/12/2018 - /// Time: 15:48 - /// email: sanfan.hx@alibaba-inc.com - /// target: xxx -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const contentA = ''' -### **简介** -> Switch 的一个衍生组件 - -基本用法与Switch相同.具体参考@Switch, 支持各种自定义样式. - - - -### **基本实例** - -'''; - - -class Demo extends StatefulWidget { - static const String routeName = 'elements/Form/Switch/SwitchListTile'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SwitchListTile', - codeUrl: 'elements/Form/Switch/SwitchListTile/demo.dart', - contentList: [ - contentA, - SwitchListTileDemo() - ], - docUrl: '', - ); - } -} diff --git a/lib/widgets/elements/Form/Switch/index.dart b/lib/widgets/elements/Form/Switch/index.dart deleted file mode 100644 index c6f26d73..00000000 --- a/lib/widgets/elements/Form/Switch/index.dart +++ /dev/null @@ -1,25 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import "Switch/index.dart" as Switch; -import "SwitchListTile/index.dart" as SwitchListTile; -import "AnimatedSwitcher/index.dart" as AnimatedSwitcher; - - -List widgetPoints = [ - WidgetPoint( - name: 'Switch', - routerName: Switch.Demo.routeName, - buildRouter: (BuildContext context) => Switch.Demo(), - ), - WidgetPoint( - name: 'SwitchListTile', - routerName: SwitchListTile.Demo.routeName, - buildRouter: (BuildContext context) => SwitchListTile.Demo(), - ), - WidgetPoint( - name: 'AnimatedSwitcher', - routerName: AnimatedSwitcher.Demo.routeName, - buildRouter: (BuildContext context) => AnimatedSwitcher.Demo(), - ) -]; diff --git a/lib/widgets/elements/Form/Text/RichText/demo.dart b/lib/widgets/elements/Form/Text/RichText/demo.dart deleted file mode 100644 index 8d8705ae..00000000 --- a/lib/widgets/elements/Form/Text/RichText/demo.dart +++ /dev/null @@ -1,31 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 14/01/2019 -/// Time: 19:02 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/material.dart'; - -class RichTextDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - @override - Widget build(BuildContext context) { - return Container( - color: Color(0xff000000), - width: 750.0, - child: RichText( - text: TextSpan( - text: 'Hello ', - children: [ - TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold, color: Color(0xfffffc42))), - TextSpan(text: ' world!', style: TextStyle(fontStyle: FontStyle.italic)), - ], - ), - ), - ); - } -} diff --git a/lib/widgets/elements/Form/Text/RichText/index.dart b/lib/widgets/elements/Form/Text/RichText/index.dart deleted file mode 100644 index b5bb5be8..00000000 --- a/lib/widgets/elements/Form/Text/RichText/index.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'package:flutter_go/widgets/elements/Form/Text/RichText/demo.dart'; - -const String intro = """ -### **简介** - -> 具有复杂样式的文本显示组件 - -在富文本使用多个不同风格的widget显示文本。要显示的文本使用TextSpan对象树来描述,每个对象都有一个用于该子树的关联样式。文本可能会跨越多行,也可能全部显示在同一行上,具体取决于布局约束。 - -无论是Text或者Text.rich, 查看源代码发现. 都是由RichText构建出来 - - -### **基本用法** -我们可以让一段文本通过使用不同的TextSpan显示不同的样式。比如我们让"Hello beautiful world"的每个单词都显示不同的样式. - -"""; - - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Text/RichText'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Rich Text', - docUrl: 'https://docs.flutter.io/flutter/widgets/RichText-class.html', - codeUrl: 'elements/Form/Text/RichText/index.dart', - contentList: [ - intro, - RichTextDemo(), - ]); - } -} diff --git a/lib/widgets/elements/Form/Text/Text/demo.dart b/lib/widgets/elements/Form/Text/Text/demo.dart deleted file mode 100644 index 505b5d09..00000000 --- a/lib/widgets/elements/Form/Text/Text/demo.dart +++ /dev/null @@ -1,22 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/01/2019 -/// Time: 22:28 -/// email: sanfan.hx@alibaba-inc.com -/// target: CupertinoTabBar - -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; - -class TextDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - int index = 0; - Duration timer = new Duration(minutes: 50); - @override - Widget build(BuildContext context) { - return Text("i'm a text"); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Text/Text/index.dart b/lib/widgets/elements/Form/Text/Text/index.dart deleted file mode 100644 index 4c6586a7..00000000 --- a/lib/widgets/elements/Form/Text/Text/index.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String intro = """ -### **简介** - -> 具有某个单一样式的文本显示的widget组件, 显示支持一行或者多行. 默认样式会继承层级最为接近的 *DefaultStyle* -当然, 你也可以重新他的样式 将 *DefaultStyle.inherit 设置为 false* - -是最基本的文本显示组件 - -### **基本用法** -在这里介绍一下他的基本属性说明. - -- data Text显示的文本,必填参数 String -- textAlign 文本的对齐方式,可以选择左对齐、右对齐还是居中对齐 TextAlign -- maxLines 文本显示的最大行数 int -- overflow 文本显示的截断方式 TextOverflow -- textScaleFactor 文本的缩放比例 double -- style 用于指定文本显示的样式如颜色、字体、粗细、背景等 - - -### **基本示例** - -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Form/Text/Text'; - _Demo createState() => _Demo(); -} - -class _Demo extends State { - onButtonTap() { - - } - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: "Text", - docUrl: 'flutter/widgets/Text-class.html', - codeUrl: 'elements/Form/Text/Text/demo.dart', - contentList: [ - intro, - TextDemo(), - ] - ); - } -} diff --git a/lib/widgets/elements/Form/Text/index.dart b/lib/widgets/elements/Form/Text/index.dart deleted file mode 100644 index f5b7eb50..00000000 --- a/lib/widgets/elements/Form/Text/index.dart +++ /dev/null @@ -1,19 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import 'RichText/index.dart' as RichText; -import 'Text/index.dart' as Text; - - -List widgetPoints = [ - WidgetPoint( - name: 'RichText', - routerName: RichText.Demo.routeName, - buildRouter: (BuildContext context) => RichText.Demo(), - ), - WidgetPoint( - name: 'Text', - routerName: Text.Demo.routeName, - buildRouter: (BuildContext context) => Text.Demo(), - ), -]; \ No newline at end of file diff --git a/lib/widgets/elements/Form/index.dart b/lib/widgets/elements/Form/index.dart deleted file mode 100644 index 7a140fa3..00000000 --- a/lib/widgets/elements/Form/index.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'Button/index.dart' as Button; -import 'Text/index.dart' as Text; -import 'Input/index.dart' as Input; -import 'CheckBox/index.dart' as CheckBox; -import 'Radio/index.dart' as Radio; -import 'Slider/index.dart' as Slider; -import 'Switch/index.dart' as Switch; - -List getWidgets() { - List result = []; - result.addAll(Button.widgetPoints); - result.addAll(Text.widgetPoints); - result.addAll(Input.widgetPoints); - result.addAll(CheckBox.widgetPoints); - result.addAll(Radio.widgetPoints); - result.addAll(Slider.widgetPoints); - result.addAll(Switch.widgetPoints); - return result; -} \ No newline at end of file diff --git a/lib/widgets/elements/Frame/Align/Align/demo.dart b/lib/widgets/elements/Frame/Align/Align/demo.dart deleted file mode 100644 index 98f48584..00000000 --- a/lib/widgets/elements/Frame/Align/Align/demo.dart +++ /dev/null @@ -1,64 +0,0 @@ -/// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:Align描述 - -import 'package:flutter/widgets.dart'; - -class AlignAlignment extends StatelessWidget { - final Alignment status; - final String dec; - - const AlignAlignment( this.status, this.dec) : super(); - - @override - Widget build(BuildContext context) { - return Container( - color: Color(0xffd81b60), - width: 90.0, - height: 50.0, - child: Align( - alignment: status, - child: Text( - dec, - style: TextStyle(fontSize: 12.0, color: Color(0xffffffff)), - ), - ), - ); - } -} - -class AlignFactor extends StatelessWidget { - final Alignment status; - final double wFactor; - final double hFactor; - final String dec; - - const AlignFactor( this.status, this.wFactor, - this.hFactor, this.dec) - : super(); - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.only(top: 10.0, bottom: 10.0), - color: Color(0xffd81b60), - child: Align( - alignment: status, - widthFactor: wFactor, - heightFactor: hFactor, - child: Container( - color: Color(0xfff06292), - width: 100.0, - height: 50.0, - child: Text( - dec, - style: TextStyle(color: Color(0xffffffff)), - ), - ), - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Align/Align/index.dart b/lib/widgets/elements/Frame/Align/Align/index.dart deleted file mode 100644 index 610ede29..00000000 --- a/lib/widgets/elements/Frame/Align/Align/index.dart +++ /dev/null @@ -1,100 +0,0 @@ - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String _flatText0 = """ -### **简介** -> Align控件即对齐控件,能将子控件所指定方式对齐,并根据子控件的大小调整自己的大小。 -- 根据自己需求,进行控件对齐 -### **基本用法** -> alignment → AlignmentGeometry -- 要对齐右下方的框,那么对这个框对要求会比对子控件更加严肃的约束,使用:Alignment.bottomRight -- 同理:Alignment.center,Alignment.bottomLeft,Alignment.topLeft等 -"""; - -const String _flatText1 = """ -> widthFactor / heightFactor → double -- 如果widthFactor / heightFactor 为空,并且外部无任何约束,child控件大小默认,那么这个控件将根据自身尺寸最大化 -- 如果widthFactor / heightFactor 不为空,并且外部无约束,align将匹配对应的child尺寸 -- ex:widthFactor/ heightFactor 为2.0;那么widget的宽高为child宽高的两倍 -- 如果widthFactor / heightFactor 为空,并且外部无约束,child控件将会设置自身大小 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Align/Align'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Align', - codeUrl: "elements/Frame/Align/Align/demo.dart", - docUrl: 'https://docs.flutter.io/flutter/widgets/Align-class.html', - contentList: [_flatText0, _alignCreate(),_flatText1,_alignCreates()], - ); - } - - Column _alignCreate() { - return Column( - children: [ - SizedBox(height: 10.0), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AlignAlignment(Alignment.center, 'center'), - AlignAlignment(Alignment.centerLeft, 'centerLeft'), - ], - ), - SizedBox(height: 10.0), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AlignAlignment(Alignment.centerRight, 'centerRight'), - AlignAlignment(Alignment.bottomCenter, 'btCenter'), - AlignAlignment(Alignment.topCenter, 'topCenter'), - ], - ), - SizedBox(height: 10.0), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AlignAlignment(Alignment.topLeft, 'topLeft'), - AlignAlignment(Alignment.topRight, 'topRight'), - AlignAlignment(Alignment.bottomLeft, 'bottomLeft'), - ], - ), - SizedBox(height: 10.0), - - - ], - ); - } -} - -Column _alignCreates(){ - return Column( - children: [ - Container( - margin: EdgeInsets.only(top: 20.0, bottom: 20.0), - color: Color(0xffe91e63), - child: Align( - alignment: Alignment.topLeft, - child: Text( - "Align", - style: TextStyle(color: Color(0xffffffff)), - ), - ), - ), - AlignFactor(Alignment.topLeft, 2.0, 2.0, 'topleft'), - AlignFactor(Alignment.topRight, null, null, 'topleft'), - AlignFactor(Alignment.center, null, null, 'center'), - AlignFactor(Alignment.bottomLeft, null, null, 'bottomLeft') - ], - ); -} diff --git a/lib/widgets/elements/Frame/Align/index.dart b/lib/widgets/elements/Frame/Align/index.dart deleted file mode 100644 index 0743b349..00000000 --- a/lib/widgets/elements/Frame/Align/index.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/model/widget.dart'; -import './Align/index.dart' as Align; - -List widgetPoints = [ - WidgetPoint( - name: 'Align', - routerName: Align.Demo.routeName, - buildRouter: (BuildContext context) => Align.Demo(), - ), -]; diff --git a/lib/widgets/elements/Frame/Box/ConstrainedBox/demo.dart b/lib/widgets/elements/Frame/Box/ConstrainedBox/demo.dart deleted file mode 100644 index 03ceeb89..00000000 --- a/lib/widgets/elements/Frame/Box/ConstrainedBox/demo.dart +++ /dev/null @@ -1,45 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:ConstrainedBox描述 - -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -class ConstrainedBoxCreate extends StatelessWidget { - final double currWidth; - final String describe; - - const ConstrainedBoxCreate({Key key,this.currWidth,this.describe}): - super(key: key); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - ConstrainedBox( - //制定一个指定大小的盒子,限定最大最小宽高 - constraints: const BoxConstraints( - minWidth: 100.0, - minHeight: 20.0, - maxWidth: 300.0, - maxHeight: 50.0, - ), - child: Container( - margin: const EdgeInsets.only(left: 20.0, right: 20.0), - //child 宽高超过制定限制范围失效,效果宽/高=100/20区域 - width: currWidth, - height: 250.0, - child: Text( - describe, - style: TextStyle(color: Colors.white), - ), - color: Color(0xfff8bbd0), - ), - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/ConstrainedBox/index.dart b/lib/widgets/elements/Frame/Box/ConstrainedBox/index.dart deleted file mode 100644 index cd1d06fe..00000000 --- a/lib/widgets/elements/Frame/Box/ConstrainedBox/index.dart +++ /dev/null @@ -1,70 +0,0 @@ -/// Author: xiaojia.dxj -/// Date: 2019-01-08 15:56:53 -/// Last Modified by: xiaojia.dxj -/// Last Modified time: 2019-01-08 15:56:53 -/// email: xiaojia.dxj@alibaba-inc.com - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text = ''' -### **简介** -> 添加额外的限制条件到child上 -- 比如说,你限制child最小高度为50.0像素,就可以用constraints: const BoxConstraints(minHeight:50) - -'''; -const String _Text1 = ''' -### **基本用法** -> 添加额外的限制条件到child上 -- ex:添加ConstrainedBox约束如下,传入不同Width约束的Container效果 -minWidth: 100.0, -minHeight: 20.0, -maxWidth: 300.0, -maxHeight: 50.0 - -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/ConstrainedBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'ConstrainedBox', - codeUrl: 'elements/Frame/Box/ConstrainedBox/demo.dart', - contentList: [ - _Text, - _Text1, - // maxWidth: 300.0, - ConstrainedBoxCreate(currWidth: 500, describe: "currWidth>maxWidth"), - SizedBox( - height: 10.0, - ), - ConstrainedBoxCreate(currWidth: 300, describe: "currWidth=maxWidth"), - SizedBox( - height: 10.0, - ), - ConstrainedBoxCreate(currWidth: 200, describe: "currWidthminWidth"), - SizedBox( - height: 10.0, - ), - ConstrainedBoxCreate(currWidth: 100, describe: "currWidth=minWidth"), - - ], - docUrl: - 'https://docs.flutter.io/flutter/widgets/ConstrainedBox-class.html', - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart b/lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart deleted file mode 100644 index 86da89f3..00000000 --- a/lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart +++ /dev/null @@ -1,105 +0,0 @@ -/// Author: xiaojia.dxj -/// Date: 2018/11/22 -/// Email: xiaojia.dxj@alibaba-inc.com -/// LastUpdateTime: 2018/11/22 -/// LastUpdateBy: xj.deng - -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -class DecoratedBoxCreate extends StatelessWidget { - DecoratedBoxCreate({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return DecoratedBox( - position: DecorationPosition.background, - decoration: BoxDecoration( - color: const Color(0xff7c94b6), - //设置图片内容 - image: DecorationImage( - ///fix:BoxFit.contain: 保持图片的比例,最大程度填充容器 BoxFit.fill:容器被图片完全填充,不在意图片比例,只填充整个容器 - ///fix:BoxFit.fitWidth:图片以宽被完全填充 BoxFit.fix:fixHigth:图片以高度完全填充 - fit: BoxFit.cover, //图片填充整个容器,按比例放大,多余部分被裁切 - image: ExactAssetImage('assets/images/food01.jpeg')), - //外宽边框,可以不设置 - border: Border.all( - color: Colors.blue.shade50, - width: 10.0, - ), - ), - ); - } -} - -class DecoratedBoxCreateTwo extends StatelessWidget { - DecoratedBoxCreateTwo({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return DecoratedBox( - position: DecorationPosition.background, - decoration: BoxDecoration( - color: const Color(0xff7c94b6), - //设置图片内容 - image: DecorationImage( - fit: BoxFit.cover, - image: ExactAssetImage('assets/images/food01.jpeg')), - //根据传入的不同大小,呈现图片效弧度不同, - borderRadius: BorderRadius.circular(90.0), - ), - ); - } -} - -class DecoratedBoxCreateShape extends StatelessWidget { - DecoratedBoxCreateShape({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return DecoratedBox( - position: DecorationPosition.background, - decoration: BoxDecoration( - color: const Color(0xff7c94b6), - image: DecorationImage( - fit: BoxFit.cover, - image: ExactAssetImage('assets/images/food01.jpeg')), - border: Border.all( - color: Colors.blue.shade50, - width: 5.0, - ), - shape: BoxShape.circle, - ), - ); - } -} - -class DecoratedBoxCreateShapes extends StatelessWidget { - DecoratedBoxCreateShapes({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return DecoratedBox( - position: DecorationPosition.background, - decoration: BoxDecoration( - gradient: const LinearGradient( - //渐变效果 线性渐变 - colors: [Colors.red, Colors.yellowAccent, Colors.lightGreenAccent]), -// color: const Color(0xff7c94b6), - border: Border.all( - color: Colors.blue.shade50, - width: 5.0, - ), - shape: BoxShape.circle, - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/DecoratedBox/index.dart b/lib/widgets/elements/Frame/Box/DecoratedBox/index.dart deleted file mode 100644 index a824d9bc..00000000 --- a/lib/widgets/elements/Frame/Box/DecoratedBox/index.dart +++ /dev/null @@ -1,83 +0,0 @@ -///Author: xiaojia.dxj -///Date: 2019-01-08 15:56:49 -///Last Modified by: xiaojia.dxj -///Last Modified time: 2019-01-08 15:56:49 -///email: xiaojia.dxj@alibaba-inc.com - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String _Text = """### **简介** -> 在child绘制前或绘制后,添加额外的限制条件到child上的widget -- 根据边界的宽高,对其child进行插入绘制 -"""; - -const String _Text1 = """### **基本用法** -> decoration → Decoration -- 常用于BoxDecoration -- BoxDecoration提供多种方式来绘制以一个框 -- 盒子形状可以是圆形也可以是矩形,用borderRadius属性来绘制角度 - -> position → DecorationPosition -- position: DecorationPosition.foreground, -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'DecoratedBox', - codeUrl: 'elements/Frame/Box/DecoratedBox/demo.dart', - contentList: [ - _Text, - _Text1, - _decoratedBoxCreate(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/DecoratedBox-class.html', - ); - } - - Column _decoratedBoxCreate() { - return Column( - children: [ - Container( - height: 100.0, - width: 100.0, - child: DecoratedBoxCreate(), - ), - SizedBox( - height: 10.0, - ), - Container( - height: 100.0, - width: 100.0, - child: DecoratedBoxCreateTwo(), - ), - SizedBox( - height: 10.0, - ), - Container( - height: 100.0, - width: 100.0, - child: DecoratedBoxCreateShape(), - ), - SizedBox( - height: 10.0, - ), - Container( - height: 100.0, - width: 100.0, - child: DecoratedBoxCreateShapes(), - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/FittedBox/demo.dart b/lib/widgets/elements/Frame/Box/FittedBox/demo.dart deleted file mode 100644 index 084f8fe9..00000000 --- a/lib/widgets/elements/Frame/Box/FittedBox/demo.dart +++ /dev/null @@ -1,44 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/12/2 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/12/2 - /// LastUpdateBy: xj.deng - /// Describle:FittedBox - -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -class FittedBoxDefault extends StatelessWidget { - final BoxFit curfit; - final String dec; - - FittedBoxDefault({Key key, this.curfit, this.dec}); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - //外部有位置约束,内部大小设定失效,保持和外部约束一致 - height: 100.0, - width: 100.0, - color: Color(0xfff8bbd0), - child: FittedBox( - fit: curfit, - // 修改child写入布局时期分配的空间 - alignment: Alignment.center, - //alignment修改child于父空间对齐方式,默认:Alignment.center, - child: Container( - color: Color(0xfff48fb1), - child: Text( - 'fittedBox', - style: TextStyle(color: Colors.white), - ), - ), - ), - ), - Text(dec), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/FittedBox/index.dart b/lib/widgets/elements/Frame/Box/FittedBox/index.dart deleted file mode 100644 index 74d1e25f..00000000 --- a/lib/widgets/elements/Frame/Box/FittedBox/index.dart +++ /dev/null @@ -1,105 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2019-01-08 - /// LastUpdateBy: xj.deng - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String Text0 = """ -### **FittedBox** -> 根据自己的需要,对child进行缩放和定位 -- 可以看看变换,在绘制时任意变换应用在子窗口的widget -"""; - -const String Text1 = """ -### **基本用法** -> 根据外部约束,调整child -- 如果外部没有约束,按照child的大小。 -- 如果外部有约束,按照外部约束调整自身大小,然后缩放调整child,根据条件进行放置 -- BoxFix 属性,可修改child写入布局时期分配的空间 -- alignment修改child于父空间对齐方式,默认:Alignment.center, -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/FittedBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'FittedBox', - codeUrl: 'elements/Frame/Box/Fittedbox/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/FittedBox-class.html', - contentList: [ - Text0, - Text1, - _fittedBoxCreate(), - ], - ); - } - - Column _fittedBoxCreate() { - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - FittedBoxDefault( - //设置child写入布局期间分配空间 - curfit: BoxFit.contain, - dec: 'contain', - ), - FittedBoxDefault( - curfit: BoxFit.fill, - dec: 'fill', - ), - FittedBoxDefault( - curfit: BoxFit.cover, - dec: 'cover', - ), - ], - ), - SizedBox( - height: 20.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - FittedBoxDefault( - curfit: BoxFit.fitHeight, - dec: 'fitHeight', - ), - FittedBoxDefault( - curfit: BoxFit.fitWidth, - dec: 'fitWidth', - ), - ], - ), - SizedBox( - height: 20.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - FittedBoxDefault( - curfit: BoxFit.none, - dec: 'none', - ), - FittedBoxDefault( - curfit: BoxFit.scaleDown, - dec: 'scaleDown', - ), - ], - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/LimitedBox/demo.dart b/lib/widgets/elements/Frame/Box/LimitedBox/demo.dart deleted file mode 100644 index 170c9b7a..00000000 --- a/lib/widgets/elements/Frame/Box/LimitedBox/demo.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:flutter/widgets.dart'; -import 'package:flutter/material.dart'; - -class LimitedBoxDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 100, - height: 100, - color: Color(0xfff8bbd0), - child: Text( - "100 * 100", - style: TextStyle(color: Colors.white), - ), - ), - LimitedBox( - maxWidth: 100, - maxHeight: 100, - child: Container( - width: 250, - height: 300, - child: Text( - "250 * 300", - style: TextStyle(color: Colors.white), - ), - color: Color(0xfff48fb1), - ), - ) - ], - ); - } -} - -class LimitedBoxColumnDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - SizedBox( - child: Text("Column 列表下效果"), - ), - Container( - width: 100, - height: 100, - color: Color(0xfff8bbd0), - child: Text( - "100 * 100", - style: TextStyle(color: Colors.white), - ), - ), - SizedBox(height: 10.0), - LimitedBox( - maxWidth: 100, - maxHeight: 100, - child: Container( - width: 250, - height: 300, - child: Text( - "250 * 300", - style: TextStyle(color: Colors.white), - ), - color: Color(0xfff48fb1), - ), - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/LimitedBox/index.dart b/lib/widgets/elements/Frame/Box/LimitedBox/index.dart deleted file mode 100644 index 30dc8321..00000000 --- a/lib/widgets/elements/Frame/Box/LimitedBox/index.dart +++ /dev/null @@ -1,52 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:56:35 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 15:56:35 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String Text0 = """ -### **LimitedBox** -> 对最大宽高进行限制的控件(前提是LimitedBox不受约束) -- 即:将child限制在指定的最大宽高中 -- 这就使得child自身没有约束大小的时候具有了外部约束,依然控制了其大小 -- 例如:通过给LimitedBox最大高度(maxHeight),widget通常会调整其自身的大小去适应父窗体,但是,当放置在竖直(cloumn)列表中时,它将采用给定的高度 -"""; - -const String Text1 = """ -### **基本用法** -> widget 限制child最大宽高,如下: -- 如果LimitedBox外部宽度没有被约束,child的宽受到LimitedBox最大宽度(maxWidth)属性限制 -- 同理,LimitedBox外部高度没有约束,child的高受到LimitedBox最大高度(maxHeight)属性限制 - - -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/LimitedBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'LimitedBox', - codeUrl: 'elements/Frame/Box/LimitedBox/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/LimitedBox-class.html', - contentList: [ - Text0, - Text1, - LimitedBoxDemo(), - SizedBox(height: 30), - LimitedBoxColumnDemo(), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/OverflowBox/demo.dart b/lib/widgets/elements/Frame/Box/OverflowBox/demo.dart deleted file mode 100644 index 30127141..00000000 --- a/lib/widgets/elements/Frame/Box/OverflowBox/demo.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -class OverflowBoxDefault extends StatelessWidget { - final double curmaxHeight; - final double curmaxWidth; - final double curHeight; - final double curWidth; - final AlignmentGeometry curalignment; - - OverflowBoxDefault( - {Key key, - this.curmaxHeight, - this.curmaxWidth, - this.curWidth, - this.curHeight, - this.curalignment}) - : super(key: key); - - @override - Widget build(BuildContext context) { - return OverflowBox( - minHeight: 80.0, - minWidth: 80.0, - //设置最大宽,高 - maxWidth: curmaxWidth, - maxHeight: curmaxHeight, - - //调整child位置 - alignment: curalignment, - child: Container( - //widget宽高大于overflowBox设置的最大,以overflowbox设置的最大宽高为限制, - //小于overflowBox 设置的最大限度,子widget能够完全显示 - height: curHeight, - width: curWidth, - child: Text( - "$curmaxWidth * $curmaxHeight", - style: TextStyle(color: Colors.white), - ), - color: Color(0xfff48fb1), - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/OverflowBox/index.dart b/lib/widgets/elements/Frame/Box/OverflowBox/index.dart deleted file mode 100644 index d9a26a75..00000000 --- a/lib/widgets/elements/Frame/Box/OverflowBox/index.dart +++ /dev/null @@ -1,101 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:56:31 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 15:56:31 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as overflowBox; - -const String Text0 = """### **OverflowBox简介** -> 它对child施加的约束不同于从其父控件获得的约束,可能允许child溢出父控件的空间. -- 当OverflowBox的最大尺寸大于child的时候,child可以完整显示,当其小于child的时候,则以最大尺寸为基准,当然,这个尺寸都是可以突破父节点的 -"""; - -const String Text1 = """ -### **基本用法** -> OverflowBox设置最大/最小尺寸 -- SizedOverflowBox,一个特定大小的小部件,但将其原始约束传递给它的子节点,然后可能会溢出。 -- ConstrainedBox,一个对其子项施加额外约束的小部件。 -- UnconstrainedBox,一个试图让它的child在没有约束的情况下绘制的容器。 -- SizedBox,一个具有指定大小的盒子。 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/OverflowBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'OverflowBox', - codeUrl: 'elements/Frame/Box/OverflowBox/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/OverflowBox-class.html', - contentList: [ - Text0, - Text1, - _overflowBoxCreate(), - ], - ); - } - - Column _overflowBoxCreate() { - return Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text("宽高都小于最小限制"), - Container( - width: 100.0, - height: 100.0, - color: Color(0xfff8bbd0), - child: overflowBox.OverflowBoxDefault( - curmaxHeight: 150.0, - curmaxWidth: 150.0, - //宽高都小于最小限制 - curHeight: 50.0, - curWidth: 50.0, - curalignment: Alignment.bottomLeft, - ), - ), - SizedBox(height: 20), - Text("在限制之内"), - Container( - width: 100.0, - height: 100.0, - color: Color(0xfff8bbd0), - child: overflowBox.OverflowBoxDefault( - curmaxHeight: 150.0, - curmaxWidth: 150.0, - curHeight: 80.0, - curWidth: 80.0, - curalignment: Alignment.topRight, - ), - ), - SizedBox(height: 20), - SizedBox( - height: 50, - child: Text("宽高都大于最大限制"), - ), - Container( - width: 100.0, - height: 100.0, - color: Color(0xfff8bbd0), - child: overflowBox.OverflowBoxDefault( - curmaxHeight: 150.0, - curmaxWidth: 150.0, - //宽高大于最大限制 - curHeight: 200.0, - curWidth: 200.0, - curalignment: Alignment.center, - ), - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/RotatedBox/demo.dart b/lib/widgets/elements/Frame/Box/RotatedBox/demo.dart deleted file mode 100644 index 36ca3f87..00000000 --- a/lib/widgets/elements/Frame/Box/RotatedBox/demo.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:flutter/material.dart'; - -class RotatedDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - RotatedBox( - child: const Text('hello flutter'), - quarterTurns: 3, - ), - SizedBox( - height: 20.0, - ), - RotatedBox( - child: const Text('hello flutter'), - quarterTurns: 8, - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/RotatedBox/index.dart b/lib/widgets/elements/Frame/Box/RotatedBox/index.dart deleted file mode 100644 index c87107d4..00000000 --- a/lib/widgets/elements/Frame/Box/RotatedBox/index.dart +++ /dev/null @@ -1,46 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:56:13 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 15:56:13 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const String _Text = ''' -### **简介** -> 可以将子widget旋转整数的四分之一 - - 和Transform不同,该对象在布局之前应用其旋转,整个旋转的范围仅消耗旋转的子widget所需要的空间 -'''; - -const String _Text1 = ''' -### **基本用法** -> 旋转widget -- 通过quarterTurns,设置child的顺时针四分之一的转数 -- ex:quarterTurns=3/8 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/RotatedBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'RotatedBox', - codeUrl: 'elements/Frame/Box/RenderBox/demo.dart', - contentList: [ - _Text, - _Text1, - RotatedDemo(), - ], - docUrl: - 'https://docs.flutter.io/flutter/widgets/RotatedBox-class.html'); - } -} diff --git a/lib/widgets/elements/Frame/Box/SizeBox/demo.dart b/lib/widgets/elements/Frame/Box/SizeBox/demo.dart deleted file mode 100644 index 9d7998dc..00000000 --- a/lib/widgets/elements/Frame/Box/SizeBox/demo.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -class SizeBoxDefault extends StatelessWidget { - @override - Widget build(BuildContext context) { - return SizedBox( - width: 140.0, - height: 80.0, - child: const Card( - child: Text( - 'SizedBox', - textDirection: TextDirection.rtl, - ), - margin: EdgeInsets.all(20.0), - color: Color(0xFFEF9A9A), - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/SizeBox/index.dart b/lib/widgets/elements/Frame/Box/SizeBox/index.dart deleted file mode 100644 index 6ae1f9db..00000000 --- a/lib/widgets/elements/Frame/Box/SizeBox/index.dart +++ /dev/null @@ -1,70 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:55:46 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 15:55:46 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as sizeBox; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/SizeBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Table', - codeUrl: 'elements/Frame/Box/SizedBox/demo.dart', - contentList: [ - _sizeBoxCreate(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/SizedBox-class.html', - ); - } - - Column _sizeBoxCreate() { - return Column( - children: [ - Text("SizedBox", - textAlign: TextAlign.right, - style: TextStyle( - fontSize: 28.0, - fontWeight: FontWeight.bold, - )), - Row( - children: [ - sizeBox.SizeBoxDefault(), - SizedBox( - width: 130.0, - height: 80.0, - child: const Card( - child: Text( - 'SizedBox', - textAlign: TextAlign.center, - ), - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), - color: Color(0xFFE57373)), - ), - ], - ), - SizedBox( - width: 900.0, - height: 50.0, - child: const Card( - child: Text( - 'SizedBox', - textAlign: TextAlign.center, - ), - color: Color(0xFFEF5350)), - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/SizedOverflowBox/demo.dart b/lib/widgets/elements/Frame/Box/SizedOverflowBox/demo.dart deleted file mode 100644 index f69a3c0d..00000000 --- a/lib/widgets/elements/Frame/Box/SizedOverflowBox/demo.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -class SizeOverflowBoxDefault extends StatelessWidget { - final double curSizeWidth; - final double curSizeHeight; - final String text; - - SizeOverflowBoxDefault( - {Key key, this.curSizeWidth, this.curSizeHeight, this.text}) - : super(key: key); - - @override - Widget build(BuildContext context) { - return SizedOverflowBox( - size: Size(curSizeWidth, curSizeHeight), - alignment: Alignment.centerRight, - //size属性设置了大小,container 里面的大小失效, - child: Container( - color: Color(0xfff06292), - width: 50.0, - height: 50.0, - child: Text( - text, - style: TextStyle(color: Colors.white), - ), - ), - ); - } -} - -class SizeBoxDefault extends StatelessWidget { - final double curWidth; - final double curHeight; - - SizeBoxDefault({Key key, this.curHeight, this.curWidth}) : super(key: key); - - @override - Widget build(BuildContext context) { - return SizedBox( - width: curWidth, - height: curHeight, - child: const Card( - child: Text( - 'SizedBox', - style: TextStyle(color: Colors.white), - textDirection: TextDirection.rtl, - ), - color: Color(0xfff06292), - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/SizedOverflowBox/index.dart b/lib/widgets/elements/Frame/Box/SizedOverflowBox/index.dart deleted file mode 100644 index 2333db8c..00000000 --- a/lib/widgets/elements/Frame/Box/SizedOverflowBox/index.dart +++ /dev/null @@ -1,107 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:55:31 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 15:55:31 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -// const String _Text = """### **SizeBox简介** -// > 常用的一个控件,设置具体尺寸。 -// - sizebox设置width,height时候,强制child宽高为该设置, -// - sizebox的width,heigh为null,child自身设置 -// ### **属性** -// > width:宽 -// > height:高 -// - ex:200*50 sizebox -// """; -const String _Text0 = """### **简介** -> 一个特定大小的窗口小部件,将其原始约束传递给其子节点,可能会溢出。 -### **基本用法** -> alignment:对齐 -> size: 设置部件大小 -- ex:为方便看效果,现设置幕布大小为(Container)200*50。图一 - -- ex:图一,基础上添加一个不设置size属性的SizeOverflowBox。图二 - -- ex:图二,添加size属性,100*20,图三 - -- ex:图三,添加 alignment: Alignment.center, -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/SizeOverflowBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SizeOverflowBox', - codeUrl: 'elements/Frame/Box/SizedOverflowBox/demo.dart', - contentList: [ - // _Text, - _Text0, - _sizedOverflowBoxCreate(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/SizedBox-class.html', - ); - } - - Column _sizedOverflowBoxCreate() { - return Column( - children: [ - SizeBoxDefault( - curWidth: 200.0, - curHeight: 50.0, - ), - SizedBox(height: 20.0), - Container( - margin: EdgeInsets.only(top: 10.0), - color: Color(0xffd81b60), - width: 200.0, - height: 50.0, - ), - Container( - margin: EdgeInsets.only(top: 10.0), - color: Color(0xffd81b60), - alignment: Alignment.topCenter, - width: 200.0, - height: 50.0, - child: SizeOverflowBoxDefault( - text: "SizeBox", - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - color: Color(0xffd81b60), - width: 200.0, - height: 50.0, - child: SizeOverflowBoxDefault( - text: "box", - curSizeWidth: 100.0, - curSizeHeight: 20.0, - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - color: Color(0xffd81b60), - width: 200.0, - height: 50.0, - alignment: Alignment.center, - child: SizeOverflowBoxDefault( - text: "box", - curSizeWidth: 100.0, - curSizeHeight: 20.0, - ), - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/UnconstrainedBox/demo.dart b/lib/widgets/elements/Frame/Box/UnconstrainedBox/demo.dart deleted file mode 100644 index 0a62c64f..00000000 --- a/lib/widgets/elements/Frame/Box/UnconstrainedBox/demo.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:flutter/material.dart'; - -class UnconstrainedBoxDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return UnconstrainedBox( - constrainedAxis: Axis.vertical, - textDirection: TextDirection.rtl, - child: Row( - children: [ - Container( - width: 100.0, - height: 100.0, - color: Color(0xfff48fb1), - child: Text( - "data", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/UnconstrainedBox/index.dart b/lib/widgets/elements/Frame/Box/UnconstrainedBox/index.dart deleted file mode 100644 index b37fd267..00000000 --- a/lib/widgets/elements/Frame/Box/UnconstrainedBox/index.dart +++ /dev/null @@ -1,50 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:57:00 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 16:00:14 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String Text0 = """### **简介** -> 跟ConstrainedBox相反,是不添加任何约束条件到child上,让child按照其原始的尺寸渲染 -- 它的作用就是给child一个尽可能大的空间,不加约束的让其显示。 -- 如果该widget不能扩展到到足够容纳整个child的空间,child将被裁剪 -"""; - -const String Text1 = """ -### **基本用法** -- alignment 属性:控制child对齐方式 -- textDirection 属性:控制文本对齐 -- constrainedAxis 属性:如果有,就使用 - -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/UnconstrainedBox'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'UnconstrainedBox', - // desc: 'Layout-Row 使用', - codeUrl: 'elements/Frame/Box/UnconstrainedBox/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/widgets/UnconstrainedBox-class.html', - contentList: [ - Text0, - Text1, - UnconstrainedBoxDemo(), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/index.dart b/lib/widgets/elements/Frame/Box/index.dart deleted file mode 100644 index f7984ead..00000000 --- a/lib/widgets/elements/Frame/Box/index.dart +++ /dev/null @@ -1,60 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import 'ConstrainedBox/index.dart' as ConstrainedBox; -import 'DecoratedBox/index.dart' as DecoratedBox; -import 'SizeBox/index.dart' as SizeBox; -import 'SizedOverflowBox/index.dart' as SizedOverflowBox; -import 'UnconstrainedBox/index.dart' as UnconstrainedBox; -import 'OverflowBox/index.dart' as OverflowBox; -import 'FittedBox/index.dart' as FittedBox; -import 'LimitedBox/index.dart' as LimitedBox; -import 'RotatedBox/index.dart' as RotatedBox; - -List widgetPoints = [ - WidgetPoint( - name: 'ConstrainedBox', - routerName: ConstrainedBox.Demo.routeName, - buildRouter: (BuildContext context) => ConstrainedBox.Demo(), - ), - WidgetPoint( - name: 'DecoratedBox', - routerName: DecoratedBox.Demo.routeName, - buildRouter: (BuildContext context) => DecoratedBox.Demo(), - ), - WidgetPoint( - name: 'SizeBox', - routerName: SizeBox.Demo.routeName, - buildRouter: (BuildContext context) => SizeBox.Demo(), - ), - WidgetPoint( - name: 'SizedOverflowBox', - routerName: SizedOverflowBox.Demo.routeName, - buildRouter: (BuildContext context) => SizedOverflowBox.Demo(), - ), - WidgetPoint( - name: 'UnconstrainedBox', - routerName: UnconstrainedBox.Demo.routeName, - buildRouter: (BuildContext context) => UnconstrainedBox.Demo(), - ), - WidgetPoint( - name: 'OverflowBox', - routerName: OverflowBox.Demo.routeName, - buildRouter: (BuildContext context) => OverflowBox.Demo(), - ), - WidgetPoint( - name: 'FittedBox', - routerName: FittedBox.Demo.routeName, - buildRouter: (BuildContext context) => FittedBox.Demo(), - ), - WidgetPoint( - name: 'LimitedBox', - routerName: LimitedBox.Demo.routeName, - buildRouter: (BuildContext context) => LimitedBox.Demo(), - ), - WidgetPoint( - name: 'RotatedBox', - routerName: RotatedBox.Demo.routeName, - buildRouter: (BuildContext context) => RotatedBox.Demo(), - ), -]; diff --git a/lib/widgets/elements/Frame/Expanded/Expanded/expanded_demo.dart b/lib/widgets/elements/Frame/Expanded/Expanded/expanded_demo.dart deleted file mode 100644 index 24075553..00000000 --- a/lib/widgets/elements/Frame/Expanded/Expanded/expanded_demo.dart +++ /dev/null @@ -1,72 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-11-28 20:09:40 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-11-28 20:10:32 - -import 'package:flutter/material.dart'; - -class ExpandedDemo extends StatelessWidget { - - final TextStyle txtColor = TextStyle(color: Colors.white); - @override - Widget build(BuildContext context) { - return Column( - children: [ - Text('Expanded'), - Row(children: [ - RaisedButton( - onPressed: () { - print('点击红色按钮事件'); - }, - color: const Color(0xffcc0000), - child: Text('红色按钮',style: txtColor,), - ), - Expanded( - flex: 1,//flex用来设置当前可用空间的占优比 - child: RaisedButton( - onPressed: () { - print('点击黄色按钮事件'); - }, - color: const Color(0xfff1c232), - child: Text('黄色按钮',style: txtColor,), - ), - ), - RaisedButton( - onPressed: () { - print('点击粉色按钮事件'); - }, - color: const Color(0xffea9999), - child: Text('粉色按钮',style: txtColor,), - ), - ]), - Text('Flexible'), - Row(children: [ - RaisedButton( - onPressed: () { - print('点击红色按钮事件'); - }, - color: const Color(0xffcc0000), - child: Text('红色按钮',style: txtColor,), - ), - Flexible( - flex: 1, - child: RaisedButton( - onPressed: () { - print('点击黄色按钮事件'); - }, - color: const Color(0xfff1c232), - child: Text('黄色按钮',style: txtColor,), - ), - ), - RaisedButton( - onPressed: () { - print('点击粉色按钮事件'); - }, - color: const Color(0xffea9999), - child: Text('粉色按钮',style: txtColor,), - ), - ]), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Expanded/Expanded/index.dart b/lib/widgets/elements/Frame/Expanded/Expanded/index.dart deleted file mode 100644 index f7d662b5..00000000 --- a/lib/widgets/elements/Frame/Expanded/Expanded/index.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './expanded_demo.dart'; - -const contentText0 = ''' -### **简介** -> 一个用于撑开 flex 布局子组件空间的widget -- 用于在Row、Column、Flex子组件内 -- 会沾满所有可用空间 -'''; - -const contentText1 = ''' -### **基本用法** -> 以下示例对比使用 ```Expanded``` -- 使用Expanded 可以使 Row、Column或者Flex的子项能够填充主轴的全部可用空间 -- 如果存在多个子项,则根据 flex 属性来划分可用空间 -- Expanded widget 必须是Row,Column或者Flex的后代 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Expanded/Expanded'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Expanded', - codeUrl: 'elements/Frame/Expanded/Expanded/expanded_demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/Expanded-class.html', - contentList: [ - contentText0, - contentText1, - ExpandedDemo(), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Expanded/index.dart b/lib/widgets/elements/Frame/Expanded/index.dart deleted file mode 100644 index cb5dc549..00000000 --- a/lib/widgets/elements/Frame/Expanded/index.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/model/widget.dart'; - -import './Expanded/index.dart' as Expanded; - -List widgetPoints = [ - WidgetPoint( - name: 'Expanded', - routerName: Expanded.Demo.routeName, - buildRouter: (BuildContext context) => Expanded.Demo(), - ), -]; diff --git a/lib/widgets/elements/Frame/Layout/Center/demo.dart b/lib/widgets/elements/Frame/Layout/Center/demo.dart deleted file mode 100644 index caa7530b..00000000 --- a/lib/widgets/elements/Frame/Layout/Center/demo.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:flutter/material.dart'; - -class CenterDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Center( - widthFactor: 2.0, - heightFactor: 2.0, - child: Container( - color: Color(0xfff48fb1), - width: 90.0, - height: 50.0, - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Layout/Center/index.dart b/lib/widgets/elements/Frame/Layout/Center/index.dart deleted file mode 100644 index 42c2bc9c..00000000 --- a/lib/widgets/elements/Frame/Layout/Center/index.dart +++ /dev/null @@ -1,48 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:57:00 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 16:00:14 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String Text0 = """### **简介** -> 一个将child 放置于中心 -- 如果它的尺寸受到外界约束,并且widthFactor和heightFactor 为null,则widget将会尽可能的大。 -- 如果它的尺寸不受外界约束,并且相应的大小为null,则widget将会匹配child widget的大小 -- 如果相应尺寸不为null,则widget的相应尺寸将是child 尺寸和尺寸因子的乘积(例如:widthFactor是2.0,那么widget的宽度始终是其child widget宽度的2倍) -"""; - -const String Text1 = """ -### **基本用法** -> widthFacto/heightFactor 非null,将其宽/高度设置为子宽/高度乘以此系数 -- 如果widthFactor是2.0,那么widget的宽度将始终是其子宽度的两倍。 -- 如果heightFactor是2.0,那么widget的高度将始终是其子高度的两倍。 - -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Layout/Center'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Center', - codeUrl: 'elements/Frame/Layout/Center/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/Column-class.html', - contentList: [ - Text0, - Text1, - CenterDemo(), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Layout/Column/demo.dart b/lib/widgets/elements/Frame/Layout/Column/demo.dart deleted file mode 100644 index e1c5a28e..00000000 --- a/lib/widgets/elements/Frame/Layout/Column/demo.dart +++ /dev/null @@ -1,72 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:Colum describe - -import 'package:flutter/widgets.dart'; - -class ColumnDefault extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - // - MainAxisAlignment.spaceEvenly/spaceAround/spaceBetween, - // - spaceEvenly:将主轴方向空白区域均分,使得children之间空间相等,包括首尾childre - // - spaceAround:将主轴方向空白区域均分,使得children之间空间相等,但是首尾childre的空白部分为一半 - // - spaceBetween:将主轴方向空白区域均分,使得children之间空间相等,但是首尾childre靠近收尾,没有空细逢 - - // - MainAxisAlignment.start/end/center, - // - start:将children放置在主轴起点方向 - // - end:将children放置在主轴末尾方向 - // - center:将children放置在主轴中间方向 - - mainAxisAlignment: MainAxisAlignment.center, - - // > mainAxisSize 属性 - // - 一行的高度是有mainAxisSize属性控制,默认是max - // - mainAxisSize: MainAxisSize.min,一行的宽度是child传入的约束 - // - mainAxisSize: MainAxisSize.max,一行的宽度的最大宽度是传入的约束。 - // > mainAxisAlignment属性 - - // mainAxisSize: MainAxisSize.max, - //- crossAxisAlignment: CrossAxisAlignment.center/end/start, - // - 即,根据设定的位置交叉对齐 - // - center/end/start: children在交叉轴上居中/末端/起点 对齐展示 - // - stretch:让children填满交叉轴方向 - // - baseline:在交叉轴方向,使得于这个baseline对齐,如果主轴是垂直的,那么这个值是当作开始 - - children: [ - Container( - color: Color(0xfffce4ec), - width: 90.0, - height: 50.0, - ), - Container( - color: Color(0xfff8bbd0), - width: 90.0, - height: 50.0, - ), - Container( - color: Color(0xfff48fb1), - width: 90.0, - height: 50.0, - ), - Container( - color: Color(0xfff06292), - width: 90.0, - height: 50.0, - ), - Text('We move under cover and we move as one'), - Text('Through the night, we have one shot to live another day'), - Text('We cannot let a stray gunshot give us away'), - Text('We will fight up close, seize the moment and stay in it'), - Text('It’s either that or meet the business end of a bayonet'), - Text('The code word is ‘Rochambeau,’ dig me?'), - Text('Rochambeau!', - style: - DefaultTextStyle.of(context).style.apply(fontSizeFactor: 1.0)), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Layout/Column/index.dart b/lib/widgets/elements/Frame/Layout/Column/index.dart deleted file mode 100644 index 34d73786..00000000 --- a/lib/widgets/elements/Frame/Layout/Column/index.dart +++ /dev/null @@ -1,55 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:Colum describe - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String Text0 = """### **简介** -> Column 是一个将其child显示在竖直方向数组的widget,于Row相对 -- 将其child填充可用的竖直水平空间,默认竖直空间无法滚动,如有很多children,竖直空间饱和无法放置,你可以使用listView搭配使用 -- 如果你只有一个child,只需要使用对齐(Align)或者居中(Center)来展示child -"""; - -const String Text1 = """ -### **基本用法** -> 竖直布局,设置位置对齐方式 - -mainAxisSize 属性 -- 一行的高度是有mainAxisSize属性控制,默认是max - -mainAxisAlignment属性 -- 将children放置在主轴某位置 - -CrossAxisAlignment 属性 -- crossAxisAlignment: crossAxisAlignment.center/end/start, -- 即,根据设定的位置交叉对齐 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Layout/Column'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Column', - codeUrl: 'elements/Frame/Layout/Column/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/Column-class.html', - contentList: [ - Text0, - Text1, - ColumnDefault(), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Layout/Container/demo.dart b/lib/widgets/elements/Frame/Layout/Container/demo.dart deleted file mode 100644 index c09965c8..00000000 --- a/lib/widgets/elements/Frame/Layout/Container/demo.dart +++ /dev/null @@ -1,72 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:Colum describe - -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; - -class ContainerDefault extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - Center( - child: Container( - margin: const EdgeInsets.all(10.0), - color: const Color(0xfff48fb1), - width: 160.0, - height: 160.0, - ), - ) - ], - ); - } -} - -class ContainerDefaultA extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - width: 30.0, - height: 30.0, - child: Container( - width: 60.0, - height: 60.0, - color: const Color(0xfff48fb1), - ), - ), - ], - ); - } -} - -class ContainerDefaultB extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - constraints: BoxConstraints.expand( - height: Theme.of(context).textTheme.display1.fontSize * 1.1 + 200.0, - ), - padding: const EdgeInsets.all(8.0), - color: Colors.teal.shade700, - alignment: Alignment.center, - child: Text('Hello World', - style: Theme.of(context) - .textTheme - .display1 - .copyWith(color: Colors.white)), - foregroundDecoration: BoxDecoration( - image: DecorationImage( - image: NetworkImage('https://www.example.com/images/frame.png'), - centerSlice: Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0), - ), - ), - transform: Matrix4.rotationZ(0.1), - ); - } -} diff --git a/lib/widgets/elements/Frame/Layout/Container/index.dart b/lib/widgets/elements/Frame/Layout/Container/index.dart deleted file mode 100644 index 86848cb7..00000000 --- a/lib/widgets/elements/Frame/Layout/Container/index.dart +++ /dev/null @@ -1,49 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:Colum describe - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String Text0 = """### **简介** -> 一个常用的widget,它结合了常见的绘画,定位和大小调整 -- 该容器首先让child填充绘制,然后再将其他的约束应用于填充范围。 -- 在绘画过程中,容器先应用给定的转换,再绘制装饰以填充的范围,然后绘制child,最后绘制前景,同时填充需要填充的范围 -- 没有child的容器将尽可能的大,除非传入的约束是无限制的。child的大小会被width,height等约束覆盖。 -"""; - -const String Text1 = """ -### **基本用法** -> Container 可以结合多种其他widget,每个widget都有自己的布局行为,因此Container的布局行为有点复杂。 -- 简单说,就是如果窗口小部件没有子窗口,没有height,没有width,没有约束,并且父窗口提供无限制约束,则Container会尝试尽可能小。 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Layout/Container'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Container', - codeUrl: 'elements/Frame/Layout/Container/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/Container-class.html', - contentList: [ - Text0, - Text1, - ContainerDefaultA(), - ContainerDefault(), - ContainerDefaultB(), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Layout/Row/demo.dart b/lib/widgets/elements/Frame/Layout/Row/demo.dart deleted file mode 100644 index 7e26823b..00000000 --- a/lib/widgets/elements/Frame/Layout/Row/demo.dart +++ /dev/null @@ -1,126 +0,0 @@ - import 'package:flutter/material.dart'; -/// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:Row - -import 'package:flutter/widgets.dart'; - -class RowMainAxisAlignment extends StatelessWidget { - //> mainAxisAlignment属性 - // - MainAxisAlignment.spaceEvenly/spaceAround/spaceBetween, - // - spaceEvenly:将主轴方向空白区域均分,使得children之间空间相等,包括首尾childre - // - spaceAround:将主轴方向空白区域均分,使得children之间空间相等,但是首尾childre的空白部分为一半 - // - spaceBetween:将主轴方向空白区域均分,使得children之间空间相等,但是首尾childre靠近收尾,没有空细逢 - // - MainAxisAlignment.start/end/center, - // - start:将children放置在主轴起点方向 - // - end:将children放置在主轴末尾方向 - // - center:将children放置在主轴中间方向 - - final MainAxisAlignment status; - - // > CrossAxisAlignment 属性 - // - crossAxisAlignment: CrossAxisAlignment.center/end/start, - // - 即,根据设定的位置交叉对齐 - // - center/end/start: children在交叉轴上居中/末端/起点 对齐展示 - // - stretch:让children填满交叉轴方向 - // - baseline:在交叉轴方向,使得于这个baseline对齐,如果主轴是垂直的,那么这个值是当作开始 - - final CrossAxisAlignment crossStatus; - - const RowMainAxisAlignment(this.status, this.crossStatus) : super(); - - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: status, - children: [ - Container( - color: Color(0xfffce4ec), - width: 90.0, - height: 50.0, - ), - Container( - color: Color(0xfff8bbd0), - width: 90.0, - height: 50.0, - ), - Container( - color: Color(0xfff48fb1), - width: 90.0, - height: 50.0, - ), - ], - ); - } -} - -class RowLayoutCreate extends StatelessWidget { - const RowLayoutCreate() : super(); - - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(top: 20.0, bottom: 20.0), - color: Color(0xfffce4ec), - width: 60.0, - height: 50.0, - ), - Container( - margin: EdgeInsets.only(top: 20.0, bottom: 20.0), - color: Color(0xfff8bbd0), - width: 60.0, - height: 50.0, - ), - Container( - margin: EdgeInsets.only(top: 20.0, bottom: 20.0), - color: Color(0xfff48fb1), - width: 60.0, - height: 50.0, - ), - Container( - margin: EdgeInsets.only(top: 20.0, bottom: 20.0), - color: Color(0xfff06292), - width: 60.0, - height: 50.0, - ), - ], - ); - } -} - -class RowExpanded extends StatelessWidget{ - @override - Widget build(BuildContext context) { - - return Row( - children: [ - ////填充数据 - Expanded(child: new RaisedButton( - onPressed: (){ - }, - color: Color(0xfffce4ec), - child:new Text('flutter',style: TextStyle(color: Colors.white),) - ),), - Expanded(child: new RaisedButton( - onPressed: (){ - }, - color: Color(0xfff8bbd0), - child:new Text('Expanded',style: TextStyle(color: Colors.white),) - ),), - Expanded(child: new RaisedButton( - onPressed: (){ - }, - color: Color(0xfff48fb1), - child:new Text('flutter',style: TextStyle(color: Colors.white),) - ),), - ], - ); - } - -} diff --git a/lib/widgets/elements/Frame/Layout/Row/index.dart b/lib/widgets/elements/Frame/Layout/Row/index.dart deleted file mode 100644 index 4ebb6f8f..00000000 --- a/lib/widgets/elements/Frame/Layout/Row/index.dart +++ /dev/null @@ -1,107 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:Row - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String Text0 = """### **简介** -> Row 是一个将其child显示在水平数组的widget -- 将其child填充可用的横向水平空间,一行高度是childs的最大高度(即:总是满足传入的垂直约束) -- 如果你只有一个child,只需要考虑使用对其或者中间位置,如果多个child,注意扩展水平空间(Expanded),可以将child封装在一个扩展部件里面 -- 当我们看到行有黄色和黑色条纹警告时候,说明行已经溢出,当行溢出,行之间空间将没有任何空间可供扩展。 - -"""; - -const String Text1 = """ -### **基本用法** -> 水平布局,设置位置对齐方式 - -mainAxisSize 属性 -- 一行的高度是有mainAxisSize属性控制,默认是max - - mainAxisAlignment属性 -- 将children放置在主轴某位置 - - CrossAxisAlignment 属性 -- crossAxisAlignment: crossAxisAlignment.center/end/start, -- 即,根据设定的位置交叉对齐 -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Layout/Row'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Row', - // desc: 'Layout-Row 使用', - codeUrl: 'elements/Frame/Layout/Row/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/Row-class.html', - contentList: [ - Text0, - Text1, - _rowCreate(), - ], - ); - } - - Column _rowCreate() { - return Column( - children: [ - RowLayoutCreate(), - SizedBox(height: 10.0,), - RowExpanded(), - Row( - children: [ - Expanded( - child: - Text('Deliver features faster', textAlign: TextAlign.center), - ), - Expanded( - child: Text('Craft beautiful UIs', textAlign: TextAlign.center), - ), - Expanded( - child: FittedBox( - fit: BoxFit.contain, // otherwise the logo will be tiny - child: const FlutterLogo(), - ), - ), - ], - ), - Row( - children: [ - const FlutterLogo(), - const Expanded( - child: const Text( - 'Flutter\'s hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android.'), - ), - const Icon(Icons.sentiment_very_satisfied), - ], - ), - SizedBox(height: 30.0), - RowMainAxisAlignment(MainAxisAlignment.spaceEvenly, null), - SizedBox(height: 10.0), - RowMainAxisAlignment(MainAxisAlignment.spaceAround, null), - SizedBox(height: 10.0), - RowMainAxisAlignment(MainAxisAlignment.spaceBetween, null), - SizedBox(height: 30.0), - RowMainAxisAlignment(MainAxisAlignment.start, null), - SizedBox(height: 10.0), - RowMainAxisAlignment(MainAxisAlignment.center, null), - SizedBox(height: 10.0), - RowMainAxisAlignment(MainAxisAlignment.end, null), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Layout/index.dart b/lib/widgets/elements/Frame/Layout/index.dart deleted file mode 100644 index b936fa00..00000000 --- a/lib/widgets/elements/Frame/Layout/index.dart +++ /dev/null @@ -1,30 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import 'Row/index.dart' as Row; -import 'Column/index.dart' as Column; -import 'Container/index.dart' as Container; -import 'Center/index.dart' as Center; - -List widgetPoints = [ - WidgetPoint( - name: 'Row', - routerName: Row.Demo.routeName, - buildRouter: (BuildContext context) => Row.Demo(), - ), - WidgetPoint( - name: 'Column', - routerName: Column.Demo.routeName, - buildRouter: (BuildContext context) => Column.Demo(), - ), - WidgetPoint( - name: 'Container', - routerName: Container.Demo.routeName, - buildRouter: (BuildContext context) => Container.Demo(), - ), - WidgetPoint( - name: 'Center', - routerName: Center.Demo.routeName, - buildRouter: (BuildContext context) => Center.Demo(), - ), -]; diff --git a/lib/widgets/elements/Frame/Spacing/AnimatedPadding/animatedPadding_demo.dart b/lib/widgets/elements/Frame/Spacing/AnimatedPadding/animatedPadding_demo.dart deleted file mode 100644 index 93bea0eb..00000000 --- a/lib/widgets/elements/Frame/Spacing/AnimatedPadding/animatedPadding_demo.dart +++ /dev/null @@ -1,53 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-28 20:42:40 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-11-28 20:42:40 - -import 'package:flutter/material.dart'; - -class AnimatedPaddingDemo extends StatefulWidget { - _AnimatedPaddingDemoState createState() => _AnimatedPaddingDemoState(); -} - -class _AnimatedPaddingDemoState extends State { - double paddingValue; - - void initState() { - super.initState(); - paddingValue = 10.0; - } - - _changePadding() { - if (paddingValue == 10.0) { - setState(() { - paddingValue = 100.0; - }); - } else { - setState(() { - paddingValue = 10.0; - }); - } - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - AnimatedPadding( - padding: EdgeInsets.symmetric( - horizontal: paddingValue, vertical: paddingValue), - duration: const Duration(milliseconds: 100), - curve: Curves.easeInOut, - child: Container( - height: 200.0, - color: Colors.blueAccent, - ), - ), - RaisedButton( - onPressed: _changePadding, - child: Text('change padding'), - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Spacing/AnimatedPadding/index.dart b/lib/widgets/elements/Frame/Spacing/AnimatedPadding/index.dart deleted file mode 100644 index 623bca26..00000000 --- a/lib/widgets/elements/Frame/Spacing/AnimatedPadding/index.dart +++ /dev/null @@ -1,43 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-28 20:44:13 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2019-01-14 17:02:20 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './animatedPadding_demo.dart'; - -const contentDesc0 = ''' -### **简介** -> 属于Flutter动画成员的一部分 -'''; - -const contentDesc1 = ''' -### **基本用法** -> 动画版本的Padding -- 在给定的时间内,自动完成转换缩进到给定的padding值 -- 通过设置curve 来指定动画的运行速率动画 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/spacing/AnimatedPadding'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'AnimatedPadding', - contentList: [ - contentDesc0, - contentDesc1, - AnimatedPaddingDemo(), - ], - docUrl: - 'https://docs.flutter.io/flutter/widgets/AnimatedPadding-class.html', - codeUrl: 'elements/Frame/Spacing/AnimatedPadding/animatedPadding_demo.dart', - ); - } -} diff --git a/lib/widgets/elements/Frame/Spacing/Padding/index.dart b/lib/widgets/elements/Frame/Spacing/Padding/index.dart deleted file mode 100644 index 82233cd7..00000000 --- a/lib/widgets/elements/Frame/Spacing/Padding/index.dart +++ /dev/null @@ -1,44 +0,0 @@ - /// Author: 一凨 - /// Date: 2018-11-28 20:25:24 - /// Last Modified by: 一凨 - /// Last Modified time: 2019-01-14 17:01:55 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './padding_demo.dart'; - -const contentDesc0=''' -### **简介** -> widget 内边距 -- 类似于前端中的 div+css:padding 效果 -- Container + padding = Padding -'''; - -const contentDesc1 = ''' -### **基本用法** -> Padding widget 的padding必须设置,不能为null -- 通过给定的padding值来隔开子组件 -- 通过EdgeInsets 类来计算 padding的大小 -'''; -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/spacing/Padding'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Padding', - contentList: [ - contentDesc0, - contentDesc1, - PaddingDemo() - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/Padding-class.html', - codeUrl: - 'elements/Frame/Spacing/Padding/padding_demo.dart', - ); - } -} diff --git a/lib/widgets/elements/Frame/Spacing/Padding/padding_demo.dart b/lib/widgets/elements/Frame/Spacing/Padding/padding_demo.dart deleted file mode 100644 index 6721d366..00000000 --- a/lib/widgets/elements/Frame/Spacing/Padding/padding_demo.dart +++ /dev/null @@ -1,23 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-28 20:20:04 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2019-01-14 16:30:16 - -import 'package:flutter/material.dart'; - -class PaddingDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - color: Colors.blueAccent, - child: Padding( - padding: const EdgeInsets.all(18.0),//通过 EdgeInsets 来设置 padding的值 - child: Container( - height: 100.0, - width: 100.0, - color: Colors.amberAccent, - ), - ), - ); - } -} diff --git a/lib/widgets/elements/Frame/Spacing/SliverPadding/index.dart b/lib/widgets/elements/Frame/Spacing/SliverPadding/index.dart deleted file mode 100644 index e836f35c..00000000 --- a/lib/widgets/elements/Frame/Spacing/SliverPadding/index.dart +++ /dev/null @@ -1,48 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-28 20:26:16 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2019-01-14 17:06:36 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './sliverpadding_demo.dart'; - -const contentDesc0 = ''' -### **简介** -> SliverPadding 属于 Flutter Slivers大家族中的一个 -- SliverPadding 是 Slivers 大家族中的一类padding -- 可以配合各种 Sliver成员使用 -'''; - -const contentDesc1 = ''' -### **基本用法** -> 这里我们结合Slivers家族中的 SliverList 来演示使用 -- Flutter 中的Slivers大家族基本都是配合CustomScrollView来实现一些自定义滚动效果 -- padding作用于每一个item -- 对于有些特殊的sliver可能会有副作用,比如对于 ```pinned:true``` 的 SliverPersisitentHeader 设置可能会导致 APPBar与之前的sliver重叠 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/spacing/SliverPadding'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'SliverPadding', - codeUrl: 'elements/Frame/Spacing/SliverPadding/sliverpadding_demo.dart', - contentList: [ - contentDesc0, - contentDesc1, - SliverPaddingDemo(), - ], - docUrl: - 'https://docs.flutter.io/flutter/widgets/SliverPadding-class.html', - ); - } - - -} diff --git a/lib/widgets/elements/Frame/Spacing/SliverPadding/product_list.dart b/lib/widgets/elements/Frame/Spacing/SliverPadding/product_list.dart deleted file mode 100644 index 0c802382..00000000 --- a/lib/widgets/elements/Frame/Spacing/SliverPadding/product_list.dart +++ /dev/null @@ -1,56 +0,0 @@ - - -class ProductItem { - final String name; - final String tag; - final String asset; - final int stock; - final double price; - - ProductItem({ - this.name, - this.tag, - this.asset, - this.stock, - this.price, - }); -} - -final List products = [ - ProductItem( - name: 'Bueno Chocolate', - tag: '1', - asset: 'assets/images/food01.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Chocolate with berries', - tag: '2', - asset: 'assets/images/food02.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Trumoo Candies', - tag: '3', - asset: 'assets/images/food03.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Choco-coko', - tag: '4', - asset: 'assets/images/food04.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Chocolate tree', - tag: '5', - asset: 'assets/images/food05.jpeg', - stock: 1, - price: 71.0), - ProductItem( - name: 'Chocolate', - tag: '6', - asset: 'assets/images/food06.jpeg', - stock: 1, - price: 71.0), -]; diff --git a/lib/widgets/elements/Frame/Spacing/SliverPadding/sliverpadding_demo.dart b/lib/widgets/elements/Frame/Spacing/SliverPadding/sliverpadding_demo.dart deleted file mode 100644 index db0fe909..00000000 --- a/lib/widgets/elements/Frame/Spacing/SliverPadding/sliverpadding_demo.dart +++ /dev/null @@ -1,70 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-28 20:36:17 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-11-28 20:36:17 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/widgets/components/Scroll/CustomScrollView/product_list.dart'; - -class SliverPaddingDemo extends StatelessWidget { - - - Widget _buildItem(BuildContext context,ProductItem product){ - return Container( - height: 100.0, - margin: const EdgeInsets.only(bottom: 5.0), - padding: const EdgeInsets.only(left: 10.0), - color: Colors.blueGrey, - child: Stack( - alignment: AlignmentDirectional.centerStart, - children: [ - Positioned( - right: 40.0, - child: Card( - child: Center( - child: Text( - product.name, - style: Theme.of(context).textTheme.title, - textAlign: TextAlign.center, - ), - ), - )), - ClipRRect( - child: SizedBox( - width: 70.0, - height: 70.0, - child: Image.asset( - product.asset, - fit: BoxFit.cover, - ), - ), - borderRadius: BorderRadius.all(Radius.circular(8.0)), - ), - ], - ), - ); - } - - @override - Widget build(BuildContext context) { - return CustomScrollView( - shrinkWrap: true, - slivers: [ - SliverPadding( - padding: const EdgeInsets.fromLTRB(50.0,10.0,20.0,0.0), - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return _buildItem(context, products[index]); - }, - childCount: products.length, - ), - ), - ) - ], - ); - } - - -} \ No newline at end of file diff --git a/lib/widgets/elements/Frame/Spacing/index.dart b/lib/widgets/elements/Frame/Spacing/index.dart deleted file mode 100644 index c3d97c1d..00000000 --- a/lib/widgets/elements/Frame/Spacing/index.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../../../../model/widget.dart'; -import './Padding/index.dart' as Padding; -import './SliverPadding/index.dart' as SliverPadding; -import './AnimatedPadding/index.dart' as AnimatedPadding; - -List widgetPoints = [ - WidgetPoint( - name: 'Padding', - routerName: Padding.Demo.routeName, - buildRouter: (BuildContext context) => Padding.Demo(), - ), - WidgetPoint( - name: 'SliverPadding', - routerName: SliverPadding.Demo.routeName, - buildRouter: (BuildContext context) => SliverPadding.Demo(), - ), - WidgetPoint( - name: 'AnimatedPadding', - routerName: AnimatedPadding.Demo.routeName, - buildRouter: (BuildContext context) => AnimatedPadding.Demo(), - ), -]; diff --git a/lib/widgets/elements/Frame/Stack/IndexedStack/demo.dart b/lib/widgets/elements/Frame/Stack/IndexedStack/demo.dart deleted file mode 100644 index bfc83c8c..00000000 --- a/lib/widgets/elements/Frame/Stack/IndexedStack/demo.dart +++ /dev/null @@ -1,90 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:indexedStack - -import 'package:flutter/material.dart'; - -class StackDefault extends StatelessWidget { - final int currIndex; - - const StackDefault(this.currIndex) : super(); - - @override - Widget build(BuildContext context) { - return IndexedStack( - index: currIndex, - children: [ -// CircleAvatar( -// backgroundImage: AssetImage('images/timg.jpeg'), -// radius: 100.0, -// ), -// Image.asset( -// 'images/timg.jpeg', -// width: 600.0, -// height: 240.0, -// fit: BoxFit.cover, -// ), - CircleAvatar( - backgroundColor: Color(0xfff48fb1), - radius: 40.0, - ), - Container( - decoration: BoxDecoration( - color: Colors.black45, - ), - child: Text( - 'IndexedStack', - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), - ], - ); - } -} - -class StackIndex extends StatelessWidget { - final int currIndex; - - const StackIndex(this.currIndex) : super(); - - @override - Widget build(BuildContext context) { - return IndexedStack( - index: currIndex, - children: [ - Icon( - Icons.update, - size: 40.0, - color: Color(0xffe91e63), - ), - Icon( - Icons.access_alarm, - size: 40.0, - color: Color(0xffe91e63), - ), - Icon( - Icons.add_alarm, - size: 40.0, - color: Color(0xffe91e63), - ), - Icon( - Icons.access_time, - size: 40.0, - color: Color(0xffe91e63), - ), - Icon( - Icons.alarm_off, - size: 40.0, - color: Color(0xffe91e63), - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Stack/IndexedStack/index.dart b/lib/widgets/elements/Frame/Stack/IndexedStack/index.dart deleted file mode 100644 index da85006c..00000000 --- a/lib/widgets/elements/Frame/Stack/IndexedStack/index.dart +++ /dev/null @@ -1,108 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2019-01-08 15:57:00 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 16:00:14 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String _stackText0 = """### **简介** -> 显示一个子项列表的单个子项。 -- 只显示指定位置的widget,其他的位置的widget不会显示,所以indexedStack的尺寸永远和最大的子节点一样。 -- 显示的子项widget是给到了具体的索引选择出来的widget -- 如果value 为null,将不显示任何内容 -"""; -const String _stackText1 = """### **基本用法** -> index → int -- 控制显示child的索引 -- ex:可以通过多个图片转化表示状态(正确,错误,警告等)。 - """; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Stack/IndexedStack'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - int currIndex = 0; - - void _indexAdd() { - setState(() { - if (currIndex > 4) - currIndex = 0; - else - currIndex++; - }); - } - - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'IndexedStack', - // desc: _desc, - codeUrl: 'elements/Frame/Stack/IndexedStack/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/IndexedStack-class.html', - contentList: [ - _stackText0, - _stackText1, - _indexedStackCreate(), - ], - ); - } - - Column _indexedStackCreate() { - return Column( - children: [ - SizedBox( - height: 10.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - color: Color(0xffe91e63), - child: StackDefault(0), - ), - Container( - color: Color(0xffe91e63), - child: StackDefault(1), - ) - ], - ), - SizedBox( - height: 10.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - StackIndex(0), - StackIndex(1), - StackIndex(2), - StackIndex(3), - StackIndex(4), - ], - ), - SizedBox( - height: 10.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - FlatButton.icon( - onPressed: () { - _indexAdd(); - }, - icon: Icon(Icons.adb), - label: Text("点击这里")), - StackIndex(currIndex) - ], - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Stack/Stack/demo.dart b/lib/widgets/elements/Frame/Stack/Stack/demo.dart deleted file mode 100644 index b1a72425..00000000 --- a/lib/widgets/elements/Frame/Stack/Stack/demo.dart +++ /dev/null @@ -1,142 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018/11/22 - /// Email: xiaojia.dxj@alibaba-inc.com - /// LastUpdateTime: 2018/11/22 - /// LastUpdateBy: xj.deng - /// Describle:stack描述 - -import 'package:flutter/material.dart'; - -class StackDefault extends StatelessWidget { - const StackDefault() : super(); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Stack( - //fit :定义如何设置non-positioned节点尺寸 - fit: StackFit.loose, - overflow: Overflow.clip, - textDirection: TextDirection.ltr, - alignment: Alignment.center, - children: [ - Container( - color: Color(0xfff48fb1), - width: 100.0, - height: 50.0, - ), - Text("stack demo", - textDirection: TextDirection.ltr, - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - letterSpacing: 5.0, - color: Colors.white)), - ], - ), - ], - ); - } -} - -class StackDefault2 extends StatelessWidget { - const StackDefault2() : super(); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Stack( - //fit :定义如何设置non-positioned节点尺寸 - fit: StackFit.loose, - overflow: Overflow.clip, - textDirection: TextDirection.ltr, - alignment: Alignment.center, - children: [ - Text("stack demo", - textDirection: TextDirection.ltr, - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - letterSpacing: 5.0, - color: Colors.white)), - Container( - color: Color(0xfff48fb1), - width: 100.0, - height: 50.0, - ), - ], - ), - ], - ); - } -} - -class StackPositioned extends StatelessWidget { - const StackPositioned() : super(); - - @override - Widget build(BuildContext context) { - return Stack( - alignment: Alignment.center, - children: [ - Positioned( - child: Icon( - Icons.monetization_on, - size: 40.0, - color: Colors.yellow[300], - )), - Positioned( - left: 40.0, - child: Icon( - Icons.monetization_on, - size: 40.0, - color: Colors.yellow[600], - )), - Positioned( - left: 60.0, - child: Icon( - Icons.monetization_on, - size: 40.0, - color: Colors.yellow[600], - )), - Positioned( - left: 80.0, - child: Icon( - Icons.monetization_on, - size: 40.0, - color: Colors.yellow[600], - )), - ], - ); - } -} - -class StackLayout extends StatelessWidget { - const StackLayout() : super(); - - @override - Widget build(BuildContext context) { - return Stack( - overflow: Overflow.visible, - alignment: const Alignment(0.2, 0.6), - children: [ - CircleAvatar( - backgroundColor: Color(0xfff48fb1), - radius: 140.0, - ), - Container( - decoration: BoxDecoration(color: Colors.black45), - child: Text( - 'Min', - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold, - color: Colors.white), - ), - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Stack/Stack/index.dart b/lib/widgets/elements/Frame/Stack/Stack/index.dart deleted file mode 100644 index 6787abd6..00000000 --- a/lib/widgets/elements/Frame/Stack/Stack/index.dart +++ /dev/null @@ -1,92 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String _stackText0 = """### **简介** -> 用于将多个childs相对于其框的边缘定位,多用于以简单方式重叠children -- 当第一个child置于底部时,堆栈按顺序绘制其子项。如果更改子项绘制顺序,可以使用新顺序重新建立堆栈 -- 注意:stack的每一个子节点都已定位或未定位,定位子项必须至少一个非null属性的定位。 - -"""; -const String _stackText1 = """### **基本用法** -> 1.alignment → AlignmentGeometry -- 对齐方式,默认是右上角,详情请点击Layout-row页面,类似 -- 多个positioned叠加图层,Alignment.center事例 -"""; -const String _stackText2 = """### -> fit → StackFit -- loose:放开了子节点宽高的约束,可以让子节点从0到最大尺寸 -- expand: 子节点最大可能的占用空间,允许最大大小 -- passthrough:不改变子节点约束 - ->textDirection → TextDirection -- 文本方向 - -> overflow → Overflow -- 超过的部分是否裁剪掉 -- overflow: Overflow.clip/visible -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Stack/Stack'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Stack', - codeUrl: 'elements/Frame/Stack/Stack/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/Stack-class.html', - contentList: [ - _stackText0, - _stackCreate(), - _stackText1, - Container( - width: 300.0, - height: 100.0, - margin: EdgeInsets.only(top: 10.0, bottom: 10.0), - color: Color(0xffe91e63), - child: StackPositioned(), - ), - _stackText2, - Container( - width: 200.0, - height: 200.0, - color: Color(0xffe91e63), - child: StackLayout(), - ), - ], - ); - } - - Column _stackCreate() { - return Column( - children: [ - Column( - children: [ - Container( - margin: EdgeInsets.only(top: 10.0, bottom: 10.0), - width: 300.0, - height: 100.0, - color: Color(0xffe91e63), - child: StackDefault(), - ), - Container( - width: 300.0, - height: 100.0, - color: Color(0xffe91e63), - //堆栈顺序替换掉 - child: StackDefault2(), - ) - ], - ), - SizedBox(height: 10.0), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Stack/index.dart b/lib/widgets/elements/Frame/Stack/index.dart deleted file mode 100644 index 7ee38c94..00000000 --- a/lib/widgets/elements/Frame/Stack/index.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/model/widget.dart'; -import './Stack/index.dart' as Stack; -import './IndexedStack/index.dart' as IndexedStack; - -List widgetPoints = [ - WidgetPoint( - name: 'Stack', - routerName: Stack.Demo.routeName, - buildRouter: (BuildContext context) => Stack.Demo(), - ), - WidgetPoint( - name: 'IndexedStack', - routerName: IndexedStack.Demo.routeName, - buildRouter: (BuildContext context) => IndexedStack.Demo(), - ), -]; diff --git a/lib/widgets/elements/Frame/Table/Table/index.dart b/lib/widgets/elements/Frame/Table/Table/index.dart deleted file mode 100644 index 7706c69d..00000000 --- a/lib/widgets/elements/Frame/Table/Table/index.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './table_demo.dart'; - -const contentDesc0 = ''' -### **简介** -> 一种布局方法 -- 一个可以对齐子元素进行table 布局算法的Widget -'''; -const contentDesc1 = ''' -### **基本用法** -> 大多用于多行多列的需求 -- 如果你只有一行或者一列,其实选择Row和Column更合适一些 -- 表格中行的大小是根据列行数和宽度计算的来,控制列宽可以使用 columnWidth 属性 -- 注意,Table中每一行的列数需要一致,否则报错 -'''; -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Table/Table'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Table', - codeUrl: - 'elements/Frame/Table/Table/table_demo.dart', - contentList: [ - contentDesc0, - contentDesc1, - TableDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/Table-class.html', - ); - } -} diff --git a/lib/widgets/elements/Frame/Table/Table/table_demo.dart b/lib/widgets/elements/Frame/Table/Table/table_demo.dart deleted file mode 100644 index 9d81d71e..00000000 --- a/lib/widgets/elements/Frame/Table/Table/table_demo.dart +++ /dev/null @@ -1,51 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-28 20:52:35 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-11-28 20:59:50 - -import 'package:flutter/material.dart'; - -class TableDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - margin:const EdgeInsets.only(top: 10.0), - child:Table( - columnWidths: const { - 0: FixedColumnWidth(50.0), - 1: FixedColumnWidth(100.0), - 2: FixedColumnWidth(50.0), - 3: FixedColumnWidth(100.0), - }, - border: TableBorder.all( - color: Colors.red, width: 1.0, style: BorderStyle.solid), - children: const [ - TableRow( - children: [ - Text('A1'), - Text('B1'), - Text('C1'), - Text('D1'), - ], - ), - TableRow( - children: [ - Text('A2'), - Text('B2'), - Text('C2'), - Text('D2'), - ], - ), - TableRow( - children: [ - Text('A3'), - Text('B3'), - Text('C3'), - Text('D3'), - ], - ), - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Frame/Table/index.dart b/lib/widgets/elements/Frame/Table/index.dart deleted file mode 100644 index 4d35e127..00000000 --- a/lib/widgets/elements/Frame/Table/index.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../../../../model/widget.dart'; -import './Table/index.dart' as Table; - -List widgetPoints = [ - WidgetPoint( - name: 'Table', - routerName: Table.Demo.routeName, - buildRouter: (BuildContext context) => Table.Demo(), - ), -]; diff --git a/lib/widgets/elements/Frame/index.dart b/lib/widgets/elements/Frame/index.dart deleted file mode 100644 index 25348967..00000000 --- a/lib/widgets/elements/Frame/index.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'Spacing/index.dart' as Spacing; -import 'Expanded/index.dart' as Expanded; -import 'Table/index.dart' as Table; -import 'Align/index.dart' as Align; -import 'Layout/index.dart' as Layout; -import 'Stack/index.dart' as Stack; -import 'Box/index.dart' as Box; - - -List getWidgets() { - List result = []; - result.addAll(Spacing.widgetPoints); - result.addAll(Expanded.widgetPoints); - // result.addAll(Axis.widgetPoints); - result.addAll(Table.widgetPoints); - result.addAll(Align.widgetPoints); - result.addAll(Layout.widgetPoints); - result.addAll(Stack.widgetPoints); - result.addAll(Box.widgetPoints); - return result; -} diff --git a/lib/widgets/elements/Media/Canvas/Canvas/demo.dart b/lib/widgets/elements/Media/Canvas/Canvas/demo.dart deleted file mode 100644 index eee36df0..00000000 --- a/lib/widgets/elements/Media/Canvas/Canvas/demo.dart +++ /dev/null @@ -1,322 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: Canvas 的示例 - -import 'dart:ui'; -import 'dart:ui' as ui; -import 'dart:typed_data'; -import 'dart:math'; -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart' show rootBundle; - -CustomPaint graph; -var image; - -class CustomViewPage extends StatefulWidget { - - final String type; - CustomViewPage({this.type='drawLine'}) : super(); - - @override - State createState() => CustomViewPageState(); -} - -class CustomViewPageState extends State - with SingleTickerProviderStateMixin { - - static Future getImage(String asset) async { - ByteData data = await rootBundle.load(asset); - Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List()); - FrameInfo fi = await codec.getNextFrame(); - return fi.image; - } - - @override - void initState() { - super.initState(); - getImage("assets/images/painterImg.jpeg").then((data) { - if (mounted) { - setState(() { - image = data; - }); - } - }); - } - - @override - Widget build(BuildContext context) { - graph = CustomPaint( - painter: DrawPainter(type:widget.type) - ); - return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width * 0.6, - margin: EdgeInsets.all(10.0), - //padding: EdgeInsets.all(10.0), - child: graph - //child:Center(child: graph) - ); - } - - - @override - void reassemble() { - super.reassemble(); - } - - @override - void dispose() { - super.dispose(); - } -} - -///新建类继承于CustomPainter并且实现CustomPainter里面的paint()和shouldRepaint方法 -class DrawPainter extends CustomPainter { - Paint painter; - final type; - - DrawPainter ({this.type}){ - // Paint painter = Paint() - // ..color = Colors.blueAccent //画笔颜色 - // ..strokeCap = StrokeCap.round //画笔笔触类型 - // ..isAntiAlias = true //是否启动抗锯齿 - // ..blendMode = BlendMode.exclusion //颜色混合模式 - // ..style = PaintingStyle.fill //绘画风格,默认为填充 - // ..colorFilter = ColorFilter.mode(Colors.blueAccent,BlendMode.exclusion) //颜色渲染模式,一般是矩阵效果来改变的,但是flutter中只能使用颜色混合模式 - // ..maskFilter = MaskFilter.blur(BlurStyle.inner, 3.0) //模糊遮罩效果,flutter中只有这个 - // ..filterQuality = FilterQuality.high //颜色渲染模式的质量 - // ..strokeWidth = 15.0 ;//画笔的宽度 - - painter = new Paint() - ..color = Colors.blueAccent - ..strokeCap = StrokeCap.round - ..isAntiAlias = true - ..strokeWidth = 5.0 - ..filterQuality = FilterQuality.high - ..style = PaintingStyle.stroke; - } - ///Flutter中负责View绘制的地方,使用传递来的canvas和size即可完成对目标View的绘制 - - @override - void paint(Canvas canvas, Size size) { - switch(type) { - case 'drawPoints': - const List points1 = [Offset(20.0, 0.0), Offset(100.0, 50.0), Offset(150.0, 0.0),Offset(300.0, 0.0)]; - const List points2 = [Offset(20.0, 100.0), Offset(100.0, 100.0), Offset(150.0, 100.0), Offset(300.0, 100.0)]; - const List points3 = [Offset(20.0, 150.0), Offset(100.0, 150.0), Offset(150.0, 180.0), Offset(300.0, 150.0)]; - //绘制点 - canvas.drawPoints( - ///PointMode的枚举类型有三个,points(点),lines(线,隔点连接),polygon(线,相邻连接) - PointMode.points, - points1, - painter..color = Colors.redAccent // 这里可以追加修改 painter 属性 - ..strokeWidth = 10.0 - ); - canvas.drawPoints( - ///PointMode的枚举类型有三个,points(点),lines(线,隔点连接),polygon(线,相邻连接) - PointMode.lines, - points2, - painter..color = Colors.orange // 这里可以追加修改 painter 属性 - ..strokeWidth = 10.0 - ); - canvas.drawPoints( - ///PointMode的枚举类型有三个,points(点),lines(线,隔点连接),polygon(线,相邻连接) - PointMode.polygon, - points3, - painter..color = Colors.blue // 这里可以追加修改 painter 属性 - ..strokeWidth = 10.0 - ); - break; - case 'drawLine': - //绘制直线 - canvas.drawLine(Offset(20.0, 0.0), Offset(size.width*0.8, 200), painter ..color = Colors.redAccent); - break; - case 'rawCircle': - //绘制圆 参数(圆心,半径,画笔) - canvas.drawCircle( - Offset(size.width/2, 100.0), - 100.0, - painter - ..color = Colors.greenAccent - ..style = PaintingStyle.stroke //绘画风格改为stroke - ); - break; - case 'drawOval': - // 绘制椭圆 - // 使用左上和右下角坐标来确定矩形的大小和位置,椭圆是在这个矩形之中内切的形状 - Rect rect1 = Rect.fromPoints(Offset(0.0, 0.0), Offset(size.width, 200.0)); - canvas.drawOval(rect1, painter ..color = Colors.indigo); - break; - case 'drawArc': - // 绘制圆弧 - // Rect来确认圆弧的位置,还需要开始的弧度、结束的弧度、是否使用中心点绘制、以及paint弧度 - const PI = 3.1415926; - Rect rect1 = Rect.fromCircle(center: Offset(20, 50.0), radius: 100.0); - canvas.drawArc(rect1, 0.0, PI / 2, false, painter ..color = Colors.pink); - - Rect rect2 = Rect.fromCircle(center: Offset(size.width*0.6, 50.0), radius: 100.0); - canvas.drawArc(rect2, 0.0, PI / 2, true, painter ..color = Colors.deepPurple); - break; - case 'drawRRect': - /// fromPoints(Offset a, Offset b) - /// 使用左上和右下角坐标来确定矩形的大小和位置 - /// fromCircle({ Offset center, double radius }) - /// 使用圆的圆心点坐标和半径和确定外切矩形的大小和位置 - /// fromLTRB(double left, double top, double right, double bottom) - /// 使用矩形左边的X坐标、矩形顶部的Y坐标、矩形右边的X坐标、矩形底部的Y坐标来确定矩形的大小和位置 - /// fromLTWH(double left, double top, double width, double height) - /// 使用矩形左边的X坐标、矩形顶部的Y坐标矩形的宽高来确定矩形的大小和位置 - // 用Rect构建一个边长50,中心点坐标为50,100的矩形 - Rect rect1 = Rect.fromCircle(center: Offset(80.0, 100.0), radius: 50.0); - Rect rect2 = Rect.fromCircle(center: Offset(250.0, 100.0), radius: 50.0); - // 根据上面的矩形,构建一个圆角矩形 - RRect rrect1 = RRect.fromRectAndRadius(rect1, Radius.circular(0.0)); - canvas.drawRRect(rrect1, painter); - RRect rrect2 = RRect.fromRectAndRadius(rect2, Radius.circular(20.0)); - canvas.drawRRect(rrect2, painter); - break; - case 'drawDRRect': - //绘制两个矩形 - Rect rect1 = Rect.fromCircle(center: Offset(size.width/2, 100.0), radius: 60.0); - Rect rect2 = Rect.fromCircle(center: Offset(size.width/2, 100.0), radius: 40.0); - //分别绘制外部圆角矩形和内部的圆角矩形 - RRect outer = RRect.fromRectAndRadius(rect1, Radius.circular(30.0)); - RRect inner = RRect.fromRectAndRadius(rect2, Radius.circular(5.0)); - canvas.drawDRRect(outer, inner, painter ..color = Colors.lime); - break; - case 'drawImage': - // canvas.drawImage(image, Offset(0.0, 0.0), painter); - final src = Rect.fromLTWH(0.0, 0.0, 684.0, 442.0); - final dst = Rect.fromLTWH(0.0, 0.0, size.width, size.height); - canvas.drawImageRect(image, src, dst, painter); - break; - case 'drawStar': - var rect = Offset.zero & size; - /// 背景颜色 - canvas.drawRect(rect, Paint()..color = Color(0xFF000000)); - /// 绘制星形 - canvas.drawPath(MathTools().regularStarPath(5, 30, Offset(50.0, 50.0)), painter..color = Colors.red); - /// 绘制多边形 - canvas.save();// save之后,可以调用Canvas的平移、放缩、旋转、错切、裁剪等操作 - canvas.translate(0, 100); - canvas.scale(1.2,1.2); - canvas.drawPath(MathTools().nStarPath(4, 30, 30, Offset(40.0, 50.0)), painter); - canvas.restore();// 用来恢复Canvas之前保存的状态。防止save后对Canvas执行的操作对后续的绘制有影响 - /// 绘制旋转星形 - canvas.save();// save之后,可以调用Canvas的平移、放缩、旋转、错切、裁剪等操作 - canvas.translate(150, 50); - canvas.rotate(50 * pi / 180); - canvas.drawPath(MathTools().regularStarPath(5, 30, Offset(0,0)), painter..color = Colors.green); - canvas.restore();// 用来恢复Canvas之前保存的状态。防止save后对Canvas执行的操作对后续的绘制有影响 - /// 绘制变形星形 - canvas.save();// save之后,可以调用Canvas的平移、放缩、旋转、错切、裁剪等操作 - canvas.translate(80, 100); - canvas.skew(0.5,0.2); - canvas.drawPath(MathTools().regularStarPath(6, 30,Offset(50,50)), painter..color = Colors.lime); - canvas.restore();// 用来恢复Canvas之前保存的状态。防止save后对Canvas执行的操作对后续的绘制有影响 - - /// 绘制matrix星形 - canvas.translate(250, 0); - Float64List matrix = Float64List.fromList(const [ - // careful, this is in _column_-major order - 0.7, -0.7, 0.0, 0.0, - 0.7, 0.7, 0.0, 0.0, - 0.7, 0.0, 1.0, 0.0, - -70.697, 98.057, 0.0, 1.0, - ]); - canvas.transform(matrix); - canvas.drawPath(MathTools().regularStarPath(5, 30,Offset(50,50)), painter..color = Colors.blue); - - break; - } - //canvas.drawColor(Colors.red, BlendMode.colorDodge); - } - - ///控制自定义View是否需要重绘的,返回false代表这个View在构建完成后不需要重绘。 - @override - bool shouldRepaint(CustomPainter oldDelegate) { - return false; - } -} - -class MathTools { - static MathTools _mathTools; - static bool _flag; - - factory MathTools(){ - if (_flag == null) { - _flag = true; - } - if (_flag) { - _mathTools = new MathTools._internal(); - _flag = false; - } - return _mathTools; - } - MathTools._internal(); - /// - ///画正n角星的路径: - /// - ///@param num 角数 - ///@param R 外接圆半径 - ///@return 画正n角星的路径 - /// - Path regularStarPath(int num, double R, Offset xy) { - double degA, degB; - if (num % 2 == 1) { - //奇数和偶数角区别对待 - degA = 360 / num / 2 / 2; - degB = 180 - degA - 360 / num / 2; - } else { - degA = 360 / num / 2; - degB = 180 - degA - 360 / num / 2; - } - double r = R * sin(_rad(degA)) / sin(_rad(degB)); - return nStarPath(num, R, r, xy); - } - - /// - ///画正n边形的路径 - /// - ///@param num 边数 - ///@param R 外接圆半径 - ///@return 画正n边形的路径 - /// - Path regularPolygonPath(int num, double R, Offset xy) { - double r = R * cos(_rad(360 / num / 2)); //!!一点解决 - return nStarPath(num, R, r, xy); - } - - /// - ///n角星路径 - /// - ///@param num 几角星 - ///@param R 外接圆半径 - ///@param r 内接圆半径 - ///@return n角星路径 - /// - Path nStarPath(int num, double R, double r, Offset xy) { - Path path = new Path(); - double perDeg = 360 / num; //尖角的度数 - double degA = perDeg / 2 / 2; - double degB = 360 / (num - 1) / 2 - degA / 2 + degA; - - path.moveTo(cos(_rad(degA)) * R + xy.dx, (-sin(_rad(degA)) * R + xy.dy)); - for (int i = 0; i < num; i++) { - path.lineTo( - cos(_rad(degA + perDeg * i)) * R + xy.dx, -sin(_rad(degA + perDeg * i)) * R + xy.dy); - path.lineTo( - cos(_rad(degB + perDeg * i)) * r + xy.dx, -sin(_rad(degB + perDeg * i)) * r + xy.dy); - } - path.close(); - return path; - } - double _rad(double deg) { - return deg * pi / 180; - } -} diff --git a/lib/widgets/elements/Media/Canvas/Canvas/index.dart b/lib/widgets/elements/Media/Canvas/Canvas/index.dart deleted file mode 100644 index 3e6cda7e..00000000 --- a/lib/widgets/elements/Media/Canvas/Canvas/index.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBoxs; - -const Text = ''' -### **简介** -> 用于操作图形的界面; -- canvas 对象用于创建图片对象,这些对象本身可以与 SceneBuilder 一起用于构建场景; -'''; -const Text1 = ''' -### **基本用法** -- 以下是绘制点,线,面的基本用法 -'''; - -const Text2 = ''' -> 绘制点 -- 绘制点有三种模式, points(点),lines(线,隔点连接),polygon(线,相邻连接) -'''; - -const Text3 = ''' -> 绘制直线 -'''; - -const Text4 = ''' -> 绘制圆 -'''; - -const Text5 = ''' -> 绘制椭圆 -- 使用左上和右下角坐标来确定矩形的大小和位置,椭圆是在这个矩形之中内切的形状 -'''; - -const Text6 = ''' -> 绘制圆弧 -- Rect 来确认圆弧的位置,还需要开始的弧度、结束的弧度、是否使用中心点绘制、以及 paint 弧度 -'''; - -const Text7 = ''' -> 绘制矩形,圆角矩形 -- 用 Rect构建矩形 -- 根据上面的矩形,构建一个圆角矩形 -'''; - -const Text8 = ''' -> 绘制两个相套矩形 -'''; - -const Text9 = ''' -> 绘制图片到canvas -'''; - -const Text10 = ''' -> 绘制一个星形 -- 它可以使用“平移”、“缩放”、“旋转”、“倾斜”和“变换”方法进行修改; -- 可以使用 clipRect、clipCorrect 和 clipPath 方法进行修改; -- 可以使用由 save、savelayer和 restore 方法管理的堆栈来保存和还原当前的转换和剪辑。 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Canvas/Canvas'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Canvas', - codeUrl: 'elements/Media/Canvas/Canvas/demo.dart', - contentList: [ - Text, - Text1, - Text2, - demoBoxs.CustomViewPage(type:'drawPoints'), - Text3, - demoBoxs.CustomViewPage(type:'drawLine'), - Text4, - demoBoxs.CustomViewPage(type:'rawCircle'), - Text5, - demoBoxs.CustomViewPage(type:'drawOval'), - Text6, - demoBoxs.CustomViewPage(type:'drawArc'), - Text7, - demoBoxs.CustomViewPage(type:'drawRRect'), - Text8, - demoBoxs.CustomViewPage(type:'drawDRRect'), - Text9, - demoBoxs.CustomViewPage(type:'drawImage'), - Text10, - demoBoxs.CustomViewPage(type:'drawStar'), - ], - docUrl: 'https://docs.flutter.io/flutter/dart-ui/Canvas-class.html', - ); - } -} diff --git a/lib/widgets/elements/Media/Canvas/CircleProgressBarPainter/demo.dart b/lib/widgets/elements/Media/Canvas/CircleProgressBarPainter/demo.dart deleted file mode 100644 index 432e4f16..00000000 --- a/lib/widgets/elements/Media/Canvas/CircleProgressBarPainter/demo.dart +++ /dev/null @@ -1,105 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CircleProgressBarPainter 的示例 - -import 'dart:ui'; - -import 'package:flutter/material.dart'; - -class CustomViewPage extends StatefulWidget { - @override - State createState() => CustomViewPageState(); -} - -class CustomViewPageState extends State - with SingleTickerProviderStateMixin { - Animation _doubleAnimation; - AnimationController _controller; - CurvedAnimation curvedAnimation; - - @override - void initState() { - super.initState(); - _controller = - AnimationController(vsync: this, duration: Duration(seconds: 2)); - curvedAnimation = - CurvedAnimation(parent: _controller, curve: Curves.decelerate); - _doubleAnimation = Tween(begin: 0.0, end: 360.0).animate(_controller); - - _controller.addListener(() { - if(mounted){ - this.setState(() {}); - } - }); - onAnimationStart(); - } - - @override - Widget build(BuildContext context) { - return Container( - width: 100.0, - height: 100.0, - margin: EdgeInsets.all(8.0), - child: CustomPaint( - child: Center( - child: Text((_doubleAnimation.value / 3.6).round().toString())), - painter: CircleProgressBarPainter(_doubleAnimation.value) - ), - ); - } - - void onAnimationStart() { - _controller.forward(from: 0.0); - } - - @override - void reassemble() { - super.reassemble(); - onAnimationStart(); - } - - @override - void dispose() { - super.dispose(); - _controller.dispose(); - } -} - -class CircleProgressBarPainter extends CustomPainter { - Paint _paintBackground; - Paint _paintFore; - final double pi = 3.1415926; - var jindu; - - CircleProgressBarPainter(this.jindu) { - _paintBackground = Paint() - ..color = Colors.grey - ..strokeCap = StrokeCap.round - ..style = PaintingStyle.stroke - ..strokeWidth = 10.0 - ..isAntiAlias = true; - _paintFore = Paint() - ..color = Colors.red - ..strokeCap = StrokeCap.round - ..style = PaintingStyle.stroke - ..strokeWidth = 10.0 - ..isAntiAlias = true; - } - @override - void paint(Canvas canvas, Size size) { - canvas.drawCircle(Offset(size.width / 2, size.height / 2), size.width / 2,_paintBackground); - Rect rect = Rect.fromCircle( - center: Offset(size.width / 2, size.height / 2), - radius: size.width / 2, - ); - canvas.drawArc(rect, 0.0, jindu * 3.14 / 180, false, _paintFore); - } - - @override - bool shouldRepaint(CustomPainter oldDelegate) { - return false; - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/Canvas/CircleProgressBarPainter/index.dart b/lib/widgets/elements/Media/Canvas/CircleProgressBarPainter/index.dart deleted file mode 100644 index 346a4fdd..00000000 --- a/lib/widgets/elements/Media/Canvas/CircleProgressBarPainter/index.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBoxs; - -const Text = ''' -### **简介** -> 操作图形的界面; - -'''; -const Text1 = ''' -### **基本用法** -- canvas + Animation 实现一个 loading 效果; -'''; - - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Canvas/CircleProgressBarPainter'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CircleProgressBarPainter', - codeUrl: 'elements/Media/Canvas/CircleProgressBarPainter/demo.dart', - contentList: [ - Text, - Text1, - demoBoxs.CustomViewPage() - ], - docUrl: 'https://docs.flutter.io/flutter/dart-ui/Canvas-class.html', - ); - } -} - diff --git a/lib/widgets/elements/Media/Canvas/PainterPath/demo.dart b/lib/widgets/elements/Media/Canvas/PainterPath/demo.dart deleted file mode 100644 index 3c02dd73..00000000 --- a/lib/widgets/elements/Media/Canvas/PainterPath/demo.dart +++ /dev/null @@ -1,181 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: PainterPath 的示例 - -import 'dart:ui'; - -import 'package:flutter/material.dart'; - -CustomPaint graph; - -class CustomViewPage extends StatefulWidget { - - final String type; - CustomViewPage({this.type='simpleline'}) : super(); - - @override - State createState() => CustomViewPageState(); -} - -class CustomViewPageState extends State - with SingleTickerProviderStateMixin { - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - graph = CustomPaint( - painter: DrawPainter(type:widget.type) - ); - return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width * 0.6, - margin: EdgeInsets.all(50.0), - //padding: EdgeInsets.all(10.0), - child: graph - //child:Center(child: graph) - ); - } - - - @override - void reassemble() { - super.reassemble(); - } - - @override - void dispose() { - super.dispose(); - } -} - -///新建类继承于CustomPainter并且实现CustomPainter里面的paint()和shouldRepaint方法 -class DrawPainter extends CustomPainter { - Paint painter; - final type; - - DrawPainter ({this.type}){ - // Paint painter = Paint() - // ..color = Colors.blueAccent //画笔颜色 - // ..strokeCap = StrokeCap.round //画笔笔触类型 - // ..isAntiAlias = true //是否启动抗锯齿 - // ..blendMode = BlendMode.exclusion //颜色混合模式 - // ..style = PaintingStyle.fill //绘画风格,默认为填充 - // ..colorFilter = ColorFilter.mode(Colors.blueAccent,BlendMode.exclusion) //颜色渲染模式,一般是矩阵效果来改变的,但是flutter中只能使用颜色混合模式 - // ..maskFilter = MaskFilter.blur(BlurStyle.inner, 3.0) //模糊遮罩效果,flutter中只有这个 - // ..filterQuality = FilterQuality.high //颜色渲染模式的质量 - // ..strokeWidth = 15.0 ;//画笔的宽度 - - painter = new Paint() - ..color = Colors.blueAccent - ..strokeCap = StrokeCap.round - ..isAntiAlias = true - ..strokeWidth = 5.0 - ..style = PaintingStyle.stroke; - } - ///Flutter中负责View绘制的地方,使用传递来的canvas和size即可完成对目标View的绘制 - - @override - void paint(Canvas canvas, Size size) { - //canvas.drawColor(Colors.red, BlendMode.colorDodge); - Path path = new Path(); - drawThisPath(canvas, size, path); - path.close(); - canvas.drawPath(path, painter); - } - - void drawThisPath(Canvas canvas, Size size, Path path,) { - switch(type) { - case 'simpleline': - //新建了一个path,然后将路径起始点移动到坐标(100,100)的位置 - Path path = new Path()..moveTo(0.0, 0.0); - path.lineTo(200.0, 200.0); - canvas.drawPath(path, painter); - break; - case 'polyline': - Path path = new Path()..moveTo(100.0, 10.0); - - path.lineTo(200.0, 150.0); - path.lineTo(100.0, 200.0); - - canvas.drawPath(path, painter); - break; - case 'Besizerline2': - Path path = new Path()..moveTo(0.0, 0.0); - Rect rect1 = Rect.fromCircle(center: Offset(50.0, 100.0), radius: 60.0); - path.arcTo(rect1, 0.0, 3.14, false); - canvas.drawPath(path, painter); - - Rect rect2 = Rect.fromCircle(center: Offset(200.0, 100.0), radius: 60.0); - path.arcTo(rect2, 0.0, 3.14*2, true); - canvas.drawPath(path, painter); - break; - case 'Besizerline3': - var width = size.width; - var height = 300; - Path path = new Path()..moveTo(width / 2, height / 4); - path.cubicTo((width * 6) / 7, height / 9, (width * 13) / 13, - (height * 2) / 5, width / 2, (height * 7) / 12); - canvas.drawPath(path, painter - // ..style = PaintingStyle.fill - // ..color = Colors.red - ); - - Path path2 = new Path(); - path2.moveTo(width / 2, height / 4); - path2.cubicTo(width / 7, height / 9, width / 21, (height * 2) / 5, - width / 2, (height * 7) / 12); - canvas.drawPath(path2, painter); - break; - case 'drawArc': - // 绘制圆弧 - // Rect来确认圆弧的位置,还需要开始的弧度、结束的弧度、是否使用中心点绘制、以及paint弧度 - const PI = 3.1415926; - Rect rect1 = Rect.fromCircle(center: Offset(size.width/2, 0.0), radius: 100.0); - canvas.drawArc(rect1, 0.0, PI / 2, false, painter ..color = Colors.pink); - - Rect rect2 = Rect.fromCircle(center: Offset(size.width/2, 150.0), radius: 100.0); - canvas.drawArc(rect2, 0.0, PI / 2, true, painter ..color = Colors.deepPurple); - break; - case 'drawRRect': - /// fromPoints(Offset a, Offset b) - /// 使用左上和右下角坐标来确定矩形的大小和位置 - /// fromCircle({ Offset center, double radius }) - /// 使用圆的圆心点坐标和半径和确定外切矩形的大小和位置 - /// fromLTRB(double left, double top, double right, double bottom) - /// 使用矩形左边的X坐标、矩形顶部的Y坐标、矩形右边的X坐标、矩形底部的Y坐标来确定矩形的大小和位置 - /// fromLTWH(double left, double top, double width, double height) - /// 使用矩形左边的X坐标、矩形顶部的Y坐标矩形的宽高来确定矩形的大小和位置 - // 用Rect构建一个边长50,中心点坐标为50,100的矩形 - Rect rect1 = Rect.fromCircle(center: Offset(50.0, 50.0), radius: 50.0); - Rect rect2 = Rect.fromCircle(center: Offset(200.0, 50.0), radius: 50.0); - // 根据上面的矩形,构建一个圆角矩形 - RRect rrect1 = RRect.fromRectAndRadius(rect1, Radius.circular(0.0)); - canvas.drawRRect(rrect1, painter); - RRect rrect2 = RRect.fromRectAndRadius(rect2, Radius.circular(20.0)); - canvas.drawRRect(rrect2, painter); - break; - case 'drawDRRect': - //绘制两个矩形 - Rect rect1 = Rect.fromCircle(center: Offset(size.width/2, 100.0), radius: 60.0); - Rect rect2 = Rect.fromCircle(center: Offset(size.width/2, 100.0), radius: 40.0); - //分别绘制外部圆角矩形和内部的圆角矩形 - RRect outer = RRect.fromRectAndRadius(rect1, Radius.circular(30.0)); - RRect inner = RRect.fromRectAndRadius(rect2, Radius.circular(5.0)); - canvas.drawDRRect(outer, inner, painter ..color = Colors.lime); - break; - } - } - - ///控制自定义View是否需要重绘的,返回false代表这个View在构建完成后不需要重绘。 - @override - bool shouldRepaint(CustomPainter oldDelegate) { - return false; - } -} diff --git a/lib/widgets/elements/Media/Canvas/PainterPath/index.dart b/lib/widgets/elements/Media/Canvas/PainterPath/index.dart deleted file mode 100644 index ab64fadb..00000000 --- a/lib/widgets/elements/Media/Canvas/PainterPath/index.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBoxs; - -//const Text = ''' -//### **简介** -//> 在 canvas 上绘制时使用的样式说明; -//- canvas 上的大多数API都使用一个绘画对象来描述用于该操作的样式。 -//'''; -const Text = ''' -### **简介** -> 在 canvas 上绘制的图案; -- canvas + paint 的应用。 -'''; - -const Text1 = ''' -### **基本用法** -- canvas 的 painter 的自定义绘制线的方法; -'''; - -const Text2 = ''' -> 绘制简单直线 -'''; - -const Text3 = ''' -> 绘制折线 -'''; - -const Text4 = ''' -> 二阶贝塞尔曲线 -'''; - -const Text5 = ''' -> 三阶贝塞尔曲线 -'''; - - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Canvas/PainterPath'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'PainterPath', - codeUrl: 'elements/Media/Canvas/PainterPath/demo.dart', - contentList: [ - Text, - Text1, - Text2, - demoBoxs.CustomViewPage(type:'simpleline'), - Text3, - demoBoxs.CustomViewPage(type:'polyline'), - Text4, - demoBoxs.CustomViewPage(type:'Besizerline2'), - Text5, - demoBoxs.CustomViewPage(type:'Besizerline3'), - ], - docUrl: 'https://docs.flutter.io/flutter/dart-ui/Paint-class.html', - ); - } -} diff --git a/lib/widgets/elements/Media/Canvas/PainterSketch/demo.dart b/lib/widgets/elements/Media/Canvas/PainterSketch/demo.dart deleted file mode 100644 index af67fae6..00000000 --- a/lib/widgets/elements/Media/Canvas/PainterSketch/demo.dart +++ /dev/null @@ -1,219 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: PainterSketchDome 的示例 - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; - -class PainterSketchDome extends StatefulWidget { - PainterSketchDome({Key key, this.title}) : super(key: key); - - final String title; - - @override - _PainterSketchDomeState createState() => new _PainterSketchDomeState(); -} - -class _PainterSketchDomeState extends State { - - List lines = []; - List nowPoints = []; - Color nowColor = Colors.redAccent; - - void moveGestureDetector(DragUpdateDetails detail){ - RenderBox box = context.findRenderObject(); - final Offset xy = box.globalToLocal(detail.globalPosition);// 重要需要转换以下坐标位置 - Offset p = Offset(xy.dx, xy.dy - 60); - //Offset p = Offset(detail.globalPosition.dx, detail.globalPosition.dy - 60); - if (mounted) { - setState(() { - nowPoints.add(p); - }); - } - } - - void newGestureDetector(DragStartDetails detail) { - if (nowPoints.length != 0) { - LinePoints l = LinePoints(new List.from(nowPoints), nowColor); - lines.add(l); - nowPoints.clear(); - } - RenderBox box = context.findRenderObject(); - final Offset xy = box.globalToLocal(detail.globalPosition);// 重要需要转换以下坐标位置 - Offset p = Offset(xy.dx, xy.dy - 60); - //Offset p = Offset(detail.globalPosition.dx, detail.globalPosition.dy - 60); - if (mounted) { - setState(() { - nowPoints.add(p); - }); - } - } - - void changeColor (Color c){ - if (nowPoints.length != 0) { - LinePoints l = LinePoints(new List.from(nowPoints), nowColor); - lines.add(l); - } - if (mounted) { - setState(() { - nowPoints.clear(); - nowColor = c; - }); - } - } - - List colors = [ - Colors.redAccent, - Colors.pink, - Colors.greenAccent, - Colors.blueAccent, - Colors.amber, - Colors.purpleAccent, - Colors.deepPurpleAccent, - Colors.lightBlueAccent, - Colors.lightGreenAccent, - Colors.cyanAccent,]; - - void _tapClear(){ - if (mounted) { - setState(() { - lines.clear(); - nowPoints.clear(); - }); - } - } - - @override - Widget build(BuildContext context) { - List pallet = []; - for (int i = 0; i < colors.length; i++) { - Color c = colors[i]; - pallet.add(ColorPallet(color: c,changeColor: changeColor,isSelect: c==nowColor,)); - } - - return SizedBox( - width: MediaQuery.of(context).size.width * 0.9, - height: MediaQuery.of(context).size.height * 0.6, - child:new Scaffold( - primary: false, - body: new Container( - decoration: BoxDecoration( - color: Colors.white - ), - child:new Flex( - direction: Axis.vertical, - children: [ - Container( - decoration:BoxDecoration( - color: Colors.black12 - ), - child: ListView( - scrollDirection: Axis.horizontal, - children: pallet - , - ), - height: 60.0, - ), - Expanded( - child: AspectRatio( - aspectRatio: 1.0, - child: GestureDetector( - child: CustomPaint( - painter: PaintCanvas(lines,nowPoints,nowColor), - ), - onHorizontalDragUpdate: moveGestureDetector, - onVerticalDragUpdate: moveGestureDetector, - onHorizontalDragStart: newGestureDetector, - onVerticalDragStart: newGestureDetector, - ), - ), - ) - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _tapClear, - backgroundColor: Colors.redAccent, - foregroundColor: Colors.white, - child: Icon(Icons.delete), - ), - ) - ); - } -} - -class PaintCanvas extends CustomPainter{ - - final List lines; - final List nowPoints; - final Color nowColor; - - PaintCanvas(this.lines, this.nowPoints, this.nowColor); - - @override - void paint(Canvas canvas, Size size) { - Paint p = new Paint() - ..color = Colors.redAccent - ..strokeCap = StrokeCap.round - ..strokeWidth = 5.0; - canvas.save(); - for (int i = 0; i < lines.length; i++) { - LinePoints l = lines[i]; - for (int j = 1; j < l.points.length; j++){ - Offset p1 = l.points[j - 1]; - Offset p2 = l.points[j]; - p.color = l.lineColor; - canvas.drawLine(p1, p2, p); - } - } - for (int i = 1; i < nowPoints.length; i++){ - Offset p1 = nowPoints[i - 1]; - Offset p2 = nowPoints[i]; - p.color = nowColor; - canvas.drawLine(p1, p2, p); - } - - canvas.restore(); - } - @override - bool shouldRepaint(CustomPainter oldDelegate) { - return true; - } -} - -class LinePoints{ - final List points; - final Color lineColor; - LinePoints(this.points, this.lineColor); -} - -class ColorPallet extends StatelessWidget { - final Color color; - final Function changeColor; - const ColorPallet({Key key, this.color, this.changeColor, this.isSelect}) : super(key: key); - final bool isSelect; - - void onPressed(){ - changeColor(color); - } - - @override - Widget build(BuildContext context) { - return new RawMaterialButton( - onPressed: onPressed, - constraints: BoxConstraints(minWidth: 60.0,minHeight: 50.0), - child: new Container( - margin: EdgeInsets.only(top: 5.0,bottom: 5.0), - width: 50.0, - height: 50.0, - decoration: BoxDecoration( - color: color, - borderRadius: BorderRadius.all(Radius.circular(25.0)), - border: Border.all(color: Colors.white,width: isSelect?3.0:0.0) - ), - )) ; - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/Canvas/PainterSketch/index.dart b/lib/widgets/elements/Media/Canvas/PainterSketch/index.dart deleted file mode 100644 index 1288eb9f..00000000 --- a/lib/widgets/elements/Media/Canvas/PainterSketch/index.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBoxs; - -const Text = ''' -### **简介** -> 操作图形的界面; - -'''; -const Text1 = ''' -### **基本用法** -- canvas + paint + GestureDetector 实现一个 简易的画板; -'''; - - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Canvas/PainterSketch'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'PainterSketch', - codeUrl: 'elements/Media/Canvas/PainterSketch/demo.dart', - contentList: [ - Text, - Text1, - demoBoxs.PainterSketchDome() - ], - docUrl: 'https://docs.flutter.io/flutter/dart-ui/Paint-class.html', - ); - } -} - diff --git a/lib/widgets/elements/Media/Canvas/index.dart b/lib/widgets/elements/Media/Canvas/index.dart deleted file mode 100644 index d3c73227..00000000 --- a/lib/widgets/elements/Media/Canvas/index.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter_go/model/widget.dart'; -import "package:flutter/material.dart"; - -import 'PainterSketch/index.dart' as PainterSketch; -import 'Canvas/index.dart' as Canvas; -import 'PainterPath/index.dart' as PainterPath; -import 'CircleProgressBarPainter/index.dart' as CircleProgressBarPainter; - - -List widgetPoints = [ - WidgetPoint( - name: 'PainterSketch', - routerName: PainterSketch.Demo.routeName, - buildRouter: (BuildContext context) => PainterSketch.Demo(), - ), - WidgetPoint( - name: 'Canvas', - routerName: Canvas.Demo.routeName, - buildRouter: (BuildContext context) => Canvas.Demo(), - ), - WidgetPoint( - name: 'PainterPath', - routerName: PainterPath.Demo.routeName, - buildRouter: (BuildContext context) => PainterPath.Demo(), - ), - WidgetPoint( - name: 'CircleProgressBarPainter', - routerName: CircleProgressBarPainter.Demo.routeName, - buildRouter: (BuildContext context) => CircleProgressBarPainter.Demo(), - ) -]; diff --git a/lib/widgets/elements/Media/Icon/Icon/demo.dart b/lib/widgets/elements/Media/Icon/Icon/demo.dart deleted file mode 100644 index 3fca415b..00000000 --- a/lib/widgets/elements/Media/Icon/Icon/demo.dart +++ /dev/null @@ -1,23 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018-12-15 15:10:34 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2018-12-17 11:09:17 -import 'package:flutter/material.dart'; - -class IconDemo extends StatelessWidget { - final Color curColor; - - IconDemo({Key key, this.curColor}) : super(); - - @override - Widget build(BuildContext context) { - return Container( - child: Icon( - Icons.favorite, - color: this.curColor, - size: 30.0, - ), - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/Icon/index.dart b/lib/widgets/elements/Media/Icon/Icon/index.dart deleted file mode 100644 index 98532f8b..00000000 --- a/lib/widgets/elements/Media/Icon/Icon/index.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const Text = ''' -### **简介** -> 使用IconData中描述的字体( 例如素材中预定义的IconDatas) 中的字形绘制的图形图标。 -- 该图标不是交互示, 只是展示图标样式。 如果对于有交互要求, 可以使用IconButton -'''; -const Text1 = ''' -### **基本用法** -- 多用于图标的使用选择 -- 可对图标设置大小, 颜色, 标签等 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Icon/Icon'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Icon', - codeUrl: 'elements/Media/Icon/Icon/demo.dart', - contentList: [ - Text, - Text1, - IconLayout(), - ], - docUrl: 'https://docs.flutter.io/flutter/material/Icons-class.html', - ); - } -} - -class IconLayout extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconDemo( - curColor: Colors.redAccent, - ), - IconDemo( - curColor: Colors.yellow, - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/IconData/demo.dart b/lib/widgets/elements/Media/Icon/IconData/demo.dart deleted file mode 100644 index a9706e45..00000000 --- a/lib/widgets/elements/Media/Icon/IconData/demo.dart +++ /dev/null @@ -1,25 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018-12-15 10:15:34 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2018-12-17 11:38:50 -import 'package:flutter/material.dart'; - -class IconDataDemo extends StatelessWidget { - final Color curColor; - - IconDataDemo({Key key, this.curColor}) : super(); - - @override - Widget build(BuildContext context) { - return Container( - child: Icon( - //参考 icon constans - IconData(0xe567, - fontFamily: 'MaterialIcons', matchTextDirection: true), - color: this.curColor, - size: 30.0, - ), - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/IconData/index.dart b/lib/widgets/elements/Media/Icon/IconData/index.dart deleted file mode 100644 index 9017a35f..00000000 --- a/lib/widgets/elements/Media/Icon/IconData/index.dart +++ /dev/null @@ -1,56 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - - -const Text = ''' -### **简介** -> 字体表示符合表示的图标说明 -- 可参考图标 -'''; - -const Text1 = ''' -### **基本用法** -- 多用于图标的使用选择 -- 可对图标设置大小, 颜色, 标签等 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Icon/IconData'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'IconData', - codeUrl: 'elements/Media/Icon/IconData/demo.dart', - contentList: [ - Text, - Text1, - _IconDataLayout(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/IconData-class.html', - ); - } -} - -class _IconDataLayout extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconDataDemo( - curColor: Colors.redAccent, - ), - IconDataDemo( - curColor: Colors.yellow, - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/IconTheme/demo.dart b/lib/widgets/elements/Media/Icon/IconTheme/demo.dart deleted file mode 100644 index c27da87f..00000000 --- a/lib/widgets/elements/Media/Icon/IconTheme/demo.dart +++ /dev/null @@ -1,56 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018-12-15 16:07:59 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2018-12-15 16:49:17 -import 'package:flutter/material.dart'; - -class IconThemeDemo extends StatelessWidget { - final Color curColor; - - IconThemeDemo({Key key, this.curColor}) : super(); - - @override - Widget build(BuildContext context) { - return AppBar( - actions: [ - IconTheme( - data: IconThemeData(color: curColor, opacity: 3.0), - child: Container( - padding: EdgeInsets.all(20.0), - child: Icon(Icons.equalizer), - ), - ), - ], - ); - } -} - -class IconThemeDemo2 extends StatelessWidget { - final Color curColor; - final double curSize; - - IconThemeDemo2({Key key, this.curColor, this.curSize}) : super(); - - @override - Widget build(BuildContext context) { - return AppBar( - actions: [ - IconTheme( - data: IconThemeData(color: curColor, opacity: 3.0), - child: Row( - children: [ - Icon( - Icons.favorite_border, - size: curSize, - ), - Padding( - padding: const EdgeInsets.all(20.0), - child: Text('喜欢'), - ), - ], - )), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/IconTheme/index.dart b/lib/widgets/elements/Media/Icon/IconTheme/index.dart deleted file mode 100644 index 5747d8b7..00000000 --- a/lib/widgets/elements/Media/Icon/IconTheme/index.dart +++ /dev/null @@ -1,66 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const Text = ''' -### **简介** -> 用于应用栏图标的颜色,不透明度和大小。 -- 图标主题Icon和ImageIcon的依赖 -'''; -const Text1 = ''' -### **基本用法** -- 通常,这与backgroundColor,brightness,textTheme一起设置。 -默认为ThemeData.primaryIconTheme。 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Icon/IconTheme'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'IconTheme', - codeUrl: 'elements/Media/Icon/IconTheme/demo.dart', - contentList: [ - Text, - Text1, - IconThemeLayout(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/IconTheme-class.html', - ); - } -} - -class IconThemeLayout extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - IconThemeDemo(), - SizedBox( - height: 20.0, - ), - IconThemeDemo( - curColor: Colors.white, - ), - SizedBox( - height: 20.0, - ), - IconThemeDemo( - curColor: Colors.yellow, - ), - SizedBox( - height: 20.0, - ), - IconThemeDemo2( - curColor: Colors.white, - curSize: 20.0, - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/IconThemeData/demo.dart b/lib/widgets/elements/Media/Icon/IconThemeData/demo.dart deleted file mode 100644 index 67d852d6..00000000 --- a/lib/widgets/elements/Media/Icon/IconThemeData/demo.dart +++ /dev/null @@ -1,54 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018-12-17 09:46:31 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2018-12-17 15:53:42 - -import 'package:flutter/material.dart'; - -class IconThemeDemo extends StatelessWidget { - final Color curColor; - final double curOpacity; - - IconThemeDemo({Key key, this.curColor, this.curOpacity}) : super(); - - @override - Widget build(BuildContext context) { - return Container( - child: IconTheme( - //opacity: 设置透明 - data: IconThemeData( - color: curColor, - opacity: curOpacity, - ), - child: Icon(Icons.favorite), - ), - ); - } -} - -class IconThemeDemo2 extends StatelessWidget { - final Color curColor; - final double curSize; - - IconThemeDemo2({Key key, this.curColor, this.curSize}) : super(); - - @override - Widget build(BuildContext context) { - return AppBar( - actions: [ - IconTheme( - data: IconThemeData(color: curColor, opacity: 1.0), - child: Row( - children: [ - Icon(Icons.favorite_border), - Padding( - padding: const EdgeInsets.all(20.0), - child: Text('喜欢'), - ), - ], - )), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/IconThemeData/index.dart b/lib/widgets/elements/Media/Icon/IconThemeData/index.dart deleted file mode 100644 index 0a1c2900..00000000 --- a/lib/widgets/elements/Media/Icon/IconThemeData/index.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const Text = ''' -### **简介** -> IconThemeData为图标提供属性,必须是Icon的父级 -- 图标主题Icon和ImageIcon的依赖,获取当前主题,是用IconTheme.of -'''; -const Text1 = ''' -### **基本用法** -- 部分widget无法管理大小,IconThemeData的size属性失效。 -- 通过opacity属性,修改widget透明度,如下图 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Icon/IconThemeData'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'IconThemeData', - codeUrl: 'elements/Media/Icon/IconThemeData/demo.dart', - contentList: [ - Text, - Text1, - IconThemeDataLayout(), - ], - docUrl: - 'https://docs.flutter.io/flutter/widgets/IconThemeData-class.html', - ); - } -} - -class IconThemeDataLayout extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconThemeDemo( - curColor: Colors.red, - curOpacity: 1.0, - ), - IconThemeDemo( - curColor: Colors.red, - curOpacity: 0.5, - ), - IconThemeDemo( - curColor: Colors.red, - curOpacity: 0.2, - ), - ], - ), - SizedBox( - height: 20.0, - ), - IconThemeDemo2(curColor: Colors.white), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/ImageIcon/demo.dart b/lib/widgets/elements/Media/Icon/ImageIcon/demo.dart deleted file mode 100644 index 0345c3b6..00000000 --- a/lib/widgets/elements/Media/Icon/ImageIcon/demo.dart +++ /dev/null @@ -1,20 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2018-12-15 15:19:41 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2018-12-17 10:07:19 - - -import 'package:flutter/material.dart'; - -class ImageIconDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - //注意:当你用一个图片的时候,这个图片会被整个覆盖,只保留图片的形状,填充你设置的颜色 - return ImageIcon( - AssetImage('assets/images/btn_icon_dingyuehao_normal.png'), - color: Colors.red, - size: 50.0, - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/ImageIcon/index.dart b/lib/widgets/elements/Media/Icon/ImageIcon/index.dart deleted file mode 100644 index a5d2acd3..00000000 --- a/lib/widgets/elements/Media/Icon/ImageIcon/index.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const Text = ''' -### **简介** -> 来自ImageProvider的图标,例如AssetImage。 -- 图标由其名称标示 -'''; -const Text1 = ''' -### **基本用法** -- 创建图像图标,在size和color默认为当前给定的值IconTheme -- 当你用一个图片时,这个图片会被填充你设置的颜色,只保留图片的形状, -- 即填充图片像素所在的所有位置 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Icon/ImageIcon'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'ImageIcon', - codeUrl: 'elements/Media/Icon/ImageIcon/demo.dart', - contentList: [ - Text, - Text1, - ImageIconDemo(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/ImageIcon-class.html', - ); - } -} diff --git a/lib/widgets/elements/Media/Icon/index.dart b/lib/widgets/elements/Media/Icon/index.dart deleted file mode 100644 index 630bf3b4..00000000 --- a/lib/widgets/elements/Media/Icon/index.dart +++ /dev/null @@ -1,36 +0,0 @@ -import '../../../../model/widget.dart'; -import "package:flutter/material.dart"; - -import 'Icon/index.dart' as Icon; -import 'ImageIcon/index.dart' as ImageIcon; -import 'IconTheme/index.dart' as IconTheme; -import 'IconData/index.dart' as IconData; -import 'IconThemeData/index.dart' as IconThemeData; - -List widgetPoints = [ - WidgetPoint( - name: 'Icon', - routerName: Icon.Demo.routeName, - buildRouter: (BuildContext context) => Icon.Demo(), - ), - WidgetPoint( - name: 'ImageIcon', - routerName: ImageIcon.Demo.routeName, - buildRouter: (BuildContext context) => ImageIcon.Demo(), - ), - WidgetPoint( - name: 'IconTheme', - routerName: IconTheme.Demo.routeName, - buildRouter: (BuildContext context) => IconTheme.Demo(), - ), - WidgetPoint( - name: 'IconData', - routerName: IconData.Demo.routeName, - buildRouter: (BuildContext context) => IconData.Demo(), - ), - WidgetPoint( - name: 'IconThemeData', - routerName: IconThemeData.Demo.routeName, - buildRouter: (BuildContext context) => IconThemeData.Demo(), - ), -]; diff --git a/lib/widgets/elements/Media/Image/AssetImage/assetImage_demo.dart b/lib/widgets/elements/Media/Image/AssetImage/assetImage_demo.dart deleted file mode 100644 index 940b4cd7..00000000 --- a/lib/widgets/elements/Media/Image/AssetImage/assetImage_demo.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:flutter/material.dart'; - -class AssetImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - CircleAvatar( - backgroundImage: AssetImage('assets/images/food01.jpeg'), - ), - Container( - child: Image( - image: AssetImage('assets/images/food02.jpeg'), - height: 300.0, - width: 300.0, - ), - ) - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/Image/AssetImage/index.dart b/lib/widgets/elements/Media/Image/AssetImage/index.dart deleted file mode 100644 index b33a0db6..00000000 --- a/lib/widgets/elements/Media/Image/AssetImage/index.dart +++ /dev/null @@ -1,97 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-11-16 15:09:12 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './assetImage_demo.dart'; - -const contentText0 = ''' -### **简介** -> 从AssetBundle中获取图像,根据上下文来确定使用确切的图像 - -根据给定的一些资源,AssetImage 可以根据你给定的配置,然后根据设备的像素比率和大小,然后选择合适的资源文件 -'''; - -const contentText1 = ''' -### **基本用法** -> 从AssetBundle中获取图像,根据上下文来确定使用确切的图像 - -#### 使用命名资源文件去匹配不同像素的设备 - -以'Nx'的形式命名图片资源文件,其中N标识改资源文件的标称设备像素比率 - -假如某一个应用程序使用命名为 heart.png 的图标,此图标的表示为1.0(主图标),以及 1.5和2.0像素比。然后我们在资源包中应如下命名: - - ``` - heart.png - 1.5x/heart.png - 2.0x/heart.png - ``` -在具有1.0设备像素比的设备上,所选择的图片是 heart.png ,在具有1.3设备的像素比的设备上,所选择图片是 1.5x/heart.png. -只要变量命名处于同一个目录层级,资源文件的目录层级就无关紧要。如下也是有效的目录结构。 - -``` - icons/heart.png - icons/1.5x/heart.png - icons/2.0x/heart.png -``` - -#### 获取资源文件 -需要从package中获取资源文件,需要提供package的参数。我们需要在项目中的 pubspec.yaml 文件里加上具体的asset文件: - -``` -flutter: - assets: - - icons/heart/.png -``` -然后可以如下使用 -``` -AssetImage('icons/heart.png'); -``` -#### 在package中的资源 -如果需要从package中获取资源文件,必须提供package参数。加入下面的结构位于一个名为 my_icons 的包中,然后获取图像: -``` -AssetImage('icons/heart.png', package: 'my_icons') -``` -如果在package的pubspec.yaml中指定了所需资源,则会自动将其与应用程序捆绑在一起。 特别是,package本身使用的资产必须在pubspec.yaml中指定。 - -package 还可以选择在其'lib /'文件夹中具有未在其pubspec.yaml中指定的资源。 在这种情况下,对于要捆绑的图像,应用程序必须指定要包含的图像。 例如,名为fancy_backgrounds的包可能具有 -``` -lib/backgrounds/background1.png -lib/backgrounds/background2.png -lib/backgrounds/background3.png -``` -比如说第一张图片,应用程序的pubspec.yaml应该在资源部分指定它: -``` -assets: - - packages/fancy_backgrounds/backgrounds/background1.png -``` -lib /是隐含的,因此它不应包含在 assets 路径中。 - - -> 一下demo分别作为背景图片和配合Image使用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/AssetImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - contentText0, - contentText1, - AssetImageDemo(), - ], - title: 'AssetImage', - docUrl: 'https://docs.flutter.io/flutter/painting/AssetImage-class.html', - codeUrl: 'elements/Media/Image/AssetImage/assetImage_demo.dart', - ); - } -} diff --git a/lib/widgets/elements/Media/Image/DecorationImage/decorationImage_demo.dart b/lib/widgets/elements/Media/Image/DecorationImage/decorationImage_demo.dart deleted file mode 100644 index f25517b5..00000000 --- a/lib/widgets/elements/Media/Image/DecorationImage/decorationImage_demo.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/material.dart'; - -class DecorationImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - child: Center( - child: Text( - 'Container', - style: TextStyle(color: Colors.red), - ), - ), - height: 200.0, - width: 200.0, - decoration: BoxDecoration( - color: Colors.blueAccent, - image: DecorationImage( - image: AssetImage('assets/images/food02.jpeg'), fit: BoxFit.cover), - ), - margin: const EdgeInsets.only(top: 10.0), - ); - } -} diff --git a/lib/widgets/elements/Media/Image/DecorationImage/index.dart b/lib/widgets/elements/Media/Image/DecorationImage/index.dart deleted file mode 100644 index d2f638e5..00000000 --- a/lib/widgets/elements/Media/Image/DecorationImage/index.dart +++ /dev/null @@ -1,46 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-11-16 15:12:39 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './decorationImage_demo.dart'; - -const contentText0 = ''' -### **简介** - -> 修饰Box的图片 -'''; - -const contentText1= ''' -### **基本用法** - -> demo演示作为背景图片的样例 - -- 一般配合BoxDecoration的img属性使用,设置背景图片 -- 也可以配合paintImage使用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/DecorationImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - contentText0, - contentText1, - DecorationImageDemo(), - ], - codeUrl: 'elements/Media/Image/DecorationImage/decorationImage_demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/painting/DecorationImage-class.html', - title: 'DecorationImage', - ); - } -} diff --git a/lib/widgets/elements/Media/Image/DecorationImagePainter/decoration_image_painter_demo.dart b/lib/widgets/elements/Media/Image/DecorationImagePainter/decoration_image_painter_demo.dart deleted file mode 100644 index c1b4ae0f..00000000 --- a/lib/widgets/elements/Media/Image/DecorationImagePainter/decoration_image_painter_demo.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; - -class DecorationImagePainterDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - - ); - } -} - -// class ImagePainter extends CustomPainter{ - - -// Future getImage(String path) async { -// ByteData data = await rootBundle.load(path); -// ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List()); -// FrameInfo frameInfo = await codec.getNextFrame(); -// image = frameInfo.image; -// return image; -// } - -// @override -// void paint(Canvas canvas, Size size) { -// Paint paint = Paint() -// ..color = Colors.black12 -// ..strokeCap = StrokeCap.round -// ..strokeWidth = 3.0; -// Image _image = Image(image: AssetImage('assets/images/food03.jpeg'),); -// canvas.drawImage(_image,Offset.zero & size,paint)); -// } - -// @override -// bool shouldRepaint(CustomPainter oldDelegate) { -// // TODO: implement shouldRepaint -// return false; -// } -// } \ No newline at end of file diff --git a/lib/widgets/elements/Media/Image/DecorationImagePainter/index.dart b/lib/widgets/elements/Media/Image/DecorationImagePainter/index.dart deleted file mode 100644 index 4550381a..00000000 --- a/lib/widgets/elements/Media/Image/DecorationImagePainter/index.dart +++ /dev/null @@ -1,30 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-11-16 15:09:12 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -const contentText0 = ''' -### **简介** -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/DecorationImagePainter'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [], - docUrl: 'https://docs.flutter.io/flutter/painting/DecorationImagePainter-class.html', - codeUrl: 'elements/Media/Image/DecorationImagePainter/decoration_image_painter_demo.dart', - title:'DecorationImagePainter' - ); - } -} - diff --git a/lib/widgets/elements/Media/Image/ExactAssetImage/exact_asset_image_demo.dart b/lib/widgets/elements/Media/Image/ExactAssetImage/exact_asset_image_demo.dart deleted file mode 100644 index 3b8fe768..00000000 --- a/lib/widgets/elements/Media/Image/ExactAssetImage/exact_asset_image_demo.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:flutter/material.dart'; - -class ExactAssetImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - Image( - image: ExactAssetImage('assets/images/food02.jpeg', scale: 1.5), - ), - SizedBox( - height: 20.0, - ), - Image( - image: ExactAssetImage('assets/images/food02.jpeg', scale: 1.0), - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Image/ExactAssetImage/index.dart b/lib/widgets/elements/Media/Image/ExactAssetImage/index.dart deleted file mode 100644 index 9b7a5c36..00000000 --- a/lib/widgets/elements/Media/Image/ExactAssetImage/index.dart +++ /dev/null @@ -1,44 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 13:29:34 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 14:12:21 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './exact_asset_image_demo.dart'; - -const contentText0 = ''' -### **简介** -> 类似带有scale属性的AssetImage - -从```Image.asset```源码中可以看到 - -'''; - -const contentText1 = ''' -### **基本使用** -- 使用方法与AssetImage类似 -- 可以理解为带有scale属性的AssetImage -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/ExactAssetImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - contentText0, - contentText1, - ExactAssetImageDemo(), - ], - title:'ExactAssetImage', - codeUrl: 'elements/Media/Image/ExactAssetImage/exact_asset_image_demo.dart', - docUrl: 'https://docs.flutter.io/flutter/painting/ExactAssetImage-class.html', - ); - } -} diff --git a/lib/widgets/elements/Media/Image/FadeInImage/fade_in_image_demo.dart b/lib/widgets/elements/Media/Image/FadeInImage/fade_in_image_demo.dart deleted file mode 100644 index e0eccc6e..00000000 --- a/lib/widgets/elements/Media/Image/FadeInImage/fade_in_image_demo.dart +++ /dev/null @@ -1,34 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 16:08:41 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 16:22:50 - -import 'package:flutter/material.dart'; - -class FadeInImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - ClipOval( - child: FadeInImage.assetNetwork( - placeholder: "assets/images/normal_user_icon.png", //预览图 - fit: BoxFit.fitWidth, - image: - "https://img.alicdn.com/tfs/TB148sWfMHqK1RjSZFgXXa7JXXa-536-482.png", - width: 160.0, - height: 160.0, - ), - ), - SizedBox( - height: 20.0, - ), - CircleAvatar( - backgroundImage: NetworkImage( - "https://img.alicdn.com/tfs/TB148sWfMHqK1RjSZFgXXa7JXXa-536-482.png"), - child: Text("一凨"), //可以在图片上添加文字等等 - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Image/FadeInImage/index.dart b/lib/widgets/elements/Media/Image/FadeInImage/index.dart deleted file mode 100644 index ffcf1d16..00000000 --- a/lib/widgets/elements/Media/Image/FadeInImage/index.dart +++ /dev/null @@ -1,48 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 14:26:00 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 16:10:55 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './fade_in_image_demo.dart'; - - -const contentText0 = ''' -### **简介** -> placeHodler image到目标图片的一种过渡widget -- 使用FadeInImage可以类似网络加载的图片以一个更加优雅的形式出现在屏幕上 -- 如果这个图片已经被加载了,或者已经存在内存中,那么placeholder图片将不会显示 -'''; - -const contentText1 = ''' -### **基本用法** -> FadeInImage的写法跟Image类似,有很多别的命名构造函数。 -- fadeOutDuration和fadeOutCurve控制placeholder的淡出动画 -- fadeInDuration和fadeInCurve控制目标图像的淡入动画 -- 对于placeholder,更倾向于使用已经缓存的,以防止他也会突然的出现在屏幕上 - -'''; - - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/FadeInImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'elements/Media/Image/FadeInImage/fade_in_image_demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/FadeInImage-class.html', - title:'FadeInImage', - contentList: [ - contentText0, - contentText1, - FadeInImageDemo(), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Image/FileImage/file_image_demo.dart b/lib/widgets/elements/Media/Image/FileImage/file_image_demo.dart deleted file mode 100644 index f0638e39..00000000 --- a/lib/widgets/elements/Media/Image/FileImage/file_image_demo.dart +++ /dev/null @@ -1,45 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 16:20:17 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 17:18:39 - -import 'dart:async'; -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:image_picker/image_picker.dart'; - -class FileImageDemo extends StatefulWidget { - @override - _FileImageDemoState createState() => _FileImageDemoState(); -} - -class _FileImageDemoState extends State { - File _image; - - Future getImage() async { - var image = await ImagePicker.pickImage(source: ImageSource.gallery); - - setState(() { - _image = image; - }); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Center( - child: _image == null - ? Text('您还未选择任何图片.') - : Image.file(_image,scale: 0.5,fit: BoxFit.cover,), - ), - FlatButton( - onPressed: getImage, - child: Text('点击选择图片',style: TextStyle(color: Colors.white),), - color: Colors.lightBlue - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Image/FileImage/index.dart b/lib/widgets/elements/Media/Image/FileImage/index.dart deleted file mode 100644 index ff20b410..00000000 --- a/lib/widgets/elements/Media/Image/FileImage/index.dart +++ /dev/null @@ -1,43 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 16:20:33 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 19:24:33 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './file_image_demo.dart'; - -const contentText0 = ''' -### **简介** -> 用于展示本地的文件 -- 将给定的File对象解码为图片 -- 可以指定缩放scale -'''; - -const contentText1 = ''' -### **基本用法** -> 简写形式和Image也都非常相似 -- Image.file 是ImageFile 的一种简写形式 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/FileImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'elements/Media/Image/FileImage/file_image_demo.dart', - docUrl: 'https://docs.flutter.io/flutter/painting/FileImage-class.html', - title:'FileImage', - contentList: [ - contentText0, - contentText1, - FileImageDemo(), - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Image/Image/demo.dart b/lib/widgets/elements/Media/Image/Image/demo.dart deleted file mode 100644 index 64a053b7..00000000 --- a/lib/widgets/elements/Media/Image/Image/demo.dart +++ /dev/null @@ -1,20 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2019-01-07 15:33:49 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2019-01-07 15:45:29 - -import 'package:flutter/material.dart'; - -class ImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - child: Image.asset( - 'assets/images/food05.jpeg', - fit: BoxFit.contain, - ), - height: 300.0, - width: 300.0, - ); - } -} diff --git a/lib/widgets/elements/Media/Image/Image/index.dart b/lib/widgets/elements/Media/Image/Image/index.dart deleted file mode 100644 index c0f13f70..00000000 --- a/lib/widgets/elements/Media/Image/Image/index.dart +++ /dev/null @@ -1,47 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2019-01-07 15:33:42 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2019-01-07 15:42:54 - -import 'package:flutter/material.dart'; - -import './demo.dart'; -import 'package:flutter_go/components/widget_demo.dart'; - -const String content0 = ''' -### **简介** -> 用于展示图片的widget -- 对于原始解码图像数据的不透明处理 -- 如果需要获取Image对象,可以考虑使用 instantiateImageCodec -- 如果需要绘制图片,可以考虑使用 Canvas,比如: Canvas.drawImage -'''; - -const String content1 = ''' -### **基本用法** -> 这里主要介绍加入图片的几种方式 -- Image.asset:加载资源图片,就是加载项目资源目录中的图片,加入图片后会增大打包的包体体积,用的是相对路径 -- Image.network:网络资源图片,意思就是你需要加入一段http://xxxx.xxx的这样的网络路径地址 -- Image.file:加载本地图片,就是加载本地文件中的图片,这个是一个绝对路径,跟包体无关 -- Image.memory: 加载Uint8List资源图片 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/Image'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Image', - codeUrl: 'elements/Media/Image/Image/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/dart-ui/Image-class.html', - contentList: [ - content0, - content1, - ImageDemo(), - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/Image/MemoryImage/index.dart b/lib/widgets/elements/Media/Image/MemoryImage/index.dart deleted file mode 100644 index b89aefbd..00000000 --- a/lib/widgets/elements/Media/Image/MemoryImage/index.dart +++ /dev/null @@ -1,46 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 20:48:28 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './memory_image_demo.dart'; - -const String _contentText0 = ''' -### **简介** -> 将给定的Uint8List 缓冲区解码为图像的widget -- 甚至我们也可以利用的来实现将Base64编码的图片展示出来(利用 Uint8List.fromtList 构造函数) -'''; - -const String _contentText1 = ''' -### **基本用法** -> demo中我们作为读取内存图片来展示 -- 提供给MemoryImage的字节不应该再有更改 -- 如果需要经常改变的图片,请使用ImageProvider下的子类 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/MemoryImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - _contentText0, - _contentText1, - MemoryImageDemo(), - ], - title: 'MemoryImage', - // desc: 'MemoryImage 使用介绍', - docUrl: 'https://docs.flutter.io/flutter/painting/MemoryImage-class.html', - codeUrl: - 'elements/Media/Image/MemoryImage/index.dart', - ); - } -} diff --git a/lib/widgets/elements/Media/Image/MemoryImage/memory_image_demo.dart b/lib/widgets/elements/Media/Image/MemoryImage/memory_image_demo.dart deleted file mode 100644 index 6abe4acc..00000000 --- a/lib/widgets/elements/Media/Image/MemoryImage/memory_image_demo.dart +++ /dev/null @@ -1,45 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 17:49:19 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 20:46:37 - -import 'dart:typed_data'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart' show rootBundle; - - -class MemoryImageDemo extends StatefulWidget { - _MemoryImageDemoState createState() => _MemoryImageDemoState(); -} - -class _MemoryImageDemoState extends State { - Uint8List bytes; - - void initState() { - super.initState(); - rootBundle.load('assets/images/food01.jpeg').then((data) { - if (mounted) { - setState(() { - bytes = data.buffer.asUint8List(); - }); - } - }); - } - - @override - Widget build(BuildContext context) { - final decoration = BoxDecoration( - image: bytes == null - ? null - : DecorationImage( - image: MemoryImage(bytes,scale: 1.0), - ), - ); - return Container( - width: 300.0, - height: 300.0, - decoration: decoration, - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/Image/NetworkImage/index.dart b/lib/widgets/elements/Media/Image/NetworkImage/index.dart deleted file mode 100644 index b3e4e72e..00000000 --- a/lib/widgets/elements/Media/Image/NetworkImage/index.dart +++ /dev/null @@ -1,42 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 17:32:57 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './network_image_demo.dart'; - -const contentText0 = ''' -### **简介** -> 展示网络图片的widget -- 我们可以使用NetworkImage来获取网络图片并展示 -'''; - -const contentText1 = ''' -### **基本用法** -> Image.network 是 NetworkImage 提供给Image widget 的一种简写形式 -- 支持scale属性进行图片的缩放 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/NetworkImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - contentText0, - contentText1, - NetworkImageDemo(), - ], - codeUrl: 'elements/Media/Image/NetworkImage/network_image_demo.dart', - docUrl: 'https://docs.flutter.io/flutter/painting/NetworkImage-class.html', - title: 'NetworkImage', - ); - } -} diff --git a/lib/widgets/elements/Media/Image/NetworkImage/network_image_demo.dart b/lib/widgets/elements/Media/Image/NetworkImage/network_image_demo.dart deleted file mode 100644 index 42f001c7..00000000 --- a/lib/widgets/elements/Media/Image/NetworkImage/network_image_demo.dart +++ /dev/null @@ -1,31 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 17:20:37 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 17:35:36 - -import 'package:flutter/material.dart'; - -class NetworkImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - margin: const EdgeInsets.symmetric(vertical: 20.0), - child: Text('Image.network的使用'), - ), - Image.network( - 'https://gw.alicdn.com/tfs/TB1XD.ZuYwrBKNjSZPcXXXpapXa-255-251.png'), - Container( - child: Text('NetworkImage的使用,带有0.5倍缩放'), - margin: const EdgeInsets.symmetric(vertical: 20.0), - ), - Image( - image: NetworkImage( - 'https://gw.alicdn.com/tfs/TB1XD.ZuYwrBKNjSZPcXXXpapXa-255-251.png', - scale: 0.5), - ) - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Image/RawImage/index.dart b/lib/widgets/elements/Media/Image/RawImage/index.dart deleted file mode 100644 index a96e002a..00000000 --- a/lib/widgets/elements/Media/Image/RawImage/index.dart +++ /dev/null @@ -1,49 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 20:11:44 - -import 'package:flutter/material.dart'; - -import './raw_image_demo.dart'; -import 'package:flutter_go/components/widget_demo.dart'; - -const contentText0 = ''' -### **简介** -> 一个直接显示dart:ui.Image的widget -'''; - -const contentText1 = ''' -### **基本用法** -> RawIamge很少使用,推荐使用Image -- RawImage 是通过 paintImage 绘制出来的Image。这个方法更加详细的描述了各个字段的含义 -- 传递给RawImage中的Image是dart:ui下的Image而不是Material下的Image,见Demo注释 - -'''; - -const contentText2= ''' -### **高级用法** -> 关于更多详细介绍,请看paintImage的属性说明 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/RawImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - codeUrl: 'elements/Media/Image/RawImage/raw_image_demo.dart', - docUrl: 'https://docs.flutter.io/flutter/widgets/RawImage-class.html', - title: 'RawImage', - contentList: [ - contentText0, - contentText1, - RawImageDemo(), - contentText2, - ], - ); - } -} diff --git a/lib/widgets/elements/Media/Image/RawImage/raw_image_demo.dart b/lib/widgets/elements/Media/Image/RawImage/raw_image_demo.dart deleted file mode 100644 index 3aa1caba..00000000 --- a/lib/widgets/elements/Media/Image/RawImage/raw_image_demo.dart +++ /dev/null @@ -1,50 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 17:47:25 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 20:09:32 - -import 'dart:async'; -import 'dart:typed_data'; -import 'dart:ui' as ui; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart' show rootBundle; - -class RawImageDemo extends StatefulWidget { - _RawImageDemoState createState() => _RawImageDemoState(); -} - -class _RawImageDemoState extends State { - ui.Image _img; - - @override - void initState() { - super.initState(); - _loadImageByAsset('assets/images/food06.jpeg').then((_urlImage) { - setState(() { - _img = _urlImage; - }); - }); - } - -// 注意这里必须使用ui.Image - Future _loadImageByAsset(String asset) async { - ByteData data = await rootBundle.load(asset); - ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List()); - ui.FrameInfo fi = await codec.getNextFrame(); - - return fi.image; - } - - @override - Widget build(BuildContext context) { - if (_img == null) { - return Container( - child: null, - ); - } - return Container( - child: RawImage(image: _img), - ); - } -} diff --git a/lib/widgets/elements/Media/Image/index.dart b/lib/widgets/elements/Media/Image/index.dart deleted file mode 100644 index 3ff15ba3..00000000 --- a/lib/widgets/elements/Media/Image/index.dart +++ /dev/null @@ -1,84 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-11-16 15:09:19 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-07 15:37:07 - -import "package:flutter/material.dart"; - -import '../../../../model/widget.dart'; -import './AssetImage/index.dart' as AssetImage; -import './DecorationImage/index.dart' as DecorationImage; -import './DecorationImagePainter/index.dart' as DecorationImagePainter; -import './ExactAssetImage/index.dart' as ExactAssetImage; -import './FadeInImage/index.dart' as FadeInImage; -import './FileImage/index.dart' as FileImage; -import './MemoryImage/index.dart' as MemoryImage; -import './NetworkImage/index.dart' as NetworkImage; -import './paintImage/index.dart' as paintImage; -import './precacheImage/index.dart' as precacheImage; -import './RawImage/index.dart' as RawImage; -import './Image/index.dart' as Image; - - -List widgetPoints = [ - WidgetPoint( - name: 'AssetImage', - routerName: AssetImage.Demo.routeName, - buildRouter: (BuildContext context) => AssetImage.Demo(), - ), - WidgetPoint( - name: 'DecorationImage', - routerName: DecorationImage.Demo.routeName, - buildRouter: (BuildContext context) => DecorationImage.Demo(), - ), - WidgetPoint( - name: 'DecorationImagePainter', - routerName: DecorationImagePainter.Demo.routeName, - buildRouter: (BuildContext context) => DecorationImagePainter.Demo(), - ), - WidgetPoint( - name: 'ExactAssetImage', - routerName: ExactAssetImage.Demo.routeName, - buildRouter: (BuildContext context) => ExactAssetImage.Demo(), - ), - WidgetPoint( - name: 'FadeInImage', - routerName: FadeInImage.Demo.routeName, - buildRouter: (BuildContext context) => FadeInImage.Demo(), - ), - WidgetPoint( - name: 'FileImage', - routerName: FileImage.Demo.routeName, - buildRouter: (BuildContext context) => FileImage.Demo(), - ), - WidgetPoint( - name: 'MemoryImage', - routerName: MemoryImage.Demo.routeName, - buildRouter: (BuildContext context) => MemoryImage.Demo(), - ), - WidgetPoint( - name: 'NetworkImage', - routerName: NetworkImage.Demo.routeName, - buildRouter: (BuildContext context) => NetworkImage.Demo(), - ), - WidgetPoint( - name: 'paintImage', - routerName: paintImage.Demo.routeName, - buildRouter: (BuildContext context) => paintImage.Demo(), - ), - WidgetPoint( - name: 'precacheImage', - routerName: precacheImage.Demo.routeName, - buildRouter: (BuildContext context) => precacheImage.Demo(), - ), - WidgetPoint( - name: 'RawImage', - routerName: RawImage.Demo.routeName, - buildRouter: (BuildContext context) => RawImage.Demo(), - ), - WidgetPoint( - name: 'Image', - routerName: Image.Demo.routeName, - buildRouter: (BuildContext context) => Image.Demo(), - ), -]; \ No newline at end of file diff --git a/lib/widgets/elements/Media/Image/paintImage/index.dart b/lib/widgets/elements/Media/Image/paintImage/index.dart deleted file mode 100644 index 38721433..00000000 --- a/lib/widgets/elements/Media/Image/paintImage/index.dart +++ /dev/null @@ -1,36 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 20:19:01 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -const String contentText0 = ''' -### **非Widget 待删除** - -'''; - -const String contentText1 = ''' - -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/paintImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - contentText0, - ], - codeUrl: 'elements/Media/Image/paintImage/paint_image_demo.dart', - docUrl: 'https://docs.flutter.io/flutter/painting/paintImage.html', - title: 'paintImage', - ); - } -} diff --git a/lib/widgets/elements/Media/Image/paintImage/paint_image_demo.dart b/lib/widgets/elements/Media/Image/paintImage/paint_image_demo.dart deleted file mode 100644 index 24347bcc..00000000 --- a/lib/widgets/elements/Media/Image/paintImage/paint_image_demo.dart +++ /dev/null @@ -1,15 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 17:46:57 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 17:46:57 - -import 'package:flutter/material.dart'; - -class PaintImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/Image/precacheImage/index.dart b/lib/widgets/elements/Media/Image/precacheImage/index.dart deleted file mode 100644 index 8e586ff9..00000000 --- a/lib/widgets/elements/Media/Image/precacheImage/index.dart +++ /dev/null @@ -1,20 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-11-16 15:09:12 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-11-16 15:09:12 - -import 'package:flutter/material.dart'; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Media/Image/precacheImage'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return Container( - child: null, - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/Image/precacheImage/precache_image_demo.dart b/lib/widgets/elements/Media/Image/precacheImage/precache_image_demo.dart deleted file mode 100644 index 4464e624..00000000 --- a/lib/widgets/elements/Media/Image/precacheImage/precache_image_demo.dart +++ /dev/null @@ -1,15 +0,0 @@ - /// @Author: 一凨 - /// @Date: 2018-12-08 17:47:57 - /// @Last Modified by: 一凨 - /// @Last Modified time: 2018-12-08 17:48:20 - -import 'package:flutter/material.dart'; - -class PrecacheImageDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - - ); - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Media/index.dart b/lib/widgets/elements/Media/index.dart deleted file mode 100644 index 488d1f67..00000000 --- a/lib/widgets/elements/Media/index.dart +++ /dev/null @@ -1,16 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-11-16 15:09:27 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-11-16 15:09:27 - -import 'Image/index.dart' as Image; -import 'Icon/index.dart' as Icon; -import 'Canvas/index.dart' as Canvas; - -List getWidgets() { - List result = []; - result.addAll(Image.widgetPoints); - result.addAll(Icon.widgetPoints); - result.addAll(Canvas.widgetPoints); - return result; -} \ No newline at end of file diff --git a/lib/widgets/elements/index.dart b/lib/widgets/elements/index.dart deleted file mode 100644 index d3362d59..00000000 --- a/lib/widgets/elements/index.dart +++ /dev/null @@ -1,16 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-11-16 15:09:31 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-11-16 15:09:31 - -import 'Form/index.dart' as Form; -import 'Frame/index.dart' as Frame; -import 'Media/index.dart' as Media; - -List getWidgets() { - List result = []; - result.addAll(Form.getWidgets()); - result.addAll(Frame.getWidgets()); - result.addAll(Media.getWidgets()); - return result; -} \ No newline at end of file diff --git a/lib/widgets/index.dart b/lib/widgets/index.dart deleted file mode 100644 index 9c937f8c..00000000 --- a/lib/widgets/index.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'elements/index.dart' as elements; -import 'components/index.dart' as components; -import 'themes/index.dart' as themes; - -class WidgetDemoList { - WidgetDemoList(); - - List getDemos() { - List result = []; - result.addAll(elements.getWidgets()); - result.addAll(components.getWidgets()); - result.addAll(themes.getWidgets()); - return result; - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoApp/demo.dart b/lib/widgets/themes/Cupertino/CupertinoApp/demo.dart deleted file mode 100644 index f503023b..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoApp/demo.dart +++ /dev/null @@ -1,178 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoApp 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// CupertinoApp 的实例 -class CupertinoAppFullDefault extends StatefulWidget { - const CupertinoAppFullDefault() : super(); - - @override - State createState() => _CupertinoAppFullDefault(); -} - -// CupertinoApp 默认的实例,有状态 -class _CupertinoAppFullDefault extends State { - routerHandler(setting) { - //setting.isInitialRoute; bool类型 是否初始路由 - //setting.name; 要跳转的路由名key - return PageRouteBuilder( - pageBuilder: (BuildContext context, _, __) { - //这里为返回的Widget - return HomePage(); - }, - opaque: false, - //跳转动画 - transitionDuration: Duration(milliseconds: 200), - transitionsBuilder: - (___, Animation animation, ____, Widget child) { - return FadeTransition( - opacity: animation, - child: ScaleTransition( - scale: Tween(begin: 0.5, end: 1.0).animate(animation), - child: child, - ), - ); - }); - } - - @override - Widget build(BuildContext context) { - return SizedBox( - height: MediaQuery.of(context).size.height, - width: MediaQuery.of(context).size.width, - //height: 500.0, - child: CupertinoApp( - title: '这里是标题', // 设备用于识别用户的应用程序的单行描述 - builder: (BuildContext context, Widget child) { - // 覆盖下面的所有界面,一般当作追加属性用 - //return Container(child:Text('这里是内容1',style:TextStyle(color:Colors.black))); - return MediaQuery( - // 当构建一个Widget前,调用一般做字体大小,方向,主题颜色等配置 - //字体大小 - data: MediaQuery.of(context).copyWith(textScaleFactor: 1.4), - child: child); - }, - checkerboardOffscreenLayers: false, // 打开渲染到屏幕外位图的图层的checkerboarding - checkerboardRasterCacheImages: false, // 打开光栅缓存图像的检查板。 - debugShowCheckedModeBanner: - true, // 在debug模式下打开一个小“DEBUG”横幅,表示该应用程序处于检查模式 - color: Colors.red, // 该颜色为程序切换中应用图标背景的颜色,当应用图标背景为透明时 -// home: HomePage(),// 进入程序后显示的第一个页面,传入的是一个Widget,但实际上这个Widget需要包裹一个Scaffold - home: CupertinoPageScaffold( - // 进入程序后显示的第一个页面,传入的是一个Widget,但实际上这个Widget需要包裹一个Scaffold - navigationBar: CupertinoNavigationBar( - leading: Icon(CupertinoIcons.back), - middle: Text('Title'), - trailing: Icon(CupertinoIcons.share), - ), - child: Container( - // home 对应的内容和 router对应的内容,同时存在 - padding: const EdgeInsets.only(bottom: 60.0), - alignment: Alignment.center, - child: Text('这里是 home 属性对应的内容', - style: TextStyle( - color: Colors - .black))), // 应用程序默认路由,(Navigator.defaultRouteName,即/) - ), - initialRoute: - '/home', // 如果构建了导航器,则显示的第一条路径的名称,初始路由,当用户进入程序时,自动打开对应的路由。(home还是位于一级)传入的是上面routes的key - locale: Locale('zh', 'CH'), // 本地化初始值 - localeResolutionCallback: (local, support) { - // 区域分辨回调,当传入的是不支持的语种,可以根据这个回调,返回相近,并且支持的语种 - return const Locale('us', 'uk'); - }, - localizationsDelegates: [], // 本地化委托,用于更改Flutter Widget默认的提示语,按钮text等,返回一个 继承自 LocalizationsDelegate 的对象 - navigatorKey: GlobalKey(), // 导航主键 GlobalKey - navigatorObservers: [ - // 路由观察器,当调用Navigator的相关方法时,会回调相关的操作 - MyObserver(), - ], - onGenerateRoute: (setting) { - // 当通过Navigation.of(context).pushNamed跳转路由时,在routes查找不到时,会调用该方法 - routerHandler(setting); - }, - onGenerateTitle: (context) { - // 跟上面的tiitle一样,但含有一个context参数用于做本地化 - return 'Flutter应用'; - }, - onUnknownRoute: (setting) { - // 效果跟onGenerateRoute一样调用顺序为onGenerateRoute ==> onUnknownRoute - //RouterHandler(setting); - }, - routes: { - // 声明程序中有哪个通过Navigation.of(context).pushNamed跳转的路由参数以键值对的形式传递key:路由名字value:对应的Widget - '/home': (BuildContext context) => HomePage(), - '/home/one': (BuildContext context) => OnePage(), - }, - showPerformanceOverlay: - false, // 当为true时应用程序顶部覆盖一层GPU和UI曲线图,可即时查看当前流畅度情况 - showSemanticsDebugger: - false, // 当为true时,打开Widget边框,类似Android开发者模式中显示布局边界 - supportedLocales: [ - // 传入支持的语种数组 - const Locale('uok'), - const Locale('meg'), - ], - )); - } - - Widget homeBuild(BuildContext context) { - return CupertinoTabScaffold( - tabBar: CupertinoTabBar( - backgroundColor: CupertinoColors.white, - items: const [ - BottomNavigationBarItem( - icon: ImageIcon( - AssetImage('assets/images/btn_icon_dingyuehao_normal.png')), - title: Text('Tab 1'), - ), - BottomNavigationBarItem( - icon: ImageIcon( - AssetImage('assets/images/btn_icon_dingyuehao_normal.png')), - title: Text('Tab 2'), - ), - ]), - tabBuilder: (BuildContext context, int index) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - backgroundColor: CupertinoColors.destructiveRed, - middle: Text('这里是标题', style: TextStyle(color: Colors.white)), - ), - child: Center(child: Text('这里是内容', style: TextStyle(color: Colors.black))), - backgroundColor: CupertinoColors.inactiveGray, - ); - }); - } -} - -class MyObserver extends NavigatorObserver { - @override - void didPush(Route route, Route previousRoute) { - // 当调用Navigator.push时回调 - super.didPush(route, previousRoute); - //可通过route.settings获取路由相关内容 - //route.currentResult获取返回内容 - print('MyObserver 路由观察器:${route.settings.name}'); - } -} - -class HomePage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Center( - child: Text('HomePage', style: TextStyle(color: Colors.black))); - } -} - -class OnePage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Center(child: Text('OnePage', style: TextStyle(color: Colors.red))); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoApp/index.dart b/lib/widgets/themes/Cupertino/CupertinoApp/index.dart deleted file mode 100644 index e1efb44d..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoApp/index.dart +++ /dev/null @@ -1,53 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 16:25:22 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-07 15:52:45 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> Cupertino 苹果设计风格的应用,用于创建 iOS 风格应用的顶层组件( Cupertino 苹果电脑的全球总公司所在地,位于美国旧金山 ) -- 它包含了 iOS 应用程序,通常需要的许多 widget; -- 它的构建于基于 iOS 的 WidgetsApp 特定的默认值,如字体和物理滚动; -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoApp 的主要特性 -- top 级别的 Navigator 搜索的配置,需要遵循以下规则优先级 - - 首先,对于 根路由 "/", 使用 home 属性,前提是 home 属性不为空; - - 如果没设置home,则使用 routes 属性,它应用程序的顶级路由表; - - 如果 home 和 routes 都没有做有效配置,则调用onGenerateRoute(如果提供),并且返回非null值; - - 最后,如果所有其他方法都失败onUnknownRoute被调用; - - 如果 home,routes,onGenerateRoute和onUnknownRoute 都为null,并且builder不为null,则不会创建任何Navigator; - - 如果配置了顶级 Navigator 的 observer,则可以做 Hero 动画; -- 在 Android 上谨慎使用此 widget,因为它可能会产生 Android 用户不同的行为,例如: - - 通过反向滑动可以禁用页面; - - 滚动到底或者顶,会触发 ios 风格的弹性效果; - - 某些苹果字体系列在 Android上 不可用,可能导致未定义的字体提示。 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoApp'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoAppFullDefault() - ], - title: 'CupertinoApp', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoApp-class.html', - codeUrl: 'themes/Cupertino/CupertinoApp/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoButton/demo.dart b/lib/widgets/themes/Cupertino/CupertinoButton/demo.dart deleted file mode 100644 index 806704df..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoButton/demo.dart +++ /dev/null @@ -1,37 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoButton 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - - -// Checkbox 默认按钮的实例 -// index 当前checkbox 的索引值 -class CupertinoButtonFullDefault extends StatefulWidget { - const CupertinoButtonFullDefault() : super(); - - @override - State createState() => _CupertinoButtonFullDefault(); -} - - -// CupertinoButton 默认的实例,有状态 -class _CupertinoButtonFullDefault extends State { - - @override - Widget build(BuildContext context) { - return CupertinoButton( - borderRadius: BorderRadius.all(Radius.circular(15.0)), - onPressed: () { - print('on Pressed!'); - }, - pressedOpacity:0.5,// 按下后的按钮不透明度 - color:CupertinoColors.inactiveGray, - child: new Text('CupertinoButton'), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoButton/index.dart b/lib/widgets/themes/Cupertino/CupertinoButton/index.dart deleted file mode 100644 index 03b691f3..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoButton/index.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 下午10:57 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoButton 的示例 - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> ios 风格的 button -- 与普通的 button 一样,需要设置 text 或者 icon, 不同的是带有 fades out 效果; -- 同时可以设置一个背景颜色; -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoButton 的一个是示例 -- 属性基本和 flatButton,raisedButton 类似 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoButton'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoButtonFullDefault() - ], - title: 'CupertinoButton', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoButton-class.html', - codeUrl: 'themes/Cupertino/CupertinoButton/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoColors/demo.dart b/lib/widgets/themes/Cupertino/CupertinoColors/demo.dart deleted file mode 100644 index 926fbcc1..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoColors/demo.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoColors 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Checkbox 默认按钮的实例 -// index 当前checkbox 的索引值 -class CupertinoColorsFullDefault extends StatefulWidget { - const CupertinoColorsFullDefault() : super(); - - @override - State createState() => _CupertinoColorsFullDefault(); -} - -// CupertinoColors 默认的实例,有状态 -class _CupertinoColorsFullDefault extends State { - - Widget setColorsView(cupertinoColors,String colorName){ - return Container( - width: MediaQuery.of(context).size.width-100, - padding: const EdgeInsets.all(10.0), - child:Text(colorName,style:TextStyle(color:Colors.white)), - decoration:BoxDecoration(color: cupertinoColors) - ); - } - @override - Widget build(BuildContext context) { - return Column( - children: [ - setColorsView(CupertinoColors.activeBlue,'activeBlue'), - setColorsView(CupertinoColors.activeGreen,'activeGreen'), - setColorsView(CupertinoColors.black,'black'), - setColorsView(CupertinoColors.destructiveRed,'destructiveRed'), - setColorsView(CupertinoColors.inactiveGray,'inactiveGray'), - setColorsView(CupertinoColors.lightBackgroundGray,'lightBackgroundGray'), - setColorsView(CupertinoColors.white,'white') - ], - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoColors/index.dart b/lib/widgets/themes/Cupertino/CupertinoColors/index.dart deleted file mode 100644 index 4953ba79..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoColors/index.dart +++ /dev/null @@ -1,42 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 下午10:57 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoColors 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> iOS平台常用的颜色 -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoColors 的一个是示例 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoColors'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoColorsFullDefault() - ], - title: 'CupertinoColors', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoColors-class.html', - codeUrl: 'themes/Cupertino/CupertinoColors/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoIcons/demo.dart b/lib/widgets/themes/Cupertino/CupertinoIcons/demo.dart deleted file mode 100644 index 10c01ad6..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoIcons/demo.dart +++ /dev/null @@ -1,85 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoIcons 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'package:flutter_go/resources/icon_names.dart' as icon_names; - -// CupertinoIcons 默认的实例 -class CupertinoIconsFullDefault extends StatefulWidget { - const CupertinoIconsFullDefault() : super(); - - @override - State createState() => _CupertinoIconsFullDefault(); -} - -// CupertinoIcons 默认的实例,有状态 -class _CupertinoIconsFullDefault extends State { - - final colorsList = []; - final List widgetList = []; - - Widget rowView(IconData itA,IconData itB){ - //print('itA=====>${itA.fontPackage}'); - return Row( - //mainAxisSize:MainAxisSize.max, - //crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex:1, - child: CupertinoButton( - padding: EdgeInsets.only(left: 0), - onPressed: () { }, - child:FlatButton.icon( - label: Text('默认按钮', semanticsLabel: 'Add'), - icon:Icon(itA, - semanticLabel: 'Add', - ), - onPressed: () { }, - ))), - Expanded( - flex:1, - child: CupertinoButton( - padding: EdgeInsets.zero, - onPressed: () { }, - child:FlatButton.icon( - label: Text('默认按钮', semanticsLabel: 'Add'), - icon:Icon(itB, - semanticLabel: 'Add', - ), - onPressed: () { }, - ))), - ], - ); - } - - @override - void initState() { - super.initState(); - - final names = icon_names.CupertinoIIconNames.names; - for(var i=0;i Cupertino图标的标识符 -- 与Icon类一起使用以显示特定图标; -- 请确保cupertino_icons在项目的pubspec.yaml文件中添加依赖项。这可确保CupertinoIcons字体包含在您的应用程序中; -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoIcons 的一个示例 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoIcons'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoIconsFullDefault() - ], - title: 'CupertinoIcons', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoIcons-class.html', - codeUrl: 'themes/Cupertino/CupertinoIcons/demo.dart' - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoNavigationBar/demo.dart b/lib/widgets/themes/Cupertino/CupertinoNavigationBar/demo.dart deleted file mode 100644 index aa62be92..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoNavigationBar/demo.dart +++ /dev/null @@ -1,132 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoNavigationBar 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// CupertinoNavigationBar 默认的实例 -class CupertinoNavigationBarFullDefault extends StatefulWidget { - const CupertinoNavigationBarFullDefault() : super(); - - @override - State createState() => _CupertinoNavigationBarFullDefault(); -} - -// CupertinoNavigationBar 默认的实例,有状态 -class _CupertinoNavigationBarFullDefault extends State { - - Widget build2(BuildContext context) { - return SizedBox( - height: MediaQuery.of(context).size.height, - width: MediaQuery.of(context).size.width, - //height: 500.0, - child:CupertinoApp( - home: CupertinoTabScaffold( - tabBar: CupertinoTabBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(CupertinoIcons.share), - title: Text('Tab 1'), - ), - BottomNavigationBarItem( - icon: Icon(CupertinoIcons.share), - title: Text('Tab 2'), - ), - ], - ), - tabBuilder: (BuildContext context, int index) { - // For 1-indexed readability. - ++index; - return CupertinoTabView( - builder: (BuildContext context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 1 of tab $index'), - ), - child: Center( - child: CupertinoButton( - child: const Text('Next'), - onPressed: () { - Navigator.of(context).push( - CupertinoPageRoute( - builder: (BuildContext context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 2 of tab $index'), - ), - child: Center( - child: CupertinoButton( - child: const Text('Back'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ), - ); - }, - ), - ); - }, - ), - ), - ); - }, - ); - }, - ), - ) - ); - } - - @override - Widget build(BuildContext context) { - return SizedBox( - height: MediaQuery.of(context).size.height/1.5, - child: navigationBar(context) - ); - } - - Widget navigationBar(BuildContext context) { - return CupertinoPageScaffold( // 进入程序后显示的第一个页面,传入的是一个Widget,但实际上这个Widget需要包裹一个Scaffold - navigationBar: CupertinoNavigationBar( - leading: Icon(CupertinoIcons.back),// 放置在导航栏的开头。通常是正常页面的后退按钮或完整页面对话框的取消按钮 - middle: Text('Title'),// 放置在导航栏的中间。通常是标题或分段控件 - trailing: Icon(CupertinoIcons.share),// 放置在导航栏的末尾。通常在页面上执行其他操作,例如搜索或编辑功能 - actionsForegroundColor:CupertinoColors.white,// 用于 导航栏中前导和尾随小部件的文本和图标的默认颜色。 - backgroundColor:CupertinoColors.activeGreen,// 导航栏的背景颜色。如果它包含透明度,标签栏将自动对其背后的内容产生模糊效果 - border:Border( // 边框样式 - bottom: BorderSide(color: CupertinoColors.inactiveGray, width: 1.0), - ), - //heroTag :null, - previousPageTitle:'???',// 自动隐含前导按钮时手动指定上一个路线的标题 - transitionBetweenRoutes:true // 是否在导航栏之间转换 - ), - child: Center( - child: Text('这里是内容', style: TextStyle(color: Colors.black)) - ), // 应用程序默认路由,(Navigator.defaultRouteName,即/) - ); - } - - Widget tabBar(BuildContext context){ - return CupertinoTabBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(CupertinoIcons.home), - title: Text('Home'), - ), - BottomNavigationBarItem( - icon: Icon(CupertinoIcons.conversation_bubble), - title: Text('Support'), - ), - BottomNavigationBarItem( - icon: Icon(CupertinoIcons.profile_circled), - title: Text('Profile'), - ), - ] - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoNavigationBar/index.dart b/lib/widgets/themes/Cupertino/CupertinoNavigationBar/index.dart deleted file mode 100644 index 8dfa5198..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoNavigationBar/index.dart +++ /dev/null @@ -1,54 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 下午10:57 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoNavigationBar 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> ios 风格的 导航栏 -- 构成 toolbar 的最基本 widget,常规页面的 title,在 toolbar 居中显示; -- 当居中显示时,它支持通过设置 leading 和 trailing 属性对应的 widget,来决定是在中间 widget 前面还是后面显示; -- leading widget 将自动的成为一个返回 chevron icon button(或全屏对话框的关闭按钮),如果没有提供,则弹出当前路由,并且automaticallyImplyLeading为true(默认为true); -- 如果没有提供,并且 automaticallyImplyIdle 为true,则中间的 widget 将自动成为当前 CupertinoPageRoute 中的 title。 -- 它应该被放在屏幕的顶部,并自动占据操作系统的状态栏。 -- 如果给定 backgroundColor 的不透明度不是1.0(默认情况下为1.0),它将对其后面的内容产生模糊效果。 -- 当路 transitionBetweenRoutes 为 true,如果被切换的路由还拥有一个 CupertinaVigationBar 或一个 CupertinoSiverNavigationBar,并且 transitionBetweenRoutes 设置为 true,则此导航栏将在路由顶部而不是在路由内部进行切换。 -- 如果 transitionBetweenRoutes 为 true,则任何 widget 的参数,都不能在其子树中包含 key,因为该 widget 将同时存在于树中的多个位置。 -- 默认情况下,每个页面路由中只应存在一个 CupertinaVigationBar 或 CupertinoSiverNavigationBar,以支持默认切换。 -- 使用 transitionBetweenRoutes 或 Herotag 可自定义每个路由的多个导航栏的切换行为。 -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoNavigationBar 的一个示例 -- 通常被 CupertinoPageScaffold 包裹 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoNavigationBar'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoNavigationBarFullDefault(), - SizedBox(height:50) - ], - title: 'CupertinoNavigationBar', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoNavigationBar-class.html', - codeUrl: 'themes/Cupertino/CupertinoNavigationBar/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoPageRoute/demo.dart b/lib/widgets/themes/Cupertino/CupertinoPageRoute/demo.dart deleted file mode 100644 index e09a6d56..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPageRoute/demo.dart +++ /dev/null @@ -1,90 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPageRoute 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// CupertinoPageRoute 默认的实例 -class CupertinoPageRouteFullDefault extends StatefulWidget { - const CupertinoPageRouteFullDefault() : super(); - - @override - State createState() => _CupertinoPageRouteFullDefault(); -} - -// CupertinoPageRoute 默认的实例,有状态 -class _CupertinoPageRouteFullDefault extends State { - - Widget pageRoute(BuildContext context,int index){ - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 2 of tab $index'), - ), - child: Center( - child: CupertinoButton( - child: const Text('Back'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - return SizedBox( - height: MediaQuery.of(context).size.height, - width: MediaQuery.of(context).size.width, - //height: 500.0, - child:CupertinoApp( - home: CupertinoTabScaffold( - tabBar: CupertinoTabBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(CupertinoIcons.share), - title: Text('无滑动的切换1'), - ), - BottomNavigationBarItem( - icon: Icon(CupertinoIcons.share), - title: Text('无滑动的切换2'), - ), - ], - ), - tabBuilder: (BuildContext context, int index) { - // For 1-indexed readability. - ++index; - return CupertinoTabView( - builder: (BuildContext context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 1 of tab $index'), - ), - child: Center( - child: CupertinoButton( - child: const Text('点击我,看滑动动画'), - onPressed: () { - Navigator.of(context).push( - CupertinoPageRoute( - maintainState:false, // 是否前一个路由将保留在内存中 - builder: (BuildContext context) { // 生成器 - return pageRoute(context,index); - } - ) - ); - }, - ), - ), - ); - }, - ); - }, - ), - ) - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoPageRoute/index.dart b/lib/widgets/themes/Cupertino/CupertinoPageRoute/index.dart deleted file mode 100644 index ba91f779..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPageRoute/index.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 下午10:57 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPageRoute 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> ios 风格全屏切换路由的滑动动画 -- 页面从右侧滑入,然后反向退出。当另一页进入覆盖它时,视差中的页面也会向左移动; -- 页面从底部滑入,然后反向退出,全屏 dialogs 没有视差效果; -- 默认情况下,当切换路由被其他路由替换时,前一个路由将保留在内存中。若要在不需要时释放所有资源,请将 maintainstate 设置为 false; -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoPageRoute 的一个示例 -- 通常被 CupertinoPageScaffold 包裹 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoPageRoute'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoPageRouteFullDefault(), - SizedBox(height:50) - ], - title: 'CupertinoPageRoute', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoPageRoute-class.html', - codeUrl: 'themes/Cupertino/CupertinoPageRoute/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoPageScaffold/demo.dart b/lib/widgets/themes/Cupertino/CupertinoPageScaffold/demo.dart deleted file mode 100644 index bc92622c..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPageScaffold/demo.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPageScaffold 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// CupertinoPageScaffold 默认的实例 -class CupertinoPageScaffoldFullDefault extends StatefulWidget { - const CupertinoPageScaffoldFullDefault() : super(); - - @override - State createState() => _CupertinoPageScaffoldFullDefault(); -} - -// CupertinoPageScaffold 默认的实例,有状态 -class _CupertinoPageScaffoldFullDefault extends State { - @override - Widget build(BuildContext context) { - return SizedBox( - height: MediaQuery.of(context).size.height/1.5, - child: navigationBar(context) - ); - } - - Widget navigationBar(BuildContext context) { - return CupertinoPageScaffold( // 进入程序后显示的第一个页面,传入的是一个Widget,但实际上这个Widget需要包裹一个Scaffold - backgroundColor:CupertinoColors.inactiveGray,// 整个脚手架下面的 widget 的颜色 - navigationBar: CupertinoNavigationBar( - leading: Icon(CupertinoIcons.back),// 放置在导航栏的开头。通常是正常页面的后退按钮或完整页面对话框的取消按钮 - middle: Text('这里是标题'),// 放置在导航栏的中间。通常是标题或分段控件 - trailing: Icon(CupertinoIcons.share),// 放置在导航栏的末尾。通常在页面上执行其他操作,例如搜索或编辑功能 - ), - child: Center( - child: Text('这里是内容', style: TextStyle(color: Colors.black)) - ), // 应用程序默认路由,(Navigator.defaultRouteName,即/) - resizeToAvoidBottomInset:false // child 是否应该调整自己的大小以避免窗口的底部插入 - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoPageScaffold/index.dart b/lib/widgets/themes/Cupertino/CupertinoPageScaffold/index.dart deleted file mode 100644 index 98a41a64..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPageScaffold/index.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 下午10:57 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPageScaffold 的示例 - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> 实现单个 iOS 应用程序页的页面布局 -- 一个 CupertinoPage 重要布局; -- 脚手架在顶部设置导航栏,在导航栏之间或之后设置内容; -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoPageScaffold 的一个示例 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoPageScaffold'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoPageScaffoldFullDefault(), - SizedBox(height:50) - ], - title: 'CupertinoPageScaffold', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoPageScaffold-class.html', - codeUrl: 'themes/Cupertino/CupertinoPageScaffold/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoPicker/demo.dart b/lib/widgets/themes/Cupertino/CupertinoPicker/demo.dart deleted file mode 100644 index 26c6df4b..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPicker/demo.dart +++ /dev/null @@ -1,295 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPicker 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:intl/intl.dart'; - - -const double _kPickerSheetHeight = 216.0; -const double _kPickerItemHeight = 32.0; - -const List coolColorNames = [ - 'Sarcoline', 'Coquelicot', 'Smaragdine', 'Mikado', 'Glaucous', 'Wenge', - 'Fulvous', 'Xanadu', 'Falu', 'Eburnean', 'Amaranth', 'Australien', - 'Banan', 'Falu', 'Gingerline', 'Incarnadine', 'Labrador', 'Nattier', - 'Pervenche', 'Sinoper', 'Verditer', 'Watchet', 'Zaffre', -]; - -class CupertinoPickerDemo extends StatefulWidget { - static const String routeName = '/cupertino/picker'; - - @override - _CupertinoPickerDemoState createState() => _CupertinoPickerDemoState(); -} - -class _CupertinoPickerDemoState extends State { - int _selectedColorIndex = 0; - - Duration timer = const Duration(); - - // Value that is shown in the date picker in date mode. - DateTime date = DateTime.now(); - - // Value that is shown in the date picker in time mode. - DateTime time = DateTime.now(); - - // Value that is shown in the date picker in dateAndTime mode. - DateTime dateTime = DateTime.now(); - - Widget _buildMenu(List children) { - return Container( - decoration: BoxDecoration( - color:CupertinoColors.inactiveGray, - border: const Border( - top: BorderSide(color: Color(0xFFBCBBC1), width: 0.0), - bottom: BorderSide(color: Color(0xFFBCBBC1), width: 0.0), - ), - ), - height: 44.0, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: SafeArea( - top: false, - bottom: false, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: children, - ), - ), - ), - ); - } - - Widget _buildBottomPicker(Widget picker) { - return Container( - height: _kPickerSheetHeight, - padding: const EdgeInsets.only(top: 6.0), - color: CupertinoColors.white, - child: DefaultTextStyle( - style: const TextStyle( - color: CupertinoColors.black, - fontSize: 22.0, - ), - child: GestureDetector( - // Blocks taps from propagating to the modal sheet and popping. - onTap: () {}, - child: SafeArea( - top: false, - child: picker, - ), - ), - ), - ); - } - - Widget _buildColorPicker(BuildContext context) { - final FixedExtentScrollController scrollController = - FixedExtentScrollController(initialItem: _selectedColorIndex); - - return GestureDetector( - onTap: () async { - await showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return _buildBottomPicker( - CupertinoPicker( - magnification:1.0, // 整体放大率 - //offAxisFraction:10.0,// 球面效果的透视系数,消失点位置 - scrollController: scrollController,// 用于读取和控制当前项的FixedxtentScrollController - itemExtent: _kPickerItemHeight,// 所以子节点 统一高度 - backgroundColor: CupertinoColors.white,// 所有子节点下面的背景颜色 - useMagnifier:true,// 是否使用放大效果 - onSelectedItemChanged: (int index) { // 当正中间选项改变时的回调 - if (mounted) { - setState(() => _selectedColorIndex = index); - } - }, - children: List.generate(coolColorNames.length, (int index) { - return Center(child: - Text(coolColorNames[index]), - ); - }), - ), - ); - }, - ); - }, - child: _buildMenu( - [ - const Text('Favorite Color'), - Text( - coolColorNames[_selectedColorIndex], - style: const TextStyle( - color: CupertinoColors.inactiveGray - ), - ), - ], - ), - ); - } - - Widget _buildCountdownTimerPicker(BuildContext context) { - return GestureDetector( - onTap: () { - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return _buildBottomPicker( - CupertinoTimerPicker( - initialTimerDuration: timer, - onTimerDurationChanged: (Duration newTimer) { - if (mounted) { - setState(() => timer = newTimer); - } - }, - ), - ); - }, - ); - }, - child: _buildMenu( - [ - const Text('Countdown Timer'), - Text( - '${timer.inHours}:' - '${(timer.inMinutes % 60).toString().padLeft(2,'0')}:' - '${(timer.inSeconds % 60).toString().padLeft(2,'0')}', - style: const TextStyle(color: CupertinoColors.inactiveGray), - ), - ], - ), - ); - } - - Widget _buildDatePicker(BuildContext context) { - return GestureDetector( - onTap: () { - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return _buildBottomPicker( - CupertinoDatePicker( - mode: CupertinoDatePickerMode.date, - initialDateTime: date, - onDateTimeChanged: (DateTime newDateTime) { - if (mounted) { - setState(() => date = newDateTime); - } - }, - ), - ); - }, - ); - }, - child: _buildMenu( - [ - const Text('Date'), - Text( - DateFormat.yMMMMd().format(date), - style: const TextStyle(color: CupertinoColors.inactiveGray), - ), - ] - ), - ); - } - - Widget _buildTimePicker(BuildContext context) { - return GestureDetector( - onTap: () { - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return _buildBottomPicker( - CupertinoDatePicker( - mode: CupertinoDatePickerMode.time, - initialDateTime: time, - onDateTimeChanged: (DateTime newDateTime) { - if (mounted) { - setState(() => time = newDateTime); - } - }, - ), - ); - }, - ); - }, - child: _buildMenu( - [ - const Text('Time'), - Text( - DateFormat.jm().format(time), - style: const TextStyle(color: CupertinoColors.inactiveGray), - ), - ], - ), - ); - } - - Widget _buildDateAndTimePicker(BuildContext context) { - return GestureDetector( - onTap: () { - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return _buildBottomPicker( - CupertinoDatePicker( - mode: CupertinoDatePickerMode.dateAndTime, - initialDateTime: dateTime, - onDateTimeChanged: (DateTime newDateTime) { - if (mounted) { - setState(() => dateTime = newDateTime); - } - }, - ), - ); - }, - ); - }, - child: _buildMenu( - [ - const Text('Date and Time'), - Text( - DateFormat.yMMMd().add_jm().format(dateTime), - style: const TextStyle(color: CupertinoColors.inactiveGray), - ), - ], - ), - ); - } - - @override - Widget build(BuildContext context) { - return SizedBox( - height:MediaQuery.of(context).size.height, - child:CupertinoPageScaffold( -// navigationBar: CupertinoNavigationBar( -// middle: const Text('Picker'), -// previousPageTitle: 'Cupertino' -// ), - child: DefaultTextStyle( - style: TextStyle(), - child: DecoratedBox( - decoration: BoxDecoration( - color: CupertinoColors.inactiveGray - ), - child: ListView( - children: [ - const Padding(padding: EdgeInsets.only(top: 32.0)), - _buildColorPicker(context), - _buildCountdownTimerPicker(context), - _buildDatePicker(context), - _buildTimePicker(context), - _buildDateAndTimePicker(context), - ], - ), - ), - ), - ) - ); - - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoPicker/index.dart b/lib/widgets/themes/Cupertino/CupertinoPicker/index.dart deleted file mode 100644 index 40de0df9..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPicker/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 下午10:57 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPicker 的示例 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> iOS风格的选择器 -- 以 wheel 的方式显示子 widget,选择发生改变后的回调; -- 通常和 showModalBottomSheet 搭配在屏幕底部显示 picker 选择器; -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoPicker 的一个示例 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoPicker'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoPickerDemo(), - SizedBox(height:50) - ], - title: 'CupertinoPicker', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoPicker-class.html', - codeUrl: 'themes/Cupertino/CupertinoPicker/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoPopupSurface/demo.dart b/lib/widgets/themes/Cupertino/CupertinoPopupSurface/demo.dart deleted file mode 100644 index a878fec5..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPopupSurface/demo.dart +++ /dev/null @@ -1,39 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 上午11:34 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPopupSurface 的示例 - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// CupertinoPopupSurface 默认的实例 -class CupertinoPopupSurfaceFullDefault extends StatefulWidget { - const CupertinoPopupSurfaceFullDefault() : super(); - - @override - State createState() => _CupertinoPopupSurfaceFullDefault(); -} - -// CupertinoPopupSurface 默认的实例,有状态 -class _CupertinoPopupSurfaceFullDefault extends State { - @override - Widget build(BuildContext context) { - return SizedBox( - height: MediaQuery.of(context).size.height/5, - child: cupertinoPopupSurfaceBar(context) - ); - } - - Widget cupertinoPopupSurfaceBar(BuildContext context) { - return CupertinoPopupSurface( - isSurfacePainted:false, - child: Container( - color: CupertinoColors.inactiveGray, - alignment: Alignment.center, - child: Text('这里是内容', style: TextStyle(color: Colors.white)) - ), // 应用程序默认路由,(Navigator.defaultRouteName,即/) - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoPopupSurface/index.dart b/lib/widgets/themes/Cupertino/CupertinoPopupSurface/index.dart deleted file mode 100644 index 87392b90..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoPopupSurface/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -/// Created with Android Studio. -/// User: 一晟 -/// Date: 2019/1/20 -/// Time: 下午10:57 -/// email: zhu.yan@alibaba-inc.com -/// target: CupertinoPopupSurface 的示例 - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart' as demoBox; - -const String content0 = ''' -### **简介** -> 像iOS弹出式表面 -- 快速实现一个圆角弹框,类似 alert dialog 和 sheet; -'''; - -const String content1 = ''' -### **基本用法** -> CupertinoPopupSurface 的一个示例 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Cupertino/CupertinoPopupSurface'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - demoBox.CupertinoPopupSurfaceFullDefault(), - SizedBox(height:50) - ], - title: 'CupertinoPopupSurface', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoPopupSurface-class.html', - codeUrl: 'themes/Cupertino/CupertinoPopupSurface/demo.dart', - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoScrollbar/demo.dart b/lib/widgets/themes/Cupertino/CupertinoScrollbar/demo.dart deleted file mode 100644 index 35abb32e..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoScrollbar/demo.dart +++ /dev/null @@ -1,74 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 15/01/2019 -/// Time: 22:23 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoScrollbarDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - @override - Widget build(BuildContext context) { - return Column( - children: [ - CupertinoScrollbar( - child: Container( - height: 300, - child: ListView.custom( - scrollDirection: Axis.vertical, - childrenDelegate:SliverChildBuilderDelegate((BuildContext context, int index) { - return Container( - height: 50.0, - alignment: Alignment.center, - color: Colors.lightBlue[100 * (index % 9)], - child: Text('list item $index'), - ); - }, childCount: 10), - ) - ) - ), - Center( - child: Text("CupertinoScrollbar效果"), - ) - ], - ); - } -} - - -class NoCupertinoScrollbarDemo extends StatefulWidget { - _NoCupertinoScrollbarDemo createState() => _NoCupertinoScrollbarDemo(); -} - -class _NoCupertinoScrollbarDemo extends State { - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - height: 300, - child: ListView.custom( - scrollDirection: Axis.vertical, - childrenDelegate:SliverChildBuilderDelegate((BuildContext context, int index) { - return Container( - height: 50.0, - alignment: Alignment.center, - color: Colors.lightBlue[100 * (index % 9)], - child: Text('list item $index'), - ); - }, childCount: 10), - ) - ), - Center( - child: Text("无CupertinoScrollbar效果"), - ) - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoScrollbar/index.dart b/lib/widgets/themes/Cupertino/CupertinoScrollbar/index.dart deleted file mode 100644 index 93f14914..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoScrollbar/index.dart +++ /dev/null @@ -1,43 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const Text0 = ''' -### **简介** -> CupertinoScrollbar 是ios样式风格的滚动条 - -为其可滚动的子元素,构建一个ios风格样式的滚动条 -'''; - -const String Text1 = """ -### **基本用法** -> 这里我们会用一个有CupertinoScrollbar和无CupertinoScrollbar的demo进行对比展示, -通过对比, 我们发现CupertinoScrollbar的子组件, 会有滚动的时候, 右侧会有一个滚动条. -"""; - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoScrollbar'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoScrollbar', - codeUrl: 'themes/Cupertino/CupertinoScrollbar/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/material/MaterialAccentColor-class.html', - contentList: [ - Text0, - Text1, - CupertinoScrollbarDemo(), - NoCupertinoScrollbarDemo(), - SizedBox(height: 100), - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoSegmentedControl/demo.dart b/lib/widgets/themes/Cupertino/CupertinoSegmentedControl/demo.dart deleted file mode 100644 index 20aeac97..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSegmentedControl/demo.dart +++ /dev/null @@ -1,36 +0,0 @@ - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoSegmentedControlDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - String value = 'a'; - @override - Widget build(BuildContext context) { - return CupertinoSegmentedControl( - onValueChanged: (v) { - this.setState(() { - value = v; - }); - }, - pressedColor: Color(0xff7c1c25), - borderColor: Color(0xffac172a), - selectedColor: Color(0xffac172a), - groupValue: value, - children: { - 'a': Container( - alignment: Alignment.center, - width: 130.0, - child: Text('a') - ), - 'c': Text('C'), - 'b': Text('B'), - }, - ); - } - -} - diff --git a/lib/widgets/themes/Cupertino/CupertinoSegmentedControl/index.dart b/lib/widgets/themes/Cupertino/CupertinoSegmentedControl/index.dart deleted file mode 100644 index 5063c7d2..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSegmentedControl/index.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const Text0 = ''' -### **简介** -> IOS风格下用于展示一些用户可以选择的选项 - -将来自CupertinoSegmentedControl的child属性的Map列表中的组件, 以水平的方式展开供用户选择.这些选择是互斥的. 用户只能选择一个. - - -### **基本用法** - -> 这个组件的重点属性在于他的child属性 - -在官方文档中, 它的child属性是一个Map对象. 这个对象的K可以是任意对象, String/Int/Widget/Array..., 这里的T值会在每次用户点击的时候. 触发**onValueChanged** 回调, -整个组件的高度, 取决于Map列表中Widget中最高的. 整个组件的宽度, 取决于Map列表中widget中最宽的 * Map的长度. - -样式支持用户自定义. -'''; - - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoSegmentedControl'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoSegmentedControl', - codeUrl: '/hemes/Cupertino/CupertinoSegmentedControl/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSegmentedControl-class.html', - contentList: [ - Text0, - CupertinoSegmentedControlDemo(), - SizedBox(height: 100), - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoSlider/demo.dart b/lib/widgets/themes/Cupertino/CupertinoSlider/demo.dart deleted file mode 100644 index 1ddded71..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSlider/demo.dart +++ /dev/null @@ -1,34 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 15/01/2019 -/// Time: 22:23 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoSliderDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - double value = 0.0; - @override - Widget build(BuildContext context) { - return CupertinoSlider( - value: value,//实际进度的位置 - min: 0.0, - max: 100.0, - divisions: 100, - activeColor: Colors.blue,//进度中活动部分的颜色 - onChanged: (double){ - setState(() { - value = double.roundToDouble(); - }); - }, - ); - } - -} - diff --git a/lib/widgets/themes/Cupertino/CupertinoSlider/index.dart b/lib/widgets/themes/Cupertino/CupertinoSlider/index.dart deleted file mode 100644 index 8d993208..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSlider/index.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const Text0 = ''' -### **简介** -> 用来选择范围性的数据 - -CupertinoSlider 是ios风格的Slide组件,用来选择连续性的或者非连续性的数据. 默认是在一段最大值最小值间做任意值的选择. 如果你想选择间隔性的值, 例如0.0到50.0间,选择10, 15,...50.0这样的值, 给divisions设定一个非空的整数5,, 去分割区间范围. - -### **基本用法** - -> 与 Slider 相同, 具体查看Slider组件 -'''; - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoSlider'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoSlider', - codeUrl: 'themes/Cupertino/CupertinoSlider/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSlider-class.html', - contentList: [ - Text0, - CupertinoSliderDemo(), - SizedBox(height: 100), - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoSliverNavigationBar/demo.dart b/lib/widgets/themes/Cupertino/CupertinoSliverNavigationBar/demo.dart deleted file mode 100644 index bbb27bd5..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSliverNavigationBar/demo.dart +++ /dev/null @@ -1,153 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 15/01/2019 -/// Time: 22:23 -/// email: sanfan.hx@alibaba-inc.com -/// target: xxx - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoSliverNavigationBarDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - double value = 0.0; - @override - Widget build(BuildContext context) { - return CupertinoPageScaffold( - child: DecoratedBox( - decoration: const BoxDecoration(color: Color(0xFFEFEFF4)), - child: Container( - height: 600.0, - child: CustomScrollView( - slivers: [ - CupertinoSliverNavigationBar( - largeTitle: const Text('demo', maxLines: 1,), - previousPageTitle: 'Cupertino', - trailing: Icon(Icons.perm_camera_mic) - ), - CupertinoSliverRefreshControl( - onRefresh: () { - }, - ), - SliverSafeArea( - top: false, // Top safe area is consumed by the navigation bar. - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return _ListItem(name: 'name$index',place: 'place$index', date: 'date', called: true); - }, - childCount: 20, - ), - ), - ), - ], - ), - ) - ), - ); - } - -} - - - - -class _ListItem extends StatelessWidget { - const _ListItem({ - this.name, - this.place, - this.date, - this.called, - }); - - final String name; - final String place; - final String date; - final bool called; - - @override - Widget build(BuildContext context) { - return Container( - color: CupertinoColors.white, - height: 60.0, - padding: const EdgeInsets.only(top: 9.0), - child: Row( - children: [ - Container( - width: 38.0, - margin: EdgeInsets.only(top: 10), - child: called - ? const Align( - alignment: Alignment.topCenter, - child: Icon( - CupertinoIcons.phone_solid, - color: CupertinoColors.inactiveGray, - size: 28.0, - ), - ) - : null, - ), - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - bottom: BorderSide(color: Color(0xFFBCBBC1), width: 0.0), - ), - ), - padding: const EdgeInsets.only(left: 1.0, bottom: 9.0, right: 10.0), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontWeight: FontWeight.w600, - letterSpacing: -0.18, - ), - ), - Text( - place, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontSize: 15.0, - letterSpacing: -0.24, - color: CupertinoColors.inactiveGray, - ), - ), - ], - ), - ), - Text( - date, - style: const TextStyle( - color: CupertinoColors.inactiveGray, - fontSize: 15.0, - letterSpacing: -0.41, - ), - ), - const Padding( - padding: EdgeInsets.only(left: 9.0), - child: Icon( - CupertinoIcons.info, - color: CupertinoColors.activeBlue - ), - ), - ], - ), - ), - ), - ], - ), - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoSliverNavigationBar/index.dart b/lib/widgets/themes/Cupertino/CupertinoSliverNavigationBar/index.dart deleted file mode 100644 index 3cd0ffc8..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSliverNavigationBar/index.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const Text0 = ''' -### **简介** -> ios-11风格下拥有一个较大标题块的导航栏目 - -### **基本用法** - -> 该组件使用时. 必须做为含有slivers属性的滚动列表的子组件中,例如CustomScrollView -'''; - - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoSliverNavigationBar'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoSlider', - codeUrl: 'themes/Cupertino/CupertinoSliverNavigationBar/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSliverNavigationBar-class.html', - contentList: [ - Text0, - CupertinoSliverNavigationBarDemo(), - SizedBox(height: 100), - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoSwitch/demo.dart b/lib/widgets/themes/Cupertino/CupertinoSwitch/demo.dart deleted file mode 100644 index d677dd0a..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSwitch/demo.dart +++ /dev/null @@ -1,33 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 15/01/2019 -/// Time: 22:23 -/// email: sanfan.hx@alibaba-inc.com -/// target: CupertinoSwitchDemo - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoSwitchDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - bool _lights = false; - @override - Widget build(BuildContext context) { - return MergeSemantics( - child: ListTile( - title: Text('CupertinoSwitch'), - trailing: CupertinoSwitch( - activeColor: Colors.yellow, - value: _lights, - onChanged: (bool value) { setState(() { _lights = value; }); }, - ), - onTap: () { setState(() { _lights = !_lights; }); }, - ), - ); - } - -} - diff --git a/lib/widgets/themes/Cupertino/CupertinoSwitch/index.dart b/lib/widgets/themes/Cupertino/CupertinoSwitch/index.dart deleted file mode 100644 index 94b9ac68..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoSwitch/index.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'demo.dart'; -const Text0 = ''' -### **简介** -> ios风格下的Switch组件, 用法与Switch组件相同 - -### **基本用法** - -> 基本用法与Switch基本相同. 不同点在于, 该组件仅支持自定义activeColor, 也就是支持自定义当按钮处于true状态下,按钮的背景色. -'''; - - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoSwitch'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoSlider', - codeUrl: 'themes/Cupertino/CupertinoSwitch/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSwitch-class.html', - contentList: [ - Text0, - CupertinoSwitchDemo() - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoTabBar/demo.dart b/lib/widgets/themes/Cupertino/CupertinoTabBar/demo.dart deleted file mode 100644 index c6794121..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTabBar/demo.dart +++ /dev/null @@ -1,52 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/01/2019 -/// Time: 22:28 -/// email: sanfan.hx@alibaba-inc.com -/// target: CupertinoTabBar - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoTabBarDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - int index = 0; - - changeIndex(int _index) { - this.setState(() { - index = _index; - }); - } - @override - Widget build(BuildContext context) { - return Container( - height: 500, - child: Scaffold( - appBar: AppBar(title: const Text('CupertinoTabBarDemo')), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - body: Center( - child: Text('CupertinoTabBarDemo in bottom'), - ), - bottomNavigationBar: CupertinoTabBar( - backgroundColor: Color.fromRGBO(244, 244, 244, 0.5), - currentIndex: index, - onTap: (i) { - this.changeIndex(i); - }, - items: [ - BottomNavigationBarItem( - title: Text("1"), - icon: Icon(Icons.add), - ), - BottomNavigationBarItem( - title: Text("2"), - icon: Icon(Icons.delete) - )], - ) - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoTabBar/index.dart b/lib/widgets/themes/Cupertino/CupertinoTabBar/index.dart deleted file mode 100644 index c2cd0106..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTabBar/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'demo.dart'; -const Text0 = ''' -### **简介** -> ios风格下底部导航组件. - -通过BottomNavigationBarItem列表,在屏幕底部展示多个小组件, 默认下选择第一个小组件; - -### **基本用法** - -这个组件, 没有任何内部状态, 使用时需要开发者自己去监听**onTap**方法, 主动为组件的属性**currentIndex**赋值 - -在官网上有这么一段文字: - -> If the given backgroundColor's opacity is not 1.0 (which is the case by default), it will produce a blurring effect to the content behind it. - -本人试了很多次. 也没有发现这个Blur Effect是怎么触发的, 如果有人了解, 欢迎提PR. -'''; - - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoTabBar'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoTabBar', - codeUrl: 'themes/Cupertino/CupertinoTabBar/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoTabBar-class.html', - contentList: [ - Text0, - CupertinoTabBarDemo() - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoTabScaffold/demo.dart b/lib/widgets/themes/Cupertino/CupertinoTabScaffold/demo.dart deleted file mode 100644 index fde03721..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTabScaffold/demo.dart +++ /dev/null @@ -1,78 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/01/2019 -/// Time: 22:28 -/// email: sanfan.hx@alibaba-inc.com -/// target: CupertinoTabBar - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoTabScaffoldDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - int index = 0; - - changeIndex(int _index) { - this.setState(() { - index = _index; - }); - } - @override - Widget build(BuildContext context) { - return SizedBox( - height: 500, - child: CupertinoTabScaffold( - tabBar: CupertinoTabBar( - items: [ - BottomNavigationBarItem( - title: Text("1"), - icon: Icon(Icons.add), - ), - BottomNavigationBarItem( - title: Text("2"), - icon: Icon(Icons.add), - ) - ], - ), - tabBuilder: (BuildContext context, int index) { - return CupertinoTabView( - builder: (BuildContext context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 1 of tab $index'), - ), - child: Center( - child: CupertinoButton( - child: Text('Next page = $index'), - onPressed: () { - Navigator.of(context).push( - CupertinoPageRoute( - builder: (BuildContext context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 2 of tab $index'), - ), - child: Center( - child: CupertinoButton( - child: const Text('Back'), - onPressed: () { Navigator.of(context).pop(); }, - ), - ), - ); - }, - ), - ); - }, - ), - ), - ); - }, - ); - }, - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoTabScaffold/index.dart b/lib/widgets/themes/Cupertino/CupertinoTabScaffold/index.dart deleted file mode 100644 index fe736adc..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTabScaffold/index.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -import 'demo.dart'; -const Text0 = ''' -### **简介** - -> 实现iOS应用程序的选项卡式的根布局与结构。 - -一个在底部放置标签栏,标签栏之间或后面放置内容的脚手架. - -这个脚手架, tabBar组件与tabBuilder组件是必须配置的。如果你为该脚手架配置的tabBar组件是 **CupertinoTabBar**的话. 它会自动监听**CupertinoTabBar**底部的切换事件, 去动态切换主体显示的内容. - - -选项卡的内容是使用**tabBuilder**选项卡生成器生成的。TabBuilder必须能够生成tabbar中组件数组长度相同数量的组件。不活动的选项卡将被移到后台并禁用其动画。 - - -使用cupertinobview作为每个选项卡的内容,以支持具有并行导航状态和历史记录的选项卡。 - - -通过BottomNavigationBarItem列表,在屏幕底部展示多个小组件, 默认下选择第一个小组件; - -### **基本用法** - - -'''; - - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoTabScaffold'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoTabScaffold', - codeUrl: 'themes/Cupertino/CupertinoTabScaffold/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html', - contentList: [ - Text0, - CupertinoTabScaffoldDemo() - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoTabView/demo.dart b/lib/widgets/themes/Cupertino/CupertinoTabView/demo.dart deleted file mode 100644 index a0b61b08..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTabView/demo.dart +++ /dev/null @@ -1,93 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/01/2019 -/// Time: 22:28 -/// email: sanfan.hx@alibaba-inc.com -/// target: CupertinoTabBar - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class CupertinoTabScaffoldDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - int index = 0; - - changeIndex(int _index) { - this.setState(() { - index = _index; - }); - } - @override - Widget build(BuildContext context) { - return SizedBox( - height: 500, - child: CupertinoTabScaffold( - tabBar: CupertinoTabBar( - items: [ - BottomNavigationBarItem( - title: Text("A"), - icon: Icon(Icons.add), - ), - BottomNavigationBarItem( - title: Text("B"), - icon: Icon(Icons.add), - ) - ], - ), - tabBuilder: (BuildContext context, int index) { - return CupertinoTabView( - routes: { - '/': (context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 1 of tabView $index'), - ), - child: Center( - child: Text('CupertinoTabView /'), - ), - ); - }, - '/home': (context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 1 of tabView $index'), - ), - child: Center( - child: Text('CupertinoTabView home'), - ), - ); - } - }, - builder: (BuildContext context) { - return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text('Page 1 of tabView $index'), - ), - child: Column( - children: [ - SizedBox(height: 100), - CupertinoButton( - child: Text('Next page is self home page'), - onPressed: () { - Navigator.of(context).pushNamed('/home'); - }, - ), - CupertinoButton( - child: Text('Next page is home home page'), - onPressed: () { - Navigator.of(context, rootNavigator: true).pushNamed('/home'); - }, - ) - ], - ) - ); - }, - ); - }, - ), - ); - } -} \ No newline at end of file diff --git a/lib/widgets/themes/Cupertino/CupertinoTabView/index.dart b/lib/widgets/themes/Cupertino/CupertinoTabView/index.dart deleted file mode 100644 index ad72bb6f..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTabView/index.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'demo.dart'; - -const Text0 = ''' -### **简介** - -> 具有自己的**Navigator**状态与历史记录的选项卡视图组件. - -在使用时需要注意,该组件有自己的路由体系, 有自己的导航系统, 并且他自身内部的导航系统并不与任何父母元素共享 - - - -### **基本用法** - -关于它自身的路由体系, 有以下几点需要注意几点. - -- 在它的根路由映射(**'/'**), 当它有 **builder** 属性的时候, 指向**build**的界面, 非得使用**router**中定义的根目录 -- 当组件未设定**builder**时, 在他的路由表 **router** 中, 一定要指定 **'/'** 跟路由, 不然会产生错误. -- 当指定 **onGenerateRoute** 属性时, 它应该返回一个回空有效的route. -- 如果所有的配置都未命中, 则会命中 **onUnknownRoute** 属性. 这与MaterialApp一致相同 - -如果你想从 **CupertinoTabView** 的路由体系, 跳转到外层的路由中, 您需要在跳转时调用 **Navigator**,并设定 **rootNavigator** 参数 -``` -Navigator.of(context, rootNavigator: true) -``` - -### **基本实例** - -'''; - - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoTabView'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoTabView', - codeUrl: 'themes/Cupertino/CupertinoTabView/demo.dart', - docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoTabView-class.html', - contentList: [ - Text0, - CupertinoTabScaffoldDemo() - ], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart b/lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart deleted file mode 100644 index fdd8d3f1..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart +++ /dev/null @@ -1,62 +0,0 @@ -/// Created with Android Studio. -/// User: 三帆 -/// Date: 20/01/2019 -/// Time: 22:28 -/// email: sanfan.hx@alibaba-inc.com -/// target: CupertionTabBar - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - - - -class CupertinoTimerPickerDemo extends StatefulWidget { - _Demo createState() => _Demo(); -} - -class _Demo extends State { - int index = 0; - Duration timer = Duration(minutes: 50); - - Widget _buildBottomPicker(Widget picker) { - return Container( - height: 300, - padding: const EdgeInsets.only(top: 6.0), - color: CupertinoColors.white, - child: DefaultTextStyle( - style: const TextStyle( - color: CupertinoColors.black, - fontSize: 22.0, - ), - child: GestureDetector( - // Blocks taps from propagating to the modal sheet and popping. - onTap: () {}, - child: SafeArea( - top: false, - child: picker, - ), - ), - ), - ); - } - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return _buildBottomPicker(CupertinoTimerPicker( - initialTimerDuration: timer, - minuteInterval: 5, - onTimerDurationChanged: (Duration newTimer) { - setState(() => timer = newTimer); - }, - )); - }, - ); - }, - child: Text("点我弹出"), - ); - } -} diff --git a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/index.dart b/lib/widgets/themes/Cupertino/CupertinoTimerPicker/index.dart deleted file mode 100644 index 1ca5a07a..00000000 --- a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/index.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/widget_demo.dart'; - -import 'demo.dart'; - -const Text0 = ''' -### **简介** - -> CupertinoTimerPicker 是一个ios风格下的时间选择组件 - -此选择器显示带有小时、分钟和秒的时间选择器。时间范围为0-23小时, 0-59分钟. 0-59秒. - - -### **基本用法** - - -### **基本实例** - -属性说明: - -- initialTimerDuration 初始化时间点 -- minuteInterval 分钟间隔, 我们设置为5, 则分钟选项为0,5,10,15... -- mode 显示的格式, 我们可以控制该属性, 仅显示小时与分钟, 分钟与秒等, 具体查看 **CupertinoTimerPickerMode** -- onTimerDurationChanged 时间改变后的回调 -- secondInterval 秒数间隔, 与minuteInterval同 - -'''; - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Cupertino/CupertinoTimerPicker'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'CupertinoTimerPicker', - codeUrl: 'themes/Cupertino/CupertinoTimerPicker/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/cupertino/CupertinoTimerPicker-class.html', - contentList: [Text0, CupertinoTimerPickerDemo()], - ); - } -} diff --git a/lib/widgets/themes/Cupertino/index.dart b/lib/widgets/themes/Cupertino/index.dart deleted file mode 100644 index 2f8b8cbc..00000000 --- a/lib/widgets/themes/Cupertino/index.dart +++ /dev/null @@ -1,120 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../../../model/widget.dart'; -import './CupertinoApp/index.dart' as CupertinoApp; -import './CupertinoButton/index.dart' as CupertinoButton; -import './CupertinoColors/index.dart' as CupertinoColors; -import './CupertinoIcons/index.dart' as CupertinoIcons; -import './CupertinoNavigationBar/index.dart' as CupertinoNavigationBar; -import './CupertinoPageRoute/index.dart' as CupertinoPageRoute; -import './CupertinoPageScaffold/index.dart' as CupertinoPageScaffold; -import './CupertinoPicker/index.dart' as CupertinoPicker; -import './CupertinoPopupSurface/index.dart' as CupertinoPopupSurface; -import './CupertinoScrollbar/index.dart' as CupertinoScrollbar; -import './CupertinoSlider/index.dart' as CupertinoSlider; -import './CupertinoSegmentedControl/index.dart' as CupertinoSegmentedControl; -import './CupertinoSliverNavigationBar/index.dart' as CupertinoSliverNavigationBar; -import './CupertinoSwitch/index.dart' as CupertinoSwitch; -import './CupertinoTabBar/index.dart' as CupertinoTabBar; -import './CupertinoTabScaffold/index.dart' as CupertinoTabScaffold; -import './CupertinoTabView/index.dart' as CupertinoTabView; -import './CupertinoTimerPicker/index.dart' as CupertinoTimerPicker; - -List widgetPoints = [ - WidgetPoint( - name: 'CupertinoPopupSurface', - routerName: CupertinoPopupSurface.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoPopupSurface.Demo(), - ), - WidgetPoint( - name: 'CupertinoPicker', - routerName: CupertinoPicker.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoPicker.Demo(), - ), - WidgetPoint( - name: 'CupertinoPageScaffold', - routerName: CupertinoPageScaffold.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoPageScaffold.Demo(), - ), - WidgetPoint( - name: 'CupertinoPageRoute', - routerName: CupertinoPageRoute.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoPageRoute.Demo(), - ), - WidgetPoint( - name: 'CupertinoNavigationBar', - routerName: CupertinoNavigationBar.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoNavigationBar.Demo(), - ), - WidgetPoint( - name: 'CupertinoIcons', - routerName: CupertinoIcons.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoIcons.Demo(), - ), - WidgetPoint( - name: 'CupertinoColors', - routerName: CupertinoColors.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoColors.Demo(), - ), - WidgetPoint( - name: 'CupertinoButton', - routerName: CupertinoButton.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoButton.Demo(), - ), - WidgetPoint( - name: 'CupertinoApp', - routerName: CupertinoApp.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoApp.Demo(), - ), - WidgetPoint( - name: 'CupertinoScrollbar', - routerName: CupertinoScrollbar.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoScrollbar.Demo(), - ), - WidgetPoint( - name: 'CupertinoSlider', - routerName: CupertinoSlider.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoSlider.Demo(), - ), - WidgetPoint( - name: 'CupertinoSegmentedControl', - routerName: CupertinoSegmentedControl.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoSegmentedControl.Demo(), - ), - WidgetPoint( - name: 'CupertinoSliverNavigationBar', - routerName: CupertinoSliverNavigationBar.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoSliverNavigationBar.Demo(), - ), - WidgetPoint( - name: 'CupertinoSliverRefreshControl', - routerName: CupertinoSliverNavigationBar.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoSliverNavigationBar.Demo(), - ), - WidgetPoint( - name: 'CupertinoSwitch', - routerName: CupertinoSwitch.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoSwitch.Demo(), - ), - WidgetPoint( - name: 'CupertinoTabBar', - routerName: CupertinoTabBar.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoTabBar.Demo(), - ), - WidgetPoint( - name: 'CupertinoTabScaffold', - routerName: CupertinoTabScaffold.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoTabScaffold.Demo(), - ), - WidgetPoint( - name: 'CupertinoTabView', - routerName: CupertinoTabView.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoTabView.Demo(), - ), - WidgetPoint( - name: 'CupertinoTimerPicker', - routerName: CupertinoTimerPicker.Demo.routeName, - buildRouter: (BuildContext context) => CupertinoTimerPicker.Demo(), - ), -]; - diff --git a/lib/widgets/themes/Material/MaterialAccentColor/index.dart b/lib/widgets/themes/Material/MaterialAccentColor/index.dart deleted file mode 100644 index af297ba2..00000000 --- a/lib/widgets/themes/Material/MaterialAccentColor/index.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import 'package:flutter_go/widgets/themes/Material/MaterialColor/demo.dart'; - -const Text0 = ''' -### **简介** -> 用来定义单一的强调色,以及四种色调的色系 -- 颜色的阴影用索引表示,索引较小的颜色比较浅,较大的索引比较暗。 -- 有个四个有效索引,100,200,400,和700.此颜色的值应与索引200和shade200的值相同。 -'''; - -const String Text1 = """ -### **基本用法** -> 这里我们配合Icon来进行演示 -- 颜色的值应与指数500和shade500的值相同 -"""; - -class Demo extends StatefulWidget { - static const String routeName = - '/element/themes/Material/MaterialAccentColor'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'MaterialAccentColor', - codeUrl: 'themes/Material/MaterialColor/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/MaterialAccentColor-class.html', - contentList: [ - Text0, - Text1, - ColorDemo(), - ], - ); - } -} diff --git a/lib/widgets/themes/Material/MaterialApp/demo.dart b/lib/widgets/themes/Material/MaterialApp/demo.dart deleted file mode 100644 index b06a5f78..00000000 --- a/lib/widgets/themes/Material/MaterialApp/demo.dart +++ /dev/null @@ -1,31 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 16:25:25 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 16:25:25 - - -// !!! 代码示例,并非Demo -// import 'package:flutter/material.dart'; -// class MaterialApp extends StatelessWidget { -// @override -// Widget build(BuildContext context) { -// return MaterialApp( -// title: 'title', -// theme: ThemeData( -// primaryColor: Color(ThemeColor), -// backgroundColor: Color(0xFFEFEFEF), -// accentColor: Color(0xFF888888), -// textTheme: TextTheme( -// //设置Material的默认字体样式 -// body1: TextStyle(color: Color(0xFF888888), fontSize: 16.0), -// ), -// iconTheme: IconThemeData( -// color: Color(ThemeColor), -// size: 35.0, -// ), -// ), -// home: MyHomePage(), -// onGenerateRoute: Application.router.generator, -// ); -// } -// } diff --git a/lib/widgets/themes/Material/MaterialApp/index.dart b/lib/widgets/themes/Material/MaterialApp/index.dart deleted file mode 100644 index 0285bc1d..00000000 --- a/lib/widgets/themes/Material/MaterialApp/index.dart +++ /dev/null @@ -1,53 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 16:25:22 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2019-01-07 15:52:45 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; - -const String content0 = ''' -### **简介** -> MaterialApp 代表 Material 设计风格的应用 -- 包含许多 Material设计风格所需要的一些基本控件 -- 在 WidgetsApp 中通过添加一些特定与 Material 设计风格的属性 -'''; - -const String content1 = ''' -### **基本用法** -> 这里我们着重介绍MaterialApp 主要属性 -- title : 在任务管理窗口中所显示的应用名字 -- theme : 应用各种 UI 所使用的主题颜色 -- color : 应用的主要颜色值(primary color),也就是安卓任务管理窗口中所显示的应用颜色 -- home : 应用默认所显示的界面 Widget -- routes : 应用的顶级导航表格,这个是多页面应用用来控制页面跳转的,类似于网页的网址 -- initialRoute :第一个显示的路由名字,默认值为 Window.defaultRouteName -- onGenerateRoute : 生成路由的回调函数,当导航的命名路由的时候,会使用这个来生成界面 -- onLocaleChanged : 当系统修改语言的时候,会触发å这个回调 -- navigatorObservers : 应用 Navigator 的监听器 -- debugShowMaterialGrid : 是否显示 Material design 基础布局网格,用来调试 UI 的工具 -- showPerformanceOverlay : 显示性能标签 -- checkerboardRasterCacheImages 、showSemanticsDebugger、debugShowCheckedModeBanner 各种调试开关 - -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Material/MaterialApp'; - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ], - title: 'MaterialApp', - docUrl: 'https://docs.flutter.io/flutter/material/MaterialApp-class.html', - codeUrl: 'themes/Material/MaterialApp/demo.dart', - ); - } -} diff --git a/lib/widgets/themes/Material/MaterialButton/demo.dart b/lib/widgets/themes/Material/MaterialButton/demo.dart deleted file mode 100644 index baa68e36..00000000 --- a/lib/widgets/themes/Material/MaterialButton/demo.dart +++ /dev/null @@ -1,50 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 16:25:25 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 16:25:25 - -import 'package:flutter/material.dart'; - -class MaterialButtonDemo extends StatelessWidget { - final TextStyle txtStyle = TextStyle(color: Colors.white); - - @override - Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - MaterialButton( - onPressed: () { - print('click MaterialButton'); - }, - child: Text( - 'MaterialButton', - style: txtStyle, - ), - color: Theme.of(context).primaryColor, - ), - FlatButton.icon( - icon: Icon( - Icons.bubble_chart, - color: Colors.white, - ), - label: Text( - 'FlatButton', - style: txtStyle, - ), - onPressed: () { - print('click FlatButton'); - }, - color: Theme.of(context).primaryColor, - ), - RaisedButton( - onPressed: () { - print('click RaisedButton'); - }, - child: Text('RaisedButton'), - ) - ], - ), - ); - } -} diff --git a/lib/widgets/themes/Material/MaterialButton/index.dart b/lib/widgets/themes/Material/MaterialButton/index.dart deleted file mode 100644 index 3fb955b3..00000000 --- a/lib/widgets/themes/Material/MaterialButton/index.dart +++ /dev/null @@ -1,47 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 16:25:22 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 16:35:39 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 用于构建一个依赖于ButtonThem 和 Theme的按钮widget -- 如果有必要,按钮的大小是自是适配于其子widget的 -- 最好不要直接使用这个widget,而应该可以考虑使用FlatButton、OutlineButton或者RaiseButton,他们包含一些和主题风格相适配的一些基础样式 -- 如果要直接创建按钮而不继承主题默认值,可以考虑使用 RawMaterialButton -- 如果想使用ink-splash的效果但是又不想使用button,可以考虑使用InkWell -'''; -const String content1 = ''' -### **基本用法** -> 尽量不要直接使用 MaterialButton -- 如果 MaterialButton上的onPress为null,则按钮处于被禁用状态 -- IconButton 可以创建一些带有 图标的按钮 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Material/MaterialButton'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - MaterialButtonDemo(), - ], - title: 'MaterialButton', - codeUrl: 'themes/Material/MaterialButton/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/MaterialButton-class.html', - ); - } -} diff --git a/lib/widgets/themes/Material/MaterialColor/demo.dart b/lib/widgets/themes/Material/MaterialColor/demo.dart deleted file mode 100644 index ff466379..00000000 --- a/lib/widgets/themes/Material/MaterialColor/demo.dart +++ /dev/null @@ -1,228 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 16:25:25 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 16:25:25 - -import 'package:flutter/material.dart'; - -const double kColorItemHeight = 48.0; - -class Palette { - Palette({this.name, this.primary, this.accent, this.threshold = 900}); - - final String name; - final MaterialColor primary; - - /// MaterialAccentColor:定义单一的色滴,颜色的阴影用索引表示, - /// 索引比较小的颜色比较浅,较大的索引较暗 - - final MaterialAccentColor accent; - final int - threshold; // titles for indices > threshold are white, otherwise black - - bool get isValid => name != null && primary != null && threshold != null; -} - -final List allPalettes = [ - Palette( - name: 'RED', - primary: Colors.red, - accent: Colors.redAccent, - threshold: 300), - Palette( - name: 'PINK', - primary: Colors.pink, - accent: Colors.pinkAccent, - threshold: 200), - Palette( - name: 'PURPLE', - primary: Colors.purple, - accent: Colors.purpleAccent, - threshold: 200), - Palette( - name: 'DEEP PURPLE', - primary: Colors.deepPurple, - accent: Colors.deepPurpleAccent, - threshold: 200), - Palette( - name: 'INDIGO', - primary: Colors.indigo, - accent: Colors.indigoAccent, - threshold: 200), - Palette( - name: 'BLUE', - primary: Colors.blue, - accent: Colors.blueAccent, - threshold: 400), - Palette( - name: 'LIGHT BLUE', - primary: Colors.lightBlue, - accent: Colors.lightBlueAccent, - threshold: 500), - Palette( - name: 'CYAN', - primary: Colors.cyan, - accent: Colors.cyanAccent, - threshold: 600), - Palette( - name: 'TEAL', - primary: Colors.teal, - accent: Colors.tealAccent, - threshold: 400), - Palette( - name: 'GREEN', - primary: Colors.green, - accent: Colors.greenAccent, - threshold: 500), - Palette( - name: 'LIGHT GREEN', - primary: Colors.lightGreen, - accent: Colors.lightGreenAccent, - threshold: 600), - Palette( - name: 'LIME', - primary: Colors.lime, - accent: Colors.limeAccent, - threshold: 800), - Palette(name: 'YELLOW', primary: Colors.yellow, accent: Colors.yellowAccent), - Palette(name: 'AMBER', primary: Colors.amber, accent: Colors.amberAccent), - Palette( - name: 'ORANGE', - primary: Colors.orange, - accent: Colors.orangeAccent, - threshold: 700), - Palette( - name: 'DEEP ORANGE', - primary: Colors.deepOrange, - accent: Colors.deepOrangeAccent, - threshold: 400), - Palette(name: 'BROWN', primary: Colors.brown, threshold: 200), - Palette(name: 'GREY', primary: Colors.grey, threshold: 500), - Palette(name: 'BLUE GREY', primary: Colors.blueGrey, threshold: 500), -]; - -class ColorItem extends StatelessWidget { - const ColorItem({ - Key key, - @required this.index, - @required this.color, - this.prefix = '', - }) : assert(index != null), - assert(color != null), - assert(prefix != null), - super(key: key); - - final int index; - final Color color; - final String prefix; - - String colorString() => - "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; - - @override - Widget build(BuildContext context) { - return Semantics( - container: true, - child: Container( - height: kColorItemHeight, - padding: const EdgeInsets.symmetric(horizontal: 16.0), - color: color, - child: SafeArea( - top: false, - bottom: false, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text('$prefix$index'), - Text(colorString()), - ], - ), - ), - ), - ); - } -} - -class PaletteTabView extends StatelessWidget { - PaletteTabView({ - Key key, - @required this.colors, - }) : assert(colors != null && colors.isValid), - super(key: key); - - final Palette colors; - - static const List primaryKeys = [ - 50, - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900 - ]; - static const List accentKeys = [100, 200, 400, 700]; - - @override - Widget build(BuildContext context) { - final TextTheme textTheme = Theme.of(context).textTheme; - final TextStyle whiteTextStyle = - textTheme.body1.copyWith(color: Colors.white); - final TextStyle blackTextStyle = - textTheme.body1.copyWith(color: Colors.black); - final List colorItems = primaryKeys.map((int index) { - return DefaultTextStyle( - style: index > colors.threshold ? whiteTextStyle : blackTextStyle, - child: ColorItem(index: index, color: colors.primary[index]), - ); - }).toList(); - - if (colors.accent != null) { - colorItems.addAll(accentKeys.map((int index) { - return DefaultTextStyle( - style: index > colors.threshold ? whiteTextStyle : blackTextStyle, - child: - ColorItem(index: index, color: colors.accent[index], prefix: 'A'), - ); - }).toList()); - } - - return ListView( - itemExtent: kColorItemHeight, - children: colorItems, - ); - } -} - -class ColorDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - height: 400.0, - child: DefaultTabController( - length: allPalettes.length, - child: Scaffold( - appBar: AppBar( - elevation: 0.0, - title: const Text('Colors'), - bottom: TabBar( - isScrollable: true, - tabs: allPalettes - .map((Palette swatch) => Tab(text: swatch.name)) - .toList(), - ), - ), - body: TabBarView( - children: allPalettes.map((Palette colors) { - return PaletteTabView(colors: colors); - }).toList(), - ), - ), - ), - ); - } -} diff --git a/lib/widgets/themes/Material/MaterialColor/index.dart b/lib/widgets/themes/Material/MaterialColor/index.dart deleted file mode 100644 index d4467e98..00000000 --- a/lib/widgets/themes/Material/MaterialColor/index.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// @Author: 一凨 -/// @Date: 2018-12-27 16:25:22 -/// @Last Modified by: 一凨 -/// @Last Modified time: 2018-12-27 16:35:39 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> 定义单色以及具有十种色调的色样 -- 颜色的阴影由索引引用。指数越大,颜色越深。总共有十个有效指数:50、100、200、...、900. -'''; - -const String content1 = ''' -### **基础用法** -> 这里我们配合Icon来进行演示 -- 颜色的值应与指数500和shade500的值相同 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Material/MaterialColor'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - ColorDemo(), - ], - title: "MaterialColor", - codeUrl: 'themes/Material/MaterialColor/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/MaterialColor-class.html', - ); - } -} diff --git a/lib/widgets/themes/Material/MaterialPageRoute/demo.dart b/lib/widgets/themes/Material/MaterialPageRoute/demo.dart deleted file mode 100644 index 726dd428..00000000 --- a/lib/widgets/themes/Material/MaterialPageRoute/demo.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'package:flutter/material.dart'; - -class User { - final String account, email; - - const User({ - this.account, - this.email, - }); -} - -class FirstPage extends StatefulWidget { - _FirstPageState createState() => _FirstPageState(); -} - -class _FirstPageState extends State { - var _usernameController = TextEditingController(); - var _emailController = TextEditingController(); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Padding( - child: Text( - "账号登录", - textAlign: TextAlign.center, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), - ), - padding: EdgeInsets.only(bottom: 10.0), - ), - TextFormField( - decoration: InputDecoration(labelText: 'account'), - controller: _usernameController, - ), - TextFormField( - decoration: InputDecoration(labelText: "email"), - controller: _emailController, - ), - RaisedButton( - child: Text("点击跳转"), - onPressed: () { - var route = MaterialPageRoute( - builder: (BuildContext context) => SecondPage( - value: User( - account: _usernameController.text, - email: _emailController.text)), - ); - Navigator.of(context).push(route); - }, - ) - ], - ); - } -} - -class SecondPage extends StatefulWidget { - final User value; - - SecondPage({Key key, this.value}) : super(key: key); - - _SecondPageState createState() => _SecondPageState(); -} - -class _SecondPageState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("MaterialPageRoute2"), - ), - body: Container( - child: Center( - child: Column( - children: [ - Container( - padding: EdgeInsets.only(top: 30.0), - child: Text("登陆成功!!!", - style: TextStyle( - fontSize: 28, fontWeight: FontWeight.bold))), - Padding( - child: Text( - 'account:${widget.value.account}', - textAlign: TextAlign.center, - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - padding: EdgeInsets.only(bottom: 20.0, top: 40.0), - ), - Padding( - child: Text( - 'email:${widget.value.email}', - textAlign: TextAlign.center, - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - padding: EdgeInsets.only(bottom: 20.0), - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/widgets/themes/Material/MaterialPageRoute/index.dart b/lib/widgets/themes/Material/MaterialPageRoute/index.dart deleted file mode 100644 index 12b8fbdf..00000000 --- a/lib/widgets/themes/Material/MaterialPageRoute/index.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const Text0 = ''' -### **简介** -> 页面跳转携带参数替换整个屏幕的页面路由。 -- 对于Android,页面的进入以下方滑动向上,页面退出,以上方滑动向下方。在ios上,页面进度从右边滑入,退出相反。 -- 默认情况下,当路由器被另外一个替换时,前一个路由将被保留在内存中,如果希望在不需要的时候能够释放资源,请将maintainState设置为false -'''; - -const String Text1 = """ -### **基本用法** -> 如下图示例: - -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/themes/Material/MaterialPageRoute'; - - @override - State createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'MaterialPageRoute', - codeUrl: 'themes/Material/MaterialPageRoute/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/MaterialPageRoute-class.html', - contentList: [ - Text0, - Text1, - FirstPage(), - ], - ); - } -} diff --git a/lib/widgets/themes/Material/MergeableMaterialItem/demo.dart b/lib/widgets/themes/Material/MergeableMaterialItem/demo.dart deleted file mode 100644 index e5d0b3aa..00000000 --- a/lib/widgets/themes/Material/MergeableMaterialItem/demo.dart +++ /dev/null @@ -1,70 +0,0 @@ - - /// Author: xiaojia.dxj - /// Date: 2019-01-08 11:33:21 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 15:24:14 - -import 'package:flutter/material.dart'; - -class MergeableMaterialItemDemo extends StatefulWidget { - _MergeableMaterialItemState createState() => _MergeableMaterialItemState(); -} - -class _MergeableMaterialItemState extends State { - final List items = []; - bool currIndex = false; - int currIndexNum = 1; - - _isChildExpanded() { - setState(() { - currIndex ? currIndex = false : currIndex = true; - currIndexNum++; - }); - } - - @override - Widget build(BuildContext context) { - items.add( - - //class MaterialSlice extends MergeableMaterialItem - MaterialSlice( - key: ValueKey(currIndexNum), - child: Column(children: [ - // header, - AnimatedCrossFade( - firstChild: Container( - height: 20.0, - width: 20.0, - color: Colors.green, - ), - secondChild: Container( - height: 20.0, - width: 20.0, - color: Colors.red, - ), - crossFadeState: currIndex - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - firstCurve: - const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), - secondCurve: - const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), - sizeCurve: Curves.fastOutSlowIn, - duration: Duration(microseconds: 6), - ) - ]))); - - return Column( - children: [ - MergeableMaterial(hasDividers: true, children: items), - RaisedButton( - child: Text("点击添加"), - onPressed: () { - _isChildExpanded(); - }, - ) - ], - ); - } -} diff --git a/lib/widgets/themes/Material/MergeableMaterialItem/index.dart b/lib/widgets/themes/Material/MergeableMaterialItem/index.dart deleted file mode 100644 index fafc2240..00000000 --- a/lib/widgets/themes/Material/MergeableMaterialItem/index.dart +++ /dev/null @@ -1,45 +0,0 @@ - /// Author: xiaojia.dxj - /// Date: 2019-01-07 16:36:43 - /// Email: xiaojia.dxj@alibaba-inc.com - /// Last Modified by: xiaojia.dxj - /// Last Modified time: 2019-01-08 14:12:32 - -import 'package:flutter/material.dart'; - -import 'package:flutter_go/components/widget_demo.dart'; -import './demo.dart'; - -const String content0 = ''' -### **简介** -> MaterialSlice 和 MaterialGap的基本类型 -- 所有的MergeableMaterialItem对象都需要LocalKey -'''; - -const String content1 = ''' -### **基础用法** -> MaterialSlice进行演示 -- MaterialSlice做为 MergeableMaterial子类。它作为Material,可以和其他的slices合并使用 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/themes/Material/MergeableMaterialItem'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - contentList: [ - content0, - content1, - MergeableMaterialItemDemo(), - ], - title: "MergeableMaterialItem", - codeUrl: 'themes/Material/MergeableMaterialItem/demo.dart', - docUrl: - 'https://docs.flutter.io/flutter/material/MergeableMaterialItem-class.html', - ); - } -} diff --git a/lib/widgets/themes/Material/index.dart b/lib/widgets/themes/Material/index.dart deleted file mode 100644 index 2ef1f607..00000000 --- a/lib/widgets/themes/Material/index.dart +++ /dev/null @@ -1,45 +0,0 @@ -import "package:flutter/material.dart"; - -import '../../../model/widget.dart'; -import 'MaterialPageRoute/index.dart' as MaterialPageRoute; -import 'MaterialAccentColor/index.dart' as MaterialAccentColor; -import 'MaterialApp/index.dart' as MaterialApp; -import 'MaterialButton/index.dart' as MaterialButton; -import 'MaterialColor/index.dart' as MaterialColor; -import 'MergeableMaterialItem/index.dart' as MergeableMaterialItem; - - -List widgetPoints = [ - WidgetPoint( - name: 'MaterialPageRoute', - routerName: MaterialPageRoute.Demo.routeName, - buildRouter: (BuildContext context) => MaterialPageRoute.Demo(), - ), - WidgetPoint( - name: 'MaterialApp', - routerName: MaterialApp.Demo.routeName, - buildRouter: (BuildContext context) => MaterialApp.Demo(), - ), - WidgetPoint( - name: 'MaterialColor', - routerName: MaterialColor.Demo.routeName, - buildRouter: (BuildContext context) => MaterialColor.Demo(), - ), - WidgetPoint( - name: 'MaterialButton', - routerName: MaterialButton.Demo.routeName, - buildRouter: (BuildContext context) => MaterialButton.Demo(), - ), - -WidgetPoint( - name: 'MaterialAccentColor', - routerName: MaterialAccentColor.Demo.routeName, - buildRouter: (BuildContext context) => MaterialAccentColor.Demo(), - ), - WidgetPoint( - name: 'MergeableMaterialItem', - routerName: MergeableMaterialItem.Demo.routeName, - buildRouter: (BuildContext context) => MergeableMaterialItem.Demo(), - ), - -]; diff --git a/lib/widgets/themes/index.dart b/lib/widgets/themes/index.dart deleted file mode 100644 index b263753b..00000000 --- a/lib/widgets/themes/index.dart +++ /dev/null @@ -1,14 +0,0 @@ -/// @Author: xiaojia.dxj -/// @Date: 2018-12-24 16:31:09 -/// @Last Modified by: xiaojia.dxj -/// @Last Modified time: 2018-12-24 16:31:09 - -import './Material/index.dart' as Material; -import './Cupertino/index.dart' as Cupertino; - -List getWidgets() { - List result = []; - result.addAll(Material.widgetPoints); - result.addAll(Cupertino.widgetPoints); - return result; -} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index e6e3e04f..00000000 --- a/pubspec.lock +++ /dev/null @@ -1,322 +0,0 @@ -# Generated by pub -# See https://www.dartlang.org/tools/pub/glossary#lockfile -packages: - args: - dependency: transitive - description: - name: args - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.5.1" - async: - dependency: transitive - description: - name: async - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.2.0" - bloc: - dependency: "direct main" - description: - name: bloc - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.12.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.4" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.2" - city_pickers: - dependency: "direct main" - description: - name: city_pickers - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.0.4" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.14.11" - cookie_jar: - dependency: "direct main" - description: - name: cookie_jar - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.0" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.16.0" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.1.2" - dio: - dependency: "direct main" - description: - name: dio - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.1.3" - event_bus: - dependency: "direct main" - description: - name: event_bus - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.0" - firebase_analytics: - dependency: "direct main" - description: - name: firebase_analytics - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.2.0+1" - firebase_core: - dependency: "direct main" - description: - name: firebase_core - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.4" - fluro: - dependency: "direct main" - description: - name: fluro - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.4.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_bloc: - dependency: "direct main" - description: - name: flutter_bloc - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.11.1" - flutter_markdown: - dependency: "direct main" - description: - name: flutter_markdown - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.0" - flutter_spinkit: - dependency: "direct main" - description: - name: flutter_spinkit - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.1.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_webview_plugin: - dependency: "direct main" - description: - name: flutter_webview_plugin - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.4" - html: - dependency: "direct main" - description: - name: html - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.14.0+2" - image_picker: - dependency: "direct main" - description: - name: image_picker - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.6.0+2" - intl: - dependency: "direct main" - description: - name: intl - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.15.7" - lpinyin: - dependency: transitive - description: - name: lpinyin - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.7" - markdown: - dependency: transitive - description: - name: markdown - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.3" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.12.5" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.6" - path: - dependency: transitive - description: - name: path - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.6.2" - path_provider: - dependency: "direct main" - description: - name: path_provider - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.5.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.3" - rxdart: - dependency: transitive - description: - name: rxdart - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.21.0" - shared_preferences: - dependency: "direct main" - description: - name: shared_preferences - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.4.3" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.5.5" - sqflite: - dependency: "direct main" - description: - name: sqflite - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.5" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.9.3" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.4" - synchronized: - dependency: transitive - description: - name: synchronized - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.1.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.5" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.6" - url_launcher: - dependency: "direct main" - description: - name: url_launcher - url: "https://pub.flutter-io.cn" - source: hosted - version: "5.0.2" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.8" -sdks: - dart: ">=2.2.0 <3.0.0" - flutter: ">=1.2.1 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml deleted file mode 100644 index d85a81e9..00000000 --- a/pubspec.yaml +++ /dev/null @@ -1,244 +0,0 @@ -name: flutter_go -description: flutter_go - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# Read more about versioning at semver.org. -version: 1.0.0 - -environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 - event_bus: ^1.0.1 - fluro: ^1.3.4 - image_picker: ^0.6.0+1 - sqflite: ^1.1.5 - flutter_markdown: ^0.2.0 - url_launcher: ^5.0.2 - # 本地存储、收藏功能 - shared_preferences: ^0.4.3 - flutter_spinkit: "^3.1.0" - path_provider: ^1.0.0 - dio: ^2.0.15 - flutter_webview_plugin: ^0.3.4 - cookie_jar: ^1.0.0 - # 日期格式化 - intl: 0.15.7 - city_pickers: ^0.0.1 - firebase_analytics: ^1.1.0 - #firebase_auth: ^0.8.3 #auth - firebase_core: ^0.3.4 # add dependency for Firebase Core - flutter_bloc: ^0.11.1 - bloc: ^0.12.0 - html: ^0.14.0+2 - -dev_dependencies: - flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://www.dartlang.org/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true - assets: - - lib/widgets/elements/Form/Input/TextField/text_field_demo.dart - - lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart - - lib/widgets/components/Bar/AppBar/demo.dart - - lib/widgets/components/Bar/BottomAppBar/demo.dart - - lib/widgets/components/Bar/ButtonBar/demo.dart - - lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart - - lib/widgets/components/Bar/SliverAppBar/demo.dart - - lib/widgets/components/Bar/SnackBar/demo.dart - - lib/widgets/components/Bar/SnackBarAction/demo.dart - - lib/widgets/components/Bar/TabBar/demo.dart - - lib/widgets/components/Card/Card/demo.dart - - lib/widgets/components/Chip/Chip/demo.dart - - lib/widgets/components/Chip/ChipTheme/demo.dart - - lib/widgets/components/Chip/ChipThemeData/demo.dart - - lib/widgets/components/Chip/ChoiceChip/demo.dart - - lib/widgets/components/Chip/FilterChip/demo.dart - - lib/widgets/components/Chip/InputChip/demo.dart - - lib/widgets/components/Chip/RawChip/demo.dart - - lib/widgets/components/Dialog/AboutDialog/demo.dart - - lib/widgets/components/Dialog/AlertDialog/demo.dart - - lib/widgets/components/Dialog/Dialog/demo.dart - - lib/widgets/components/Dialog/SimpleDialog/demo.dart - - lib/widgets/components/Grid/GridTile/demo.dart - - lib/widgets/components/Grid/GridTileBar/demo.dart - - lib/widgets/components/Grid/GridView/demo.dart - - lib/widgets/components/Grid/GridPaper/demo.dart - - lib/widgets/components/Grid/SliverGrid/demo.dart - - lib/widgets/components/List/AnimatedList/demo.dart - - lib/widgets/components/List/ListBody/demo.dart - - lib/widgets/components/List/ListView/demo.dart - - lib/widgets/components/Menu/CheckedPopupMenuItem/demo.dart - - lib/widgets/components/Menu/DropdownMenuItem/demo.dart - - lib/widgets/components/Menu/PopupMenuButton/demo.dart - - lib/widgets/components/Menu/PopupMenuDivider/demo.dart - - lib/widgets/components/Navigation/BottomNavigationBar/demo.dart - - lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart - - lib/widgets/components/Panel/ExpansionPanel/demo.dart - - lib/widgets/components/Panel/ExpansionPanelList/demo.dart - - lib/widgets/components/Pick/DayPicker/demo.dart - - lib/widgets/components/Pick/MonthPicker/demo.dart - - lib/widgets/components/Pick/ShowdatePicker/demo.dart - - lib/widgets/components/Pick/YearPicker/demo.dart - - lib/widgets/components/Progress/CircularProgressIndicator/demo.dart - - lib/widgets/components/Progress/LinearProgressIndicator/demo.dart - - lib/widgets/components/Progress/RefreshProgressIndicator/demo.dart - - lib/widgets/components/Scaffold/Scaffold/demo.dart - - lib/widgets/components/Scaffold/ScaffoldState/demo.dart - - lib/widgets/components/Scroll/BoxScrollView/demo.dart - - lib/widgets/components/Scroll/CustomScrollView/demo.dart - - lib/widgets/components/Scroll/NestedScrollView/demo.dart - - lib/widgets/components/Scroll/Scrollable/demo.dart - - lib/widgets/components/Scroll/ScrollbarPainter/demo.dart - - lib/widgets/components/Scroll/ScrollMetrics/demo.dart - - lib/widgets/components/Scroll/ScrollPhysics/demo.dart - - lib/widgets/components/Scroll/ScrollView/demo.dart - - lib/widgets/components/Tab/Tab/demo.dart - - lib/widgets/elements/Form/Button/DropdownButton/demo.dart - - lib/widgets/elements/Form/Button/FlatButton/demo.dart - - lib/widgets/elements/Form/Button/FloatingActionButton/demo.dart - - lib/widgets/elements/Form/Button/IconButton/demo.dart - - lib/widgets/elements/Form/Button/OutlineButton/demo.dart - - lib/widgets/elements/Form/Button/PopupMenuButton/demo.dart - - lib/widgets/elements/Form/Button/RaisedButton/demo.dart - - lib/widgets/elements/Form/Button/RawMaterialButton/demo.dart - - lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart - - lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart - - lib/widgets/elements/Form/Radio/Radio/demo.dart - - lib/widgets/elements/Form/Radio/RadioListTile/demo.dart - - lib/widgets/elements/Form/Slider/Slider/demo.dart - - lib/widgets/elements/Form/Slider/SliderTheme/demo.dart - - lib/widgets/elements/Form/Slider/SliderThemeData/demo.dart - - lib/widgets/elements/Form/Switch/AnimatedSwitcher/demo.dart - - lib/widgets/elements/Form/Switch/Switch/demo.dart - - lib/widgets/elements/Form/Switch/SwitchListTile/demo.dart - - lib/widgets/elements/Frame/Align/Align/demo.dart - - lib/widgets/elements/Frame/Box/ConstrainedBox/demo.dart - - lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart - - lib/widgets/elements/Frame/Box/FittedBox/demo.dart - - lib/widgets/elements/Frame/Box/LimitedBox/demo.dart - - lib/widgets/elements/Frame/Box/OverflowBox/demo.dart - - lib/widgets/elements/Frame/Box/RotatedBox/demo.dart - - lib/widgets/elements/Frame/Box/SizeBox/demo.dart - - lib/widgets/elements/Frame/Box/SizedOverflowBox/demo.dart - - lib/widgets/elements/Form/Text/Text/demo.dart - - lib/widgets/elements/Form/Text/RichText/index.dart - - lib/widgets/elements/Frame/Box/UnconstrainedBox/demo.dart - - lib/widgets/elements/Frame/Expanded/Expanded/expanded_demo.dart - - lib/widgets/elements/Frame/Layout/Center/demo.dart - - lib/widgets/elements/Frame/Layout/Column/demo.dart - - lib/widgets/elements/Frame/Layout/Container/demo.dart - - lib/widgets/elements/Frame/Layout/Row/demo.dart - - lib/widgets/elements/Frame/Spacing/AnimatedPadding/animatedPadding_demo.dart - - lib/widgets/elements/Frame/Spacing/Padding/padding_demo.dart - - lib/widgets/elements/Frame/Spacing/SliverPadding/sliverpadding_demo.dart - - lib/widgets/elements/Frame/Stack/IndexedStack/demo.dart - - lib/widgets/elements/Frame/Stack/Stack/demo.dart - - lib/widgets/elements/Frame/Table/Table/table_demo.dart - - lib/widgets/elements/Media/Icon/Icon/demo.dart - - lib/widgets/elements/Media/Icon/IconData/demo.dart - - lib/widgets/elements/Media/Icon/IconTheme/demo.dart - - lib/widgets/elements/Media/Icon/IconThemeData/demo.dart - - lib/widgets/elements/Media/Icon/ImageIcon/demo.dart - - lib/widgets/elements/Media/Image/AssetImage/assetImage_demo.dart - - lib/widgets/elements/Media/Image/DecorationImage/decorationImage_demo.dart - - lib/widgets/elements/Media/Image/DecorationImagePainter/decoration_image_painter_demo.dart - - lib/widgets/elements/Media/Image/ExactAssetImage/exact_asset_image_demo.dart - - lib/widgets/elements/Media/Image/FadeInImage/fade_in_image_demo.dart - - lib/widgets/elements/Media/Image/FileImage/file_image_demo.dart - - lib/widgets/elements/Media/Image/Image/demo.dart - - lib/widgets/elements/Media/Image/MemoryImage/memory_image_demo.dart - - lib/widgets/elements/Media/Image/NetworkImage/network_image_demo.dart - - lib/widgets/elements/Media/Image/paintImage/paint_image_demo.dart - - lib/widgets/elements/Media/Image/precacheImage/precache_image_demo.dart - - lib/widgets/elements/Media/Image/RawImage/raw_image_demo.dart - - lib/widgets/elements/Media/Canvas/Canvas/demo.dart - - lib/widgets/elements/Media/Canvas/CircleProgressBarPainter/demo.dart - - lib/widgets/elements/Media/Canvas/PainterPath/demo.dart - - lib/widgets/elements/Media/Canvas/PainterSketch/demo.dart - - lib/widgets/themes/Material/MaterialApp/demo.dart - - lib/widgets/themes/Material/MaterialButton/demo.dart - - lib/widgets/themes/Material/MaterialColor/demo.dart - - lib/widgets/themes/Material/MaterialPageRoute/demo.dart - - lib/widgets/themes/Material/MergeableMaterialItem/demo.dart - - lib/widgets/themes/Cupertino/CupertinoApp/demo.dart - - lib/widgets/themes/Cupertino/CupertinoButton/demo.dart - - lib/widgets/themes/Cupertino/CupertinoColors/demo.dart - - lib/widgets/themes/Cupertino/CupertinoIcons/demo.dart - - lib/widgets/themes/Cupertino/CupertinoNavigationBar/demo.dart - - lib/widgets/themes/Cupertino/CupertinoPageRoute/demo.dart - - lib/widgets/themes/Cupertino/CupertinoPageScaffold/demo.dart - - lib/widgets/themes/Cupertino/CupertinoPicker/demo.dart - - lib/widgets/themes/Cupertino/CupertinoPopupSurface/demo.dart - - lib/widgets/themes/Cupertino/CupertinoScrollbar/demo.dart - - lib/widgets/themes/Cupertino/CupertinoSegmentedControl/demo.dart - - lib/widgets/elements/Form/Switch/Switch/demo.dart - - lib/widgets/themes/Cupertino/CupertinoSlider/demo.dart - - lib/widgets/themes/Cupertino/CupertinoSliverNavigationBar/demo.dart - - lib/widgets/themes/Cupertino/CupertinoSwitch/demo.dart - - lib/widgets/themes/Cupertino/CupertinoTabBar/demo.dart - - lib/widgets/themes/Cupertino/CupertinoTabScaffold/demo.dart - - lib/widgets/themes/Cupertino/CupertinoTabView/demo.dart - - lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart - - assets/app.db - - assets/images/ - - assets/fonts/ - - fonts: - - family: FlamanteRoma - fonts: - - asset: assets/fonts/Flamante-Roma-Medium.ttf - - asset: assets/fonts/Flamante-Roma-MediumItalic.ttf - - - family: LatoBold - fonts: - - asset: assets/fonts/Lato-Bold.ttf - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.io/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.io/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.io/custom-fonts/#from-packages diff --git a/recruit b/recruit deleted file mode 100644 index f173ce63..00000000 --- a/recruit +++ /dev/null @@ -1,29 +0,0 @@ - ---- - -## 加个广告:团队招聘 - - ### 🔥《阿里巴巴集团春季校园招聘》已经启动。 - -- 团队获取此消息后第一时间,赶紧通知,各位刚走出校园的千里马,走进阿里的机会来了!!! - - 基本要求如下: - - - 招收 2019年11月-2020年10月 毕业的同学 - - 本次校招行动共执行四周,到 4月12日结束 - -#### 🔔强调一下这次是校招哦!!!如果你有意向,又符合 2019年11月-2020年10月 的应届毕业生条件; - -- 不符合,也没关系,可以推荐优秀的学弟,学妹;增进一下“纯洁”的同学感情 👫😎。 - -#### 请移步往下,关注我们《阿里拍卖团队》 的招聘信息。 - - - - - - - -#### 最重要的部分来了,手机扫描下面二维码,即可进入简历投递系统 - - diff --git a/test/imp.dart b/test/imp.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/test/imp2.dart b/test/imp2.dart deleted file mode 100644 index a33beeeb..00000000 --- a/test/imp2.dart +++ /dev/null @@ -1 +0,0 @@ -var router = [12,13,14]; diff --git a/test/test.dart b/test/test.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 49aed263..00000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// This is a basic Flutter widget test. -// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter -// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to -// find child widgets in the widget tree, read text, and verify that the values of widget properties -// are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:flutter_go/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(new MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/tools/getPR.sh b/tools/getPR.sh deleted file mode 100644 index c9e86974..00000000 --- a/tools/getPR.sh +++ /dev/null @@ -1,18 +0,0 @@ - -#!/bin/bash - -# pr 日志生成器,自动 pr 工具抓取器,抓取两周前至今的,提交数据,并去重。 -# 生成一个 http 页面,打印成 markdown 格式 -# run $ bash tools/getPR.sh - -# git log --pretty="%h - %s - %ad" --author=ryan --since=2.weeks --no-merges > tools/log.txt - -logs=`git log --date=iso --since=2.weeks --no-merges --pretty=format:'{"commit": "-%h","author": "%aN <%aE>","date": "%ad","message": "%s"},'` - -log1=${logs} - -# echo ${log1%*,} - -echo '{"pr_req":['${log1%*,}']}' > tools/log.json - -node ./tools/parsLog.js \ No newline at end of file diff --git a/tools/parsLog.js b/tools/parsLog.js deleted file mode 100644 index ab6108a8..00000000 --- a/tools/parsLog.js +++ /dev/null @@ -1,70 +0,0 @@ -var path = require('path'); //系统路径模块 -var fs = require('fs'); //文件模块 -var http = require('http'); -var child_process = require('child_process'); - -var file = path.join(__dirname, './log.json'); //文件路径,__dirname为当前运行js文件的目录 - //读取json文件 -fs.readFile(file, 'utf-8', function(err, data) { - if (err) { - res.send('文件读取失败'); - } else { - // res.send(data); - if(data) { - const obj = JSON.parse(data); - const newObj ={}; - obj.pr_req.map((item,i)=>{ - const key = encodeURIComponent(item.message); - newObj[key] ={date: new Date(item.date).toLocaleDateString(),msg:item.message}; - }) - const newObjCategory = Object.values(newObj); - const categorys ={}; - newObjCategory.map((item)=>{ - if(!categorys[item.date]) { - categorys[item.date] =[]; - }else { - categorys[item.date].push(item.msg); - } - }) - //console.log('----------->',categorys); - rendHtml(categorys); - } - - } -}); - - -function rendHtml(categorys){ - http.createServer(function (req, res) { - var html = buildHtml(categorys); - res.writeHead(200, { - 'Content-Type': 'text/html;charset=utf-8', - //'Content-Length': html.length, - 'Expires': new Date().toUTCString() - }); - - res.end(html); - }).listen(8889,"127.0.0.1"); - - console.log("Server running at http://127.0.0.1:8889/"); - child_process.exec(`start "http://127.0.0.1:8080"`); - - function buildHtml(obj) { - var header = ''; - var body = ''; - var content = ''; - for(var i in obj) { - let liContent = `
    #### ${i}`; - const list = obj[i]; - list.map((it,index)=>{ - liContent += `
  •   - [x] ${it}
  • ` - }) - liContent += `
`; - - content += liContent; - } - // console.log('content===>',content) - return '' - + '
' + header + '
' + content + ''; - }; -} \ No newline at end of file