fix dragging
This commit is contained in:
@@ -99,23 +99,9 @@ class _MediaListViewState extends State<MediaListView> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_scrollController.addListener(() {
|
|
||||||
if (_scrollController.offset >
|
|
||||||
_scrollController.position.maxScrollExtent - 100) {
|
|
||||||
_getMedia();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
_getMedia();
|
_getMedia();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_scrollController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _getMedia() async {
|
void _getMedia() async {
|
||||||
final List<MediaCollection> collections =
|
final List<MediaCollection> collections =
|
||||||
await MediaGallery.listMediaCollections(
|
await MediaGallery.listMediaCollections(
|
||||||
@@ -154,8 +140,5 @@ class _MediaListViewState extends State<MediaListView> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_media.addAll(allItems);
|
_media.addAll(allItems);
|
||||||
});
|
});
|
||||||
|
|
||||||
print(
|
|
||||||
'_media.where((element) => element.mediaType == MediaType.video).length: ${_media.where((element) => element.mediaType == MediaType.video).length}');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
final _imagePicker = ImagePicker();
|
final _imagePicker = ImagePicker();
|
||||||
bool _inputEnabled = true;
|
bool _inputEnabled = true;
|
||||||
bool _messageIsPresent = false;
|
bool _messageIsPresent = false;
|
||||||
bool _typingStarted = false;
|
bool _animateContainer = true;
|
||||||
bool _commandEnabled = false;
|
bool _commandEnabled = false;
|
||||||
OverlayEntry _commandsOverlay, _mentionsOverlay, _emojiOverlay;
|
OverlayEntry _commandsOverlay, _mentionsOverlay, _emojiOverlay;
|
||||||
Iterable<String> _emojiNames;
|
Iterable<String> _emojiNames;
|
||||||
@@ -383,11 +383,6 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
|
|
||||||
_checkEmoji(s, context);
|
_checkEmoji(s, context);
|
||||||
},
|
},
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
_typingStarted = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
style: Theme.of(context).textTheme.bodyText2,
|
style: Theme.of(context).textTheme.bodyText2,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
@@ -613,7 +608,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
|
|
||||||
Widget _buildFilePickerSection() {
|
Widget _buildFilePickerSection() {
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
duration: Duration(milliseconds: 300),
|
duration: _animateContainer ? Duration(milliseconds: 300) : Duration.zero,
|
||||||
height: _openFilePickerSection ? _filePickerSize : 0,
|
height: _openFilePickerSection ? _filePickerSize : 0,
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Color(0xFFF2F2F2),
|
color: Color(0xFFF2F2F2),
|
||||||
@@ -662,13 +657,11 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onVerticalDragUpdate: (update) {
|
onVerticalDragUpdate: (update) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_filePickerSize -= update.delta.dy;
|
_animateContainer = false;
|
||||||
if (_filePickerSize < 100) {
|
_filePickerSize = (_filePickerSize - update.delta.dy).clamp(
|
||||||
_filePickerSize = 100.0;
|
100,
|
||||||
} else if (_filePickerSize >
|
MediaQuery.of(context).size.height / 1.7,
|
||||||
MediaQuery.of(context).size.height / 1.7) {
|
);
|
||||||
_filePickerSize = MediaQuery.of(context).size.height / 1.7;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -1206,6 +1199,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
|
|
||||||
if (_openFilePickerSection) {
|
if (_openFilePickerSection) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_animateContainer = true;
|
||||||
_openFilePickerSection = false;
|
_openFilePickerSection = false;
|
||||||
_filePickerSize = 250.0;
|
_filePickerSize = 250.0;
|
||||||
});
|
});
|
||||||
@@ -1536,7 +1530,6 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_messageIsPresent = false;
|
_messageIsPresent = false;
|
||||||
_typingStarted = false;
|
|
||||||
_commandEnabled = false;
|
_commandEnabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1632,7 +1625,6 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
void _parseExistingMessage(Message message) {
|
void _parseExistingMessage(Message message) {
|
||||||
textEditingController.text = message.text;
|
textEditingController.text = message.text;
|
||||||
|
|
||||||
_typingStarted = true;
|
|
||||||
_messageIsPresent = true;
|
_messageIsPresent = true;
|
||||||
|
|
||||||
message.attachments?.forEach((attachment) {
|
message.attachments?.forEach((attachment) {
|
||||||
|
|||||||
Reference in New Issue
Block a user