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

A simple Flutter package providing reusable loading widgets including a button loading indicator, a centered circular progress loader, and a shimmer loading placeholder. Easily enhance your app's load [...]

example/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Loading Builder Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const LoadingExampleScreen(),
    );
  }
}

class LoadingExampleScreen extends StatefulWidget {
  const LoadingExampleScreen({super.key});

  @override
  State<LoadingExampleScreen> createState() => _LoadingExampleScreenState();
}

class _LoadingExampleScreenState extends State<LoadingExampleScreen> {
  bool _isButtonLoading = false;

  void _simulateButtonLoading() async {
    setState(() {
      _isButtonLoading = true;
    });
    await Future.delayed(const Duration(seconds: 2));
    setState(() {
      _isButtonLoading = false;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Loading Builder Example'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(20.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            ElevatedButton(
              onPressed: _isButtonLoading ? null : _simulateButtonLoading,
              child: Row(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  const Text('Submit'),
                  btnLoading(loading: _isButtonLoading),
                ],
              ),
            ),
            const SizedBox(height: 40),
            const Text('Centered Loading:', style: TextStyle(fontSize: 16)),
            const SizedBox(height: 10),
            const BuildLoading(),
            const SizedBox(height: 40),
            const Text('Shimmer Loading Placeholder:', style: TextStyle(fontSize: 16)),
            const SizedBox(height: 10),
            const ShimmerLoading(
              height: 100,
              width: double.infinity,
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
130
points
237
downloads

Publisher

unverified uploader

Weekly Downloads

A simple Flutter package providing reusable loading widgets including a button loading indicator, a centered circular progress loader, and a shimmer loading placeholder. Easily enhance your app's loading states with customizable and lightweight components.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, shimmer

More

Packages that depend on loading_builder