You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

88 lines
2.8 KiB

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
class CupertinoDatePickerWidget extends StatelessWidget {
final DateTime minimumDate;
final DateTime maximumDate;
CupertinoDatePickerWidget({this.minimumDate,this.maximumDate});
@override
Widget build(BuildContext context) {
DateTime dateTime;
return Container(
height: 252,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Column(
children: [
Container(
height: 50.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Container(
child: Text(
S.of(context).quxiao,
style: TextStyle(
fontSize: 16,
fontWeight: MyFontWeight.semi_bold,
color: Colors.black),
),
margin: EdgeInsets.only(left: 6),
padding: EdgeInsets.all(10),
),
),
InkWell(
onTap: () {
Navigator.of(context).pop(dateTime);
},
child: Container(
child: Text(
S.of(context).queren,
style: TextStyle(
fontSize: 16,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060)),
),
margin: EdgeInsets.only(left: 6),
padding: EdgeInsets.all(10),
),
),
],
),
),
Container(
height: 2.h,
color: Color(0xFFF4F4F4),
),
Expanded(child:Container(
height: 200.h,
child: CupertinoDatePicker(
mode: CupertinoDatePickerMode.date,
backgroundColor: Colors.white,
initialDateTime: DateTime.now(),
minimumDate: minimumDate ?? DateTime(1900),
maximumDate: maximumDate ?? DateTime.now(),
onDateTimeChanged: (data) {
dateTime = data;
},
),
),),
],
),
);
}
}