Commit c70dc107 authored by skeyboy's avatar skeyboy

Android 登录页修改

parent c2930089
import 'dart:io'; import 'dart:io';
import 'package:bruno/bruno.dart';
import 'package:chart/common/routers/routes.dart'; import 'package:chart/common/routers/routes.dart';
import 'package:chart/pages/application/index.dart'; import 'package:chart/pages/application/index.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
...@@ -17,6 +18,11 @@ import 'package:social_login_buttons/social_login_buttons.dart'; ...@@ -17,6 +18,11 @@ import 'package:social_login_buttons/social_login_buttons.dart';
import 'index.dart'; import 'index.dart';
const kPrimaryColor = Color(0xFF6F35A5);
const kPrimaryLightColor = Color(0xFFF1E6FF);
const double defaultPadding = 16.0;
class SignInPage extends GetView<SignInController> { class SignInPage extends GetView<SignInController> {
// logo // logo
Widget _buildLogo() { Widget _buildLogo() {
...@@ -266,25 +272,25 @@ class SignInPage extends GetView<SignInController> { ...@@ -266,25 +272,25 @@ class SignInPage extends GetView<SignInController> {
suffixIcon: InkWell( suffixIcon: InkWell(
onTap: () => controller.chageCodeStatus(), onTap: () => controller.chageCodeStatus(),
child: Obx(() => Container( child: Obx(() => Container(
// height: 20, // height: 20,
width: 100, width: 100,
// padding: EdgeInsets.all(5.0), // padding: EdgeInsets.all(5.0),
decoration: BoxDecoration( decoration: BoxDecoration(
// color: Colors.red, // color: Colors.red,
// border: Border.all( // border: Border.all(
// color: controller.codeEnable.value // color: controller.codeEnable.value
// ? Color(0xFF0165B8) // ? Color(0xFF0165B8)
// : Colors.white), // : Colors.white),
), ),
child: Center( child: Center(
child: Text( child: Text(
controller.verifyStr.value, controller.verifyStr.value,
style: TextStyle( style: TextStyle(
color: controller.codeEnable.value color: controller.codeEnable.value
? Color(0xFF0165B8) ? Color(0xFF0165B8)
: Color(0xFFACB1B6)), : Color(0xFFACB1B6)),
)), )),
)), )),
), ),
// isPassword: true, // isPassword: true,
), ),
...@@ -427,246 +433,379 @@ class SignInPage extends GetView<SignInController> { ...@@ -427,246 +433,379 @@ class SignInPage extends GetView<SignInController> {
return Scaffold( return Scaffold(
body: Platform.isIOS body: Platform.isIOS
? Container( ? Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
// ignore: sort_child_properties_last // ignore: sort_child_properties_last
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
_buildLogo(), _buildLogo(),
], ],
)), )),
Expanded( Expanded(
child: Center( child: Center(
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 90), padding: EdgeInsets.only(top: 90),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
SocialLoginButton( SocialLoginButton(
text: "通过 Apple 登录", text: "通过 Apple 登录",
buttonType: SocialLoginButtonType.apple, buttonType: SocialLoginButtonType.apple,
onPressed: () { onPressed: () {
Get.bottomSheet( Get.bottomSheet(
Container( Container(
padding: EdgeInsets.all(14), padding: EdgeInsets.all(14),
decoration: BoxDecoration( decoration: BoxDecoration(
// topLeft: Radius.circular(30), topRight: Radius.circular(30))) // topLeft: Radius.circular(30), topRight: Radius.circular(30)))
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(15), topLeft: Radius.circular(15),
topRight: Radius.circular(15)), topRight: Radius.circular(15)),
color: Colors.white, color: Colors.white,
), ),
height: 260, height: 260,
child: Column(children: [ child: Column(children: [
Text( Text(
"请阅读并同意以下条款", "请阅读并同意以下条款",
style: TextStyle( style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
SizedBox(
height: 20,
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 20),
child: RichText(
text: TextSpan(
style:
DefaultTextStyle.of(context)
.style,
children: [
TextSpan(
text: '《用户协议》',
recognizer:
TapGestureRecognizer()
..onTap = () {
Get.toNamed(AppRoutes
.USER_PRIVACT);
},
style: TextStyle(
fontWeight:
FontWeight.bold,
color: AppColors
.primaryElement)),
TextSpan(
text: '《隐私权限》',
recognizer:
TapGestureRecognizer()
..onTap = () {
Get.toNamed(
AppRoutes
.PRIVACT);
},
style: TextStyle(
fontWeight:
FontWeight.bold,
color: AppColors
.primaryElement)),
],
),
),
),
SizedBox(
height: 20,
),
btnFlatButtonWidget(
onPressed: () {
Get.back();
controller.signInWithApple();
},
width: 294,
gbColor: AppColors.primaryElement,
fontColor:
AppColors.primaryBackground,
title: "同意并登录",
fontWeight: FontWeight.w500,
fontSize: 16, fontSize: 16,
) fontWeight: FontWeight.bold),
// Text(
// "请阅读并同意以下条款",
// style: TextStyle(
// fontSize: 16,
// color: Colors.blue[900],
// fontWeight: FontWeight.bold),
// ),
]),
), ),
// backgroundColor: Colors.white, SizedBox(
); height: 20,
// controller.signInWithApple ),
}, Padding(
), padding: EdgeInsets.symmetric(
vertical: 20),
child: RichText(
text: TextSpan(
style:
DefaultTextStyle.of(context)
.style,
children: [
TextSpan(
text: '《用户协议》',
recognizer:
TapGestureRecognizer()
..onTap = () {
Get.toNamed(AppRoutes
.USER_PRIVACT);
},
style: TextStyle(
fontWeight:
FontWeight.bold,
color: AppColors
.primaryElement)),
TextSpan(
text: '《隐私权限》',
recognizer:
TapGestureRecognizer()
..onTap = () {
Get.toNamed(
AppRoutes
.PRIVACT);
},
style: TextStyle(
fontWeight:
FontWeight.bold,
color: AppColors
.primaryElement)),
],
),
),
),
SizedBox(
height: 20,
),
btnFlatButtonWidget(
onPressed: () {
Get.back();
controller.signInWithApple();
},
width: 294,
gbColor: AppColors.primaryElement,
fontColor:
AppColors.primaryBackground,
title: "同意并登录",
fontWeight: FontWeight.w500,
fontSize: 16,
)
// Text(
// "请阅读并同意以下条款",
// style: TextStyle(
// fontSize: 16,
// color: Colors.blue[900],
// fontWeight: FontWeight.bold),
// ),
]),
),
// backgroundColor: Colors.white,
);
// controller.signInWithApple
},
),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
SocialLoginButton( SocialLoginButton(
text: "不登录使用", text: "不登录使用",
buttonType: buttonType:
SocialLoginButtonType.generalLogin, SocialLoginButtonType.generalLogin,
backgroundColor: AppColors.thirdElement, backgroundColor: AppColors.thirdElement,
onPressed: () async { onPressed: () async {
Get.back(); Get.back();
}), }),
// Get.put(ApplicationController()); // Get.put(ApplicationController());
// await Get.offAndToNamed( // await Get.offAndToNamed(
// AppRoutes.Application); // AppRoutes.Application);
// }), // }),
// SizedBox( // SizedBox(
// height: 20, // height: 20,
// ), // ),
// SocialLoginButton( // SocialLoginButton(
// text: "微信登录", // text: "微信登录",
// buttonType: // buttonType:
// SocialLoginButtonType.generalLogin, // SocialLoginButtonType.generalLogin,
// backgroundColor: AppColors.thirdElement, // backgroundColor: AppColors.thirdElement,
// onPressed: () async { // onPressed: () async {
// Get.back(); // Get.back();
// }), // }),
], ],
)), )),
), ),
) )
], ],
), ),
padding: EdgeInsets.symmetric(horizontal: 16), padding: EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: Image.asset("assets/images/bg2.png").image, image: Image.asset("assets/images/bg2.png").image,
fit: BoxFit.cover), fit: BoxFit.cover),
)) ))
: buildAndroidSigin(context)); : buildAndroidSigin(context));
} }
Widget buildAndroidSigin(BuildContext buildContext) { Widget buildAndroidSigin(BuildContext buildContext) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.translucent, onTap: ()=> Focus.of(buildContext).unfocus(),
onTap: () => FocusScope.of(buildContext).unfocus(), child: Stack(
child: Container( alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 16), children: <Widget>[
decoration: BoxDecoration( Container(
image: DecorationImage( decoration: BoxDecoration(
image: Image.asset("assets/images/background.png").image, image: DecorationImage(
fit: BoxFit.cover), 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(), child: Column(
const Padding( mainAxisAlignment: MainAxisAlignment.center,
padding: EdgeInsets.only(top: 10), children: <Widget>[
child: Center( Column(
child: Text( children: [
'未注册的手机号验证通过后将自动通过', Row(
style: TextStyle(fontSize: 12, color: Colors.white70), children: [
const Spacer(),
SizedBox(
height: 145,
width: 145,
child: Image.asset("assets/images/logo.png"),
),
const Spacer(),
],
),
SizedBox(height: defaultPadding * 1.5),
],
), ),
), Row(
), children: [
const SizedBox( Spacer(),
height: 55, Expanded(
), flex: 8,
Container( child: Form(
height: 44.h, child: Column(
margin: EdgeInsets.only(top: 15.h), children: [
child: btnFlatButtonWidget( TextFormField(
width: Get.width - 40, controller: controller.mobileMemberController,
fontColor: Colors.black54, keyboardType: TextInputType.emailAddress,
fontSize: 16, textInputAction: TextInputAction.next,
gbColor: Colors.green.withOpacity(0.7), cursorColor: kPrimaryColor,
onPressed: controller.handleSignIn, onSaved: (email) {},
// controller.handleSignIn, decoration: const InputDecoration(
title: "登录"), hintText: "输入手机号",
prefixIcon: Padding(
padding: EdgeInsets.all(defaultPadding),
child: Icon(Icons.phone_android),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: defaultPadding),
child: TextFormField(
controller: controller.codeController,
textInputAction: TextInputAction.done,
obscureText: true,
cursorColor: kPrimaryColor,
decoration: const InputDecoration(
hintText: "输入验证码",
prefixIcon: Padding(
padding: EdgeInsets.all(defaultPadding),
child: Icon(Icons.verified_sharp),
),
),
),
),
Row(
children: [
Flexible(child: Container()),
GestureDetector(
onTap: () => controller.chageCodeStatus(),
child: const Text(
"获取验证码",
style: TextStyle(
color: Colors.white54, fontSize: 12),
),
)
],
),
const SizedBox(height: defaultPadding),
Hero(
tag: "login_btn",
child: Container(
width: Get.width - 40,
height: 45,
child: ElevatedButton(
// style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Color(0xFF6F35A5))),
onPressed: () {
controller.handleSignIn();
},
child: Text(
"登录".toUpperCase(),
),
),
),
),
const SizedBox(height: defaultPadding),
],
),
),
),
Spacer(),
],
),
],
), ),
// SizedBox( ),
// height: 25,
// ), ],
// Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// _buildInputForm(),
// // _buildLogo(),
// // _buildInputForm(),
// // Spacer(),
// // _buildThirdPartyLogin(),
// // _buildSignupButton(),
// ],
// ))
],
),
), ),
); );
// 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,
// )),
// ]),
// const SizedBox(
// height: 25,
// ),
// Row(
// children: [
// const SizedBox(
// width: 35,
// ),
// const Text(
// "短信验证码登录",
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// color: Colors.white70),
// ),
// Flexible(child: Container())
// ],
// ),
// Row(
// children: [
// const SizedBox(
// width: 35,
// ),
// const Text(
// "未注册手机验证后自动登录",
// style: TextStyle(
// fontSize: 11,
// fontWeight: FontWeight.bold,
// color: Colors.white38),
// ),
// Flexible(child: Container())
// ],
// ),
// SizedBox(
// height: 65.h,
// ),
// _buildSigMobileInput(),
// const SizedBox(
// height: 25,
// ),
// _buildSigCodeInput(),
// const SizedBox(
// height: 100,
// ),
// 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