nex_common_toast 0.0.5 copy "nex_common_toast: ^0.0.5" to clipboard
nex_common_toast: ^0.0.5 copied to clipboard

A Flutter package that provides a convenient way to display customizable toast messages using the `oktoast` package.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:nex_common_toast/nex_cmmon_toast.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return OKToast(child: const MaterialApp(home: ToastDemo()));
  }
}

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

  @override
  State<ToastDemo> createState() => _ToastDemoState();
}

class _ToastDemoState extends State<ToastDemo> {
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      MyToast().showToastMessage();
    });
  }

  @override
  Widget build(BuildContext context) {
    return const Scaffold(body: Center(child: Text("Hello, World!")));
  }
}

class MyToast extends ToastFile {
  void showToastMessage() {
    toastMsg(
      msg: "Hello, World!",
      backgroundColor: Colors.blue,
      position: ToastPosition.bottom,
      duration: const Duration(seconds: 3),
      textStyle: const TextStyle(fontSize: 16.0, color: Colors.white),
      radius: 10.0,
      textOverflow: TextOverflow.ellipsis,
      textMaxLines: 2,
      textAlign: TextAlign.left,
      textDirection: TextDirection.ltr,
    );
  }
}
0
likes
150
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides a convenient way to display customizable toast messages using the `oktoast` package.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, oktoast

More

Packages that depend on nex_common_toast