简体   繁体   中英

Creating month and year date using dropdown in flutter

I want to create a date-month-year picker, in the image below, using a dropdown, I'm using flutter, should there be a control or should I write my own, and how do I get started? Thank you

在此处输入图像描述

use datepicker_dropdown packages
https://pub.dev/packages/datepicker_dropdown

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  datepicker_dropdown: ^0.0.7+1
import 'package:datepicker_dropdown/datepicker_dropdown.dart';

DropdownDatePicker(
                  inputDecoration: InputDecoration(
                      enabledBorder: const OutlineInputBorder(
                        borderSide: BorderSide(color: Colors.grey, width: 1.0),
                      ),
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(10))), // optional
                  isDropdownHideUnderline: true, // optional
                  isFormValidator: true, // optional
                  startYear: 1900, // optional
                  endYear: 2022, // optional
                  width: 10, // optional
                  selectedDay: 14, // optional
                  selectedMonth: 10, // optional
                  selectedYear: 1993, // optional
                  onChangedDay: (value) => print('onChangedDay: $value'),
                  onChangedMonth: (value) => print('onChangedMonth: $value'),
                  onChangedYear: (value) => print('onChangedYear: $value'),
                ),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM