StorybookToolkit / storybook_toolkit

A storybook for Flutter widgets.
https://pub.dev/packages/storybook_toolkit
MIT License
2 stars 1 forks source link

Dialog + Inspector #2

Open TomaszCz opened 1 month ago

TomaszCz commented 1 month ago

I have a feature proposition, there is still possibility to have dialog / pop up in mobile. If that is the case, the inspector buttons such as color / size inspection is unreachable :)

image

mjablecnik commented 1 month ago

Thank you for your issue.

When you develop some dialogs, you should have dialog content in your stories instead of call showDialog function and then develop it.

For example. Instead of:

showDialog(
  context: context,
  builder: (BuildContext context) {
    return AlertDialog(
      title: Text('Alert Dialog Title'),
      content: Text('This is a simple alert dialog.'),
      actions: [
        TextButton(
          onPressed: () {
            Navigator.of(context).pop();
          },
          child: Text('OK'),
        ),
      ],
    );
  }
);  

You can have only:

Story(
  name: 'Dialog,
  description: 'Simple dialog widget.',
  builder: (context) => AlertDialog(
    title: Text('Alert Dialog Title'),
    content: Text('This is a simple alert dialog.'),
    actions: [
      TextButton(
        child: Text('OK'),
      ),
    ],
  );
)

and every story will represent some different dialog.

TomaszCz commented 1 month ago

Maybe you are right, i basically cannot imitate full dialog behavior in device mode. I would argue that dialog is not just what is inside the frame, but the overall look on phone is equally important. I tried insetPadding but it is not respected.

image

mjablecnik commented 1 month ago

@TomaszCz Yes, I understand your problem. I will try to find some good solution of this situation.