feat: Added file picker section space
This commit is contained in:
+76
-89
@@ -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: () {
|
||||||
showAttachmentModal();
|
if(_openFilePickerSection) {
|
||||||
|
setState(() {
|
||||||
|
_openFilePickerSection = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
showAttachmentModal();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -851,73 +832,79 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
_focusNode.unfocus();
|
_focusNode.unfocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
showModalBottomSheet(
|
if(!kIsWeb) {
|
||||||
clipBehavior: Clip.hardEdge,
|
setState(() {
|
||||||
shape: RoundedRectangleBorder(
|
_openFilePickerSection = true;
|
||||||
borderRadius: BorderRadius.only(
|
});
|
||||||
topLeft: Radius.circular(32),
|
} else {
|
||||||
topRight: Radius.circular(32),
|
showModalBottomSheet(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(32),
|
||||||
|
topRight: Radius.circular(32),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
context: context,
|
||||||
context: context,
|
isScrollControlled: true,
|
||||||
isScrollControlled: true,
|
builder: (_) {
|
||||||
builder: (_) {
|
return Column(
|
||||||
return Column(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
ListTile(
|
||||||
ListTile(
|
title: Text(
|
||||||
title: Text(
|
'Add a file',
|
||||||
'Add a file',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
fontWeight: FontWeight.bold,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.image),
|
|
||||||
title: Text('Upload a photo'),
|
|
||||||
onTap: () {
|
|
||||||
pickFile(DefaultAttachmentTypes.image, false);
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.video_library),
|
|
||||||
title: Text('Upload a video'),
|
|
||||||
onTap: () {
|
|
||||||
pickFile(DefaultAttachmentTypes.video, false);
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (!kIsWeb)
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.camera_alt),
|
leading: Icon(Icons.image),
|
||||||
title: Text('Photo from camera'),
|
title: Text('Upload a photo'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
pickFile(DefaultAttachmentTypes.image, true);
|
pickFile(DefaultAttachmentTypes.image, false);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (!kIsWeb)
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.videocam),
|
leading: Icon(Icons.video_library),
|
||||||
title: Text('Video from camera'),
|
title: Text('Upload a video'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
pickFile(DefaultAttachmentTypes.video, true);
|
pickFile(DefaultAttachmentTypes.video, false);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
if (!kIsWeb)
|
||||||
leading: Icon(Icons.insert_drive_file),
|
ListTile(
|
||||||
title: Text('Upload a file'),
|
leading: Icon(Icons.camera_alt),
|
||||||
onTap: () {
|
title: Text('Photo from camera'),
|
||||||
pickFile(DefaultAttachmentTypes.file, false);
|
onTap: () {
|
||||||
Navigator.pop(context);
|
pickFile(DefaultAttachmentTypes.image, true);
|
||||||
},
|
Navigator.pop(context);
|
||||||
),
|
},
|
||||||
],
|
),
|
||||||
);
|
if (!kIsWeb)
|
||||||
});
|
ListTile(
|
||||||
|
leading: Icon(Icons.videocam),
|
||||||
|
title: Text('Video from camera'),
|
||||||
|
onTap: () {
|
||||||
|
pickFile(DefaultAttachmentTypes.video, true);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.insert_drive_file),
|
||||||
|
title: Text('Upload a file'),
|
||||||
|
onTap: () {
|
||||||
|
pickFile(DefaultAttachmentTypes.file, false);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add an attachment to the sending message
|
/// Add an attachment to the sending message
|
||||||
|
|||||||
Reference in New Issue
Block a user