Closed guilhermedaldim closed 1 year ago
Hey, thanks!
Do you mean to wrap the whole app in one custom theme? For that, you can provide a custom wrapperBuilder
to wrap each story in the custom theme. If you mean switching custom themes in the storybook in runtime, I guess, you'll need to write a custom plugin – you can check how the default theme switcher is implemented: https://github.com/ookami-kb/storybook_flutter/blob/master/packages/storybook_flutter/lib/src/plugins/theme_mode.dart
Yes man, I want to change the whole app to the selected theme.
Can you show me an example code?
If it's based on the Flutter material theme data, it can be something like this:
@override
Widget build(BuildContext context) => Storybook(
initialStory: 'Screens/Scaffold',
wrapperBuilder: (context, child) => MaterialApp(
title: 'Storybook Flutter',
theme: CustomTheme(),
home: child,
),
stories: [
If it's totally custom widget, you can wrap the child:
@override
Widget build(BuildContext context) => Storybook(
initialStory: 'Screens/Scaffold',
wrapperBuilder: (context, child) => MaterialApp(
title: 'Storybook Flutter',
home: CustomTheme(child: child),
),
stories: [
Hey man, this works, thanks for your help!
Hey man, thanks for your package, it's very good!
How to use custom themes coming from another package (own library)?
Thanks!