Skip to content

Rebuild Prevent by ResizableWidget #20

Open

Description

@Ayad-Ben-Saliem

I have faced an issue using ResizableWidget with Easy_Localization package.

Easy_Localization trigger widget three to rebuild if the application locale is changed using the context.setLocale method.
However, ResizableWidget prevent rebuild if the width or height (depending on axis direction) is not changed.
This makes the translation fail for widgets inside ResizableWidget.

I have workaround this issue by editing resizable_widget.dart like this:

  @override
  Widget build(BuildContext context) {
    // Force children to rebuild
    _controller.eventStream.add(_controller);
    return LayoutBuilder(
      builder: (context, constraints) {
        _controller.setSizeIfNeeded(constraints);
        return StreamBuilder(
          stream: _controller.eventStream.stream,
          builder: (context, snapshot) =>
          _info.isHorizontalSeparator
              ? Column(children: _controller.children.map(_buildChild).toList())
              : Row(children: _controller.children.map(_buildChild).toList()),
        );
      },
    );
  }

I know this will cause rebuild children every time the ResizableWidget rebuild and may will make _controller.setSizeIfNeeded(constraints) useless, but this is what I have to do right now.

Another question ...
Why does ResizableWidget prevent rebuilding children if the application state is changed, the BoxConstraint is one of the application states on which ResizableWidget depends on, but maybe there is another state that children need.

Activity

  1. changed the title [-]Rebuild[/-] [+]Rebuild Prevent by ResizableWidget[/+] on Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions