AnalogClock
A Flutter package for creating a customizable analog clock widget. Perfect for adding a classic timepiece look to your Flutter applications.
Features
Customizable clock face including circle width, height, and color. Adjustable hour, minute, and second hands with customizable colors. Support for setting the clock's background color, border width, and more. Easy integration and use in any Flutter app.
Installation
Add analog_clock to your pubspec.yaml file:
dependencies: flutter: sdk: flutter analog_clock: ^1.0.0 # Replace with the latest version
Then run:
flutter pub get
Usage
Here’s a simple example of how to use the AnalogClock widget:
import 'package:flutter/material.dart'; import 'package:analog_clock/analog_clock.dart'; // Import the package
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Analog Clock Example'), ), body: Center( child: AnalogClock( circleWidth: 200, circleHeight: 200, oneToTwelveNumberColor: Colors.black, hourHandColor: Colors.blue, minuteHandColor: Colors.green, secondHandColor: Colors.red, backgroundColor: Colors.white, circleBorderWidth: 4, secondsDotsColor: Colors.grey, centerCircleWidth: 10, centerCircleHeight: 10, centerCircleColor: Colors.black, clockNameFontSize: 20, clockNameColor: Colors.black, clockName: 'My Clock', clockNamePositionTop: 20, ), ), ), ); } }
Customization
The AnalogClock widget allows various customizations:
- circleWidth: Width of the clock face.
- circleHeight: Height of the clock face.
- oneToTwelveNumberColor: Color of the numbers on the clock face.
- hourHandColor: Color of the hour hand.
- minuteHandColor: Color of the minute hand.
- secondHandColor: Color of the second hand.
- backgroundColor: Background color of the clock.
- circleBorderWidth: Border width of the clock face.
- secondsDotsColor: Color of the second dots.
- centerCircleWidth: Width of the center circle.
- centerCircleHeight: Height of the center circle.
- centerCircleColor: Color of the center circle.
- clockNameFontSize: Font size of the clock name.
- clockNameColor: Color of the clock name.
- clockName: Text to display as the clock's name.
- clockNamePositionTop: Vertical position of the clock name.
Contributing
Contributions are welcome! Please fork the repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
License
This package is licensed under the BSD 3-Clause License (https://pub.dev/packages/analog_mclock/license). See the LICENSE file for details.
Contact
For questions or support, please reach out to frontenddeveloper.marikkm@gmail.com.