custom_btn_plus 1.0.0 copy "custom_btn_plus: ^1.0.0" to clipboard
custom_btn_plus: ^1.0.0 copied to clipboard

A comprehensive Flutter button package with enums, multiple variants, gesture support, and icon buttons. Build once, use everywhere.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Custom Button Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF2563EB)),
        useMaterial3: true,
      ),
      home: const HomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Custom Button Demo')),
      body: SingleChildScrollView(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            const Text('Auth Buttons', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            AppButton(type: ButtonType.signIn, onPressed: () {}),
            const SizedBox(height: 8),
            AppButton(type: ButtonType.signUp, variant: ButtonVariant.outlined, onPressed: () {}),
            const SizedBox(height: 8),
            AppButton(type: ButtonType.biometric, variant: ButtonVariant.filled, onPressed: () {}),
            const SizedBox(height: 24),

            const Text('Navigation Buttons', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            Row(
              children: [
                AppButton(type: ButtonType.back, variant: ButtonVariant.iconBtn, fullWidth: false, onPressed: () {}),
                const SizedBox(width: 8),
                AppButton(type: ButtonType.skip, variant: ButtonVariant.text, onPressed: () {}),
              ],
            ),
            const SizedBox(height: 24),

            const Text('Connectivity Buttons', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            AppButton(type: ButtonType.connect, onPressed: () {}),
            const SizedBox(height: 8),
            AppButton(type: ButtonType.scanDevices, variant: ButtonVariant.gesture, onPressed: () {}),
            const SizedBox(height: 24),

            const Text('Danger Buttons', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            AppButton(type: ButtonType.delete, onPressed: () {}),
            const SizedBox(height: 8),
            AppButton(type: ButtonType.signOut, variant: ButtonVariant.outlined, onPressed: () {}),
            const SizedBox(height: 24),

            const Text('Loading State', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            const AppButton(type: ButtonType.submit, isLoading: true, onPressed: null),
            const SizedBox(height: 24),

            const Text('Gesture with Double/Triple Tap', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            AppButton(
              type: ButtonType.syncData,
              variant: ButtonVariant.gesture,
              gestureConfig: const GestureConfig(
                onTap: null,
                onDoubleTap: null,
                onLongPress: null,
                onTripleTap: null,
              ),
              onPressed: () {},
            ),
            const SizedBox(height: 24),

            const Text('Icon Buttons', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                AppIconButton(type: ButtonType.connect, onPressed: () {}),
                AppIconButton(
                  type: ButtonType.syncData,
                  shape: IconButtonShape.rounded,
                  size: IconButtonSize.lg,
                  showBadge: true,
                  badgeLabel: '3',
                  onPressed: () {},
                ),
                AppIconButton(
                  type: ButtonType.sendCommand,
                  size: IconButtonSize.xl,
                  hasBorder: true,
                  onPressed: () {},
                ),
              ],
            ),
            const SizedBox(height: 24),

            const Text('Custom Child', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            const SizedBox(height: 8),
            AppButton(
              type: ButtonType.save,
              customChild: const Row(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Icon(Icons.cloud_done, color: Colors.white),
                  SizedBox(width: 6),
                  Text('Save to Cloud', style: TextStyle(color: Colors.white)),
                ],
              ),
              onPressed: () {},
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
150
points
67
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A comprehensive Flutter button package with enums, multiple variants, gesture support, and icon buttons. Build once, use everywhere.

Repository (GitHub)
View/report issues

Topics

#buttons #ui #widget #design-system

License

MIT (license)

Dependencies

flutter

More

Packages that depend on custom_btn_plus