|
@@ -1,5 +1,6 @@
|
|
|
import 'package:cs_resources/constants/color_constants.dart';
|
|
|
import 'package:cs_resources/generated/assets.dart';
|
|
|
+import 'package:flutter/gestures.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
import 'package:get/get.dart';
|
|
@@ -102,132 +103,129 @@ class _MainPageState extends BaseState<LoginPage, LoginController> with StateLif
|
|
|
|
|
|
// 底部滚动的布局
|
|
|
SingleChildScrollView(
|
|
|
- scrollDirection: Axis.vertical,
|
|
|
- physics: const BouncingScrollPhysics(),
|
|
|
- child: Column(
|
|
|
- mainAxisSize: MainAxisSize.max,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- MyTextView(
|
|
|
- "Casual Labour System",
|
|
|
- textColor: ColorConstants.white,
|
|
|
- isFontBold: true,
|
|
|
- fontSize: 35,
|
|
|
- marginTop: 20,
|
|
|
- fontStyle: FontStyle.italic,
|
|
|
- textAlign: TextAlign.center,
|
|
|
- marginLeft: 50,
|
|
|
- marginRight: 50,
|
|
|
- ),
|
|
|
-
|
|
|
- //中间的输入框布局
|
|
|
- Container(
|
|
|
- width: double.infinity,
|
|
|
- margin: EdgeInsets.symmetric(vertical: 45, horizontal: 15),
|
|
|
- padding: EdgeInsets.symmetric(vertical: 33, horizontal: 20),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
|
|
|
- borderRadius: BorderRadius.circular(5.0), // 设置圆角
|
|
|
+ scrollDirection: Axis.vertical,
|
|
|
+ physics: const BouncingScrollPhysics(),
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ "Casual Labour System",
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ isFontBold: true,
|
|
|
+ fontSize: 35,
|
|
|
+ marginTop: 20,
|
|
|
+ fontStyle: FontStyle.italic,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ marginLeft: 50,
|
|
|
+ marginRight: 50,
|
|
|
),
|
|
|
- child: Center(
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- //登录文本
|
|
|
- MyTextView(
|
|
|
- "Login Code".tr,
|
|
|
- isFontMedium: true,
|
|
|
- fontSize: 17,
|
|
|
- textColor: ColorConstants.white,
|
|
|
- ),
|
|
|
-
|
|
|
- // 登录表单 - 账号
|
|
|
- _buildInputLayout(
|
|
|
- "code",
|
|
|
- textInputAction: TextInputAction.next,
|
|
|
- errorText: controller.codeErrorText,
|
|
|
- onSubmit: (formKey, value) {
|
|
|
- state.formData[formKey]!['focusNode'].unfocus();
|
|
|
- FocusScope.of(context).requestFocus(state.formData['password']!['focusNode']);
|
|
|
- },
|
|
|
- ),
|
|
|
|
|
|
- //密码文本
|
|
|
- MyTextView(
|
|
|
- "Password".tr,
|
|
|
- isFontMedium: true,
|
|
|
- fontSize: 17,
|
|
|
- textColor: ColorConstants.white,
|
|
|
- marginTop: 18,
|
|
|
- ),
|
|
|
+ //中间的输入框布局
|
|
|
+ Container(
|
|
|
+ width: double.infinity,
|
|
|
+ margin: EdgeInsets.symmetric(vertical: 45, horizontal: 15),
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 33, horizontal: 20),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
|
|
|
+ borderRadius: BorderRadius.circular(5.0), // 设置圆角
|
|
|
+ ),
|
|
|
+ child: Center(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ //登录文本
|
|
|
+ MyTextView(
|
|
|
+ "Email".tr,
|
|
|
+ isFontMedium: true,
|
|
|
+ fontSize: 17,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ),
|
|
|
|
|
|
- // 登录表单 - 密码
|
|
|
- _buildInputLayout(
|
|
|
- "password",
|
|
|
- obscureText: !controller.pwdVisibility,
|
|
|
- errorText: controller.passwordErrorText,
|
|
|
- showRightIcon: true,
|
|
|
- rightWidget: IconButton(
|
|
|
- highlightColor: Colors.transparent,
|
|
|
- splashColor: Colors.transparent,
|
|
|
- icon: controller.pwdVisibility
|
|
|
- ? const MyAssetImage(
|
|
|
- Assets.cptAuthPasswordShowIcon,
|
|
|
- width: 21,
|
|
|
- height: 21,
|
|
|
- color: ColorConstants.white,
|
|
|
- )
|
|
|
- : const MyAssetImage(
|
|
|
- Assets.cptAuthPasswordHideIcon,
|
|
|
- width: 21,
|
|
|
- height: 21,
|
|
|
- color: ColorConstants.white,
|
|
|
- ),
|
|
|
- onPressed: () {
|
|
|
- controller.switchPwdVisibility();
|
|
|
+ // 登录表单 - 账号
|
|
|
+ _buildInputLayout(
|
|
|
+ "code",
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ errorText: state.codeErrorText,
|
|
|
+ onSubmit: (formKey, value) {
|
|
|
+ state.formData[formKey]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['password']!['focusNode']);
|
|
|
},
|
|
|
),
|
|
|
- onSubmit: (formKey, value) {
|
|
|
- state.formData[formKey]!['focusNode'].unfocus();
|
|
|
- controller.doInputLogin();
|
|
|
- },
|
|
|
- ),
|
|
|
|
|
|
- //选择签到功能还是全功能
|
|
|
- CustomRadioCheck(
|
|
|
- options: state.loginOption,
|
|
|
- onOptionSelected: (index, text) {
|
|
|
- state.loginOptionPosition = index;
|
|
|
- },
|
|
|
- ).marginSymmetric(vertical: 20),
|
|
|
+ //密码文本
|
|
|
+ MyTextView(
|
|
|
+ "Password".tr,
|
|
|
+ isFontMedium: true,
|
|
|
+ fontSize: 17,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ marginTop: 18,
|
|
|
+ ),
|
|
|
|
|
|
- //登录按钮
|
|
|
- MyButton(
|
|
|
- type: ClickType.throttle,
|
|
|
- milliseconds: 500,
|
|
|
- onPressed: () {
|
|
|
- FocusScope.of(context).unfocus();
|
|
|
- controller.doInputLogin();
|
|
|
- },
|
|
|
- text: "Log in".tr,
|
|
|
- textColor: ColorConstants.white,
|
|
|
- fontSize: 16,
|
|
|
- radius: 22.5,
|
|
|
- backgroundColor: hexToColor("#FFBB1B"),
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- ),
|
|
|
+ // 登录表单 - 密码
|
|
|
+ _buildInputLayout(
|
|
|
+ "password",
|
|
|
+ obscureText: !state.pwdVisibility,
|
|
|
+ errorText: state.passwordErrorText,
|
|
|
+ showRightIcon: true,
|
|
|
+ rightWidget: IconButton(
|
|
|
+ highlightColor: Colors.transparent,
|
|
|
+ splashColor: Colors.transparent,
|
|
|
+ icon: state.pwdVisibility
|
|
|
+ ? const MyAssetImage(
|
|
|
+ Assets.cptAuthPasswordShowIcon,
|
|
|
+ width: 21,
|
|
|
+ height: 21,
|
|
|
+ color: ColorConstants.white,
|
|
|
+ )
|
|
|
+ : const MyAssetImage(
|
|
|
+ Assets.cptAuthPasswordHideIcon,
|
|
|
+ width: 21,
|
|
|
+ height: 21,
|
|
|
+ color: ColorConstants.white,
|
|
|
+ ),
|
|
|
+ onPressed: () {
|
|
|
+ controller.switchPwdVisibility();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ onSubmit: (formKey, value) {
|
|
|
+ state.formData[formKey]!['focusNode'].unfocus();
|
|
|
+ controller.doInputLogin();
|
|
|
+ },
|
|
|
+ ),
|
|
|
|
|
|
- //注册入口
|
|
|
- _buildRichText(),
|
|
|
+ //选择签到功能还是全功能
|
|
|
+ CustomRadioCheck(
|
|
|
+ options: state.loginOption,
|
|
|
+ onOptionSelected: (index, text) {
|
|
|
+ state.loginOptionPosition = index;
|
|
|
+ },
|
|
|
+ ).marginSymmetric(vertical: 20),
|
|
|
|
|
|
- //注册入口
|
|
|
- ],
|
|
|
- ),
|
|
|
- ), // 传递子部件
|
|
|
- ),
|
|
|
- ],
|
|
|
- )
|
|
|
- ).expanded(),
|
|
|
+ //登录按钮
|
|
|
+ MyButton(
|
|
|
+ type: ClickType.throttle,
|
|
|
+ milliseconds: 500,
|
|
|
+ onPressed: () {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.doInputLogin();
|
|
|
+ },
|
|
|
+ text: "Log in".tr,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ fontSize: 16,
|
|
|
+ radius: 22.5,
|
|
|
+ backgroundColor: hexToColor("#FFBB1B"),
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+
|
|
|
+ //注册入口
|
|
|
+ _buildRichText(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ), // 传递子部件
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )).expanded(),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
@@ -251,6 +249,11 @@ class _MainPageState extends BaseState<LoginPage, LoginController> with StateLif
|
|
|
TextSpan(
|
|
|
text: "Sign up".tr,
|
|
|
style: TextStyle(color: ColorConstants.textYellowFFBB1B),
|
|
|
+ recognizer: TapGestureRecognizer()
|
|
|
+ ..onTap = () {
|
|
|
+ //去登录页面
|
|
|
+ controller.gotoSignUpPage();
|
|
|
+ },
|
|
|
),
|
|
|
],
|
|
|
),
|