Commit b202aaf4 authored by skeyboy's avatar skeyboy

登录页调整

parent 1c1e22c6
buildscript {
ext.kotlin_version = '1.6.20'
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
......@@ -16,6 +16,11 @@ allprojects {
google()
mavenCentral()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
rootProject.buildDir = '../build'
......
......@@ -66,6 +66,11 @@ class SignInController extends GetxController {
// 执行登录操作
handleSignIn() async {
if(!GetUtils.isPhoneNumber(mobileMemberController.text)) {
EasyLoading.showToast("请输入手机号");
return;
}
if (codeController.text.length < 5) {
EasyLoading.showToast("验证码输入有误");
return;
......@@ -180,6 +185,10 @@ class SignInController extends GetxController {
}
chageCodeStatus() async {
if(!mobileMemberController.text.isNotEmpty) {
EasyLoading.showToast('请先输入手机号');
return;
}
if (codeEnable.value) {
EasyLoading.show(status: "发送验证码中");
MsmEntity? res =
......
......@@ -2,11 +2,13 @@ import 'dart:io';
import 'package:chart/common/routers/routes.dart';
import 'package:chart/pages/application/index.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:chart/common/values/values.dart';
import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter/services.dart';
// import 'package:flutter_icons/flutter_icons.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
......@@ -97,6 +99,121 @@ class SignInPage extends GetView<SignInController> {
);
}
// 手机号登录
Widget _buildSigMobileInput({Color mainColor = Colors.green}) {
return Container(
width: Get.width,
height: 45,
// color: Colors.white,
margin: const EdgeInsets.fromLTRB(15, 0, 15, 0),
decoration: BoxDecoration(
color: mainColor,
gradient: LinearGradient(colors: [
mainColor.withOpacity(0.2),
mainColor.withOpacity(0.2),
mainColor.withOpacity(0.2)
], begin: Alignment.topLeft, end: Alignment.bottomRight),
border: Border.all(color: mainColor, width: 1.w),
borderRadius: BorderRadius.circular(5),
),
child: Row(
children: [
SizedBox(
width: 45,
child: Center(
child: Text(
textAlign: TextAlign.center,
'+86',
style: TextStyle(color: mainColor, fontSize: 11),
),
),
),
Flexible(
flex: 1,
child: TextField(
autofocus: false,
controller: controller.mobileMemberController,
keyboardType: TextInputType.phone,
decoration: InputDecoration(
hintText: '请输入手机号',
contentPadding: EdgeInsets.fromLTRB(0, 0, 0, 9),
border: InputBorder.none,
suffixIcon: null),
style: const TextStyle(
color: Colors.grey,
fontFamily: "Avenir",
fontWeight: FontWeight.w400,
fontSize: 11,
),
maxLines: 1,
autocorrect: false,
// 自动纠正
obscureText: false, // 隐藏输入内容, 密码框
),
)
],
));
}
// 验证码
Widget _buildSigCodeInput({Color mainColor = Colors.green}) {
return Container(
width: Get.width,
height: 45,
// color: Colors.white,
margin: const EdgeInsets.fromLTRB(15, 0, 15, 0),
decoration: BoxDecoration(
color: mainColor,
gradient: LinearGradient(colors: [
mainColor.withOpacity(0.2),
mainColor.withOpacity(0.2),
mainColor.withOpacity(0.2)
], begin: Alignment.topLeft, end: Alignment.bottomRight),
border: Border.all(color: mainColor, width: 1.w),
borderRadius: BorderRadius.circular(5),
),
child: Row(
children: [
Flexible(
flex: 1,
child: TextField(
autofocus: false,
controller: controller.codeController,
keyboardType: TextInputType.phone,
decoration: const InputDecoration(
hintText: '输入验证码',
contentPadding: EdgeInsets.fromLTRB(25, 0, 0, 9),
border: InputBorder.none,
suffixIcon: null),
style: const TextStyle(
color: Colors.grey,
fontFamily: "Avenir",
fontWeight: FontWeight.w400,
fontSize: 11,
),
maxLines: 1,
autocorrect: false,
// 自动纠正
obscureText: false, // 隐藏输入内容, 密码框
),
),
SizedBox(
width: 45,
child: GestureDetector(
onTap: () => controller.chageCodeStatus(),
child: Center(
child: Text(
textAlign: TextAlign.center,
'获取',
style: TextStyle(color: mainColor, fontSize: 13),
),
),
),
),
],
));
}
// 登录表单
Widget _buildInputForm() {
return GlassmorphicContainer(
......@@ -308,7 +425,6 @@ class SignInPage extends GetView<SignInController> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: Platform.isIOS
? Container(
width: double.infinity,
......@@ -464,25 +580,93 @@ class SignInPage extends GetView<SignInController> {
image: Image.asset("assets/images/bg2.png").image,
fit: BoxFit.cover),
))
: Container(
padding: EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg2.png").image,
fit: BoxFit.cover),
: buildAndroidSigin(context));
}
Widget buildAndroidSigin(BuildContext buildContext) {
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () => FocusScope.of(buildContext).unfocus(),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/background.png").image,
fit: BoxFit.cover),
),
child: Column(
children: [
SizedBox(
height: 55.h,
),
Row(children: [
GestureDetector(
onTap: () => Get.back(),
child: const Icon(
Icons.chevron_left,
color: Colors.white70,
size: 35,
)),
]),
SizedBox(
height: 65.h,
),
const Text(
'欢迎登录',
style:
TextStyle(color: Colors.white70, fontWeight: FontWeight.bold),
),
SizedBox(
height: 45.h,
),
_buildSigMobileInput(),
const SizedBox(
height: 20,
),
_buildSigCodeInput(),
const Padding(
padding: EdgeInsets.only(top: 10),
child: Center(
child: Text(
'未注册的手机号验证通过后将自动通过',
style: TextStyle(fontSize: 10, color: Colors.white70),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_buildInputForm(),
// _buildLogo(),
// _buildInputForm(),
// Spacer(),
// _buildThirdPartyLogin(),
// _buildSignupButton(),
],
)),
));
),
),
const SizedBox(
height: 55,
),
Container(
height: 44.h,
margin: EdgeInsets.only(top: 15.h),
child: btnFlatButtonWidget(
width: Get.width - 40,
fontColor: Colors.black54,
fontSize: 16,
gbColor: Colors.green.withOpacity(0.7),
onPressed: controller.handleSignIn,
// controller.handleSignIn,
title: "登录"),
),
// SizedBox(
// height: 25,
// ),
// Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// _buildInputForm(),
// // _buildLogo(),
// // _buildInputForm(),
// // Spacer(),
// // _buildThirdPartyLogin(),
// // _buildSignupButton(),
// ],
// ))
],
),
),
);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment