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

'RenderBox was not laid out' was thrown #97

Closed
satoyan opened this issue Nov 23, 2020 · 9 comments
Closed

'RenderBox was not laid out' was thrown #97

satoyan opened this issue Nov 23, 2020 · 9 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@satoyan
Copy link

satoyan commented Nov 23, 2020

Describe the bug
'RenderBox was not laid out' was thrown.

To Reproduce
Steps to reproduce the behavior:
The code I wrote was below
(just to show login form)

  import 'package:flutter/material.dart';                                                                                                                    
  import 'package:flutter_gen/gen_l10n/app_localizations.dart';                                                                                              
  import 'package:flutter_login/flutter_login.dart';                                                                                                         
                                                                                                                                                             
  class LoginScreen extends StatelessWidget {                                                                                                                
    @override                                                                                                                                                
    Widget build(BuildContext context) {                                                                                                                     
      return FlutterLogin(                                                                                                                                   
        onLogin: handleAuthUser,                                                                                                                             
        onRecoverPassword: handleRecoveryPassword,                                                                                                           
        onSignup: handleSignup,                                                                                                                              
      ); // FlutterLogin                                                                                                                                     
    }                                                                                                                                                        
                                                                                                                                                             
>>  Future<String> handleAuthUser(LoginData data) {}                                                                                                         
>>  Future<String> handleRecoveryPassword(String data) {}                                                                                                    
>>  Future<String> handleSignup(LoginData data) {}                                                                                                           
  }                                                                                                                                                          
~     

And when I start the app, an error was thrown

$ flutter run

Screenshots
I can see the error message below

An Observatory debugger and profiler on sdk gphone x86 arm is available at: http://127.0.0.1:42033/TOE7m9uJmNk=/
I/flutter (13350): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (13350): The following assertion was thrown during a scheduler callback:
I/flutter (13350): RenderBox was not laid out: RenderRepaintBoundary#bb0f7 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (13350): 'package:flutter/src/rendering/box.dart':
I/flutter (13350): Failed assertion: line 1785 pos 12: 'hasSize'
I/flutter (13350): 
I/flutter (13350): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (13350): more information in this error message to help you determine and fix the underlying cause.
I/flutter (13350): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (13350):   https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (13350): 
I/flutter (13350): When the exception was thrown, this was the stack:
I/flutter (13350): #2      RenderBox.size (package:flutter/src/rendering/box.dart:1785:12)
I/flutter (13350): #3      RenderBox.paintBounds (package:flutter/src/rendering/box.dart:2389:41)
I/flutter (13350): #4      _TransformerPageViewState._onGetSize (package:transformer_page_view/transformer_page_view.dart:461:34)
I/flutter (13350): #5      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
I/flutter (13350): #6      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1063:9)
I/flutter (13350): #7      SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:864:7)
I/flutter (13350): (elided 13 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
I/flutter (13350): ════════════════════════════════════════════════════════════════════════════════════════════════════

Information (please complete the following information):

  • Device: Nexus9 (emulator)
  • Platform android (API 30)
  • Flutter version: 1.22.4
  • Package version 1.0.14
@satoyan satoyan added the bug Something isn't working label Nov 23, 2020
@juliansteenbakker juliansteenbakker added this to the 1.0.15 milestone Mar 15, 2021
@juliansteenbakker
Copy link
Collaborator

After some debugging i found out that this error is being thrown here:

transformer: CustomPageTransformer(),

If we comment out this CustomPageTransformer() we don't get the error anymore. However, this PageTransformer controls the effect when navigation from login page to password reset page.

I have tried some things but i cant seem to find why this PageTransformer is causing issues. I think it has something to do with the parent width and height but i'm not sure.

@span
Copy link

span commented Apr 2, 2021

I'm also seeing this for 1.1.0 in a fresh project where I simply add the example implementation. Is there a workaround that does not include hacking the library?

Attaching my sample project.
simplestats.zip

@juliansteenbakker
Copy link
Collaborator

At this moment there is no work around besides commenting out the CustomPageTransformer() in the library. Since commenting this out means removing the animation between the different login and signup cards I don't want to remove it. I'm still searching for a solution that doesn't involve removing the animation.

@span
Copy link

span commented Apr 6, 2021

I see. I'll keep an eye open if I stumble into something. I reverted to 1.0.15 and it works great.

@SirNotReallySmokeAlot
Copy link

Hello all,
is there any new information on this already?

Or a workaround :)?

@VELCpro
Copy link

VELCpro commented Apr 19, 2021

Hi all,
there are some news on the issue?

@alparslana
Copy link

alparslana commented May 4, 2021

Unfortunately, I have encountered even bigger problems with CustomPageTransformer call in my project. It is causing indeterminate memory errors, causing the whole application to crash.

RuntimeError: memory access out of bounds

It took me quite some time to discover the real cause, and I am still not sure under which conditions the problem surfaces but commenting that one line of code in auth_card.dart definitely solves the problem. The exception is triggered upon switching between login page and recover password page; sometimes during the 2nd switch, sometimes 20th. Interestingly, I didn't observe it with the example project, but in many other project formations I used, it shows up.

@shubh1204
Copy link

Hi,

is there any update on this issue?

@juliansteenbakker
Copy link
Collaborator

I have added the following parameter which can be used to disable the CustomPageTransformer: disableCustomPageTransformer: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants