flutter_time_button 2.0.0 copy "flutter_time_button: ^2.0.0" to clipboard
flutter_time_button: ^2.0.0 copied to clipboard

discontinued

A new Flutter timer button widget.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              width: 150,
              child: TimeButton(
                label: 'Click me',
                timeout: 30,
                color: Theme.of(context).primaryColor,
                toastMessage: 'Click!',
                onPressed: () => _incrementCounter(),
              ),
            ),
            SizedBox(height: 10),
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
80
pub points
37%
popularity

Publisher

unverified uploader

A new Flutter timer button widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

flutter, fluttertoast

More

Packages that depend on flutter_time_button