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

flutter_datetime_picker_plus 표지
패키지 상세v3.0.1

flutter_datetime_picker_plus

플러터용 날짜 및 시간 선택기입니다. 영어, 네덜란드어, 중국어로 날짜/시간/날짜 및 시간을 선택할 수 있으며, 사용자 정의 피커 콘텐츠도 가능합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
5.3만
좋아요
171
Pub 점수
140

패키지 설치

flutter pub add flutter_datetime_picker_plus

패키지 개요

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

Flutter용 사용자 정의 가능한 날짜 및 시간 선택기로 영어, 네덜란드어, 중국어에서 날짜, 시간 또는 둘 다를 선택할 수 있습니다. 지역화된 인터페이스를 제공하며 개발자가 앱의 특정 요구 사항에 맞게 선택기 내용을 조정할 수 있도록 합니다. Android, iOS, Web, macOS, Windows, Linux와 호환되어 모든 플랫폼에서 원활한 사용자 경험을 제공합니다. 통합이 쉬우며 UI 커스터마이징에 유연성을 제공하도록 설계되었습니다.

사용 사례

  • 날짜/시간 선택이 필요한 폼 입력
  • 다국어 애플리케이션
  • 사용자 정의 가능한 날짜/시간 선택기
  • 다중 플랫폼 날짜/시간 입력
  • 사용자 친화적인 캘린더 인터페이스
  • 로컬라이즈된 앱 경험

주요 기능

  • 날짜, 시간 및 병합 선택을 지원합니다
  • 영어, 네덜란드어 및 중국어로 이용 가능
  • 높은 사용자 정의 가능한 UI
  • 크로스 플랫폼 호환성
  • pub.dev를 통한 간편한 통합
  • Localization-ready

적합한 대상

  • 다국어 앱을 개발하는 개발자
  • 유연한 날짜/시간 입력이 필요한 앱
  • 플랫폼 전반의 일관성 요구 프로젝트
  • 사용자 정의 가능한 피커를 원하는 팀
  • 사용자 경험 중심의 폼 디자인
  • 국제화된 모바일 및 웹 앱

고려 사항

  • 지원되지 않는 언어에 대해 수동 설정이 필요합니다
  • 사용자 정의는 복잡성을 증가시킬 수 있습니다
  • 확장되지 않는 한 사전 정의된 지역 설정에 국한됨
  • 강력한 사용자 정의로 인한 성능 영향
  • 일관된 외관을 위해 추가적인 스타일링이 필요할 수 있습니다
  • Flutter 버전 호환성에 의존

원본 README

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

Flutter Datetime Picker Plus

Forked from (Pub) flutter_datetime_picker as it had issues with dart 3.0/Flutter 3.10.

This package only works on Flutter >=3.10.0. If you need an older version, please use the original package.

(Pub) flutter_datetime_picker_plus

Documentation

A flutter date time picker inspired by flutter-cupertino-date-picker

you can choose date / time / date&time in multiple languages:

  • Albanian(sq)
  • Arabic(ar)
  • Armenian(hy)
  • Azerbaijani(az)
  • Basque(eu)
  • Bengali(bn)
  • Bosnian(bs)
  • Bulgarian(bg)
  • Catalan(cat)
  • Chinese(zh)
  • Chinese, Traditional(tw)
  • Croatian(hr)
  • Czech(cs)
  • Danish(da)
  • Dutch(nl)
  • English(en)
  • Finnish(fi)
  • French(fr)
  • German(de)
  • Greek(gr, el)
  • Hebrew(he)
  • Hindi(hi)
  • Indonesian(id)
  • Italian(it)
  • Japanese(jp)
  • Kazakh(kk)
  • Khmer(kh)
  • Korean(ko)
  • Mongolian(mn)
  • Norwegian(no)
  • Persian(fa)
  • Polish(pl)
  • Portuguese(pt)
  • Russian(ru)
  • Serbian(sr)
  • Slovak(sk)
  • Slovenian(si, sl)
  • Spanish(es)
  • Swedish(sv)
  • Tamil(ta)
  • Thai(th)
  • Turkish(tr)
  • Ukrainian(uk)
  • Vietnamese(vi)

and you can also custom your own picker content

Date picker Time picker Date Time picker

International:

Date Time picker (Chinese) Date Time picker (America) Date Time picker (Dutch) Date Time picker (Russian)

Demo App

main page

Usage

TextButton(
    onPressed: () {
        DatePicker.showDatePicker(context,
                              showTitleActions: true,
                              minTime: DateTime(2018, 3, 5),
                              maxTime: DateTime(2019, 6, 7), onChanged: (date) {
                            print('change $date');
                          }, onConfirm: (date) {
                            print('confirm $date');
                          }, currentTime: DateTime.now(), locale: LocaleType.zh);
    },
    child: Text(
        'show date time picker (Chinese)',
        style: TextStyle(color: Colors.blue),
    ));

Customize

If you want to customize your own style of date time picker, there is a class called CommonPickerModel, every type of date time picker is extended from this class, you can refer to other picker model (eg. DatePickerModel), and write your custom one, then pass this model to showPicker method, so that your own date time picker will appear, it’s easy, and will perfectly meet your demand

How to customize your own picker model:

class CustomPicker extends CommonPickerModel {
  String digits(int value, int length) {
    return '$value'.padLeft(length, "0");
  }

  CustomPicker({DateTime currentTime, LocaleType locale}) : super(locale: locale) {
    this.currentTime = currentTime ?? DateTime.now();
    this.setLeftIndex(this.currentTime.hour);
    this.setMiddleIndex(this.currentTime.minute);
    this.setRightIndex(this.currentTime.second);
  }

  @override
  String leftStringAtIndex(int index) {
    if (index >= 0 && index < 24) {
      return this.digits(index, 2);
    } else {
      return null;
    }
  }

  @override
  String middleStringAtIndex(int index) {
    if (index >= 0 && index < 60) {
      return this.digits(index, 2);
    } else {
      return null;
    }
  }

  @override
  String rightStringAtIndex(int index) {
    if (index >= 0 && index < 60) {
      return this.digits(index, 2);
    } else {
      return null;
    }
  }

  @override
  String leftDivider() {
    return "|";
  }

  @override
  String rightDivider() {
    return "|";
  }

  @override
  List<int> layoutProportions() {
    return [1, 2, 1];
  }

  @override
  DateTime finalTime() {
    return currentTime.isUtc
        ? DateTime.utc(currentTime.year, currentTime.month, currentTime.day,
            this.currentLeftIndex(), this.currentMiddleIndex(), this.currentRightIndex())
        : DateTime(currentTime.year, currentTime.month, currentTime.day, this.currentLeftIndex(),
            this.currentMiddleIndex(), this.currentRightIndex());
  }
}
Custom title bar

By default every picker shows a Cancel/Done bar above the wheels. Pass a titleActionsBuilder to any DatePicker.show* method to replace it with your own widget. The builder receives onCancel / onConfirm callbacks (which dismiss the picker the same way the default buttons do) and the currently selected DateTime:

DatePicker.showDatePicker(
  context,
  titleActionsBuilder: (context, onCancel, onConfirm, currentTime) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        TextButton(onPressed: onCancel, child: const Text('Close')),
        Text('${currentTime.year}-${currentTime.month}-${currentTime.day}'),
        TextButton(onPressed: onConfirm, child: const Text('Pick')),
      ],
    );
  },
);

The bar is laid out within the theme's titleHeight, so keep your widget within that height (or raise titleHeight via a custom DatePickerTheme). The builder is only used when showTitleActions is true (the default).

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

카테고리

의존성

의존성 목록 2 개

소스 저장소

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