flutter_year_picker 0.0.1
flutter_year_picker: ^0.0.1 copied to clipboard
Year picker for flutter project.
Simple use this package for pick a year.
Features #
flutter_year_picker can use for pick only year.
Getting started #
Usage #
Future flutterYearPicker(BuildContext context) async{
return showDialog(
context: context,
builder: (context) {
final Size size = MediaQuery.of(context).size;
return AlertDialog(
title: Column(
children: const [
Text('Select a Year'),
Divider(thickness: 1,)
],
),
contentPadding: const EdgeInsets.all(10),
content: SizedBox(
height: size.height / 3,
width: size.width,
child: GridView.count(
physics: const BouncingScrollPhysics(),
crossAxisCount: 3,
children: [
...List.generate(
123,
(index) => InkWell(
onTap: () {
log("Selected Year ==> ${(2022 - index).toString()}");
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0,vertical: 0),
child: Chip(
label: Container(
padding: const EdgeInsets.all(5),
child: Text(
(2022 - index).toString(),
),
),
),
),
),
),
],
),
),
);
},
);
}