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

A Flutter package that provides a widget to listen to the system's datetime and trigger a rebuild based on the specified time unit.

example/lib/main.dart

import 'package:datetime_loop/datetime_loop.dart';
import 'package:example/page.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: SafeArea(
        child: Scaffold(
          body: Center(
            child: Builder(
              builder: (context) {
                return Column(
                  children: [
                    ElevatedButton(
                      onPressed: () {
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) => const ExamplePage(timeUnit: TimeUnit.seconds,)),
                        );
                      },
                      child: const Text('Seconds'),
                    ),
                    ElevatedButton(
                      onPressed: () {
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) => const ExamplePage(timeUnit: TimeUnit.minutes,)),
                        );
                      },
                      child: const Text('Minutes'),
                    ),
                    ElevatedButton(
                      onPressed: () {
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) => const ExamplePage(timeUnit: TimeUnit.hours,)),
                        );
                      },
                      child: const Text('Hours'),
                    ),
                    ElevatedButton(
                      onPressed: () {
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) => const ExamplePage(timeUnit: TimeUnit.days,)),
                        );
                      },
                      child: const Text('Days'),
                    ),
                  ],
                );
              }
            ),
          ),
        ),
      ),
    );
  }
}
10
likes
0
points
196
downloads

Publisher

verified publishertkantira.com

Weekly Downloads

A Flutter package that provides a widget to listen to the system's datetime and trigger a rebuild based on the specified time unit.

Repository (GitHub)
View/report issues

Topics

#widget

License

unknown (license)

Dependencies

flutter

More

Packages that depend on datetime_loop