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