Skip to content

Commit fe6e1bb

Browse files
committed
feat: NoDemo
1 parent 741b1a6 commit fe6e1bb

File tree

6 files changed

+85
-9
lines changed

6 files changed

+85
-9
lines changed

assets/nothing.png

8.51 KB
Loading

lib/components/nodemo.dart

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import 'package:flutter/material.dart';
2+
3+
class Index extends StatelessWidget {
4+
@override
5+
Widget build(BuildContext context) {
6+
return Container(
7+
width: double.infinity,
8+
margin: EdgeInsets.only(top: 100.0),
9+
child: Column(
10+
mainAxisAlignment: MainAxisAlignment.center,
11+
crossAxisAlignment: CrossAxisAlignment.center,
12+
children: <Widget>[
13+
Container(
14+
width: 200.0,
15+
height: 200.0,
16+
decoration: BoxDecoration(
17+
image: DecorationImage(
18+
image: AssetImage('assets/nothing.png')
19+
)
20+
),
21+
),
22+
Text(
23+
'等待更新',
24+
style: TextStyle(
25+
fontSize: 20.0,
26+
color: Colors.grey
27+
),
28+
)
29+
],
30+
),
31+
);
32+
}
33+
}

lib/components/widgetComp.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:efox_flutter/components/markdownComp.dart' as MarkDownComp;
55
import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
66
import 'package:efox_flutter/components/baseComp.dart' as BaseComp;
77
import 'package:efox_flutter/components/exampleComp.dart' as ExampleComp;
8+
import 'package:efox_flutter/components/nodemo.dart' as NoDemo;
89
import 'package:efox_flutter/utils/file.dart' as FileUtils;
910
import 'package:efox_flutter/utils/loadAsset.dart' as LoadAssetUtils;
1011
import 'package:efox_flutter/router/index.dart' show FluroRouter;
@@ -61,15 +62,19 @@ class IndexState extends State<Index> {
6162

6263
void init() async {
6364
this._bodyList.length = 0;
64-
this
65+
if (this.demoChild.length != 0) {
66+
this
6567
._bodyList
6668
.add(await MarkDownComp.Index(await this.getMdFile(this.mdUrl)));
6769

68-
// 增加
69-
if (this.demoChild != null) {
70-
this.demoChild.forEach((Widget item) {
71-
this._bodyList.add(ExampleComp.Index(child: item));
72-
});
70+
// 增加
71+
if (this.demoChild != null) {
72+
this.demoChild.forEach((Widget item) {
73+
this._bodyList.add(ExampleComp.Index(child: item));
74+
});
75+
}
76+
} else {
77+
this._bodyList.add(NoDemo.Index());
7378
}
7479

7580
setState(() {

lib/widget/form/textfield/demo.dart

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

88
class _IndexState extends State<Index> {
9+
final _textEditingController = TextEditingController();
10+
11+
@override
12+
void dispose(){
13+
super.dispose();
14+
_textEditingController.dispose();
15+
}
16+
917
@override
1018
void initState() {
1119
super.initState();
20+
_textEditingController.text = '';
21+
_textEditingController.addListener(() {
22+
print('input: ${_textEditingController.text}');
23+
});
1224
}
1325

1426
@override
@@ -18,7 +30,32 @@ class _IndexState extends State<Index> {
1830
title: Text('TextField'),
1931
),
2032
body: Center(
21-
child: Text('更新中'),
33+
child: Container(
34+
padding: EdgeInsets.all(10.0),
35+
child: TextField(
36+
controller: _textEditingController,
37+
maxLength: 20,
38+
maxLines: 1,
39+
obscureText: false,
40+
textAlign: TextAlign.center,
41+
style: TextStyle(
42+
fontSize: 20.0,
43+
color: Theme.of(context).primaryColor
44+
),
45+
onChanged: (value) {
46+
print('正在输入:$value');
47+
},
48+
onSubmitted: (value) {
49+
print('sumbit输入完毕: $value');
50+
},
51+
decoration: InputDecoration(
52+
icon: Icon(Icons.subject),
53+
// labelText: 'Title',
54+
// hintText: 'Enter the post title',
55+
// filled: true
56+
),
57+
),
58+
)
2259
),
2360
);
2461
}

lib/widget/form/textfield/index.dart

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

55
class Index extends StatefulWidget {
66
static String title = 'TextField';
@@ -19,7 +19,7 @@ class _IndexState extends State<Index> {
1919
originCodeUrl: Index.originCodeUrl,
2020
mdUrl: Index.mdUrl,
2121
demoChild: [
22-
// Demo.Index(),
22+
Demo.Index(),
2323
],
2424
);
2525
}

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ flutter:
5757
# - images/a_dot_ham.jpeg
5858
assets:
5959
- locale/
60+
- assets/
6061
- docs/widget/scrollview/customscrollview/
6162
- docs/widget/scrollview/gridview/
6263
- docs/widget/scrollview/listview/

0 commit comments

Comments
 (0)