progressive_button_flutter 0.0.2 copy "progressive_button_flutter: ^0.0.2" to clipboard
progressive_button_flutter: ^0.0.2 copied to clipboard

A Progressive Button with linear loading animation

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Progressive Button Demo'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    Future<void> makeApiCall() async {
      await Future.delayed(const Duration(seconds: 8));
    }

    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: Center(
        child: Column(
          children: [
            const SizedBox(
              height: 100,
            ),
            ProgressiveButtonFlutter(
              text: 'Click Me',
              onPressed: makeApiCall,
              estimatedTime: const Duration(seconds: 5),
              showCircularIndicator: false,
            ),
            const SizedBox(
              height: 100,
            ),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 20),
              child: ProgressiveButtonFlutter(
                text: 'Click Me',
                onPressed: makeApiCall,
                estimatedTime: const Duration(seconds: 5),
                showCircularIndicator: true,
                backgroundColor: const Color(0xffabd4ed),
                progressColor: const Color(0xff5ba9d6),
                stretched: true,
              ),
            )
          ],
        ),
      ),
    );
  }
}
9
likes
140
points
11
downloads

Publisher

verified publisherswiftkart.icu

Weekly Downloads

A Progressive Button with linear loading animation

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on progressive_button_flutter