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.
83 lines
2.4 KiB
83 lines
2.4 KiB
4 years ago
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class CupertinoDatePickerWidget extends StatelessWidget {
|
||
|
DateTime dateTime;
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
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,
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
InkWell(
|
||
|
onTap: () {
|
||
|
Navigator.of(context).pop();
|
||
|
},
|
||
|
child: Container(
|
||
|
child: Text(
|
||
|
"取消",
|
||
|
style: TextStyle(
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black),
|
||
|
),
|
||
|
margin: EdgeInsets.only(left: 6),
|
||
|
padding: EdgeInsets.all(10),
|
||
|
),
|
||
|
),
|
||
|
InkWell(
|
||
|
onTap: () {
|
||
|
Navigator.of(context).pop(dateTime);
|
||
|
},
|
||
|
child: Container(
|
||
|
child: Text(
|
||
|
"确认",
|
||
|
style: TextStyle(
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Color(0xFF32A060)),
|
||
|
),
|
||
|
margin: EdgeInsets.only(left: 6),
|
||
|
padding: EdgeInsets.all(10),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Container(
|
||
|
height: 2,
|
||
|
color: Color(0xFFF4F4F4),
|
||
|
),
|
||
|
Container(
|
||
|
height: 200,
|
||
|
child: CupertinoDatePicker(
|
||
|
mode: CupertinoDatePickerMode.date,
|
||
|
backgroundColor: Colors.white,
|
||
|
initialDateTime: DateTime.now(),
|
||
|
minimumDate: DateTime(1900),
|
||
|
maximumDate: DateTime.now(),
|
||
|
onDateTimeChanged: (data) {
|
||
|
dateTime = data;
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|