I am trying to pick a date only. I used flutter_holo_date_picker
dependency. When I select date I get time with it. But I only want date not time. How can I remove it?
Here is my code -
import 'package:flutter/material.dart';
import 'package:flutter_holo_date_picker/flutter_holo_date_picker.dart';
class WidgetPage extends StatefulWidget {
@override
_WidgetPageState createState() => _WidgetPageState();
}
class _WidgetPageState extends State<WidgetPage> {
late DateTime _selectedDate;
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 25),
child: Expanded(
child: Row(
children: <Widget>[
Expanded(
child: DatePickerWidget(
looping: false, // default is not looping
firstDate: DateTime(1990, 01, 01),
lastDate: DateTime(2030, 1, 1),
initialDate: DateTime(1991, 10, 12),
dateFormat: "dd-MMM-yyyy",
locale: DatePicker.localeFromString('en'),
onChange: (DateTime newDate, _) =>
_selectedDate = newDate,
pickerTheme: const DateTimePickerTheme(
itemTextStyle:
TextStyle(color: Colors.black, fontSize: 19),
dividerColor: Colors.blue,
),
),
),
Expanded(
child: TextButton(
onPressed: (){
print('current_date: $_selectedDate');
},
child: const Text('submit'),
),
),
],
),
),
),
),
),
);
}
}
Expected output will be -
current_date: 2022-1-1