riverpod_toast 0.1.0 copy "riverpod_toast: ^0.1.0" to clipboard
riverpod_toast: ^0.1.0 copied to clipboard

A Riverpod-based toast notification system with overlay support, localization, and adaptive theming.

example/lib/main.dart

import 'package:example/registrar.dart';
import 'package:example/router.dart';
import 'package:example/screens/home.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await EasyLocalization.ensureInitialized();

  runApp(
    ProviderScope(
      child: EasyLocalization(
        supportedLocales: const [Locale('en')],
        path: 'assets/translations',
        fallbackLocale: const Locale('en'),
        child: const MyApp1(),
      ),
    ),
  );
}

// Go Router Version
class MyApp extends ConsumerWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return MaterialApp.router(
        routerConfig: router,
        builder: (context, child) => StyledToast(
        locale: context.locale,
        child: ToastContextRegistrar(child: child!),
      ),
        title: 'Toast Demo',
        theme: ThemeData.light(),
        darkTheme: ThemeData.dark(),
        themeMode: ThemeMode.system,
        localizationsDelegates: context.localizationDelegates,
        supportedLocales: context.supportedLocales,
        locale: context.locale,
      
    );
  }
}

//Without Go Router

class MyApp1 extends ConsumerWidget {
  const MyApp1({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return MaterialApp(
      builder: (context, child) => StyledToast(
        locale: context.locale,
        child: ToastContextRegistrar(child: child!),
      ),
      title: 'Toast Demo',
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      themeMode: ThemeMode.system,
      localizationsDelegates: context.localizationDelegates,
      supportedLocales: context.supportedLocales,
      locale: context.locale,
      home: HomePage(false),
    );
  }
}
0
likes
150
points
139
downloads

Publisher

verified publisherkumpali.com

Weekly Downloads

A Riverpod-based toast notification system with overlay support, localization, and adaptive theming.

Homepage
Repository (GitHub)
View/report issues

Topics

#toast #snackbar #riverpod #riverpod-toast #notification

Documentation

API reference

License

MIT (license)

Dependencies

easy_localization, flutter, flutter_riverpod, flutter_styled_toast, riverpod_annotation

More

Packages that depend on riverpod_toast