fix command layout

This commit is contained in:
Salvatore Giordano
2020-03-04 10:40:35 +01:00
parent 1ec09bac63
commit 0f0226ca69
5 changed files with 159 additions and 140 deletions
+6
View File
@@ -14,6 +14,8 @@ PODS:
- Reachability
- path_provider (0.0.1):
- Flutter
- path_provider_macos (0.0.1):
- Flutter
- Reachability (3.2)
- screen (0.0.1):
- Flutter
@@ -38,6 +40,7 @@ DEPENDENCIES:
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- keyboard_visibility (from `.symlinks/plugins/keyboard_visibility/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)
- screen (from `.symlinks/plugins/screen/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
@@ -64,6 +67,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/keyboard_visibility/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
path_provider_macos:
:path: ".symlinks/plugins/path_provider_macos/ios"
screen:
:path: ".symlinks/plugins/screen/ios"
sqflite:
@@ -87,6 +92,7 @@ SPEC CHECKSUMS:
image_picker: e3eacd46b94694dde7cf2705955cece853aa1a8f
keyboard_visibility: 96a24de806fe6823c3ad956c01ba2ec6d056616f
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0
sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0
+7 -7
View File
@@ -3,13 +3,13 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
void main() async {
final client = Client(
's2dxdhpxd94g',
'b67pax5b2wdq',
logLevel: Level.INFO,
);
await client.setUser(
User(id: 'falling-mountain-7'),
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNDE5MjI5YTMtODRhMC00MDZiLTkzNzEtN2NlOWE0ZTBhNjc2In0.J3SjGH4e4v7b3cg5EgWkljTxXj_HeHpCWn5ujEVv_H8',
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZmFsbGluZy1tb3VudGFpbi03In0.AKgRXHMQQMz6vJAKszXdY8zMFfsAgkoUeZHlI-Szz9E',
);
runApp(MyApp(client));
@@ -38,11 +38,11 @@ class ChannelListPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
body: ChannelListView(
// filter: {
// 'members': {
// '\$in': [StreamChat.of(context).user.id],
// }
// },
filter: {
'members': {
'\$in': [StreamChat.of(context).user.id],
}
},
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
+1 -1
View File
@@ -89,7 +89,7 @@ class ChannelPreview extends StatelessWidget {
initialData: channel.state.typingEvents,
builder: (context, snapshot) {
final typings = snapshot.data;
final opacity = channel.state.unreadCount > .0 ? 1.0 : 0.5;
final opacity = channel.state.unreadCount > 0 ? 1.0 : 0.5;
return typings.isNotEmpty
? _buildTypings(typings, context, opacity)
: _buildLastMessage(context, opacity);
+31 -17
View File
@@ -118,10 +118,6 @@ class _MessageInputState extends State<MessageInput> {
}
AnimatedCrossFade _animateSendButton(BuildContext context) {
print(
'_messageIsPresent || _attachments.isNotEmpty: ${_messageIsPresent || _attachments.isNotEmpty}');
print('_attachments.isNotEmpty: ${_attachments.isNotEmpty}');
print('_messageIsPresent: ${_messageIsPresent}');
return AnimatedCrossFade(
crossFadeState: (_messageIsPresent || _attachments.isNotEmpty)
? CrossFadeState.showFirst
@@ -214,15 +210,26 @@ class _MessageInputState extends State<MessageInput> {
RenderBox renderBox = context.findRenderObject();
final size = renderBox.size;
final offset = renderBox.localToGlobal(Offset.zero);
return OverlayEntry(builder: (_) {
return OverlayEntry(builder: (context) {
return Positioned(
top: offset.dy - size.height,
bottom: size.height + MediaQuery.of(context).viewInsets.bottom,
left: 0,
right: 0,
child: Material(
color: StreamChatTheme.of(context).primaryColor,
child: Container(
constraints: BoxConstraints.loose(Size.fromHeight(400)),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
spreadRadius: -8,
blurRadius: 5.0,
offset: Offset(0, -4),
),
],
color: StreamChatTheme.of(context).primaryColor,
),
child: Flex(
mainAxisSize: MainAxisSize.min,
direction: Axis.vertical,
@@ -256,6 +263,7 @@ class _MessageInputState extends State<MessageInput> {
],
),
),
),
);
});
}
@@ -388,6 +396,16 @@ class _MessageInputState extends State<MessageInput> {
color: Colors.transparent,
child: IconButton(
onPressed: () {
_showAttachmentModal();
},
icon: Icon(
Icons.add_circle_outline,
),
),
);
}
void _showAttachmentModal() {
showModalBottomSheet(
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(
@@ -453,12 +471,6 @@ class _MessageInputState extends State<MessageInput> {
],
);
});
},
icon: Icon(
Icons.add_circle_outline,
),
),
);
}
void _pickFile(FileType type, bool camera) async {
@@ -599,12 +611,13 @@ class _MessageInputState extends State<MessageInput> {
void initState() {
super.initState();
_keyboardListener =
KeyboardVisibilityNotification().addNewListener(onHide: () {
_keyboardListener = KeyboardVisibilityNotification().addNewListener(
onHide: () {
if (_commandsOverlay != null) {
_commandsOverlay.remove();
}
}, onShow: () {
},
onShow: () {
if (_commandsOverlay != null) {
if (_textController.text.startsWith('/')) {
WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -613,7 +626,8 @@ class _MessageInputState extends State<MessageInput> {
});
}
}
});
},
);
if (widget.editMessage != null) {
_textController = TextEditingController(text: widget.editMessage.text);
+10 -11
View File
@@ -687,14 +687,16 @@ class _MessageWidgetState extends State<MessageWidget>
}
Row _buildReactionRow() {
final List<Widget> children =
widget.message.reactionCounts.keys.map((reactionType) {
return Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
...widget.message.reactionCounts.keys.map((reactionType) {
return Text(
reactionToEmoji[reactionType] ?? '?',
) as Widget;
}).toList();
children.add(Padding(
);
}),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
widget.message.reactionCounts.values
@@ -702,11 +704,8 @@ class _MessageWidgetState extends State<MessageWidget>
.toString(),
style: TextStyle(color: Colors.white),
),
));
return Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: children,
),
],
);
}