패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.1.0

flutter_cupertino_date_picker_fork

Flutter cupertino 날짜 선택기. iOS 스타일로 날짜 선택기를 표시합니다. Android 및 iOS 플랫폼을 모두 지원합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
5.6천
좋아요
32
Pub 점수
150

패키지 설치

flutter pub add flutter_cupertino_date_picker_fork

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Android 및 기타 플랫폼과 호환되는 iOS 스타일의 날짜 선택기 제공하는 플러터 패키지입니다. 네이티브인 커퍼티노 날짜 선택기의 외관과 동작을 복제하여 다양한 기기에서 일관된 사용자 경험을 보장합니다. 이 포크는 최신 플러터 버전과의 호환성을 유지하며 웹, macOS, Windows, Linux 등 여러 플랫폼을 지원합니다. 플랫폼별 코드 없이 네이티브 iOS 룩을 제공하고자 하는 앱에 이상적입니다.

사용 사례

  • 크로스 플랫폼 앱에서 iOS 스타일의 날짜 선택
  • Android 및 iOS에서 일관된 날짜 선택기 UI
  • 웹 및 데스크톱 앱에서 네이티브처럼 보이는 날짜 입력
  • 사용자 정의 날짜 범위 선택
  • 날짜 선택기 필요 형식 입력

주요 기능

  • iOS 스타일 디자인과 네이티브 느낌
  • 다중 플랫폼 지원 (Android, iOS, Web, macOS, Windows, Linux)
  • Flutter 폼과의 간편한 통합
  • 날짜 및 시간 선택기 모두 지원
  • 가벼운 유지 관리된 포크

적합한 대상

  • 안드로이드에서 iOS 미학을 목표로 하는 개발자
  • 크로스 플랫폼 앱 디자이너
  • 일관된 날짜 선택기 UX가 필요한 팀
  • 양식 중심 인터페이스를 가진 앱
  • 최소한의 종속성 요구 프로젝트

고려 사항

  • 비-iOS 플랫폼에 추가 스타일링이 필요할 수 있습니다
  • 네이티브 컴포넌트에 비해 사용자 지정 옵션이 제한됨
  • 업데이트를 위한 분기된 저장소에 대한 종속성
  • 플러터 팀에서 공식적으로 유지 관리하지 않음
  • 새로운 Flutter 릴리스와의 잠재적인 버전 충돌

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Flutter Cupertino Date Picker

[fork packages flutter_cupertino_date_picker]

  1. Solve the error of flutter1.20.0 :not support DiagnosticableMixin;

  2. Support Dark Mode theme

Flutter cupertino date picker.

Example

Usage

1. Depend

Add this to you package's pubspec.yaml file:

dependencies:
  flutter_cupertino_date_picker_fork: ^1.1.0
2. Install

Run command:

$ flutter packages get
3. Import

Import in Dart code:

import 'package:flutter_cupertino_date_picker_fork/flutter_cupertino_date_picker_fork.dart';
4. Display DatePicker
Bottom Sheet DatePicker
/// Display date picker in bottom sheet.
///
/// context: [BuildContext]
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerMode: [DateTimePickerMode] display mode: date(DatePicker)、time(TimePicker)、datetime(DateTimePicker)
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onClose: [DateVoidCallback] date picker closed event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
DatePicker.showDatePicker(
  context,
  minDateTime: DateTime(2019, 1, 1),
  maxDateTime: DateTime(2021, 12, 31),
  initialDateTime: DateTime(2020, 6, 15),
  dateFormat: 'yyyy-MMMM-dd',
  locale: DateTimePickerLocale.en_us,
  pickerMode: DateTimePickerMode.date,
  pickerTheme: DateTimePickerTheme.Default,
  minuteDivider: 1,
  onMonthChangeStartWithFirstDate: false,
  onCancel: () => print('cancel'),
  onClose: () => print('close'),
  onChange: (dateTime, index) => print('$dateTime'),
  onConfirm: (dateTime, index) => print('$dateTime'),
);
DatePicker Widget
/// Display date picker widget.
///
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
DatePickerWidget(
  minDateTime: DateTime(2019, 1, 1),
  maxDateTime: DateTime(2021, 12, 31),
  initialDateTime: DateTime(2020, 6, 15),
  dateFormat: 'yyyy-MMMM-dd',
  locale: DateTimePickerLocale.en_us,
  pickerTheme: DateTimePickerTheme.Default,
  onChange: (dateTime, selectedIndex) { },
  onConfirm: (dateTime, selectedIndex) { },
)
TimePicker Widget
/// Display time picker widget.
///
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// minuteDivider: [int] minute restriction, e.g. 5: every 5th minute will be shown (0, 5, 10, 15 ...)
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
TimePickerWidget(
  minDateTime: DateTime(2019, 1, 1, 8, 0),
  maxDateTime: DateTime(2021, 12, 31, 22, 0),
  initDateTime: DateTime(2020, 6, 15, 14, 30),
  dateFormat: 'HH:mm',
  locale: DateTimePickerLocale.en_us,
  pickerTheme: DateTimePickerTheme.Default,
  minuteDivider: 1,
  onChange: (dateTime, selectedIndex) { },
  onConfirm: (dateTime, selectedIndex) { },
)
DateTimePicker Widget
/// Display date time picker widget.
///
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
DateTimePickerWidget(
  minDateTime: DateTime(2019, 1, 1),
  maxDateTime: DateTime(2021, 12, 31),
  initDateTime: DateTime(2020, 6, 15),
  dateFormat: 'yyyy-MM-dd HH:mm',
  locale: DateTimePickerLocale.en_us,
  pickerTheme: DateTimePickerTheme.Default,
  onChange: (dateTime, selectedIndex) { },
  onConfirm: (dateTime, selectedIndex) { },
)
5. DateTimePickerLocale

