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

A Flutter package providing a set of reusable buttons including elevated, text, route-based, and visibility-controlled buttons with built-in loading support and flexible customization options.

example/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Reusable Button Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomeScreen(),
      routes: {
        '/next': (context) => const NextScreen(),
      },
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Home Screen'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            AppButton(
              title: 'Submit',
              onPressed: () {
                ScaffoldMessenger.of(context)
                    .showSnackBar(const SnackBar(content: Text('Button Pressed')));
              },
              loading: false,
              bgColor: Colors.blue,
              txtColor: Colors.white,
            ),
            const SizedBox(height: 20),
            AppTxtBtn(
              title: "Don't have an account?",
              btnText: 'Sign Up',
              onPressed: () {},
            ),
            const SizedBox(height: 20),
            AppTxtRouteButton(
              title: 'Already a user?',
              btnText: 'Login',
              route: '/next',
            ),
            const SizedBox(height: 20),
            VisibilityButton(
              isVisible: true,
              btnTitle: 'Visible Button',
              onPressed: () {},
              icon: Icons.visibility,
            ),
          ],
        ),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Next Screen')),
      body: const Center(
        child: Text('You have navigated to the next screen!'),
      ),
    );
  }
}
0
likes
130
points
102
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package providing a set of reusable buttons including elevated, text, route-based, and visibility-controlled buttons with built-in loading support and flexible customization options.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

app_style, flutter, loading_builder

More

Packages that depend on reusable_button