Skip to content

Commit 1af4ec8

Browse files
authored
Merge pull request #13 from efoxTeam/test
Test
2 parents 5fd796f + 3c0cae5 commit 1af4ec8

File tree

31 files changed

+920
-44
lines changed

31 files changed

+920
-44
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## **AspectRatio**
2+
3+
>
4+
将子控件调整为特定宽高比的控件
5+
* AspectRatio 首先会尝试布局约束的最大宽度,widget的高度是通过给定的宽度和宽高比率来决定的
6+
* 对于需要缩放调整位置的,一般是对图片的处理
7+
8+
### 构造方法
9+
``` dart
10+
AspectRatio({
11+
Key key,
12+
@required this.aspectRatio,
13+
Widget child
14+
})
15+
```
16+
17+
### 属性介绍
18+
* aspectRatio: 宽高比,如1.5,宽度是高度的1.5倍
19+
* child: AspectRatio中的内容widget
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## **ConstrainedBox**
2+
3+
>
4+
一个基础布局控件,添加额外的限制条件(constraints)到child上
5+
6+
### 构造方法
7+
``` dart
8+
ConstrainedBox({
9+
Key key,
10+
@required this.constraints,
11+
Widget child
12+
})
13+
```
14+
15+
### 属性介绍
16+
* constraints: 添加到child上的额外限制条件,其类型为BoxConstraints,限制各种最大最小宽高
17+
* child: ConstrainedBox中的内容Widget
18+
19+
### 其他用法
20+
* constraints值为BoxConstraints.expand时,提供width或者height,那么限制(Constraints)将严格使用给出的width或者height值

docs/widget/regular/flow/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## **Flow**
2+
3+
>
4+
实现优化流式布局以使用流布局的控件
5+
* 实现较为复杂,一般可通过Wrap来替换实现
6+
7+
### 构造方法
8+
``` dart
9+
Flow({
10+
Key key,
11+
@required this.delegate,
12+
List<Widget> children = const <Widget>[],
13+
})
14+
```
15+
16+
### 属性介绍
17+
* delegeate: 影响布局的FlowDelegate,包含方法如下:
18+
* paintChildren: child的绘制控制代码,可以调整尺寸位置
19+
* shouldPepaint:是否需要重绘
20+
* shouldRelayout:是否需要重新布局
21+
* getConstraintsForChild:设置每个child的约束条件,会覆盖已有
22+
* getSize: 设置Flow的尺寸
23+
* children: Flow中的内容widget

docs/widget/regular/stack/index.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## **Stack**
2+
3+
>
4+
该Widget将子控件相对于其边框进行定位
5+
* Stack的布局行为,根据child是positioned节点还是non-positioned节点来区分
6+
* 对于positioned的子节点,它们的位置会根据所设置的top、bottom、right以及left属性来确定,这几个值都是相对于Stack的左上角;
7+
* 对于non-positioned的子节点,它们会根据Stack的aligment来设置位置。
8+
* 对应child的顺序,第一个child会被绘制在最低端
9+
10+
### 构造方法
11+
``` dart
12+
Stack({
13+
Key key,
14+
this.alignment = AlignmentDirectional.topStart,
15+
this.textDirection,
16+
this.fit = StackFit.loose,
17+
this.overflow = Overflow.clip,
18+
List<Widget> children = const <Widget>[],
19+
})
20+
```
21+
22+
### 属性介绍
23+
* alignment: 对齐方式,默认是topLeft
24+
* textDirection:文本方向,不常用
25+
* fit: 默认loose
26+
* loose:子节点尺寸可以从min到max
27+
* expand:子节点尽可能占用空间
28+
* passthrough: 不改变子节点约束
29+
* overflow:超过部分是否裁切,Overflow.clip/visible
30+
* children: Stack中的内容Widget
31+

docs/widget/regular/table/index.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## **Table**
2+
3+
>
4+
该控件为其子控件进行table布局的Widget
5+
6+
### 构造方法
7+
``` dart
8+
Table({
9+
Key key,
10+
this.children = const <TableRow>[],
11+
this.columnWidths,
12+
this.defaultColumnWidth = const FlexColumnWidth(1.0),
13+
this.textDirection,
14+
this.border,
15+
this.defaultVerticalAlignment = TableCellVerticalAlignment.top,
16+
this.textBaseline,
17+
})
18+
```
19+
20+
### 属性介绍
21+
>
22+
该Widget适用于多行多列,若只有一行或者一列,选择Row或Column会更合适一些
23+
24+
* columnWidths:设置每一列的宽度
25+
* defaultColumnWidth:默认的每一列宽度值,默认情况下均分,通过FixedColumnWidth设置
26+
* textDirection:文字显示方向
27+
* border:表格边框
28+
* defaultVerticalAlignment:每一个cell的垂直方向的对齐方式, 包含5种:
29+
* top:放置在的顶部;
30+
* middle:垂直居中;
31+
* bottom:放置在底部;
32+
* baseline:文本baseline对齐;
33+
* fill:充满整个cell。
34+
* textBaseline:defaultVerticalAlignment为baseline的时候,会用到这个属性。
35+
* children: Table的中的内容widget