Support:

  • en_us: English (EN) United States [Default locale]
  • ar: Arabic (ar)
  • ar_eg: Arabic (ar) Egypt
  • bn: Bengali (BN)
  • bs: Bosnian (BS)
  • de: German (DE)
  • es: Spanish (ES)
  • fr: French (FR)
  • hr: Croatian (HR)
  • hu: Hungarian (HU)
  • in_id: Bahasa (IN) Indonesia
  • it: Italian (IT)
  • jp: Japanese (JP)
  • ko: Korea (KO)
  • nl: Dutch (NL)
  • pt_br: Portuguese (PT) Brazil
  • ro: Romanian (RO)
  • ru: Russian (RU)
  • sr_cyrl: Serbia (sr) Cyrillic
  • sr_latn: Serbia (sr) Latin
  • tr: Turkish (TR)
  • uk: Ukraine (UK)
  • vi: Vietnamese (VI) Vietnam
  • zh_cn: Chinese (ZH) Simplified
Add more language
1. Add language i18n file

Fork this project, add language file in lib/src/i18n/ directory, e.g. strings_en_us.dart.

/// English (EN) United States
class _StringsEnUs extends _StringsI18n {
  const _StringsEnUs();

  @override
  String getCancelText() {
    // TODO return cancel widget's text
    return null;
  }

  @override
  String getDoneText() {
    // TODO return done widget's text
    return null;
  }

  @override
  List<String> getMonths() {
    // TODO return the array of month's full name [January, February ... December]
    return null;
  }

  @override
  List<String>? getMonthsShort() {
    // TODO return the array of month's short name [Jan, Feb ... Dec]. If return null, will substring the full name (max length is 3)
    return null;
  }

  @override
  List<String> getWeeksFull() {
    // TODO return the array of week's full name [Monday, Tuesday ... Sunday]
    return null;
  }

  @override
  List<String>? getWeeksShort() {
    // TODO return the array of week's short name [Mon, Tue ... Sun]
    return null;
  }
}
2. Add Locale

Add language locale in lib/src/i18n/date_picker_i18n.dart file.

enum DateTimePickerLocale {
  /// English (EN) United States
  en_us,
}
3. Add Locale-Language relationship

Add language-locale relationship in lib/src/i18n/date_picker_i18n.dart file.

const Map<DateTimePickerLocale, _StringsI18n> datePickerI18n = {
  DateTimePickerLocale.en_us: const _StringsEnUs(),
};
6. dateFormat
Pattern Meaning e.g.
yyyy year 2019, 2020
yy year, 2 digits 19, 20
MMMM month January(en_us), 01(zh_cn)
MMM month, abbreviated Jan(en_us), 01(zh_cn)
MM month, 2 digits 01、11
M month 1, 11
dd day in month, 2 digits 05, 25
d day in month 5, 25
EEEE day of week Monday(en_us), 星期一(zh_cn)
EEE day of week, abbreviated Mon(en_us), 周一(zh_cn)
HH hour (0~23), 2 digits 04, 12, 20
H hour (0~23) 4, 12, 20
mm minute, 2 digits 05, 40
m minute 5, 40
ss second, 2 digits 06, 55
s second 6, 55
yyyy年 format 2019年, 2020年
H时 format 5时, 21时
Date Format Separator

Support separator: |,-/\._: .

7. DateTimePickerTheme

All color/style fields are nullable. When you pass a partial theme, missing values are resolved automatically from Theme.of(context), supporting both light and dark mode out of the box.

/// DateTimePicker theme.
///
/// [backgroundColor] DatePicker's background color. null = auto (white / dark surface).
/// [cancelTextStyle] Default cancel widget's [TextStyle]. null = auto.
/// [confirmTextStyle] Default confirm widget's [TextStyle]. null = auto.
/// [cancel] Custom cancel widget.
/// [confirm] Custom confirm widget.
/// [title] Custom title widget. If specify a title widget, the cancel and confirm widgets will not display. Must set [titleHeight] value for custom title widget.
/// [showTitle] Whether display title widget or not. If set false, the default cancel and confirm widgets will not display, but the custom title widget will display if had specified one custom title widget.
/// [pickerHeight] The value of DatePicker's height.
/// [titleHeight] The value of DatePicker's title height.
/// [itemHeight] The value of DatePicker's column height.
/// [itemTextStyle] The value of DatePicker's column [TextStyle]. null = auto.
const DateTimePickerTheme({
  this.backgroundColor,
  this.cancelTextStyle,
  this.confirmTextStyle,
  this.cancel,
  this.confirm,
  this.title,
  this.showTitle = true,
  this.pickerHeight = 210.0,
  this.titleHeight = 44.0,
  this.itemHeight = 36.0,
  this.itemTextStyle,
});
Dark Mode

DateTimePickerTheme.of(context) reads Theme.of(context) to produce correct defaults for dark mode. The showDatePicker entry point and all widgets call resolve(context) automatically, so you don't need to do anything — it just works when your app's ThemeData has brightness: Brightness.dark.

If you provide partial overrides, unspecified fields still adapt to the current theme:

DatePicker.showDatePicker(
  context,
  minDateTime: ...,
  maxDateTime: ...,
  pickerTheme: DateTimePickerTheme(
    backgroundColor: Colors.blue.shade50,  // explicit
    // cancelTextStyle, confirmTextStyle, itemTextStyle → auto-resolved
  ),
);

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.