flutter_toast_bar 0.0.2 copy "flutter_toast_bar: ^0.0.2" to clipboard
flutter_toast_bar: ^0.0.2 copied to clipboard

An alert toast package to show snackbar easily. To show all validation and local messages.

example/lib/main.dart

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Toast Message Bar"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () {
                FlutterToastBar.showToast(
                    context: context,
                    message: 'Show Snackbar Success',
                    backgroundColor: Colors.green);
              },
              child: const Text("Show Snackbar: Success"),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () {
                FlutterToastBar.showToast(
                    context: context,
                    message: 'Show Snackbar Error',
                    backgroundColor: Colors.red);
              },
              child: const Text("Show Snackbar: Error"),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () {
                FlutterToastBar.showToast(
                    context: context, message: 'Show Snackbar');
              },
              child: const Text("Show Snackbar"),
            ),
          ],
        ),
      )
    );
  }
}
1
likes
160
pub points
40%
popularity

Publisher

verified publisheraddwebsolution.com

An alert toast package to show snackbar easily. To show all validation and local messages.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_toast_bar