123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- import 'package:cpt_auth/modules/sign_up/sign_up_controller.dart';
- import 'package:cpt_auth/modules/sign_up/sign_up_state.dart';
- import 'package:cs_resources/constants/color_constants.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:plugin_basic/base/base_state.dart';
- import 'package:plugin_basic/base/base_stateful_page.dart';
- import 'package:plugin_basic/utils/ext_get_nav.dart';
- import 'package:router/path/router_path.dart';
- import 'package:shared/utils/screen_util.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:widgets/my_appbar.dart';
- import 'package:widgets/my_button.dart';
- import 'package:widgets/shatter/form_require_text.dart';
- import 'package:widgets/shatter/round_my_text_field.dart';
- class SignUpPage extends BaseStatefulPage<SignUpController> {
- SignUpPage({Key? key}) : super(key: key);
- //启动当前页面
- static void startInstance() {
- return Get.start(RouterPath.AUTH_SIGNUP);
- }
- @override
- Widget build(BuildContext context) {
- return Container();
- }
- @override
- SignUpController createRawController() {
- return SignUpController();
- }
- @override
- State<SignUpPage> createState() => _SignUpState();
- }
- class _SignUpState extends BaseState<SignUpPage, SignUpController> {
- late SignUpState state;
- @override
- void initState() {
- super.initState();
- state = controller.state;
- }
- @override
- Widget build(BuildContext context) {
- return autoCtlGetBuilder(builder: (controller) {
- return Scaffold(
- extendBodyBehindAppBar: true,
- appBar: MyAppBar.appBar(context, "Sign up".tr),
- body: SafeArea(
- bottom: true,
- top: false,
- child: Container(
- width: double.infinity,
- height: double.infinity,
- padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
- decoration: const BoxDecoration(
- gradient: LinearGradient(
- colors: [
- Color(0xFF091D44),
- Color(0xFF245A8A),
- Color(0xFF7F7CEC),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: SingleChildScrollView(
- scrollDirection: Axis.vertical,
- physics: const BouncingScrollPhysics(),
- child: Column(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- //邮箱的设置
- FormRequireText(text: "Email".tr).marginOnly(left: 15, top: 19),
- CustomTextField(
- formKey: "email",
- formData: state.formData,
- errorText: state.emailErrorText,
- onSubmit: (key, value) {
- state.formData[key]!['focusNode'].unfocus();
- FocusScope.of(context).requestFocus(state.formData['password']!['focusNode']);
- },
- marginTop: 10,
- ),
- //密码的设置
- FormRequireText(text: "Password".tr).marginOnly(left: 15, top: 19),
- CustomTextField(
- formKey: "password",
- formData: state.formData,
- errorText: state.passwordErrorText,
- onSubmit: (key, value) {
- state.formData[key]!['focusNode'].unfocus();
- FocusScope.of(context).requestFocus(state.formData['confirm_password']!['focusNode']);
- },
- marginTop: 10,
- ),
- //确认密码的设置
- FormRequireText(text: "Confirm Password".tr).marginOnly(left: 15, top: 19),
- CustomTextField(
- formKey: "confirm_password",
- formData: state.formData,
- errorText: state.confirmPasswordErrorText,
- textInputAction: TextInputAction.done,
- onSubmit: (key, value) {
- FocusScope.of(context).unfocus();
- controller.doSignUp();
- },
- marginTop: 10,
- ),
- //注册按钮
- MyButton(
- type: ClickType.throttle,
- milliseconds: 500,
- onPressed: () {
- FocusScope.of(context).unfocus();
- controller.doSignUp();
- },
- text: "Submit".tr,
- textColor: ColorConstants.white,
- fontSize: 16,
- radius: 22.5,
- backgroundColor: hexToColor("#FFBB1B"),
- fontWeight: FontWeight.w500,
- ).marginSymmetric(horizontal: 15, vertical: 25),
- ],
- ),
- ),
- ),
- ),
- );
- });
- }
- }
|