ripple_button 2.3.1 copy "ripple_button: ^2.3.1" to clipboard
ripple_button: ^2.3.1 copied to clipboard

A fully customizable button with material ripple effect. Easy to use having some pre-defined button types.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:ripple_button/ripple_button.dart';
import 'package:another_flushbar/flushbar.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Flushbar? _flush;

  _showFlushbar(String message) {
    _flush?.dismiss();
    _flush = Flushbar(
      message: message,
      flushbarStyle: FlushbarStyle.FLOATING,
      margin: EdgeInsets.all(20.0),
      borderRadius: BorderRadius.all(Radius.circular(8.0)),
      icon: Icon(
        Icons.info,
        size: 28.0,
        color: Colors.white,
      ),
      duration: Duration(seconds: 1),
      leftBarIndicatorColor: Colors.white,
    );
    _flush?.show(context);
  }

  bool isEnabled = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xFF8185E2),
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            RippleButton(
              text: "Yellow Button",
              padding: EdgeInsets.all(16),
              type: RippleButtonType.YELLOW,
              onPressed: () => {_showFlushbar("Clicked Yellow Button")},
            ),
            RippleButton(
              text: "Blue Translucent Button",
              padding: EdgeInsets.all(16),
              type: RippleButtonType.BLUE_TRANSLUCENT,
              onPressed: () =>
                  {_showFlushbar("Clicked Blue Translucent Button")},
            ),
            RippleButton(
              text: "White Translucent Button",
              padding: EdgeInsets.all(16),
              type: RippleButtonType.WHITE_TRANSLUCENT,
              onPressed: () =>
                  {_showFlushbar("Clicked White Translucent Button")},
            ),
            RippleButton(
              type: RippleButtonType.AMBER,
              text: "Amber Button",
              padding: EdgeInsets.all(16),
              onPressed: () {
                _showFlushbar("Clicked Amber Button");
              },
            ),
            RippleButton(
              text:
                  isEnabled ? "Disable Custom Button" : "Enable Custom Button",
              padding: EdgeInsets.all(16),
              style: RippleButtonStyle(
                color: RippleButtonColor(
                  background: Colors.orange,
                ),
                text: TextStyle(
                  color: Color(0xFF8185E2),
                  fontSize: 18,
                  fontWeight: FontWeight.w900,
                  letterSpacing: 0.1,
                  wordSpacing: 0.5,
                ),
                border: RippleButtonBorder(
                  side: BorderSide(
                    color: Colors.yellowAccent,
                    width: 1.5,
                  ),
                ),
              ),
              onPressed: () {
                setState(() => {isEnabled = !isEnabled});
                _showFlushbar(isEnabled ? "Enabled Button" : "Disabled Button");
              },
            ),
            RippleButton(
              isEnabled: isEnabled,
              text: isEnabled ? "Enabled Button" : "Disabled Button",
              padding: EdgeInsets.all(16),
              style: RippleButtonStyle(
                color: RippleButtonColor(
                  background: Colors.orange,
                ),
                text: TextStyle(
                  color: Color(0xFF8185E2),
                  fontSize: 18,
                  fontWeight: FontWeight.w900,
                  letterSpacing: 0.1,
                  wordSpacing: 0.5,
                ),
                border: RippleButtonBorder(
                  side: BorderSide(
                    color: Colors.white,
                    width: 1.5,
                  ),
                ),
              ),
              onPressed: () =>
                  {_showFlushbar("Clicked on Enable/Disable Button")},
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
150
points
18
downloads

Publisher

verified publisherfreya-hidroponia.ga

Weekly Downloads

A fully customizable button with material ripple effect. Easy to use having some pre-defined button types.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter

More

Packages that depend on ripple_button