mechanical_counter 1.0.1 copy "mechanical_counter: ^1.0.1" to clipboard
mechanical_counter: ^1.0.1 copied to clipboard

Minimalist interface mimicking a mechanical digital counter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:mechanical_counter/mechanical_counter.dart';

void main() {
  runApp(MyApp());
}

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

class MyHomePage extends StatefulWidget {
  MyHomePage({
    Key? key,
    required this.title,
  }) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Text(
              "This counter has style: 'number' by default",
            ),
            MechanicalCounter(
                digits: 6,
                initialValue: 12345678,
                color: Colors.red,
                backgroundColor: Colors.amber,
                onChanged: (newValue) => print("Value changed to $newValue")),
            Text(
              "And this is meant to resemble a clock, style: 'hh:mm:ss'",
            ),
            MechanicalCounter(
                format: "hh:mm:ss",
                onChanged: (newValue) => print("Value changed to $newValue"))
          ],
        ),
      ),
    );
  }
}
0
likes
130
pub points
0%
popularity

Publisher

verified publisherideati.co

Minimalist interface mimicking a mechanical digital counter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on mechanical_counter