floating_snackbar 1.0.4 copy "floating_snackbar: ^1.0.4" to clipboard
floating_snackbar: ^1.0.4 copied to clipboard

A package that provides custom floating snackbar for your project.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

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

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Floating Snackbar'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextButton(
              onPressed: () {
                // minimal usage
                floatingSnackBar(
                  message: 'Hi there! I am a floating SnackBar!',
                  context: context,
                );
              },
              child: const Text('Show SnackBar'),
            ),
            const SizedBox(height: 20),
            TextButton(
              onPressed: () {
                // detailed usage
                floatingSnackBar(
                  message: 'Developed by @emeenx on Twitter!',
                  context: context,
                  textColor: Colors.black,
                  textStyle: const TextStyle(color: Colors.red),
                  duration: const Duration(milliseconds: 4000),
                  backgroundColor: Colors.white,
                );
              },
              child: const Text('Show SnackBar'),
            ),
          ],
        ),
      ),
    );
  }
}
15
likes
150
pub points
88%
popularity

Publisher

verified publisherameeen.me

A package that provides custom floating snackbar for your project.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on floating_snackbar