fix: ios, chat window position, wrong member value (#8464)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-06-24 22:56:13 +08:00 committed by GitHub
parent 1765c7bbf4
commit 00ddd63372
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -486,7 +486,7 @@ class IOSDraggableState extends State<IOSDraggable> {
_height = widget.height;
}
get position => widget.position;
DraggableKeyPosition get position => widget.position;
checkKeyboard() {
final bottomHeight = MediaQuery.of(context).viewInsets.bottom;
@ -494,13 +494,13 @@ class IOSDraggableState extends State<IOSDraggable> {
// save
if (!_keyboardVisible && currentVisible) {
_saveHeight = position.value.dy;
_saveHeight = position.pos.dy;
}
// reset
if (_lastBottomHeight > 0 && bottomHeight == 0) {
setState(() {
position.value = Offset(position.value.dx, _saveHeight);
position.update(Offset(position.pos.dx, _saveHeight));
});
}
@ -508,10 +508,10 @@ class IOSDraggableState extends State<IOSDraggable> {
if (_keyboardVisible && currentVisible) {
final sumHeight = bottomHeight + _height;
final contextHeight = MediaQuery.of(context).size.height;
if (sumHeight + position.value.dy > contextHeight) {
if (sumHeight + position.pos.dy > contextHeight) {
final y = contextHeight - sumHeight;
setState(() {
position.value = Offset(position.value.dx, y);
position.update(Offset(position.pos.dx, y));
});
}
}
@ -526,14 +526,14 @@ class IOSDraggableState extends State<IOSDraggable> {
return Stack(
children: [
Positioned(
left: position.value.dx,
top: position.value.dy,
left: position.pos.dx,
top: position.pos.dy,
child: GestureDetector(
onPanUpdate: (details) {
setState(() {
position.value += details.delta;
position.update(position.pos + details.delta);
});
_chatModel?.setChatWindowPosition(position.value);
_chatModel?.setChatWindowPosition(position.pos);
},
child: Material(
child: Container(