on_toast_widget 1.1.0 copy "on_toast_widget: ^1.1.0" to clipboard
on_toast_widget: ^1.1.0 copied to clipboard

Flutter Package used to show a custom and animated toast or snackbar Widget.

example/lib/main.dart

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

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

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

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
  // Setup [AnimationController]
  late final AnimationController _controller = AnimationController(
    vsync: this,
    duration: const Duration(seconds: 1),
  );

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text("OnToastExample"),
        ),
        body: Stack(
          children: [
            OnToastWidget(
              effectType: EffectType.SIZE,
              sizePositionType: SizePositionType.TYPE_2,
              controller: _controller,
              child: Container(
                margin: const EdgeInsets.all(10),
                decoration: BoxDecoration(
                  color: Colors.amber,
                  borderRadius: BorderRadius.circular(50),
                ),
                height: 70,
              ),
            ),
            Center(
              child: ElevatedButton(
                onPressed: () {
                  _controller.forward();
                },
                onLongPress: () {
                  _controller.reverse();
                },
                child: const Text("Something"),
              ),
            )
          ],
        ),
      ),
    );
  }
}
8
likes
130
pub points
56%
popularity

Publisher

verified publisherlucasjosino.com

Flutter Package used to show a custom and animated toast or snackbar Widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on on_toast_widget