feat: Added file picker section space

This commit is contained in:
Deven Joshi
2020-11-05 16:02:04 +05:30
parent 5099b55fde
commit f10faee751
+21 -34
View File
@@ -172,6 +172,7 @@ class MessageInputState extends State<MessageInput> {
Command _chosenCommand; Command _chosenCommand;
bool _actionsShrunk = false; bool _actionsShrunk = false;
bool _sendAsDm = false; bool _sendAsDm = false;
bool _openFilePickerSection = false;
/// The editing controller passed to the input TextField /// The editing controller passed to the input TextField
TextEditingController textEditingController; TextEditingController textEditingController;
@@ -197,6 +198,8 @@ class MessageInputState extends State<MessageInput> {
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: _buildDmCheckbox(), child: _buildDmCheckbox(),
), ),
if(_openFilePickerSection)
_buildFilePickerSection(),
], ],
), ),
), ),
@@ -420,40 +423,6 @@ class MessageInputState extends State<MessageInput> {
); );
} }
Positioned _buildBorder(BuildContext context) {
return Positioned.fill(
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
gradient: _getGradient(context),
),
child: Container(
decoration: BoxDecoration(
color: StreamChatTheme.of(context)
.channelTheme
.inputBackground
.withAlpha(255),
borderRadius: BorderRadius.circular(10.0),
),
child: Container(
decoration: BoxDecoration(
color: StreamChatTheme.of(context).channelTheme.inputBackground,
borderRadius: BorderRadius.circular(10.0),
border: Border.all(
color: _typingStarted
? Colors.transparent
: Theme.of(context).brightness == Brightness.dark
? Colors.white.withOpacity(.2)
: Colors.black.withOpacity(.2)),
),
),
),
),
);
}
OverlayEntry _buildCommandsOverlayEntry() { OverlayEntry _buildCommandsOverlayEntry() {
final text = textEditingController.text; final text = textEditingController.text;
final commands = StreamChannel.of(context) final commands = StreamChannel.of(context)
@@ -566,6 +535,12 @@ class MessageInputState extends State<MessageInput> {
}); });
} }
Widget _buildFilePickerSection() {
return Container(
height: 200.0,
);
}
OverlayEntry _buildMentionsOverlayEntry() { OverlayEntry _buildMentionsOverlayEntry() {
final splits = textEditingController.text final splits = textEditingController.text
.substring(0, textEditingController.value.selection.start) .substring(0, textEditingController.value.selection.start)
@@ -839,7 +814,13 @@ class MessageInputState extends State<MessageInput> {
), ),
), ),
onTap: () { onTap: () {
if(_openFilePickerSection) {
setState(() {
_openFilePickerSection = false;
});
} else {
showAttachmentModal(); showAttachmentModal();
}
}, },
), ),
); );
@@ -851,6 +832,11 @@ class MessageInputState extends State<MessageInput> {
_focusNode.unfocus(); _focusNode.unfocus();
} }
if(!kIsWeb) {
setState(() {
_openFilePickerSection = true;
});
} else {
showModalBottomSheet( showModalBottomSheet(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@@ -919,6 +905,7 @@ class MessageInputState extends State<MessageInput> {
); );
}); });
} }
}
/// Add an attachment to the sending message /// Add an attachment to the sending message
/// Use this to add custom type attachments /// Use this to add custom type attachments