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

board_datetime_picker 표지
패키지 상세v2.8.8

board_datetime_picker

Flutter용 날짜 및 시간 선택기입니다. 캘린더이자 피커이며, 다양한 옵션을 제공하는 패키지입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
5.4천
좋아요
238
Pub 점수
160

패키지 설치

flutter pub add board_datetime_picker

패키지 개요

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

캘린더 통합을 지원하는 조합형 날짜 및 시간 선택기 기능을 제공하는 플러터 패키지로, 다양한 플랫폼에서 날짜와 시간 선택을 위한 사용자 친화적이고 사용자 정의 가능한 UI를 제공합니다. 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스를 모두 지원하여 정확한 날짜 및 시간 입력이 필요한 앱에 이상적입니다. 개발자가 유연하게 구성할 수 있도록 기능성과 시각적 일관성을 갖추고 있습니다.

사용 사례

  • 날짜 및 시간 선택이 필요한 폼 입력
  • 캘린더 기반 스케줄링 애플리케이션
  • 다중 플랫폼 날짜 및 시간 선택기
  • 생년월일 또는 이벤트 시간을 사용한 사용자 프로필 설정
  • 시간대 인식 날짜 입력

주요 기능

  • 통합 캘린더 및 시간 선택기
  • 크로스 플랫폼 호환성
  • 사용자 정의 가능한 UI 및 동작
  • 다양한 날짜 및 시간 형식 지원
  • 부드러운 애니메이션 및 전환
  • 사용자 지정 가능한 최소 및 최대 날짜 범위

적합한 대상

  • 크로스 플랫폼 앱을 개발하는 개발자
  • 강력한 날짜-시간 입력이 필요한 앱
  • 기기 간 일관된 UX를 우선시하는 팀
  • 날짜 및 시간 선택에 최소한의 보일러플레이트가 필요한 프로젝트
  • 현대적이고 반응형 피커를 원하는 사용자

고려 사항

  • 테마 일관성을 위해 추가 스타일링이 필요할 수 있습니다
  • 내부 캘린더 레이아웃의 사용자 정의가 제한됨
  • 일부 기능은 플랫폼별 렌더링에 의존합니다
  • 매우 큰 날짜 범위에 대해 최적화되지 않음
  • 국제 앱에서는 시간대를 신중하게 다뤄야 합니다

원본 README

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

board_datetime_picker

Picker to select date and time for Flutter.
It is both a calendar and a picker, offering a variety of options as a package.

On tablets, the calendar and picker can be displayed simultaneously for easy date/time selection. In other cases, the calendar and picker can be switched at the touch of a button for easy date/time selection.

Multiple selections are supported, and you can also select the start and end date and time in a single Picker display.

Features

Picker Selection

There are two types of Picker: a modal display and a builder display embedded in a widget.
Multi-selection supports only modal display.

Single Multi Builder
Single Multi
Input Field
Standard Wide

Getting Started

In order to add board_datetime_picker package to your project add this line to your pubspec.yaml file

dependencies:
    board_datetime_picker: 2.8.6

Usage

Import it to your project file.

import 'package:board_datetime_picker/board_datetime_picker.dart';
Modal Dialog

Show normal single-picker.

final result = await showBoardDateTimePicker(
  context: context,
  pickerType: DateTimePickerType.datetime,
)

Show picker making multiple selections.

final result = await showBoardDateTimeMultiPicker(
  context: context,
  pickerType: DateTimePickerType.datetime,
)
Builder
final controller = BoardDateTimeController();

DateTime date = DateTime.now();

@override
Widget build(BuildContext context) {
  return BoardDateTimeBuilder(
    controller: controller,
    pickerType: DateTimePickerType.datetime
    builder: (context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('Example'),
        ),
        body: Center(
          child: Text(BoardDateFormat('yyyy/MM/dd').format(date))
        ),
      );
    },
    onChange: (val) {
      setState(() => date = val);
    }
  );
}
Input Field
final textController = BoardDateTimeTextController();

@override
Widget build(BuildContext context) {
  return SizedBox(
    width: 160,
    child: BoardDateTimeInputField(
      controller: textController,
      pickerType: DateTimePickerType.datetime,
      options: const BoardDateTimeOptions(
        languages: BoardPickerLanguages.en(),
      ),
      textStyle: Theme.of(context).textTheme.bodyMedium,
      onChanged: (date) {
        print('onchanged: $date');
      },
      onFocusChange: (val, date, text) {
        print('on focus changed date: $val, $date, $text');
      },
    ),
  );
}
Picker Type

DateTimePickerType types include [date], [datetime], [time]. The picker to be displayed depends on the type selected. Only [datetime] and [date] types can be displayed for calendars.

Parameters

In using BoardDateTimeBuilder or showBoardDateTimePicker, there are several parameters.
Those without [required] are optional.

