rounded_loading_button 1.0.13

Flutter Android iOS web

A simple implementation of an animated loading button widget for Flutter

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:rounded_loading_button/rounded_loading_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: 'Rounded Loading Button Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Rounded Loading Button Demo'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {

  final RoundedLoadingButtonController _btnController = new RoundedLoadingButtonController();

  void _doSomething() async {
    Timer(Duration(seconds: 3), () {
      _btnController.success();
    });
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RoundedLoadingButton(
              child: Text('Tap me!', style: TextStyle(color: Colors.white)),
              controller: _btnController,
              onPressed: _doSomething,
              width: 200,
            ),
            FlatButton(
              child: Text("Reset"),
              onPressed: _btnController.reset)
          ],
        ),
      )
    );
  }
}
65
likes
90
pub points
92%
popularity

Publisher

edgington.dev

A simple implementation of an animated loading button widget for Flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, rxdart

More

Packages that depend on rounded_loading_button