| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- import 'package:keyboard/base/base_page.dart';
- import 'package:keyboard/module/change/birthday/change_birthday_controller.dart';
- import 'package:keyboard/utils/styles.dart';
- import 'package:keyboard/widget/birthday_date_picker.dart';
- import '../../../resource/assets.gen.dart';
- import '../../../router/app_pages.dart';
- class ChangeBirthdayPage extends BasePage<ChangeBirthdayController> {
- const ChangeBirthdayPage({super.key});
- static Future start({String? birthday}) async {
- return Get.toNamed(RoutePath.changeBirthday, arguments: {"birthday": birthday});
- }
- @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(context),
- ],
- ),
- ),
- Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- margin: EdgeInsets.only(bottom: 32.h),
- child: Obx(() {
- return _buildSaveButton(
- onTap: () {
- controller.clickSave();
- },
- isEnable: controller.constellation.value.isNotEmpty,
- );
- }),
- ),
- ),
- ],
- ),
- ),
- ],
- );
- }
- _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,
- ),
- ),
- ],
- ),
- );
- }
- _buildContent(BuildContext context) {
- return Column(
- children: [
- Text('选择生日', style: Styles.getTextStyleBlack204W500(22.sp)),
- Container(
- margin: EdgeInsets.only(top: 119.h),
- alignment: Alignment.center,
- child: Container(child: _datePicker(context)),
- ),
- SizedBox(height: 18.h),
- Obx(() {
- return Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Assets.images.iconChangeBirthdayGemini.image(
- width: 26.w,
- height: 26.w,
- ),
- Text(
- controller.constellation.value,
- style: Styles.getTextStyleBlack204W500(14.sp),
- ),
- ],
- );
- }),
- ],
- );
- }
- SizedBox _datePicker(BuildContext context) {
- var widget = SizedBox(
- height: 150.h,
- width: 320.w,
- // child: DatePickerWidget(),
- child: BirthdayDatePicker(
- initialDate: controller.initialDate,
- minimumDate: controller.minimumDate,
- maximumDate: DateTime.now(),
- onDateChanged: (date) {
- controller.updateConstellation(date);
- },
- ),
- );
- return widget;
- }
- 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,
- ),
- ),
- ),
- ),
- );
- }
- }
|