corrected overlay positions
This commit is contained in:
@@ -11,7 +11,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:photo_manager/photo_manager.dart';
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
import 'package:shimmer/shimmer.dart';
|
import 'package:shimmer/shimmer.dart';
|
||||||
import 'package:stream_chat_flutter/overlays.dart';
|
import 'package:stream_chat_flutter/src/overlays.dart';
|
||||||
import 'package:stream_chat_flutter/src/emoji/emoji.dart';
|
import 'package:stream_chat_flutter/src/emoji/emoji.dart';
|
||||||
import 'package:stream_chat_flutter/src/extension.dart';
|
import 'package:stream_chat_flutter/src/extension.dart';
|
||||||
import 'package:stream_chat_flutter/src/media_list_view.dart';
|
import 'package:stream_chat_flutter/src/media_list_view.dart';
|
||||||
@@ -475,13 +475,20 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
_emojiOverlay != null ||
|
_emojiOverlay != null ||
|
||||||
_mentionsOverlay != null,
|
_mentionsOverlay != null,
|
||||||
overlayBuilder: (context, offset) {
|
overlayBuilder: (context, offset) {
|
||||||
|
late Widget child;
|
||||||
|
|
||||||
if (_commandsOverlay != null) {
|
if (_commandsOverlay != null) {
|
||||||
return _buildCommandsOverlayEntry();
|
child = _buildCommandsOverlayEntry();
|
||||||
} else if (_emojiOverlay != null) {
|
} else if (_emojiOverlay != null) {
|
||||||
return _buildEmojiOverlay();
|
child = _buildEmojiOverlay();
|
||||||
} else {
|
} else {
|
||||||
return _buildMentionsOverlayEntry();
|
child = _buildMentionsOverlayEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CenterAbout(
|
||||||
|
position: Offset(offset.dx, offset.dy),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
@@ -924,9 +931,10 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
.where((c) => c.name.contains(text.replaceFirst('/', '')))
|
.where((c) => c.name.contains(text.replaceFirst('/', '')))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[];
|
[];
|
||||||
|
final size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Card(
|
child: Card(
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@@ -935,7 +943,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
color: _streamChatTheme.colorTheme.barsBg,
|
color: _streamChatTheme.colorTheme.barsBg,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints.loose(const Size.fromHeight(400)),
|
constraints: BoxConstraints.loose(Size(size.width - 16, 400)),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _streamChatTheme.colorTheme.barsBg,
|
color: _streamChatTheme.colorTheme.barsBg,
|
||||||
borderRadius: BorderRadius.circular(8)),
|
borderRadius: BorderRadius.circular(8)),
|
||||||
@@ -1336,7 +1344,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints.loose(const Size.fromHeight(240)),
|
constraints: BoxConstraints.loose(Size(size.width - 16, 200)),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _streamChatTheme.colorTheme.barsBg,
|
color: _streamChatTheme.colorTheme.barsBg,
|
||||||
),
|
),
|
||||||
@@ -1390,11 +1398,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Positioned(
|
return TweenAnimationBuilder<double>(
|
||||||
bottom: size.height + MediaQuery.of(context).viewInsets.bottom,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: TweenAnimationBuilder<double>(
|
|
||||||
tween: Tween(begin: 0, end: 1),
|
tween: Tween(begin: 0, end: 1),
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
curve: Curves.easeInOutExpo,
|
curve: Curves.easeInOutExpo,
|
||||||
@@ -1403,7 +1407,6 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1422,11 +1425,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
final renderBox = context.findRenderObject() as RenderBox;
|
final renderBox = context.findRenderObject() as RenderBox;
|
||||||
final size = renderBox.size;
|
final size = renderBox.size;
|
||||||
|
|
||||||
return Positioned(
|
return Card(
|
||||||
bottom: size.height + MediaQuery.of(context).viewInsets.bottom,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Card(
|
|
||||||
margin: const EdgeInsets.all(8),
|
margin: const EdgeInsets.all(8),
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
color: _streamChatTheme.colorTheme.barsBg,
|
color: _streamChatTheme.colorTheme.barsBg,
|
||||||
@@ -1435,7 +1434,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints.loose(const Size.fromHeight(200)),
|
constraints: BoxConstraints.loose(Size(size.width - 16, 200)),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
boxShadow: const [
|
boxShadow: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
@@ -1501,7 +1500,6 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-5
@@ -84,7 +84,7 @@ class _OverlayBuilderState extends State<OverlayBuilder> {
|
|||||||
bool isShowingOverlay() => overlayEntry != null;
|
bool isShowingOverlay() => overlayEntry != null;
|
||||||
|
|
||||||
void showOverlay() {
|
void showOverlay() {
|
||||||
overlayEntry = new OverlayEntry(
|
overlayEntry = OverlayEntry(
|
||||||
builder: widget.overlayBuilder,
|
builder: widget.overlayBuilder,
|
||||||
);
|
);
|
||||||
if (overlayEntry != null) {
|
if (overlayEntry != null) {
|
||||||
@@ -128,13 +128,18 @@ class CenterAbout extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Positioned(
|
var size = MediaQuery.of(context).size;
|
||||||
top: position.dy,
|
|
||||||
|
return Positioned(
|
||||||
|
bottom: size.height - position.dy,
|
||||||
left: position.dx,
|
left: position.dx,
|
||||||
child: new FractionalTranslation(
|
child: FractionalTranslation(
|
||||||
translation: const Offset(-0.5, -0.5),
|
translation: const Offset(-0.5, 0.0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 32.0),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user