Skip to content

Commit 204dfe5

Browse files
committed
Merge branch 'dev' of https://github.com/efoxTeam/flutter-ui into dev
2 parents de19a89 + acf0fb4 commit 204dfe5

File tree

10 files changed

+229
-56
lines changed

10 files changed

+229
-56
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.flutter.beer">
2+
package="com.flutter.beer"
3+
android:installLocation="preferExternal">
34

45
<!-- The INTERNET permission is required for development. Specifically,
56
flutter needs it to communicate with the running application
@@ -37,3 +38,4 @@
3738
</activity>
3839
</application>
3940
</manifest>
41+

docs/widget/vision/transform/index.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
## **文档完善中**
1+
## **Transform**
2+
3+
> 在绘制子元素前应用转换的组件
4+
5+
### 构造方法
6+
```
7+
Transform({
8+
Key key,
9+
@required Matrix4 transform,
10+
Offset origin,
11+
AlignmentGeometry alignment,
12+
bool transformHitTests: true,
13+
Widget child
14+
})
15+
```
16+
17+
### 属性介绍
18+
origin:坐标系的原点(相对于此渲染对象的左上角)应用矩阵的原点
19+
alignment:原点的对齐方式
20+
transform: 在绘制过程中改变子元素的矩阵
21+
transformHitTests:在测试时是否执行转换
22+
23+
24+
### 实例

lib/components/widgetComp.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
22
import 'package:efox_flutter/store/index.dart' show Store;
3-
import 'headerComp.dart' as Header;
43
import 'package:efox_flutter/components/markdownComp.dart' as MarkDownComp;
54
import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
65
import 'package:efox_flutter/components/baseComp.dart' as BaseComp;

lib/config/index.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'development.dart' as Development;
22
import 'production.dart' as Production;
33

4-
const bool isPro = true;
4+
const bool isPro = false;
55

66
Object env = isPro ? Production.Config() : Development.Config();

lib/page/component/tabs.dart

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:efox_flutter/config/theme.dart' show AppTheme;
55
import 'package:efox_flutter/widget/index.dart' as WidgetRoot;
66
import 'package:efox_flutter/router/index.dart' show FluroRouter;
77
import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
8-
// import 'package:efox_flutter/components/headerComp.dart' as Header;
98

109
class Index extends StatefulWidget {
1110
final MainStateModel model;
@@ -45,12 +44,6 @@ class _IndexState extends State<Index>
4544
Widget build(BuildContext context) {
4645
return Scaffold(
4746
key: _scaffoldKey,
48-
/* appBar: AppBar(
49-
title: Header.Index(
50-
AppLocalizations.$t('nav_title_0'),
51-
),
52-
actions: appBarActions(),
53-
), */
5447
appBar: PreferredSize(
5548
preferredSize: Size.fromHeight(kToolbarHeight),
5649
child: Container(
@@ -76,13 +69,6 @@ class _IndexState extends State<Index>
7669
tabs: _mapList.map((v) {
7770
return new Tab(
7871
text: AppLocalizations.$t(v.typeName),
79-
/* icon: Icon(
80-
IconData(
81-
v.code,
82-
fontFamily: 'MaterialIcons',
83-
matchTextDirection: true,
84-
),
85-
), */
8672
);
8773
}).toList());
8874
}
@@ -152,36 +138,4 @@ class _IndexState extends State<Index>
152138
),
153139
);
154140
}
155-
156-
List<Widget> appBarActions() {
157-
return [
158-
PopupMenuButton(
159-
icon: Icon(
160-
Icons.more_vert,
161-
),
162-
onSelected: (local) {
163-
AppLocalizations.changeLanguage(Locale(local));
164-
print('local=$local');
165-
},
166-
itemBuilder: (context) => [
167-
PopupMenuItem(
168-
child: Row(
169-
children: <Widget>[
170-
Text('中文'),
171-
],
172-
),
173-
value: 'zh',
174-
),
175-
PopupMenuItem(
176-
child: Row(
177-
children: <Widget>[
178-
Text('english'),
179-
],
180-
),
181-
value: 'en',
182-
),
183-
],
184-
),
185-
];
186-
}
187141
}