docs/widget/regular/wrap/index.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## **Wrap**
2+
3+
>
4+
该控件以多个水平或垂直方向显示其子控件
5+
* 单行的Wrap和Row表现几乎一致,单列的Wrap和Column表现几乎一致,但是Row同Column系单行单列的,Wrap中行或列空间不足时,会自动换行
6+
7+
### 构造方法
8+
``` dart
9+
Wrap({
10+
Key key,
11+
this.direction = Axis.horizontal,
12+
this.alignment = WrapAlignment.start,
13+
this.spacing = 0.0,
14+
this.runAlignment = WrapAlignment.start,
15+
this.runSpacing = 0.0,
16+
this.crossAxisAlignment = WrapCrossAlignment.start,
17+
this.textDirection,
18+
this.verticalDirection = VerticalDirection.down,
19+
List<Widget> children = const <Widget>[],
20+
})
21+
```
22+
23+
### 属性介绍
24+
* direction:主轴的方向,默认为水平,值:Axis.horizontal/vertical
25+
* alignment:主轴方向上的对齐方式,默认为start, 值: WrapAlignment.start/center/end/spaceAround/spaceBetween/spaceEvenly
26+
* spacing:主轴方向上的间距。
27+
* runAlignment:run的对齐方式, 值: WrapAlignment.start/center/end/spaceAround/spaceBetween/spaceEvenly
28+
* runSpacing:run的间距。
29+
* crossAxisAlignment:交叉轴(crossAxis)方向上的对齐方式,值: WrapCrossAlignment.start/center/end
30+
* textDirection:文本方向, 值:TextDirection.ltr/rtl
31+
* verticalDirection:定义了children摆放顺序,默认是down,值: VerticalDirection.down/up
32+
* children: Table的中的内容widget

git.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# git使用规范
2+
## 提交规范
3+
+ feat:新功能(feature)
4+
+ fix:修补bug
5+
+ docs:文档(documentation)
6+
+ style: 格式(不影响代码运行的变动)
7+
+ refactor:重构(即不是新增功能,也不是修改bug的代码变动)
8+
+ test:增加测试
9+
+ chore:构建过程或辅助工具的变动

lib/components/exampleComp.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import 'package:flutter/material.dart';
2-
import 'package:efox_flutter/store/models/main_state_model.dart' show MainStateModel;
2+
import 'package:efox_flutter/store/models/main_state_model.dart'
3+
show MainStateModel;
34
import 'package:efox_flutter/store/store.dart' show Store;
5+
import 'package:efox_flutter/config/theme.dart' show AppTheme;
46

57
class Index extends StatelessWidget {
68
final Widget child;
79

8-
Index({Key key, this.child}):super(key: key);
10+
Index({Key key, this.child}) : super(key: key);
911

1012
@override
1113
Widget build(BuildContext context) {
@@ -15,14 +17,11 @@ class Index extends StatelessWidget {
1517
height: 420.0,
1618
margin: EdgeInsets.fromLTRB(50, 40, 50, 40),
1719
decoration: BoxDecoration(
18-
border: Border.all(
19-
color: Color(model.theme.mainColor),
20-
width: 1.0
21-
),
20+
border: Border.all(color: Color(AppTheme.mainColor), width: 1.0),
2221
),
2322
child: this.child,
2423
);
2524
},
2625
);
2726
}
28-
}
27+
}

lib/components/widgetComp.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:efox_flutter/components/exampleComp.dart' as ExampleComp;
88
import 'package:efox_flutter/utils/file.dart' as FileUtils;
99
import 'package:efox_flutter/utils/loadAsset.dart' as LoadAssetUtils;
1010
import 'package:efox_flutter/router/index.dart' show FluroRouter;
11+
import 'package:efox_flutter/config/theme.dart' show AppTheme;
1112

1213
class Index extends StatefulWidget {
1314
final List<Widget> demoChild;
@@ -149,7 +150,7 @@ class IndexState extends State<Index> {
149150
child: Row(children: [
150151
Icon(
151152
Icons.home,
152-
color: Color(model.theme.greyColor),
153+
color: Color(AppTheme.greyColor),
153154
),
154155
Text(" "),
155156
Text('Flutter-UI'),
@@ -160,7 +161,7 @@ class IndexState extends State<Index> {
160161
child: Row(children: [
161162
Icon(
162163
Icons.code,
163-
color: Color(model.theme.greyColor),
164+
color: Color(AppTheme.greyColor),
164165
),
165166
Text(" "),
166167
Text(this.title),
@@ -205,8 +206,7 @@ class IndexState extends State<Index> {
205206
child: Text(
206207
AppTranslations.of(context).t('loading'),
207208
style: TextStyle(
208-
color: Color(this.model.theme.secondColor),
209-
fontSize: 20.0),
209+
color: Color(AppTheme.secondColor), fontSize: 20.0),
210210
),
211211
)
212212
],

lib/config/theme.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import 'package:flutter/material.dart';
2+
3+
class AppTheme {
4+
static int mainColor = 0xFFD32F2F;
5+
static int secondColor = 0xFFFFFFFF;
6+
static int thirdColor = 0xFFFAFAFA;
7+
static int greyColor = 0x8A000000;
8+
static int blackColor = 0xFF000000;
9+
static ThemeData themData = ThemeData(
10+
textTheme: TextTheme(
11+
body1: TextStyle(
12+
// color: Colors.black,
13+
// fontWeight: FontWeight.bold,
14+
),
15+
),
16+
platform: TargetPlatform.iOS,
17+
iconTheme: IconThemeData(
18+
size: 32,
19+
color: Color(thirdColor),
20+
opacity: 0.85,
21+
),
22+
// primaryIconTheme 导航栏按钮颜色
23+
primaryIconTheme: IconThemeData(
24+
color: Color(secondColor),
25+
),
26+
accentColor: Colors.grey, // 选中颜色
27+
primaryColor: Color(mainColor), // appbar背景
28+
scaffoldBackgroundColor: Color(thirdColor), // 整体的scaffold背景颜色
29+
);
30+
}

0 commit comments

Comments
 (0)