| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:keyboard/base/base_page.dart';
- import 'package:get/get.dart';
- import 'package:keyboard/module/change/gender/change_gender_controller.dart';
- import 'package:flutter/material.dart';
- import '../../../resource/assets.gen.dart';
- import '../../../router/app_pages.dart';
- import '../../../utils/styles.dart';
- class ChangeGenderPage extends BasePage<ChangeGenderController> {
- const ChangeGenderPage({super.key});
- static Future start({int? gender}) async {
- return Get.toNamed(RoutePath.changeGender, arguments: {"gender": gender});
- }
- @override
- bool immersive() {
- return true;
- }
- @override
- Color backgroundColor() {
- return const Color(0xFFF6F5FA);
- }
- @override
- Widget buildBody(BuildContext context) {
- return Stack(
- children: [
- IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)),
- SafeArea(
- child: Stack(
- children: [
- SingleChildScrollView(
- child: Column(
- children: [
- _buildTitle(),
- SizedBox(height: 40.h),
- _buildContent(),
- ],
- ),
- ),
- Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- margin: EdgeInsets.only(bottom: 32.h),
- child: Obx(() {
- return _buildSaveButton(
- onTap: () {
- controller.clickSave();
- },
- isEnable: controller.currentGender.value != null,
- );
- }),
- ),
- ),
- ],
- ),
- ),
- ],
- );
- }
- _buildTitle() {
- return Container(
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(top: 12.h, left: 16.w, right: 16.w),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- GestureDetector(
- onTap: controller.clickBack,
- child: Assets.images.iconMineBackArrow.image(
- width: 24.w,
- height: 24.w,
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildSaveButton({required VoidCallback onTap, required isEnable}) {
- return GestureDetector(
- onTap: () {
- onTap();
- },
- child: Container(
- width: 260.w,
- height: 48.h,
- decoration:
- isEnable
- ? Styles.getActivateButtonDecoration(31.r)
- : Styles.getInactiveButtonDecoration(31.r),
- child: Center(
- child: Text(
- '保存',
- style: TextStyle(
- color: Colors.white,
- fontSize: 16.sp,
- fontWeight: FontWeight.w500,
- ),
- ),
- ),
- ),
- );
- }
- _buildContent() {
- return Column(
- children: [
- Text('选择性别', style: Styles.getTextStyleBlack204W500(22.sp)),
- SizedBox(height: 119.h),
- _buildFemale(),
- SizedBox(height: 25.h),
- _buildMale(),
- ],
- );
- }
- _buildFemale() {
- return GestureDetector(
- onTap: () {
- if (controller.currentGender.value == 2) {
- controller.currentGender.value = 1;
- } else {
- controller.currentGender.value = 2;
- }
- },
- child: Obx(() {
- return SizedBox(
- width: 320.w,
- height: 115.h,
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- controller.currentGender.value == 2
- ? Assets.images.iconChangeGenderFemaleSelect.image(
- width: 320.w,
- fit: BoxFit.fill,
- )
- : Assets.images.iconChangeGenderFemaleUnselect.image(
- width: 320.w,
- fit: BoxFit.cover,
- ),
- Container(
- alignment: Alignment.centerRight,
- padding: EdgeInsets.only(right: 40.w),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Assets.images.iconChangeGenderFemaleLogo.image(
- width: 20.w,
- height: 20.w,
- ),
- SizedBox(width: 4.w),
- Text(
- '女生',
- textAlign: TextAlign.center,
- style: TextStyle(
- color:
- controller.currentGender.value == 2
- ? Colors.black.withAlpha(204)
- : Colors.black
- .withAlpha(204)
- .withValues(alpha: 0.5),
- fontSize: 22.sp,
- fontWeight: FontWeight.w700,
- ),
- ),
- ],
- ),
- SizedBox(height: 4.w),
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- SizedBox(width: 20.w, height: 20.w),
- SizedBox(width: 4.w),
- Text(
- 'Girl',
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.black.withAlpha(128),
- fontSize: 14.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }),
- );
- }
- _buildMale() {
- return GestureDetector(
- onTap: () {
- if (controller.currentGender.value == 1) {
- controller.currentGender.value = 2;
- } else {
- controller.currentGender.value = 1;
- }
- },
- child: Obx(() {
- return SizedBox(
- width: 320.w,
- height: 115.h,
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- controller.currentGender.value == 1
- ? Assets.images.iconChangeGenderMaleSelect.image(
- width: 320.w,
- fit: BoxFit.fill,
- )
- : Assets.images.iconChangeGenderMaleUnselect.image(
- width: 320.w,
- fit: BoxFit.cover,
- ),
- Container(
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: 40.w),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- '男生',
- textAlign: TextAlign.center,
- style: TextStyle(
- color:
- controller.currentGender.value == 1
- ? Colors.black.withAlpha(204)
- : Colors.black
- .withAlpha(204)
- .withValues(alpha: 0.5),
- fontSize: 22.sp,
- fontWeight: FontWeight.w700,
- ),
- ),
- SizedBox(width: 4.w),
- Assets.images.iconChangeGenderMaleLogo.image(
- width: 20.w,
- height: 20.w,
- ),
- ],
- ),
- SizedBox(height: 4.w),
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- 'Boy',
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.black.withAlpha(128),
- fontSize: 14.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- SizedBox(width: 4.w),
- SizedBox(width: 20.w, height: 20.w),
- ],
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }),
- );
- }
- }
|