akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.38k stars 381 forks source link

Performance improvements #112

Closed s0nerik closed 4 years ago

s0nerik commented 4 years ago
  1. Removed unneeded setState call that caused too many unnecessary rebuilds of the panel and body.
  2. Replaced FadeTransition for backdrop overlay with a Container color which is more performant according to docs.
  3. Added empty child in case of collapsed widget is not specified.
akshathjain commented 4 years ago

@s0nerik This is some great work! Literally saved me hours of debugging + its a very simple change. I'm currently reviewing the changes and will hopefully get a release out by tonight!

hamra commented 3 years ago

I am using your maps example from latest version (1.0.2) of this package as of now. In the build method of State _HomePageState, I have added print statement to see if the _HomePageState gets rebuild on slide panel scroll ... It still rebuilds on every scroll or any click event that use setState()

@override Widget build(BuildContext context){ _panelHeightOpen = MediaQuery.of(context).size.height * .80; print("main build"); ....

The output if as below;

[+26555 ms] I/flutter (16800): main build [+22351 ms] I/chatty (16800): uid=10164(com.example.example) 1.ui identical 351 lines [ ] I/flutter (16800): main build [ +144 ms] I/flutter (16800): main build [+4116 ms] I/chatty (16800): uid=10164(com.example.example) 1.ui identical 106 lines [ ] I/flutter (16800): main build [ +103 ms] I/flutter (16800): main build [+26906 ms] I/chatty (16800): uid=10164(com.example.example) 1.ui identical 203 lines [ ] I/flutter (16800): main build [+3629 ms] I/flutter (16800): main build [ +807 ms] I/chatty (16800): uid=10164(com.example.example) 1.ui identical 12 lines [ ] I/flutter (16800): main build [+1269 ms] I/flutter (16800): main build [+9528 ms] I/chatty (16800): uid=10164(com.example.example) 1.ui identical 49 lines [ ] I/flutter (16800): main build