import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:keyboard/resource/string.gen.dart'; import 'package:keyboard/utils/styles.dart'; import '../widget/birthday_date_picker.dart'; class SelectBirthdayDialog { static const tag = "SelectBirthdayDialog"; static show({ required DateTime initialDate, required DateTime minimumDate, required Function(DateTime) onDateChanged, }) { DateTime currentDate = initialDate; SmartDialog.show( backType: SmartBackType.block, clickMaskDismiss: true, alignment: Alignment.bottomCenter, animationType: SmartAnimationType.centerScale_otherSlide, tag: tag, keepSingle: true, builder: (_) => Container( decoration: ShapeDecoration( color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(18.r), topRight: Radius.circular(18.r), ), ), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 16.w), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () { SmartDialog.dismiss(tag: tag); }, child: Container( width: 87.w, height: 38.h, decoration: ShapeDecoration( color: const Color(0xFFF5F4F9), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(28.r), ), ), child: Center( child: Text( StringName.selectBirthdayDialogCancel, style: Styles.getTextStyleBlack204W500(14.sp), ), ), ), ), Text( StringName.selectBirthdayDialogTitle, style: Styles.getTextStyleBlack204W500(16.sp), ), GestureDetector( onTap: () { onDateChanged(currentDate); SmartDialog.dismiss(tag: tag); }, child: Container( width: 87.w, height: 38.h, decoration: Styles.getActivateButtonDecoration(28.r), child: Center( child: Text( StringName.selectBirthdayDialogConfirm, style: Styles.getTextStyleWhiteW500(14.sp), ), ), ), ), ], ), ), SizedBox(height: 30.h), SizedBox( height: 150.h, width: 320.w, child: BirthdayDatePicker( initialDate: initialDate, minimumDate: minimumDate, backgroundColor: Color(0xffF6F5FA), maximumDate: DateTime.now(), onDateChanged: (dateTime) { currentDate = dateTime; }, ), ), SizedBox(height: 30.h), ], ), ), ); } }