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

day_month_picker 封面
插件详情v1.0.3

day_month_picker

使用此包轻松选择您想要的月份和日期!从选择器中挑选简单的日期选择过程——无需选择年份。享受吧!

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
103
喜欢数
29
Pub 分数
150

安装插件

flutter pub add day_month_picker

插件介绍

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

一个 Flutter 包,可让用户轻松选择日期中的日和月,而无需选择年份。它提供了一个简单直观的日期选择器界面,非常适合生日、纪念日或仅需关注月份和日期的活动安排场景。该选择器轻量级,支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台。设计简洁,易于集成,只需少量设置即可显著提升用户体验。

适合场景

  • 生日选择
  • 周年纪念策划
  • 事件日期输入
  • 每月提醒
  • 简单日期输入

主要特点

  • 无需选择年份
  • 跨平台支持
  • 最小设置
  • 直观的用户界面
  • 轻量级设计

适合对象

  • 简单日期格式
  • 用户引导流程
  • 生日选择器
  • 非年度特定日期
  • 移动和网页应用

使用建议

  • 不包括年份选择
  • 仅限日和月
  • 不适合用于完整日期验证
  • 需要手动处理日期逻辑
  • 未提及本地化支持

原始 README

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

Day Month Picker or You can say Date Month picker

The DayMonthPicker widget is a customizable Flutter component that allows users to select a specific day and month from a dialog interface. It is particularly useful in forms or applications where date input is needed without year.

Features

Easy selection of months and days Customizable appearance Built-in support for existing day and month values Callback function to handle changes

Constructor

const DayMonthPicker({
  Key? key,
  this.surfaceTintColor,
  this.titleTextStyle,
  this.selectedMonthBgColor = Colors.blue,
  this.unSelectedMonthBgColor = Colors.white,
  this.selectedDayBgColor = Colors.blue,
  this.unSelectedDayBgColor = Colors.white,
  this.title = "Date Month Picker",
  this.selectedMonthTextStyle = const TextStyle(color: Colors.white, fontSize: 14),
  this.unSelectedMonthTextStyle = const TextStyle(color: Colors.black, fontSize: 14),
  this.selectedDayTextStyle = const TextStyle(color: Colors.white, fontSize: 12),
  this.unSelectedDayTextStyle = const TextStyle(color: Colors.black, fontSize: 12),
  this.child = const Padding(
    padding: EdgeInsets.all(8.0),
    child: Text("Month Picker"),
  ),
  this.cancelTextStyle = const TextStyle(color: Colors.grey, fontSize: 16),
  this.okTextStyle = const TextStyle(color: Colors.blue, fontSize: 16),
  this.existingDay,
  this.existingMonth,
  required this.onChange,
});

Parameters

  • key: An optional key to identify the widget.
  • surfaceTintColor: A color to tint the dialog surface (default is transparent).
  • titleTextStyle: Text style for the dialog title.
  • selectedMonthBgColor: Background color for the selected month (default is blue).
  • unSelectedMonthBgColor: Background color for unselected months (default is white).
  • selectedDayBgColor: Background color for the selected day (default is blue).
  • unSelectedDayBgColor: Background color for unselected days (default is white).
  • title: The title of the dialog (default is "Date Month Picker").
  • selectedMonthTextStyle: Text style for the selected month label.
  • unSelectedMonthTextStyle: Text style for unselected month labels.
  • selectedDayTextStyle: Text style for the selected day label.
  • unSelectedDayTextStyle: Text style for unselected day labels.
  • child: The widget displayed as the button to open the picker (default is a padded "Month Picker" text).
  • cancelTextStyle: Text style for the cancel button.
  • okTextStyle: Text style for the ok button.
  • existingDay: An optional string representing the already selected day.
  • existingMonth: An optional string representing the already selected month.
  • onChange: A required callback function that is triggered when the user selects a day and month.

Usage

Short and useful examples for package users.

DayMonthPicker(onChange: (DayMonth? dayMonth){
        if(dayMonth != null) {
          print("Day: ${dayMonth.day}");
          print("Month: ${dayMonth.month}");
        }
      }),

Example

@override
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(title: Text('Day Month Picker Example')),
    body: Center(
      child: DayMonthPicker(
        onChange: (dayMonth) {
          // Do something with the selected day and month
          print('Selected Day: ${dayMonth.day}, Month: ${dayMonth.month}');
        },
      ),
    ),
  );
}

Some UI examples

Day Month Picker Example

Day Month Picker Example image (7)

所属分类

源码仓库

使用此插件的项目

暂无相关数据。