Parameter Type Description
builder Widget Function(BuildContext context) [required] builder function to form a widget for a screen that uses a picker.
controller BoardDateTimeController [required] Controller to open or close the picker.
onChange void Function(DateTime) [required] Callback when date is changed in the picker.
pickerType DateTimePickerType Display picker type. datetime, date. time. default is datetime.
breakpoint double Breakpoints for switching between Wide and Standard modes. default is 800.
initialDate DateTime Date and time of initial display. default is DateTime.now(). Builder only parameter.
minimumDate DateTime Minimum date in the selectable range. default is DateTime(1970, 1, 1, 0, 0).
maximumDate DateTime Maximum date in the selectable range. default is DateTime(2050, 12, 31, 23, 59).
resizeBottom bool Flag whether to resize the bottom of the specified Builder. If true, the picker is displayed under the builder in Column. default is true.
options BoardDateTimeOptions Class for defining options related to the UI used by [BoardDateTimeBuilder].
customCloseButtonBuilder Function A builder function for customizing the close button.

When using showBoardDateTimeMultiPicker, specify startDate and endDate instead of initialDate.
Please guarantee that the correct values are entered, as it will not work correctly if the start and end are reversed at the time of the function call.

BoardDateTimeOptions

Introduce the definition of the property class that controls UI among the BoardDateTimeBuilder's parameters.
All properties are optional.
The same parameter is used in showBoardDateTimePicker.

Parameter Type Description
backgroundColor Color Picker Background Color. default is Theme.of(context).scaffoldBackgroundColor
foregroundColor Color Picket Foreground Color. default is Theme.of(context).cardColor
textColor Color Picker Text Color. default is Theme.of(context).textTheme.bodyLarge?.color
activeColor Color Use the color of the currently selected date or button in the calendar as a color to indicate the selection status. default is Theme.of(context).primaryColor
activeTextColor Color activeColor is used as the background color and activeTextColor as the text color. default color is white.
backgroundDecoration BoxDecoration BoxDecoration of the widget displayed on the backmost side of the picker. If not specified, it will be a standard BoxDecoration with the color specified in the normal backgroundColor (default).
languages BoardPickerLanguages Language information for text displayed in the picker. Default is en
customOptions BoardPickerCustomOptions Option to specify items to be displayed in the picker by date and time. Only time can be specified. Default is null
startDayOfWeek int First day of the week in the calendar. Defailt is DateTime.sunday
pickerFormat String Date format for pickers. Specify if you want to change the display order of year, month, date. Default is ymd
pickerMonthFormat PickerMonthFormat Month format to be displayed on the picker. number: 1, 2, 3, ..., short: Jan, Feb, Mar, .... Default is PickerMonthFormat.number
showDateButton bool Flag whether the today or tomorrow button is displayed in the header of the picker. Default is true
boardTitle String Title to be displayed in the header of the Picker
boardTitleBuilder Function Title to be displayed at the top of the picker. textStyle parameter is boardTitleTextStyle if declared, defaults if not specified.
boardTitleTextStyle TextStyle Style of title to be displayed in the header of the Picker
pickerSubTitles BoardDateTimeItemTitles Specify the title of each item to be displayed in the picker
weekend BoardPickerWeekendOptions Specify the color of Saturday and Sunday to be displayed in the calendar
inputable bool Flag whether the date to be selected should be text-enabled or not. Default is true
withSecond bool Flag to allow seconds to be specified. This parameter is only valid if DateTimePickerType is time. Default is false
calendarSelectionRadius double Background radius for the date selected in the calendar. Default is null
calendarSelectionBuilder Function Callback to build a Widget that displays the selected item in the calendar. Default is null
actionButtonTypes List<BoardDateButtonType> List of buttons to select dates. Set the enum you want to display with a choice of yesterday, today, or tomorrow. Default is today and tomorrow.
useResetButton bool The reset button will be displayed on the right side of the header section. Default is false
useAmpm bool Set if the time is to be displayed as AM/PM. Default is false
separators BoardDateTimePickerSeparators Specify the separator between items displayed in the Picker. Default is null
allowRetroactiveTime bool Flag to allow retroactive time. If true, allows DateTimePickerType.time to reverse start and end times in multi-selection

Sample of gradient background:

options: BoardDateTimeOptions(
    backgroundDecoration: const BoxDecoration(
        gradient: LinearGradient(
            colors: <Color>[
                Color(0xff1A2980),
                Color(0xff26D0CE),
            ],
        ),
    ),
),
Picker Format

The order in which picker dates are displayed can be specified.
The default is ymd, which displays dates in the picker in the order year - month - day.
The type specified is `BoardDateTimePickerFormat.

PickerFotmat format
ymd year - month - day
Mdy month - day - year
dMy day - month - year
Language Option

By default, English, Japanese, and Italian definitions are prepared.
If you want to use other languages, define the BoardPickerLanguages class and set it as an option. Bellow is an example of using French.

option = BoardDateTimeOptions(
  languages: BoardPickerLanguages(
    locale: 'fr',
    today: 'Aujourd’hui',
    tomorrow: 'Demain',
    now: 'Maintenant',
  ),
);

LICENSE

BSD 3-Clause License

Copyright (c) 2023, mytooyo

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

카테고리

의존성

의존성 목록 2 개

소스 저장소

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

아직 데이터가 없습니다.