|
@@ -1,6 +1,7 @@
|
|
|
import 'package:cs_resources/constants/color_constants.dart';
|
|
|
import 'package:cs_resources/generated/assets.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
+import 'package:flutter/widgets.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:plugin_basic/base/base_stateful_page.dart';
|
|
|
import 'package:plugin_basic/base/base_state.dart';
|
|
@@ -8,6 +9,8 @@ import 'package:plugin_basic/base/mixin_state_lifecycle.dart';
|
|
|
import 'package:plugin_basic/utils/ext_get_nav.dart';
|
|
|
import 'package:router/path/router_path.dart';
|
|
|
import 'package:shared/utils/log_utils.dart';
|
|
|
+import 'package:shared/utils/screen_util.dart';
|
|
|
+import 'package:widgets/custom_radio_check.dart';
|
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
|
import 'package:widgets/my_button.dart';
|
|
|
import 'package:widgets/my_load_image.dart';
|
|
@@ -80,113 +83,152 @@ class _MainPageState extends BaseState<LoginPage, LoginController> with StateLif
|
|
|
end: Alignment.bottomCenter,
|
|
|
),
|
|
|
),
|
|
|
- child: SingleChildScrollView(
|
|
|
- scrollDirection: Axis.vertical,
|
|
|
- physics: const BouncingScrollPhysics(),
|
|
|
- child: Column(
|
|
|
- mainAxisSize: MainAxisSize.max,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- //顶部Logo
|
|
|
- MyAssetImage(
|
|
|
- Assets.assetsYyBusinessTopLogo,
|
|
|
- width: 164.5,
|
|
|
- height: 101,
|
|
|
- ).marginOnly(top: 75),
|
|
|
-
|
|
|
- //中间的输入框布局
|
|
|
- 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(
|
|
|
- "Login Code".tr,
|
|
|
- isFontMedium: true,
|
|
|
- fontSize: 17,
|
|
|
- textColor: ColorConstants.white,
|
|
|
- ),
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ //当前选择的国家,这个不跟随滚动
|
|
|
+ Align(
|
|
|
+ alignment: Alignment.topRight,
|
|
|
+ child: MyTextView(
|
|
|
+ "Vietnam".tr,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ isFontMedium: true,
|
|
|
+ fontSize: 15,
|
|
|
+ marginTop: ScreenUtil.getStatusBarH(context) + 20,
|
|
|
+ marginRight: 20,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
|
|
|
- // 登录表单 - 账号
|
|
|
- _buildInputLayout(
|
|
|
- "code",
|
|
|
- textInputAction: TextInputAction.next,
|
|
|
- errorText: controller.codeErrorText,
|
|
|
- onSubmit: (formKey, value) {
|
|
|
- state.formData[formKey]!['focusNode'].unfocus();
|
|
|
- FocusScope.of(context).requestFocus(state.formData['password']!['focusNode']);
|
|
|
- },
|
|
|
- ),
|
|
|
+ // 底部滚动的布局
|
|
|
+ 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,
|
|
|
+ ),
|
|
|
|
|
|
- //密码文本
|
|
|
- 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(
|
|
|
+ "Login Code".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();
|
|
|
- },
|
|
|
- ),
|
|
|
- onSubmit: (formKey, value) {
|
|
|
- state.formData[formKey]!['focusNode'].unfocus();
|
|
|
- controller.doInputLogin();
|
|
|
- },
|
|
|
- ),
|
|
|
+ // 登录表单 - 账号
|
|
|
+ _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,
|
|
|
+ ),
|
|
|
+
|
|
|
+ // 登录表单 - 密码
|
|
|
+ _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();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ onSubmit: (formKey, value) {
|
|
|
+ state.formData[formKey]!['focusNode'].unfocus();
|
|
|
+ controller.doInputLogin();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+
|
|
|
+ //选择签到功能还是全功能
|
|
|
+ CustomRadioCheck(
|
|
|
+ options: state.loginOption,
|
|
|
+ onOptionSelected: (index, text) {
|
|
|
+ state.loginOptionPosition = index;
|
|
|
+ },
|
|
|
+ ).marginSymmetric(vertical: 20),
|
|
|
+
|
|
|
+ //登录按钮
|
|
|
+ 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(),
|
|
|
|
|
|
- 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,
|
|
|
- ).marginOnly(top: 31)
|
|
|
- ],
|
|
|
+ //注册入口
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ), // 传递子部件
|
|
|
),
|
|
|
- ), // 传递子部件
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ).expanded(),
|
|
|
+ ],
|
|
|
),
|
|
|
),
|
|
|
);
|
|
@@ -194,8 +236,30 @@ class _MainPageState extends BaseState<LoginPage, LoginController> with StateLif
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ //底部的注册文本
|
|
|
+ Widget _buildRichText() {
|
|
|
+ return Align(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: RichText(
|
|
|
+ text: TextSpan(
|
|
|
+ style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500, color: ColorConstants.textGrayAECAE5),
|
|
|
+ children: <TextSpan>[
|
|
|
+ TextSpan(
|
|
|
+ text: "Don’t have an account?".tr,
|
|
|
+ style: TextStyle(color: ColorConstants.textGrayAECAE5),
|
|
|
+ ),
|
|
|
+ TextSpan(
|
|
|
+ text: "Sign up".tr,
|
|
|
+ style: TextStyle(color: ColorConstants.textYellowFFBB1B),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ).marginOnly(top: 23);
|
|
|
+ }
|
|
|
+
|
|
|
/// 输入框 账号与密码
|
|
|
- _buildInputLayout(
|
|
|
+ Widget _buildInputLayout(
|
|
|
String key, {
|
|
|
double marginTop = 0,
|
|
|
bool? showRightIcon = false, //是否展示右侧的布局
|