refactor(ui): remove context and add size property to EmojiOverlay
This commit is contained in:
@@ -38,7 +38,9 @@ class AuthInterceptor extends Interceptor {
|
|||||||
'Authorization': token.rawValue,
|
'Authorization': token.rawValue,
|
||||||
'stream-auth-type': token.authType.raw,
|
'stream-auth-type': token.authType.raw,
|
||||||
};
|
};
|
||||||
options..queryParameters.addAll(params)..headers.addAll(headers);
|
options
|
||||||
|
..queryParameters.addAll(params)
|
||||||
|
..headers.addAll(headers);
|
||||||
return handler.next(options);
|
return handler.next(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,6 @@
|
|||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>8.0</string>
|
<string>9.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ import 'package:substring_highlight/substring_highlight.dart';
|
|||||||
/// Overlay for displaying emoji that can be used
|
/// Overlay for displaying emoji that can be used
|
||||||
class EmojiOverlay extends StatelessWidget {
|
class EmojiOverlay extends StatelessWidget {
|
||||||
/// Constructor for creating a [EmojiOverlay]
|
/// Constructor for creating a [EmojiOverlay]
|
||||||
const EmojiOverlay(
|
const EmojiOverlay({
|
||||||
this.context, {
|
|
||||||
required this.query,
|
required this.query,
|
||||||
required this.onEmojiResult,
|
required this.onEmojiResult,
|
||||||
|
required this.size,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// Context of the upper tree
|
/// The size of the overlay
|
||||||
final BuildContext context;
|
final Size size;
|
||||||
|
|
||||||
/// Query for searching emoji
|
/// Query for searching emoji
|
||||||
final String query;
|
final String query;
|
||||||
@@ -24,7 +24,7 @@ class EmojiOverlay extends StatelessWidget {
|
|||||||
final ValueChanged<Emoji> onEmojiResult;
|
final ValueChanged<Emoji> onEmojiResult;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext otherContext) {
|
Widget build(BuildContext context) {
|
||||||
final _streamChatTheme = StreamChatTheme.of(context);
|
final _streamChatTheme = StreamChatTheme.of(context);
|
||||||
final _emojiNames =
|
final _emojiNames =
|
||||||
Emoji.all().where((it) => it.name != null).map((e) => e.name!);
|
Emoji.all().where((it) => it.name != null).map((e) => e.name!);
|
||||||
@@ -38,10 +38,6 @@ class EmojiOverlay extends StatelessWidget {
|
|||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: cast_nullable_to_non_nullable
|
|
||||||
final renderBox = context.findRenderObject() as RenderBox;
|
|
||||||
final size = renderBox.size;
|
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
margin: const EdgeInsets.all(8),
|
margin: const EdgeInsets.all(8),
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
@@ -51,7 +47,7 @@ class EmojiOverlay extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints.loose(Size(size.width - 16, 200)),
|
constraints: BoxConstraints.loose(size),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
boxShadow: const [
|
boxShadow: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
|||||||
@@ -1170,9 +1170,11 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
.split(':');
|
.split(':');
|
||||||
|
|
||||||
final query = splits.last.toLowerCase();
|
final query = splits.last.toLowerCase();
|
||||||
|
// ignore: cast_nullable_to_non_nullable
|
||||||
|
final renderObject = context.findRenderObject() as RenderBox;
|
||||||
|
|
||||||
return EmojiOverlay(
|
return EmojiOverlay(
|
||||||
context,
|
size: Size(renderObject.size.width - 16, 200),
|
||||||
query: query,
|
query: query,
|
||||||
onEmojiResult: (emoji) {
|
onEmojiResult: (emoji) {
|
||||||
_chooseEmoji(splits, emoji);
|
_chooseEmoji(splits, emoji);
|
||||||
|
|||||||
Reference in New Issue
Block a user