Last updated:
0 purchases
number date picker
Getting started #
A Flutter package to pick date with number only.
Usage #
To use this package:
-add the dependency to your pubspec.yaml file
dependencies:
flutter:
sdk: flutter
number_date_picker: <latest-package>
copied to clipboard
Then you can use the package
ElevatedButton(
onPressed: () => showDateNumPicker(
context: context,
startYear: 2000,
endYear: 2023,
initialDate: selectedDate,
onDaySelected: (DateTime? dateTime) {
setState(() {
selectedDate = dateTime as DateTime;
});
},
),
child: const Text('Select Date'))
copied to clipboard
Show the selected date
Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
boxShadow: const [
BoxShadow(
spreadRadius: 2, blurRadius: 2, color: Colors.black12)
]),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// day
Text(
DateFormat.d().format(selectedDate),
style: const TextStyle(
fontSize: 30, fontWeight: FontWeight.w800),
),
const SizedBox(width: 3),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
// month
Text(
DateFormat.MMM().format(selectedDate),
style: const TextStyle(
fontSize: 12, fontWeight: FontWeight.w600),
),
// year
Text(
DateFormat.y().format(selectedDate),
style: const TextStyle(
fontSize: 12, fontWeight: FontWeight.w600),
),
],
)
],
))
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.