update 2datePicker

null_safety
小赖 4 years ago
parent a19385c108
commit e866a2b12c

@ -12,11 +12,12 @@ class RangeDate {
///`bool``true`, ///`bool``true`,
/// ///
///`RangeDate` ///`RangeDate`
Future<dynamic> show2DatePicker(BuildContext context) async { Future<dynamic> show2DatePicker(BuildContext context,
{bool isAnHour, RangeDate date}) async {
return await showModalBottomSheet( return await showModalBottomSheet(
context: context, context: context,
builder: (context) { builder: (context) {
return AS2DatePicker(); return AS2DatePicker(isAnHour:isAnHour,date:date);
}, },
); );
} }

@ -1,7 +1,9 @@
part of ansu_ui; part of ansu_ui;
class AS2DatePicker extends StatefulWidget { class AS2DatePicker extends StatefulWidget {
AS2DatePicker({Key key}) : super(key: key); final bool isAnHour;
final RangeDate date;
AS2DatePicker({Key key, this.isAnHour, this.date}) : super(key: key);
@override @override
_AS2DatePickerState createState() => _AS2DatePickerState(); _AS2DatePickerState createState() => _AS2DatePickerState();
@ -152,6 +154,8 @@ class _AS2DatePickerState extends State<AS2DatePicker> {
super.initState(); super.initState();
_pageController = PageController(); _pageController = PageController();
_selectedDate = now; _selectedDate = now;
_inAnHour = widget.isAnHour ?? true;
_selectedDate = widget.date?.start ?? now;
} }
@override @override

Loading…
Cancel
Save