搜尋套件、儲存庫與 APP 分類

time_slot 封面
套件詳情v1.0.2

time_slot

一個全新的 Flutter 套件,可協助您根據給定的時間間隔或日期時間清單建立時段,並取得時間的時段名稱。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
632
喜歡數
32
Pub 分數
140

安裝套件

flutter pub add time_slot

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

time_slot 套件是專為 Flutter 設計的實用工具,旨在簡化時間區段的建立與管理。它允許開發者根據指定的持續時間或自訂日期時間清單產生時間間隔。該套件還提供功能,以判斷給定時間對應的時段(例如早上、下午、晚上)。適用於排程應用程式、預約系統或任何需要結構化時間表示的應用程式,支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。

適用情境

  • 安排預約
  • 預訂系統時間選擇
  • 活動規劃工具
  • 基於時間的 UI 組件
  • 每日活動追蹤

主要特色

  • 從間隔或列表產生時間槽
  • 根據時間確定時段名稱
  • 跨平台相容性
  • 簡單的 API 結合
  • 支援自定時間範圍
  • 輕量且快速

適合對象

  • 日曆和預訂應用
  • 基於時間的資料視覺化
  • 面向使用者的日期時間選擇器
  • 行動與網頁排程介面
  • 需要時間槽邏輯的開發人員

使用建議

  • 需要手動處理時區差異
  • 僅限時段產生與時段檢測
  • 無內建 UI 元件
  • 不支援重複的時間模式
  • 假設輸入的時間是有效且有序的

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

time_slot

A new Flutter package which helps in creating time slots with given time interval or list of date times and get day part name of time, and this package allow localization ar and en.

Pub Version

Demo gif

image

Installation

  1. Add this to your package's pubspec.yaml file:
dependencies:
  time_slot: any
  1. Get the package using your IDE's GUI or via command line with
$ pub get
  1. Import the time_slot.dart file in your app
import 'package:time_slot/time_slot.dart';

Features

  • Creating time slots with given time interval
  • Creating time slots with given list date times
  • Get day part name of time
  • Support for multiple selection
  • Support different display options

Usage

DayPartController image

  DayPartController dayPartController = DayPartController();

to get day part of time

  DayParts dayPart = dayPartController.getDayPartOfTime(
    time: DateTime(2023, 1, 1, 10, 30),
  ); ///  DayParts.morning

to get day part name from DayParts

  DayParts dayPart = dayPartController.getDayPartName(dayPart: dayPart),);
  /// morning

TimesSlotGridViewFromInterval

to build time slot grid view from interval (10:00 AM to 10:00 PM) every hour

image

            TimesSlotGridViewFromInterval(
                locale: "en",
                initTime: selectTime,
                crossAxisCount: 4,
                timeSlotInterval: const TimeSlotInterval(
                  start: TimeOfDay(hour: 10, minute: 00),
                  end: TimeOfDay(hour: 22, minute: 0),
                  interval: Duration(hours: 1, minutes: 0),
                ),
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),

locale = "ar",

                TimesSlotGridViewFromInterval(
                locale: "ar",
                initTime: selectTime,
                crossAxisCount: 4,
                timeSlotInterval: const TimeSlotInterval(
                  start: TimeOfDay(hour: 10, minute: 00),
                  end: TimeOfDay(hour: 22, minute: 0),
                  interval: Duration(hours: 1, minutes: 0),
                ),
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),

TimesSlotGridViewFromList

to build time slot grid view from list date.

image

            TimesSlotGridViewFromList(
                locale: "en",
                initTime: selectTime,
                crossAxisCount: 4,
                listDates: [
                  DateTime(2023, 1, 1, 10, 30),
                  DateTime(2023, 1, 1, 11, 30),
                  DateTime(2023, 1, 1, 12, 30),
                  DateTime(2023, 1, 1, 13, 30),
                  DateTime(2023, 1, 1, 14, 30),
                  DateTime(2023, 1, 1, 15, 30)
                ],
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),

locale = "ar",

                TimesSlotGridViewFromList(
                locale: "ar",
                initTime: selectTime,
                crossAxisCount: 4,
                listDates: [
                  DateTime(2023, 1, 1, 10, 30),
                  DateTime(2023, 1, 1, 11, 30),
                  DateTime(2023, 1, 1, 12, 30),
                  DateTime(2023, 1, 1, 13, 30),
                  DateTime(2023, 1, 1, 14, 30),
                  DateTime(2023, 1, 1, 15, 30)
                ],
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。