|
|
|
@ -1,15 +1,15 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
import 'dart:math';
|
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart';
|
|
|
|
|
import 'package:akuCommunity/pages/setting_page/agreement_page/privacy_page.dart';
|
|
|
|
|
import 'package:akuCommunity/pages/sign/user_authentication_page.dart';
|
|
|
|
|
import 'package:akuCommunity/pages/sign/sign_func.dart';
|
|
|
|
|
import 'package:akuCommunity/extensions/num_ext.dart';
|
|
|
|
|
import 'package:akuCommunity/const/resource.dart';
|
|
|
|
|
import 'package:ani_route/ani_route.dart';
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
|
import 'package:flustars/flustars.dart' show TextUtil;
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
@ -17,7 +17,7 @@ import 'package:akuCommunity/utils/headers.dart';
|
|
|
|
|
import 'package:akuCommunity/base/base_style.dart';
|
|
|
|
|
import 'package:akuCommunity/base/assets_image.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:get/get.dart' hide Response;
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
class SignInPage extends StatefulWidget {
|
|
|
|
@ -51,15 +51,9 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InkWell _inkWellLogin() {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (TextUtil.isEmpty(_phone.text))
|
|
|
|
|
BotToast.showText(text: '手机号不能为空');
|
|
|
|
|
else if (TextUtil.isEmpty(_code.text))
|
|
|
|
|
BotToast.showText(text: '验证码不能为空');
|
|
|
|
|
else {
|
|
|
|
|
showCupertinoDialog(
|
|
|
|
|
Future<bool> _showLoginVerify() async {
|
|
|
|
|
return await showCupertinoDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
return CupertinoAlertDialog(
|
|
|
|
@ -69,49 +63,50 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
|
actions: [
|
|
|
|
|
CupertinoDialogAction(
|
|
|
|
|
child: Text('同意'),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Future.delayed(
|
|
|
|
|
Duration(milliseconds: 1000 + Random().nextInt(500)),
|
|
|
|
|
() {
|
|
|
|
|
Get.back();
|
|
|
|
|
(_phone.text == '18067170899') &&
|
|
|
|
|
(_code.text == '123456')
|
|
|
|
|
? ARoute.push(context, UserAuthenticationPage())
|
|
|
|
|
: BotToast.showText(text: '账号或密码错误!');
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
onPressed: () => Get.back(result: true),
|
|
|
|
|
),
|
|
|
|
|
CupertinoDialogAction(
|
|
|
|
|
child: Text('拒绝'),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Get.back();
|
|
|
|
|
},
|
|
|
|
|
onPressed: () => Get.back(result: false),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_parseLogin(bool result) async {
|
|
|
|
|
if (!result) return;
|
|
|
|
|
BotToast.showLoading();
|
|
|
|
|
Response response = await SignFunc.login(_phone.text, _code.text);
|
|
|
|
|
|
|
|
|
|
BotToast.cleanAll();
|
|
|
|
|
if (response.data['status']) {
|
|
|
|
|
} else {
|
|
|
|
|
BotToast.showText(text: response.data['message']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _inkWellLogin() {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 80.w),
|
|
|
|
|
child: MaterialButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (TextUtil.isEmpty(_phone.text))
|
|
|
|
|
BotToast.showText(text: '手机号不能为空');
|
|
|
|
|
else if (TextUtil.isEmpty(_code.text))
|
|
|
|
|
BotToast.showText(text: '验证码不能为空');
|
|
|
|
|
else {
|
|
|
|
|
bool result = await _showLoginVerify();
|
|
|
|
|
_parseLogin(result);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
height: 89.w,
|
|
|
|
|
width: 586.w,
|
|
|
|
|
padding: EdgeInsets.only(top: 25.w, bottom: 24.w),
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 82.w),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xffffc40c),
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(36)),
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
'登录',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: BaseStyle.fontSize28,
|
|
|
|
|
color: ktextPrimary,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
shape: StadiumBorder(),
|
|
|
|
|
elevation: 0,
|
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
child: '登陆'.text.bold.size(28.sp).color(ktextPrimary).make(),
|
|
|
|
|
color: kPrimaryColor,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -182,9 +177,7 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
appBar: _appBar,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
body: GestureDetector(
|
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
|
onTap: () {
|
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode());
|
|
|
|
@ -192,13 +185,10 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
|
child: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: ListView(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 153.w,
|
|
|
|
|
),
|
|
|
|
|
153.hb,
|
|
|
|
|
_containerImage(),
|
|
|
|
|
SizedBox(height: 16.w),
|
|
|
|
|
16.hb,
|
|
|
|
|
Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
@ -209,7 +199,7 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
|
color: ktextPrimary),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 89.w),
|
|
|
|
|
89.hb,
|
|
|
|
|
_buildTextField(
|
|
|
|
|
hint: '请输入手机号',
|
|
|
|
|
controller: _phone,
|
|
|
|
@ -244,6 +234,7 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
|
),
|
|
|
|
|
onPressed: _canGetCode
|
|
|
|
|
? () {
|
|
|
|
|
SignFunc.sendMessageCode(_phone.text);
|
|
|
|
|
startTick();
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
@ -282,8 +273,6 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|