处理上传图片的问题

This commit is contained in:
1147192855@qq.com 2025-04-19 21:46:37 +08:00
parent ed30fc6240
commit 138b4bb767
1 changed files with 2 additions and 4 deletions

View File

@ -82,7 +82,6 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
@override @override
void onInit() { void onInit() {
appBarHeight = MediaQuery.of(Get.context!).padding.top; appBarHeight = MediaQuery.of(Get.context!).padding.top;
print("appBarHeight $appBarHeight"); print("appBarHeight $appBarHeight");
// WidgetsFlutterBinding.ensureInitialized(); // WidgetsFlutterBinding.ensureInitialized();
@ -109,7 +108,6 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
state.studentQuestions.value = e.studentQuestions; // state.studentQuestions.value = e.studentQuestions; //
final currentTemplateId = zoomState.zoomFile.value?.templateId; // ID final currentTemplateId = zoomState.zoomFile.value?.templateId; // ID
if (currentTemplateId != null && currentTemplateId != e.templateId) { if (currentTemplateId != null && currentTemplateId != e.templateId) {
// zoom zoom文件 // zoom zoom文件
@ -239,9 +237,9 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
// double dpr = MediaQuery.of(context).devicePixelRatio; // double dpr = MediaQuery.of(context).devicePixelRatio;
/// ///
double? pixelRatio = zoomLogic.zoomState.zoomFile.value?.scaleRatio ?? MediaQuery.of(context).devicePixelRatio; // double? pixelRatio = zoomLogic.zoomState.zoomFile.value?.scaleRatio ?? MediaQuery.of(context).devicePixelRatio;
ui.Image image = await boundary.toImage(pixelRatio: pixelRatio); ui.Image image = await boundary.toImage();
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png); ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
if (byteData == null) return null; if (byteData == null) return null;