Skip to content

Dialog creation best practices #57

Closed Answered by GregoryConrad
busslina asked this question in Q&A
Discussion options

You must be logged in to vote

Yea, definitely don't pass an entire WidgetHandle around. If you do pass something, I'd make it just a CapsuleReader. Even then, I wouldn't use inheritance to solve this issue like you are. I'd do something like this:

@rearchWidget
Widget createDialog({
  // These two will be parameters to your CreateDialog constructor without the @rearchWidget macro
  required Widget Function(BuildContext, WidgetHandle) bodyBuilder,
  required Future<void> Function() create,
}) {
  // I might also suggest use.mutation here to watch the create() function so you can give
  // users an update on how the creation is going
  return Column(children: [
        // Title
        Text(title),

        // Body

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@busslina
Comment options

@busslina
Comment options

@GregoryConrad
Comment options

@busslina
Comment options

@GregoryConrad
Comment options

Answer selected by GregoryConrad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants