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

scroll_date_picker 封面
插件详情v3.8.0

scroll_date_picker

一个可自定义且易于使用的 Flutter 日期选择器库。兼容 Android、iOS 和 Web。

AndroidiOS
近 30 天下载
1.7万
喜欢数
120
Pub 分数
150

安装插件

flutter pub add scroll_date_picker

插件介绍

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

一个可自定义且用户友好的 Flutter 日期选择器库,专为在 Android、iOS 和 Web 平台上的无缝集成而设计。它提供基于滚动的日期选择界面,带来直观且现代的体验。该包易于实现,设置简单,支持外观和行为的自定义。非常适合需要流畅日期选择而无需复杂配置的应用程序。

适合场景

  • 表单中的日期选择
  • 基于日历的应用程序界面
  • 旅行预订系统
  • 事件调度工具
  • 用户资料日期输入

主要特点

  • 基于滚动的日期选择
  • 跨平台兼容性
  • 可自定义的 UI
  • 简单集成
  • 响应式设计

适合对象

  • 寻求轻量级日期选择器的开发者
  • 面向多个平台的应用程序
  • 需要直观日期输入的项目
  • 以用户界面为重点的应用程序
  • 快速原型设计

使用建议

  • 仅限选择日期
  • 不支持时间选择器
  • 最小化内置验证
  • 依赖外部样式进行高级自定义
  • 无内置本地化支持

原始 README

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

Scroll Date Picker

A customizable and easy-to-use date picker library for Flutter.

Compatible with Android & iOS & Web. :heart_eyes:

pub


Showcase


Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  scroll_date_picker : "^lastest_version"

Usage

Need to include the import the package to the dart file where it will be used, refer the below command

import 'package:scroll_date_picker/scroll_date_picker.dart';

Complete example

import 'package:flutter/material.dart';
import 'package:scroll_date_picker/scroll_date_picker.dart';

void main() {
  runApp(MaterialApp(home: const MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  DateTime _selectedDate = DateTime.now();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Scroll Date Picker Example"),
        centerTitle: true,
      ),
      body: Column(
        children: [
          Container(
            height: 100.0,
            alignment: Alignment.center,
            child: Text(
              "$_selectedDate",
              style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500),
            ),
          ),
          Container(
            alignment: Alignment.centerRight,
            padding: const EdgeInsets.only(right: 48),
            child: TextButton(
              onPressed: () {
                setState(() {
                  _selectedDate = DateTime.now();
                });
              },
              child: Text(
                "TODAY",
                style: TextStyle(color: Colors.red),
              ),
            ),
          ),
          SizedBox(
            height: 250,
            child: ScrollDatePicker(
              selectedDate: _selectedDate,
              locale: Locale('en'),
              onDateTimeChanged: (DateTime value) {
                setState(() {
                  _selectedDate = value;
                });
              },
            ),
          ),
          /// Showcase second image source
      // SizedBox(
          //   height: 250,
          //   child: ScrollDatePicker(
          //     selectedDate: _selectedDate,
          //     locale: Locale('ko'),
          //     scrollViewOptions: DatePickerScrollViewOptions(
          //       year: ScrollViewDetailOptions(
          //         label: '년',
          //         margin: const EdgeInsets.only(right: 8),
          //       ),
          //       month: ScrollViewDetailOptions(
          //         label: '월',
          //         margin: const EdgeInsets.only(right: 8),
          //       ),
          //       day: ScrollViewDetailOptions(
          //         label: '일',
          //       )
          //     ),
          //     onDateTimeChanged: (DateTime value) {
          //       setState(() {
          //         _selectedDate = value;
          //       });
          //     },
          //   ),
          // ),
        ],
      ),
    );
  }
}

License

Copyright 2020, the Flutter project authors. All rights reserved.

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

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * 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.
    * Neither the name of Google Inc. 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 OWNER 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.

所属分类

源码仓库

使用此插件的项目