Skip to content

Commit

Permalink
更换轮播组件
Browse files Browse the repository at this point in the history
  • Loading branch information
simplezhli committed Jul 22, 2019
1 parent b1d6f8f commit e89179c
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 197 deletions.
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/deer-issue-template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: deer issue template
about: Describe this issue template's purpose here.
about: 请确保已经详细阅读了readme和查找了已有的issue,避免提出重复的问题。
title: ''
labels: ''
assignees: ''
Expand All @@ -9,7 +9,8 @@ assignees: ''

### 运行环境 ###

- [x] 设备型号:如:`MIX 2s`
- [x] 电脑系统:如:`Windows 10`
- [x] 设备型号:如:`小米MIX 2s`
- [x] 设备系统版本:如 `Android 9.0`
- [x] Flutter 版本:如 `1.5.4`

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ iOS需要自行下载代码运行。(效果是一致的)
```dart
flustars: ^0.2.6+1
cached_network_image: ^1.0.0
cached_network_image: ^1.1.0
```

## 使用到的三方库
Expand All @@ -94,7 +94,7 @@ iOS需要自行下载代码运行。(效果是一致的)
| [common_utils](https://github.com/Sky24n/common_utils) | **Dart 常用工具类库** |
| [flutter_slidable](https://github.com/letsar/flutter_slidable) | **侧滑删除** |
| [flustars](https://github.com/Sky24n/flustars) | **Flutter 常用工具类库** |
| [flukit](https://github.com/flutterchina/flukit) | **Flutter UI组件库** |
| [flutter_swiper](https://github.com/best-flutter/flutter_swiper) | **Flutter 轮播组件** |
| [url_launcher](https://github.com/flutter/plugins/tree/master/packages/url_launcher) | **启动URL的插件** |
| [image_picker](https://github.com/flutter/plugins/tree/master/packages/image_picker) | **图片选择插件** |
| [rxdart](https://github.com/ReactiveX/rxdart) | **Dart的响应式扩展** |
Expand Down Expand Up @@ -141,8 +141,6 @@ iOS需要自行下载代码运行。(效果是一致的)

- [flutter_wanandroid](https://github.com/Sky24n/flutter_wanandroid)

- [Flutter-TianYue](https://github.com/ZDfordream/Flutter-TianYue)

## 友情赞助

想系统学习Flutter的可以通过下图的二维码购买陈航老师的课程。
Expand Down
46 changes: 18 additions & 28 deletions lib/home/splash_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter_deer/routers/fluro_navigator.dart';
import 'package:flutter_deer/util/image_utils.dart';
import 'package:flutter_deer/util/utils.dart';
import 'package:rxdart/rxdart.dart';
import 'package:flukit/flukit.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flustars/flustars.dart';

class SplashPage extends StatefulWidget {
Expand Down Expand Up @@ -40,7 +40,7 @@ class _SplashPageState extends State<SplashPage> {

void _initAsync() async {
await SpUtil.getInstance();
if (SpUtil.getBool(Constant.key_guide, defValue: true)) {
if (!SpUtil.getBool(Constant.key_guide, defValue: true)) {
SpUtil.putBool(Constant.key_guide, false);
_initGuide();
} else {
Expand Down Expand Up @@ -81,32 +81,22 @@ class _SplashPageState extends State<SplashPage> {
Offstage(
offstage: !(_status == 1),
child: Swiper(
autoStart: false,
circular: false,
indicator: null,
children: [
for (int i = 0, length = _guideList.length; i < length; i++)
if (i == length - 1)
InkWell(
onTap: (){
_goLogin();
},
child: loadAssetImage(
_guideList[i],
fit: BoxFit.fill,
width: double.infinity,
height: double.infinity,
),
)
else
loadAssetImage(
_guideList[i],
fit: BoxFit.fill,
width: double.infinity,
height: double.infinity,
)
]
),
itemCount: _guideList.length,
loop: false,
itemBuilder: (_, index){
return loadAssetImage(
_guideList[index],
fit: BoxFit.fill,
width: double.infinity,
height: double.infinity,
);
},
onTap: (index){
if (index == _guideList.length - 1){
_goLogin();
}
},
)
)
],
),
Expand Down
106 changes: 62 additions & 44 deletions lib/login/register_page.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_deer/res/resources.dart';
import 'package:flutter_deer/util/toast.dart';
import 'package:flutter_deer/util/utils.dart';
import 'package:flutter_deer/widgets/app_bar.dart';
import 'package:flutter_deer/widgets/my_button.dart';
import 'package:flutter_deer/widgets/text_field.dart';
import 'package:keyboard_actions/keyboard_actions.dart';

class Register extends StatefulWidget {
@override
Expand All @@ -17,6 +20,9 @@ class _RegisterState extends State<Register> {
TextEditingController _nameController = TextEditingController();
TextEditingController _vCodeController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
final FocusNode _nodeText1 = FocusNode();
final FocusNode _nodeText2 = FocusNode();
final FocusNode _nodeText3 = FocusNode();
bool _isClick = false;

@override
Expand Down Expand Up @@ -52,54 +58,66 @@ class _RegisterState extends State<Register> {
void _register(){
Toast.show("确认......");
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
title: "注册",
),
body: SingleChildScrollView(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"开启你的账号",
style: TextStyles.textBoldDark26,
),
Gaps.vGap16,
MyTextField(
controller: _nameController,
maxLength: 11,
keyboardType: TextInputType.phone,
hintText: "请输入手机号",
),
Gaps.vGap10,
MyTextField(
controller: _vCodeController,
keyboardType: TextInputType.number,
getVCode: (){
Toast.show("并没有真正发送哦,直接登录吧!");
},
maxLength: 6,
hintText: "请输入验证码",
),
Gaps.vGap10,
MyTextField(
isInputPwd: true,
controller: _passwordController,
maxLength: 16,
hintText: "请输入密码",
),
Gaps.vGap10,
Gaps.vGap15,
MyButton(
onPressed: _isClick ? _register : null,
text: "注册",
)
],
appBar: MyAppBar(
title: "注册",
),
body: defaultTargetPlatform == TargetPlatform.iOS ? FormKeyboardActions(
child: _buildBody(),
) : SingleChildScrollView(
child: _buildBody(),
)
);
}

_buildBody(){
return Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"开启你的账号",
style: TextStyles.textBoldDark26,
),
Gaps.vGap16,
MyTextField(
focusNode: _nodeText1,
config: Utils.getKeyboardActionsConfig([_nodeText1, _nodeText2, _nodeText3]),
controller: _nameController,
maxLength: 11,
keyboardType: TextInputType.phone,
hintText: "请输入手机号",
),
Gaps.vGap10,
MyTextField(
focusNode: _nodeText2,
controller: _vCodeController,
keyboardType: TextInputType.number,
getVCode: (){
Toast.show("并没有真正发送哦,直接登录吧!");
},
maxLength: 6,
hintText: "请输入验证码",
),
Gaps.vGap10,
MyTextField(
focusNode: _nodeText3,
isInputPwd: true,
controller: _passwordController,
maxLength: 16,
hintText: "请输入密码",
),
Gaps.vGap10,
Gaps.vGap15,
MyButton(
onPressed: _isClick ? _register : null,
text: "注册",
)
],
),
);
}
Expand Down
106 changes: 62 additions & 44 deletions lib/login/reset_password_page.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_deer/res/resources.dart';
import 'package:flutter_deer/util/toast.dart';
import 'package:flutter_deer/util/utils.dart';
import 'package:flutter_deer/widgets/app_bar.dart';
import 'package:flutter_deer/widgets/my_button.dart';
import 'package:flutter_deer/widgets/text_field.dart';
import 'package:keyboard_actions/keyboard_actions.dart';

class ResetPassword extends StatefulWidget {
@override
Expand All @@ -17,6 +20,9 @@ class _ResetPasswordState extends State<ResetPassword> {
TextEditingController _nameController = TextEditingController();
TextEditingController _vCodeController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
final FocusNode _nodeText1 = FocusNode();
final FocusNode _nodeText2 = FocusNode();
final FocusNode _nodeText3 = FocusNode();
bool _isClick = false;

@override
Expand Down Expand Up @@ -52,54 +58,66 @@ class _ResetPasswordState extends State<ResetPassword> {
void _reset(){
Toast.show("确认......");
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
title: "忘记密码",
),
body: SingleChildScrollView(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"重置登录密码",
style: TextStyles.textBoldDark26,
),
Gaps.vGap16,
MyTextField(
controller: _nameController,
maxLength: 11,
keyboardType: TextInputType.phone,
hintText: "请输入手机号",
),
Gaps.vGap10,
MyTextField(
controller: _vCodeController,
keyboardType: TextInputType.number,
getVCode: (){

},
maxLength: 6,
hintText: "请输入验证码",
),
Gaps.vGap10,
MyTextField(
isInputPwd: true,
controller: _passwordController,
maxLength: 16,
hintText: "请输入密码",
),
Gaps.vGap10,
Gaps.vGap15,
MyButton(
onPressed: _isClick ? _reset : null,
text: "确认",
)
],
appBar: MyAppBar(
title: "忘记密码",
),
body: defaultTargetPlatform == TargetPlatform.iOS ? FormKeyboardActions(
child: _buildBody(),
) : SingleChildScrollView(
child: _buildBody(),
)
);
}

_buildBody(){
return Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"重置登录密码",
style: TextStyles.textBoldDark26,
),
Gaps.vGap16,
MyTextField(
focusNode: _nodeText1,
config: Utils.getKeyboardActionsConfig([_nodeText1, _nodeText2, _nodeText3]),
controller: _nameController,
maxLength: 11,
keyboardType: TextInputType.phone,
hintText: "请输入手机号",
),
Gaps.vGap10,
MyTextField(
focusNode: _nodeText2,
controller: _vCodeController,
keyboardType: TextInputType.number,
getVCode: (){

},
maxLength: 6,
hintText: "请输入验证码",
),
Gaps.vGap10,
MyTextField(
focusNode: _nodeText3,
isInputPwd: true,
controller: _passwordController,
maxLength: 16,
hintText: "请输入密码",
),
Gaps.vGap10,
Gaps.vGap15,
MyButton(
onPressed: _isClick ? _reset : null,
text: "确认",
)
],
),
);
}
Expand Down
Loading

0 comments on commit e89179c

Please sign in to comment.