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 { @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: DateTime(1900), maximumDate: DateTime.now(), onDateTimeChanged: (data) { dateTime = data; }, ), ),), ], ), ); } }