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

View File

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

View File

@@ -361,6 +361,7 @@ class _ReplyPageState extends State<ReplyPage>
EasyThrottle.throttle(
'imagePicker', const Duration(milliseconds: 500),
() async {
try {
List<XFile> pickedFiles =
await _imagePicker.pickMultiImage(
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) {
_whisperDetailController.sendMsg();
} else {
try {
XFile? pickedFile = await _imagePicker.pickImage(
source: ImageSource.gallery,
imageQuality: 100,
@@ -335,13 +336,17 @@ class _WhisperDetailPageState extends State<WhisperDetailPage> {
'size': imageSize / 1024,
};
SmartDialog.showLoading(msg: '正在发送');
await _whisperDetailController.sendMsg(picMsg: picMsg);
await _whisperDetailController.sendMsg(
picMsg: picMsg);
} else {
SmartDialog.dismiss();
SmartDialog.showToast(result['msg']);
return;
}
}
} catch (e) {
SmartDialog.showToast(e.toString());
}
}
},
icon: Icon(snapshot.data == true