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

time_range_picker 封面
套件詳情v2.3.1

time_range_picker

用於 Flutter 的時間範圍選擇器。此組件讓您開啟對話框來選擇包含開始和結束時間的時間範圍。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
6520
喜歡數
186
Pub 分數
140

安裝套件

flutter pub add time_range_picker

套件介紹

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

一個 Flutter 套件,提供可自訂的時間範圍選擇器元件,讓使用者透過直覺的對話方塊介面,在指定時間範圍內選擇起始與結束時間。設計為跨平台使用,支援 Android、iOS、Web、macOS、Windows 與 Linux。此選擇器非常適合用於排程、預約,或任何需要精確時間區間選擇的應用程式。能順暢整合至現有的 Flutter 應用,並提供乾淨、響應式的使用者介面。

適用情境

  • 安排預約
  • 預訂時間槽
  • 設定定時器
  • 設定事件持續時間
  • 追蹤工作時間

主要特色

  • 基於對話框的時間選擇
  • 開始與結束時間選擇器
  • 跨平台相容性
  • 可自訂的 UI
  • 響應式設計

適合對象

  • 日曆和排程應用
  • 時間追蹤工具
  • 預訂系統
  • 事件管理平台
  • 生產力應用

使用建議

  • 需要 Flutter SDK 2.0 或更高版本
  • 時間步長間隔的自訂有限
  • 無內建重疊時間的驗證
  • 可能需要額外的樣式以支援深色模式
  • 依賴外部 GitHub 倉庫以取得更新

原始 README

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

Time Range Picker

A time range picker for flutter.

Getting Started

Installation

Add


time_range_picker : any

to your pubspec.yaml, and run

flutter packages get

in your project's root directory.

Basic Usage
import 'package:flutter/material.dart';

import 'package:time_range_picker/time_range_picker.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.blueGrey,
        body: Center(
          child: RaisedButton(
            onPressed: () async {
              TimeRange result = await showTimeRangePicker(
                context: context,
              );
              print("result " + result.toString());
            },
            child: Text("Pure"),
          ),
        ));
  }
}
Examples
Simple

Simple

Interval

Interval

Filled Style

Filled Style

Disabled Timeframe

Disabled Timeframe

Background Widget

Background Widget

Rotated Clock

Rotated Clock

Max Duration

Max Duration

Min Duration

Min Duration

Default Widget

Default Widget

Custom Dialog

Custom Dialog

Custom Dialog iOS Style

Custom Dialog iOS Style

Parameters
type param default description
TimeOfDay start TimeOfDay.now() preselected start time
TimeOfDay end now + 3h preselected end time
TimeRange disabledTime disabled time range (this time cannot be selected)
Color disabledColor Colors.red.withOpacity(0.5) the color for the disabled section
PaintingStyle paintingStyle PaintingStyle.stroke Style of the arc (filled or stroke)
Function(TimeOfDay) onStartChange
Function(TimeOfDay) onEndChange
Duration interval Duration(minutes: 5) Minimum time steps that can be selected
String fromText "From" label for start time
String toText "To" label for end time
bool use24HourFormat true use 24 hours or am / pm
double padding 36 the padding of the ring
double strokeWidth 12 the thickness of the ring
Color strokeColor primaryColor the color of the active arc from start time to end time
double handlerRadius 12 the radius of the handler to drag the arc
Color handlerColor primaryColor the color of a handler
Color selectedColor primaryColorLight the color of a selected handler
Color backgroundColor Colors.grey[200] the color of the circle outline
Widget backgroundWidget a widget displayed in the background, use e.g. an image
int ticks number of ticks displayed
double ticksOffset 0 the offset for ticks
double ticksLength strokeWidth ticks length
double ticksWidth 1 ticks thickness
Color ticksColor Colors.white Color of ticks
bool snap false Snap time bar to interval
List labels Show labels around the circle (start at 0 hours)
double labelOffset 20 Offset of the labels
bool rotateLabels true rotate labels
bool autoAdjustLabels true flip labels if the angle woulb be upside down (only if rotate labels is active)
TextStyle labelStyle Style of the labels
TextStyle timeTextStyle TextStyle of the time texts
TextStyle activeTimeTextStyle TextStyle of the currently moving time text
bool hideTimes false hide the time texts
double clockRotation 0 rotate the clock around angle
Duration maxDuration null maximum Duration that can be picked
Duration minDuration Duration(minutes: 30) minimum Duration that can be picked
bool barrierDismissible true barrierDismissible false = user must tap button to close time range picker

所屬分類

原始碼儲存庫

使用此套件的專案