submit_button 0.0.3 copy "submit_button: ^0.0.3" to clipboard
submit_button: ^0.0.3 copied to clipboard

outdated

Submit button with animation.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:submit_button/submit_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,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  bool _loading = false;

  void _submit() {
    setState(() {
      _loading = true;
    });

    Future.delayed(Duration(milliseconds: 5000), () {
      setState(() {
        _loading = false;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
          child: Column(
        children: [
          SubmitButton(
            isLoading: _loading,
            spinnerColor: Colors.green,
            backgroundColor: Colors.red,
            button: FlatButton(onPressed: _submit, child: Text("Submit")),
          ),
        ],
      )),
    );
  }
}
3
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Submit button with animation.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

animator, flutter

More

Packages that depend on submit_button