搜尋套件、儲存庫與 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.

所屬分類

原始碼儲存庫

使用此套件的專案