sunarya-thito / shadcn_flutter

Shadcn/UI ported to Flutter (Unofficial)
https://sunarya-thito.github.io/shadcn_flutter/
BSD 3-Clause "New" or "Revised" License
103 stars 17 forks source link

Using Toast with Material App Or Material Theme #75

Closed SPiercer closed 1 month ago

SPiercer commented 1 month ago

Hi @sunarya-thito, first of all your package is amazing

however i only need a couple of functionalities from it such as using this sonner toast.

however i found a limitation where i have to use ShadcnApp in order to use this toast. and when i use it, i have to submit the Shadcn themes (colors) which contradict my design since we already made our colors and design system

is there a way i can use the toast without all of this ?

SPiercer commented 1 month ago

i've managed to do it by doing this in the builder

MaterialApp.router(
  debugShowCheckedModeBanner: false,
  routerConfig: appRouter.router,
  theme: MaterialTheme(Theme.of(context).textTheme).light(),
  darkTheme: MaterialTheme(Theme.of(context).textTheme).dark(),
  builder: (context, child) {
    return shad.Theme(
      data: shad.ThemeData(
        colorScheme: shad.ColorSchemes.lightOrange(),
        radius: 0.5,
      ),
      child: shad.ToastLayer(child: child!),
    );
  },
);
sunarya-thito commented 1 month ago

I'll come up with something

sunarya-thito commented 1 month ago

You can now wrap your scaffold or anything in between MaterialApp and your main content with ShadcnLayer, it provides the basic necessity for this package to run within your app.