lib/widget/gestures/gesturedetector/demo.dart

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,135 @@ class Index extends StatefulWidget {
66
}
77

88
class _IndexState extends State<Index> {
9+
bool isOn = false;
10+
String _value = '';
11+
String _value2 = '';
912
@override
1013
void initState() {
1114
super.initState();
1215
}
1316

17+
updateText(txt) {
18+
setState(() {
19+
_value = txt;
20+
});
21+
}
22+
23+
updateText2(txt) {
24+
setState(() {
25+
_value2 = txt;
26+
});
27+
}
28+
29+
1430
@override
1531
Widget build(BuildContext context) {
1632
return Scaffold(
1733
appBar: AppBar(
1834
title: Text('GestureDetector'),
1935
),
2036
body: Center(
21-
child: Text('更新中'),
37+
child: Column(
38+
children: <Widget>[
39+
GestureDetector(
40+
onTap: () {
41+
Scaffold.of(context).showSnackBar(
42+
SnackBar(content: Text('you click the button')));
43+
},
44+
child: Icon(
45+
Icons.share,
46+
color: Colors.red,
47+
),
48+
),
49+
GestureDetector(
50+
onPanStart: (ev) {
51+
updateText('onPanStart $ev');
52+
},
53+
onPanEnd: (ev) {
54+
updateText('onPanEnd $ev');
55+
},
56+
onPanCancel: () {
57+
updateText('onPanCancel');
58+
},
59+
onPanDown: (ev) {
60+
updateText('onPanDown $ev');
61+
},
62+
onPanUpdate: (ev) {
63+
updateText('onPanUpdate $ev');
64+
},
65+
onDoubleTap: () {
66+
updateText('onDoubleTap');
67+
},
68+
// 连接点击两次的话,不会触发onTap,只会触发 onDoubleTap
69+
onTap: () {
70+
updateText('onTap');
71+
setState(() {
72+
isOn = !isOn;
73+
});
74+
},
75+
child: Container(
76+
alignment: Alignment.center,
77+
height: 100,
78+
width: 200,
79+
color: Colors.blue,
80+
child: Column(
81+
mainAxisAlignment: MainAxisAlignment.center,
82+
children: <Widget>[
83+
Text('TURN LIGHTS ON'),
84+
Divider(),
85+
Icon(
86+
Icons.lightbulb_outline,
87+
color: isOn ? Colors.yellow : Colors.grey,
88+
)
89+
],
90+
),
91+
),
92+
),
93+
Text(_value),
94+
GestureDetector(
95+
onLongPress: () {
96+
updateText2('onLongPress');
97+
},
98+
onForcePressEnd: (ev) {
99+
updateText2('onForcePressEnd ${ev.globalPosition}');
100+
},
101+
onForcePressStart: (ev) {
102+
updateText2('onForcePressStart ${ev.globalPosition}');
103+
},
104+
onForcePressUpdate: (ev) {
105+
updateText2('onForcePressUpdate ${ev.globalPosition}');
106+
},
107+
onForcePressPeak: (ev) {
108+
updateText2('onForcePressPeak ${ev.globalPosition}');
109+
},
110+
// 连接点击两次的话,不会触发onTap,只会触发 onDoubleTap
111+
onTap: () {
112+
updateText2('onDoubleTap');
113+
setState(() {
114+
isOn = !isOn;
115+
});
116+
},
117+
child: Container(
118+
alignment: Alignment.center,
119+
height: 100,
120+
width: 200,
121+
color: Colors.blue,
122+
child: Column(
123+
mainAxisAlignment: MainAxisAlignment.center,
124+
children: <Widget>[
125+
Text('Tap or DoubleTap is not useful'),
126+
Divider(),
127+
Icon(
128+
Icons.lightbulb_outline,
129+
color: isOn ? Colors.yellow : Colors.grey,
130+
)
131+
],
132+
),
133+
),
134+
),
135+
Text(_value2),
136+
],
137+
),
22138
),
23139
);
24140
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import 'package:flutter/material.dart';
2+
3+
class Index extends StatefulWidget {
4+
@override
5+
State<StatefulWidget> createState() => _IndexState();
6+
}
7+
8+
class _IndexState extends State<Index> {
9+
double _top = 0;
10+
double _left = 0;
11+
@override
12+
void initState() {
13+
super.initState();
14+
}
15+
16+
setPanEvent(txt, [ev]) {
17+
print('$txt $ev');
18+
19+
if (ev != null && ev.delta != null) {
20+
setState(() {
21+
_top += ev.delta.dy;
22+
_left += ev.delta.dx;
23+
});
24+
}
25+
}
26+
27+
@override
28+
Widget build(BuildContext context) {
29+
return Scaffold(
30+
appBar: AppBar(
31+
title: Text('GestureDetectorDrag'),
32+
),
33+
body: Center(
34+
child: Stack(
35+
children: <Widget>[
36+
Positioned(
37+
width:40,
38+
height: 40,
39+
top: _top,
40+
left: _left,
41+
child: GestureDetector(
42+
child: CircleAvatar(
43+
child: Text("Drag"),
44+
),
45+
onPanStart: (ev) {
46+
setPanEvent('onPanStart', ev);
47+
},
48+
// DragEndDetails结束时用户滑动的瞬间速度
49+
onPanEnd: (DragEndDetails ev) {
50+
// setPanEvent('onPanEnd', ev);
51+
print('end $ev');
52+
},
53+
onPanCancel: () {
54+
setPanEvent('onPanCancel');
55+
},
56+
// DragDownDetails返回相对屏幕的位置
57+
onPanDown: (DragDownDetails ev) {
58+
// setPanEvent('onPanDown', ev);
59+
print('DragDownDetails ${ev.globalPosition}');
60+
},
61+
onPanUpdate: (DragUpdateDetails ev) {
62+
setPanEvent('onPanUpdate', ev);
63+
},
64+
),
65+
),
66+
],
67+
),
68+
),
69+
);
70+
}
71+
}

lib/widget/gestures/gesturedetector/index.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp;
33
import 'demo.dart' as Demo;
4+
import 'demo_drag.dart' as DemoDrag;
45

56
class Index extends StatefulWidget {
67
static String title = 'GestureDetector';
@@ -20,6 +21,7 @@ class _IndexState extends State<Index> {
2021
mdUrl: Index.mdUrl,
2122
demoChild: [
2223
Demo.Index(),
24+
DemoDrag.Index(),
2325
],
2426
);
2527
}

lib/widget/vision/transform/demo.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ class _IndexState extends State<Index> {
1515
Widget build(BuildContext context) {
1616
return Scaffold(
1717
appBar: AppBar(
18-
title: Text('SingleChildScrollView'),
18+
title: Text('Transform'),
1919
),
20-
body: Center(
21-
child: Text('更新中'),
20+
body: Transform(
21+
alignment: Alignment.center,
22+
transform: Matrix4.skewY(0.1),
23+
child: Container(
24+
padding: const EdgeInsets.all(8.0),
25+
color: const Color(0xFFE8581C),
26+
child: const Text('Apartment for rent!'),
27+
),
2228
),
2329
);
2430
}

locale/zh.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"compProgress": "组件进度"
1313
},
1414
"common_mine_1" : {
15-
"cn": "CN",
16-
"en": "EN",
15+
"cn": "中文",
16+
"en": "英文",
1717
"language": "选择语言",
1818
"environment": "选择环境",
1919
"compProgress": "组件进度",

0 commit comments

Comments
 (0)