hz_loading_button 0.0.1 copy "hz_loading_button: ^0.0.1" to clipboard
hz_loading_button: ^0.0.1 copied to clipboard

A width-stable loading ElevatedButton widget with built-in async loading state.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:hz_loading_button/loading_button.dart';

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('hz_loading_button Demo')),
      body: Center(
        child: CustomLoadingButton(
          text: 'Submit',
          color: Colors.green,
          textColor: Colors.white,
          fullWidth: false,
          onPressed: () async {
            // Simulate async work
            await Future.delayed(const Duration(seconds: 2));
            if (context.mounted) {
              ScaffoldMessenger.of(context).showSnackBar(
                const SnackBar(content: Text('Task Complete!')),
              );
            }
          },
        ),
      ),
    );
  }
}
1
likes
130
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

A width-stable loading ElevatedButton widget with built-in async loading state.

Topics

#button #loading #widget #ui

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on hz_loading_button