Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyboardAttachable throws RenderBox exception on Navigator pop. #27

Open
pavittarsingh315 opened this issue Jun 12, 2022 · 1 comment
Open

Comments

@pavittarsingh315
Copy link

pavittarsingh315 commented Jun 12, 2022

So basically I am using the using the package as so:

@override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    return FooterLayout(
      footer: KeyboardAttachable(
        child: _backButton(context),
      ),
      child: SizedBox(
        height: size.height,
        width: size.width,
        child: const Body(),
      ),
    );
  }

  Widget _backButton(BuildContext context) {
    return TextButton(
      onPressed: () {
        FocusManager.instance.primaryFocus?.unfocus();
        Navigator.of(context).pop();
      },
      child: Text('Go back'),
    );
  }

For some reason, the ``Navigator.of(context).pop();` cause this exception to be thrown:

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building KeyboardAttachable(dirty, dependencies: [MediaQuery], state: _KeyboardAttachableState#8173b(ticker inactive)):
RenderBox was not laid out: RenderFittedBox#193dd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 1979 pos 12: 'hasSize'

2

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was
KeyboardAttachable

I am really not sure why this is occurring. I have tried to specify a size for the back button the error still occurs.

How can I fix this?

@bdlukaa
Copy link

bdlukaa commented Jan 22, 2023

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants