opt: pick images

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-10 15:19:09 +08:00
parent 59910e275e
commit 8919d82913
5 changed files with 190 additions and 169 deletions

View File

@@ -550,6 +550,7 @@ class _CreatePanelState extends State<CreatePanel> {
EasyThrottle.throttle( EasyThrottle.throttle(
'imagePicker', const Duration(milliseconds: 500), 'imagePicker', const Duration(milliseconds: 500),
() async { () async {
try {
List<XFile> pickedFiles = List<XFile> pickedFiles =
await _imagePicker.pickMultiImage( await _imagePicker.pickMultiImage(
limit: _limit, limit: _limit,
@@ -575,6 +576,9 @@ class _CreatePanelState extends State<CreatePanel> {
_isEnableStream.add(true); _isEnableStream.add(true);
} }
} }
} catch (e) {
SmartDialog.showToast(e.toString());
}
}); });
}, },
child: Ink( child: Ink(

View File

@@ -448,6 +448,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
} }
void _pickImg() async { void _pickImg() async {
try {
XFile? pickedFile = await _imagePicker.pickImage( XFile? pickedFile = await _imagePicker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,
imageQuality: 100, imageQuality: 100,
@@ -510,6 +511,9 @@ class _EditProfilePageState extends State<EditProfilePage> {
}); });
} }
} }
} catch (e) {
SmartDialog.showToast(e.toString());
}
} }
} }

View File

@@ -112,6 +112,7 @@ class _CreateFavPageState extends State<CreateFavPage> {
} }
void _pickImg() async { void _pickImg() async {
try {
XFile? pickedFile = await _imagePicker.pickImage( XFile? pickedFile = await _imagePicker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,
imageQuality: 100, imageQuality: 100,
@@ -157,6 +158,9 @@ class _CreateFavPageState extends State<CreateFavPage> {
}); });
} }
} }
} catch (e) {
SmartDialog.showToast(e.toString());
}
} }
dynamic leadingStyle = TextStyle(fontSize: 14); dynamic leadingStyle = TextStyle(fontSize: 14);

View File

@@ -361,6 +361,7 @@ class _ReplyPageState extends State<ReplyPage>
EasyThrottle.throttle( EasyThrottle.throttle(
'imagePicker', const Duration(milliseconds: 500), 'imagePicker', const Duration(milliseconds: 500),
() async { () async {
try {
List<XFile> pickedFiles = List<XFile> pickedFiles =
await _imagePicker.pickMultiImage( await _imagePicker.pickMultiImage(
limit: _limit, limit: _limit,
@@ -383,6 +384,9 @@ class _ReplyPageState extends State<ReplyPage>
} }
} }
} }
} catch (e) {
SmartDialog.showToast(e.toString());
}
}); });
}, },
), ),

View File

@@ -310,6 +310,7 @@ class _WhisperDetailPageState extends State<WhisperDetailPage> {
if (snapshot.data == true) { if (snapshot.data == true) {
_whisperDetailController.sendMsg(); _whisperDetailController.sendMsg();
} else { } else {
try {
XFile? pickedFile = await _imagePicker.pickImage( XFile? pickedFile = await _imagePicker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,
imageQuality: 100, imageQuality: 100,
@@ -335,13 +336,17 @@ class _WhisperDetailPageState extends State<WhisperDetailPage> {
'size': imageSize / 1024, 'size': imageSize / 1024,
}; };
SmartDialog.showLoading(msg: '正在发送'); SmartDialog.showLoading(msg: '正在发送');
await _whisperDetailController.sendMsg(picMsg: picMsg); await _whisperDetailController.sendMsg(
picMsg: picMsg);
} else { } else {
SmartDialog.dismiss(); SmartDialog.dismiss();
SmartDialog.showToast(result['msg']); SmartDialog.showToast(result['msg']);
return; return;
} }
} }
} catch (e) {
SmartDialog.showToast(e.toString());
}
} }
}, },
icon: Icon(snapshot.data == true icon: Icon(snapshot.data == true