ookami-kb / storybook_flutter

A storybook for Flutter widgets.
https://pub.dev/packages/storybook_flutter
MIT License
293 stars 66 forks source link

Feature Request: Add device with 320px width #118

Closed guilhermedaldim closed 1 year ago

guilhermedaldim commented 1 year ago

Hi, thank you for your package, it's very good!

I need of support for a device that is 320px wide.

Thanks!

ookami-kb commented 1 year ago

Hey, thanks.

You can create your own devices, you just need to initialize plugins manually. Something like this:

@override
Widget build(BuildContext context) => Storybook(
      plugins: [
        ThemeModePlugin(),
        DeviceFramePlugin(
          deviceInfos: [
            DeviceInfo.genericPhone(
              platform: TargetPlatform.android,
              id: 'custom-320',
              name: '320px phone',
              screenSize: const Size(320, 480),
            ),
            ...Devices.all,
          ],
        ),
      ],
      initialStory: 'Screens/Scaffold',
      // ...

And select it in the storybook:

image
guilhermedaldim commented 1 year ago

Hey man, thanks for your support this works.