Closed ghost closed 5 years ago
The same situation happens even if I replace my complex layout with just Containers
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).homeTitle),
),
body: RubberBottomSheet(
lowerLayer: Container(
decoration: BoxDecoration(
color: Colors.cyan[100]
),
),
upperLayer: Container(
decoration: BoxDecoration(
color: Colors.cyan
),
),
//scrollController: _scrollController,
animationController: _controller,
),
);
}
I haven't explored sources yet, but i guess that reason might be connected with fact, that in release builds Flutter provide size of widget not imidiatly, but after some time. So it's necessary to check all init methods, where height might be used.
I'm back on the project! With the latest commits, it seems working on my device give it a try with the latest update. 👍 The first layout on release mode caused me already some headaches and I've already integrated after_layout to avoid these issues. Cool design by the way!
I'm not sure if this is related, but even after the new update I get the following error:
RenderBox was not laid out: RenderStack#78f77 NEEDS-LAYOUT NEEDS-PAINT
'package:flutter/src/rendering/box.dart': Failed assertion: line 1482 pos 12: 'hasSize'
The offending code:
double get _bottomSheetHeight {
final RenderBox renderBox = _keyWidget.currentContext.findRenderObject();
return renderBox.size.height;
}
Appearently it doesn't have a size yet, which is weird because findRenderObject mentions:
/// If the render object is a [RenderBox], which is the common case, then the
/// size of the render object can be obtained from the [size] getter. This is
/// only valid after the layout phase, and should therefore only be examined
/// from paint callbacks or interaction event handlers (e.g. gesture
/// callbacks)
and in the new update you only call _botttomSheetHeight
in the afterFirstLayout
callback. Any ideas?
When do you get that error? And on which device/os?
This is my issue: https://github.com/mcrovero/rubber/issues/18
I get the error as soon as my page builds, when RubberBottomSheet is called for the first time. More specifically when the _bottomSheetHeight getter is called. I should probably mention that running the examples works fine but somehow i get an error in my project... I realize this is quite vague so If its not enough to go by I can try to set up a minimum example
Any updates on this? it stops us from going to production... :(
@alexandr2levin Were you able to resolve this issue?
This is my issue: #18
I get the error as soon as my page builds, when RubberBottomSheet is called for the first time. More specifically when the _bottomSheetHeight getter is called. I should probably mention that running the examples works fine but somehow i get an error in my project... I realize this is quite vague so If its not enough to go by I can try to set up a minimum example
I can't reproduce the error, is the example in the library also generating the error?
Closing for inactivity
Great library! For now, it's the only way to implement awesome persistent bottom sheet. But there is an annoying bug.
Source code of my application: https://github.com/alexandr2levin/my_mikhailovka
Description of the bug RubberBottomSheet very often expands to full height and can't be collapsed in release builds. Sometimes it works as expected, but it happens very rare. Debug builds works as expected.
To Reproduce
flutter run --release
my projectScreenshots
Smartphone:
Flutter doctor