搜索插件、代码仓与 APP 分类

custom_date_range_picker 封面
插件详情v1.2.0

custom_date_range_picker

一个适用于 Android 和 iOS 的 Flutter 包,提供可自定义的日期范围选择器,具有美观的用户界面和流畅的动画效果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
5480
喜欢数
85
Pub 分数
160

安装插件

flutter pub add custom_date_range_picker

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 包,为 Android、iOS、Web、macOS、Windows 和 Linux 提供高度可定制的日程范围选择器。它具有优雅的用户界面和流畅的动画效果,使开发者能够根据应用的设计自定义选择器的外观和行为。该选择器支持直观的日期选择并提供视觉反馈,非常适合预订系统、日程安排应用和数据筛选界面。该组件从跨平台兼容性角度设计,确保在各种设备上提供一致的用户体验。

适合场景

  • 预订和预订系统
  • 按日期范围筛选数据
  • 事件调度应用
  • 旅行规划工具
  • 自定义日历集成

主要特点

  • 跨平台支持
  • 流畅的动画
  • 高度可定制的用户界面
  • 直观的日期选择
  • 所选范围的视觉反馈

适合对象

  • 开发旅游或预订应用的开发者
  • 需要在跨平台环境中保持一致日期选择器的团队
  • 需要自定义日历设计的应用程序
  • 专注于用户体验和美学的项目

使用建议

  • 需要与现有的日期处理逻辑进行集成
  • 可能需要额外的样式来支持复杂主题
  • 仅限日期范围选择(无时间组件)
  • 依赖 Flutter SDK 版本兼容性

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

custom_date_range_picker

custom_date_range_picker

Usage

...
  floatingActionButton: FloatingActionButton(
        onPressed: () {
          showCustomDateRangePicker(
            context,
            dismissible: true,
            minimumDate: DateTime.now().subtract(const Duration(days: 30)),
            maximumDate: DateTime.now().add(const Duration(days: 30)),
            endDate: endDate,
            startDate: startDate,
            backgroundColor: Colors.white,
            primaryColor: Colors.green,
            onApplyClick: (start, end) {
              setState(() {
                endDate = end;
                startDate = start;
              });
            },
            onCancelClick: () {
              setState(() {
                endDate = null;
                startDate = null;
              });
            },
          );
        },
        tooltip: 'choose date Range',
        child: const Icon(Icons.calendar_today_outlined, color: Colors.white),
      ),

Function: showCustomDateRangePicker

This function displays a custom date range picker dialog box.

Parameters

  • context (required): The context in which to show the dialog.
  • dismissible (required): A boolean value indicating whether the dialog can be dismissed by tapping outside of it.
  • minimumDate (required): A DateTime object representing the minimum allowable date that can be selected in the date range picker.
  • maximumDate (required): A DateTime object representing the maximum allowable date that can be selected in the date range picker.
  • startDate (optional): A nullable DateTime object representing the initial start date of the date range selection.
  • endDate (optional): A nullable DateTime object representing the initial end date of the date range selection.
  • onApplyClick (required): A function that takes two DateTime parameters representing the selected start and end dates, respectively, and is called when the user taps the "Apply" button.
  • onCancelClick (required): A function that is called when the user taps the "Cancel" button.
  • backgroundColor (required): The background color of the dialog.
  • primaryColor (required): The primary color of the dialog.
  • fontFamily (optional): The font family to use for the text in the dialog.

Usage

Inside the function, a FocusNode is requested to take focus away from any input field that might be in focus. A showDialog function is then called to show the CustomDateRangePicker dialog box. The CustomDateRangePicker widget is built with the parameters passed to showCustomDateRangePicker, and then passed as the builder parameter of the showDialog function.

When the user interacts with the CustomDateRangePicker dialog box, the onApplyClick and onCancelClick functions are called accordingly.

Many Thanks to the creator of this Repo https://github.com/mitesh77/Best-Flutter-UI-Templates

Getting Started

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

For help on editing package code, view the documentation.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目