import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:keyboard/base/base_page.dart'; import 'package:keyboard/module/new_user/new_user_controller.dart'; import 'package:flutter/material.dart'; import 'package:keyboard/module/new_user/step/birthday/step_birthday_view.dart'; import 'package:keyboard/module/new_user/step/gender/step_gender_view.dart'; import 'package:keyboard/module/new_user/step/intimacy/step_intimacy_stages_view.dart'; import 'package:keyboard/module/new_user/step/nickname/step_nickname_view.dart'; import 'package:keyboard/module/new_user/step/partner/step_partner_view.dart'; import 'package:keyboard/router/app_pages.dart'; import '../../resource/assets.gen.dart'; import '../../resource/string.gen.dart'; import '../../utils/styles.dart'; import '../../widget/step_progress_bar.dart'; class NewUserPage extends BasePage { const NewUserPage({super.key}); static start() { Get.toNamed(RoutePath.newUser); } @override Color backgroundColor() { return const Color(0xFFF6F5FA); } @override bool immersive() { return true; } @override Widget buildBody(BuildContext context) { return PopScope( canPop: false, onPopInvokedWithResult: (didPop, result) { if (didPop) { return; } controller.clickBack(); }, child: Stack( children: [ IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)), SafeArea( child: Stack( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ _buildTitle(), Container( margin: EdgeInsets.only( top: 22.w, left: 32.w, right: 32.w, ), child: Obx(() { return StepProgressBar( currentStep: controller.currentStep, totalSteps: controller.totalSteps, ); }), ), SizedBox(height: 17.w), Expanded( child: PageView( controller: controller.pageController, physics: const NeverScrollableScrollPhysics(), children: const [ StepGenderView(), StepBirthdayView(), StepNicknameView(), StepIntimacyStagesView(), StepPartnerView(), ], ), ), ], ), Align( alignment: Alignment.bottomCenter, child: Container( margin: EdgeInsets.only( bottom: 50.w, left: 50.w, right: 50.w, ), child: Obx(() { return _buildNextButton( onTap: () { controller.clickNextButton(); }, isEnable: controller.isCurrentStepValid, ); }), ), ), ], ), ), ], ), ); } _buildTitle() { return Container( alignment: Alignment.centerLeft, padding: EdgeInsets.only(top: 12.h, left: 16.w, right: 16.w), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () => controller.clickBack(), child: Assets.images.iconMineBackArrow.image( width: 24.w, height: 24.w, ), ), GestureDetector( onTap: () => controller.clickSkip(), child: Text( StringName.skip, style: Styles.getTextStyleBlack128W400(14.sp), ), ), ], ), ); } Widget _buildNextButton({required VoidCallback onTap, required isEnable}) { return GestureDetector( onTap: () { onTap(); }, child: Row( children: [ Column( mainAxisSize: MainAxisSize.min, children: [ Container( width: 260.w, height: 48.h, decoration: isEnable ? Styles.getActivateButtonDecoration(50.r) : Styles.getInactiveButtonDecoration(50.r), child: Center( child: Text( controller.currentStep == controller.totalSteps ? StringName.newUserPartnerNowGenerate : StringName.nextStep, style: TextStyle( color: Colors.white, fontSize: 16.sp, fontWeight: FontWeight.w500, ), ), ), ), Visibility( visible: controller.currentStep == controller.totalSteps, child: SizedBox(height: 25.w), ), Visibility( visible: controller.currentStep == controller.totalSteps, child: GestureDetector( onTap: controller.clickUseGeneralMode, child: Text( StringName.newUserPartnerLater, style: TextStyle( color: Colors.black.withAlpha(87), fontSize: 14.sp, ), ), ), ), ], ), ], ), ); } }