Skip to content

Commit 9e61da0

Browse files
committed
sth
1 parent 3453faf commit 9e61da0

File tree

6 files changed

+105
-15
lines changed

6 files changed

+105
-15
lines changed

images/splash_logo.png

15.4 KB
Loading

lib/fonts/iconfont.ttf

4.34 KB
Binary file not shown.

lib/main.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import 'package:coderiver/ui/Application.dart';
2+
import 'package:coderiver/ui/home/HomePage.dart';
3+
import 'package:coderiver/ui/home/SplashPage.dart';
24
import 'package:coderiver/ui/login/LoginPage.dart';
35
import 'package:flutter/material.dart';
46

@@ -9,10 +11,11 @@ class MyApp extends StatelessWidget {
911
@override
1012
Widget build(BuildContext context) {
1113
return MaterialApp(
12-
home: Scaffold(
13-
body: LoginPage(),
14-
)
14+
home: new SplashPage(),
15+
routes: <String, WidgetBuilder>{
16+
// 路由
17+
'/HomePage': (BuildContext context) => new LoginPage()
18+
},
1519
);
1620
}
1721
}
18-

lib/ui/home/SplashPage.dart

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import 'dart:async';
2+
import 'package:flutter/material.dart';
3+
import 'package:flutter/widgets.dart';
4+
5+
class SplashPage extends StatefulWidget {
6+
@override
7+
State<StatefulWidget> createState() {
8+
return _SplashPageState();
9+
}
10+
}
11+
12+
class _SplashPageState extends State<SplashPage> {
13+
@override
14+
Widget build(BuildContext context) {
15+
return new MaterialApp(
16+
theme: new ThemeData(backgroundColor: Colors.blue),
17+
home: new Scaffold(
18+
backgroundColor: Colors.white,
19+
body: new Center(
20+
child: new Image.asset(
21+
"images/splash_logo.png",
22+
width: 170,
23+
height: 170,
24+
),
25+
),
26+
));
27+
}
28+
29+
@override
30+
void initState() {
31+
super.initState();
32+
countDown();
33+
}
34+
35+
// 倒计时
36+
void countDown() {
37+
var _duration = new Duration(seconds: 3);
38+
new Future.delayed(_duration, go2HomePage);
39+
}
40+
41+
void go2HomePage() {
42+
Navigator.of(context).pushReplacementNamed('/HomePage');
43+
}
44+
}

lib/ui/login/LoginPage.dart

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ class _MarketPageState extends State<LoginPage> {
6363
mainAxisAlignment: MainAxisAlignment.start,
6464
children: <Widget>[
6565
Padding(
66-
padding: EdgeInsets.all(10.0), child: weiboOR('新浪微博')),
67-
Padding(padding: EdgeInsets.all(20.0), child: weiboOR('微信')),
66+
padding: EdgeInsets.fromLTRB(0.0, 26.0, 0.0, 0.0),
67+
child: weiboOR('新浪微博')),
68+
Padding(
69+
padding: EdgeInsets.fromLTRB(20.0, 26.0, 0.0, 0.0),
70+
child: weChatOR('微信')),
6871
],
6972
)
7073
//_body(),
@@ -113,7 +116,7 @@ Widget _btnGithubLogin(context) {
113116
label: new Text(
114117
'使用GitHub账号登录',
115118
style: new TextStyle(
116-
color: Colors.green, fontStyle: FontStyle.normal, fontSize: 16),
119+
color: Colors.green, fontStyle: FontStyle.normal, fontSize: 20),
117120
)),
118121
width: double.infinity,
119122
height: 50,
@@ -135,19 +138,58 @@ Widget _btnCreadeAccound(context) {
135138
child: new Text(
136139
'创建账号',
137140
style: new TextStyle(
138-
color: Colors.white, fontStyle: FontStyle.normal, fontSize: 16),
141+
color: Colors.white, fontStyle: FontStyle.normal, fontSize: 20),
139142
)),
140143
width: double.infinity,
141144
height: 50,
142145
);
143146
}
144147

145148
Widget weiboOR(String str) {
146-
return RaisedButton.icon(
147-
color: Colors.white,
148-
disabledColor: Colors.transparent,
149-
icon: new Icon(Icons.star),
150-
label: new Text(str,
151-
style:
152-
new TextStyle(color: Colors.white, fontStyle: FontStyle.normal)));
149+
return Row(
150+
children: <Widget>[
151+
Padding(
152+
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
153+
child: new Image.asset(
154+
'images/silan_icon.png',
155+
)),
156+
Padding(
157+
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
158+
child: new GestureDetector(
159+
child: new Text(
160+
str,
161+
style: new TextStyle(
162+
color: Colors.white, fontStyle: FontStyle.normal),
163+
),
164+
onTap: () {
165+
Fluttertoast.showToast(msg: "微博登录");
166+
}),
167+
),
168+
],
169+
);
170+
}
171+
172+
Widget weChatOR(String str) {
173+
return Row(
174+
children: <Widget>[
175+
Padding(
176+
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
177+
child: new Image.asset(
178+
'images/wechat_icon.png',
179+
),
180+
),
181+
Padding(
182+
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
183+
child: new GestureDetector(
184+
child: new Text(
185+
str,
186+
style: new TextStyle(
187+
color: Colors.white, fontStyle: FontStyle.normal),
188+
),
189+
onTap: () {
190+
Fluttertoast.showToast(msg: "微信登录");
191+
}),
192+
),
193+
],
194+
);
153195
}

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ flutter:
4242
- images/github_icon.png
4343
- images/silan_icon.png
4444
- images/wechat_icon.png
45+
- images/splash_logo.png

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy