fluttercandies / flutter_scrollview_observer

A widget for observing data related to the child widgets being displayed in a ScrollView. Maintainer: @LinXunFeng
https://pub.dev/packages/scrollview_observer
MIT License
438 stars 47 forks source link

demo聊天界面里,键盘弹起发送消息,当消息超过聊天界面,再收起键盘,会发现消息在底部排列,没有置顶,请问有什么好的解决办法? #60

Closed atiman closed 11 months ago

atiman commented 1 year ago

Platforms

dart

Description

image

My code

No response

Try do it

No response

LinXunFeng commented 1 year ago

在页面尺寸发生变化的时候,调用 observeSwitchShrinkWrap 去及时更新 shrinkWrap

@override
void initState() {
  super.initState();

  // with WidgetsBindingObserver
  WidgetsBinding.instance.addObserver(this);
  ...
}
@override
void dispose() {
  WidgetsBinding.instance.removeObserver(this);

  super.dispose();
}
  @override
void didChangeMetrics() {
  super.didChangeMetrics();

  chatObserver.observeSwitchShrinkWrap();
}

示例已更新: chat_demo

988494 commented 11 months ago

太强了 我最近也遇到这个问题 牛逼