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

flutter_analog_clock 封面
套件詳情v1.0.3

flutter_analog_clock

一個簡單且高度可自訂的類比時鐘小部件。此小部件可讓您自訂時鐘的背景、表盤、標記和指針。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
4590
喜歡數
68
Pub 分數
150

安裝套件

flutter pub add flutter_analog_clock

套件介紹

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

一個簡單且高度可自訂的模擬時鐘小工具,適用於 Flutter 應用程式。它允許開發者透過自訂背景、表盤設計、刻度與指針樣式來調整時鐘外觀。非常適合需要經典時間顯示且具精緻外觀的應用程式。此小工具支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 與 Linux,確保跨裝置的一致性表現。程式碼乾淨,設定選項直覺,輕鬆整合至任何需要視覺吸引人的模擬時鐘專案中。

適用情境

  • 在儀表板應用中顯示即時時間
  • 為UI添加復古或經典美學
  • 建立時間追蹤或冥想應用
  • 整合到主螢幕小工具
  • 設計具有傳統風格的數位鐘

主要特色

  • 完全可自定義的背景與表盤
  • 可設定的手部樣式和顏色
  • 對多個平台目標的支援
  • 透過 pub.dev 實現輕鬆整合
  • 跨螢幕尺寸的響應式設計

適合對象

  • 開發基於時間應用程式的開發者
  • 尋求優雅時鐘組件的UI設計師
  • 需要跨平台一致性的專案
  • 具有極簡或復古主題的應用程式
  • 原型設計互動式時鐘介面

使用建議

  • 可能需要額外的樣式以相容深色模式
  • 高刷新率動畫的效能影響
  • 有限的內建時區支援
  • 自訂可能會稍微增加套件大小
  • 手部動畫的順暢度取決於裝置效能

原始 README

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

Flutter Analog Clock

pub package

A simple, highly customizable analog clock widget. This widget enables you to customize the clock's background, dial, markings, and hands.

Install

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

dependencies:
  flutter_analog_clock: ^1.0.3

In your library add the following import:

import 'package:flutter_analog_clock/flutter_analog_clock.dart';

Usage

1. Simple to use

  const AnalogClock()
  const AnalogClock.dark()
2. Use an image as a clock face

  Container(
    decoration: const BoxDecoration(
      image: DecorationImage(image: AssetImage('assets/dial01.webp')),
    ),
    child: const AnalogClock(
      dialColor: null,
      markingColor: null,
      hourNumberColor: null,
      secondHandColor: null,
    ),
  ),
3. With a child

  AnalogClock(
    dateTime: DateTime(2022, 10, 24, 10, 12, 07),
    isKeepTime: false,
    child: const Align(
      alignment: FractionalOffset(0.5, 0.75),
      child: Text('GMT-8'),
    ),
  ),
4. Customize to use
  AnalogClock(
    dateTime: DateTime.now(),
    isKeepTime: true,
    dialColor: Colors.white,
    dialBorderColor: Colors.black,
    dialBorderWidthFactor: 0.02,
    markingColor: Colors.black,
    markingRadiusFactor: 1.0,
    markingWidthFactor: 1.0,
    hourNumberColor: Colors.black,
    hourNumbers: const ['', '', '3', '', '', '6', '', '', '9', '', '', '12'],
    hourNumberSizeFactor: 1.0,
    hourNumberRadiusFactor: 1.0,
    hourHandColor: Colors.black,
    hourHandWidthFactor: 1.0,
    hourHandLengthFactor: 1.0,
    minuteHandColor: Colors.black,
    minuteHandWidthFactor: 1.0,
    minuteHandLengthFactor: 1.0,
    secondHandColor: Colors.black,
    secondHandWidthFactor: 1.0,
    secondHandLengthFactor: 1.0,
    centerPointColor: Colors.black,
    centerPointWidthFactor: 1.0,
  )
5. Specify a time
class ExampleSpecifyTime extends StatefulWidget {
  const ExampleSpecifyTime({Key? key}) : super(key: key);

  @override
  State<ExampleSpecifyTime> createState() => _ExampleSpecifyTimeState();
}

class _ExampleSpecifyTimeState extends State<ExampleSpecifyTime> {
  final GlobalKey<AnalogClockState> _analogClockKey = GlobalKey();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Analog clock'),
      ),
      body: AnalogClock(
        key: _analogClockKey,
        dateTime: DateTime(2022, 10, 24, 1, 23, 45),
        isKeepTime: false,
      ),
      persistentFooterButtons: [
        ElevatedButton(
          onPressed: () {
            _analogClockKey.currentState!.dateTime = DateTime.now();
          },
          child: const Text('Now'),
        ),
        ElevatedButton(
          onPressed: () {
            _analogClockKey.currentState!.isKeepTime = true;
          },
          child: const Text('Keep time'),
        ),
      ],
    );
  }
}

You can find all custom options here:

https://github.com/conghaonet/flutter_analog_clock/blob/master/example/lib/example.dart

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。