no message
This commit is contained in:
parent
c790a37e83
commit
a481b05782
|
|
@ -0,0 +1,50 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
||||||
|
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
|
||||||
|
|
||||||
|
part 'cached_network_img.g.dart';
|
||||||
|
|
||||||
|
@hwidget
|
||||||
|
Widget $theCachedNetworkImage(ImageWidgetBuilder imageBuilder, {required String imageUrl}) {
|
||||||
|
UseCachedImgRefresh useImgRefsh = UseCachedImgRefresh.use();
|
||||||
|
|
||||||
|
return CachedNetworkImage(
|
||||||
|
key: useImgRefsh.imageKey.value,
|
||||||
|
cacheKey: imageUrl,
|
||||||
|
fit: BoxFit.fitWidth,
|
||||||
|
width: double.infinity,
|
||||||
|
imageUrl: imageUrl,
|
||||||
|
imageBuilder: imageBuilder,
|
||||||
|
placeholder: (context, url) => Center(child: SpinKitWave(color: Theme.of(context).primaryColor, size: 50.r)),
|
||||||
|
errorWidget: (context, url, error) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => (useImgRefsh.imageKey.value = UniqueKey()),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset('assets/images/test_paper_loading_failed.png'),
|
||||||
|
quickText('加载失败,点击重试', color: const Color.fromRGBO(148, 163, 182, 1), size: 12.sp),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CachedNetworkImage 重新加载图片
|
||||||
|
class UseCachedImgRefresh {
|
||||||
|
ValueNotifier<int> refreshNumber;
|
||||||
|
ValueNotifier<Key> imageKey;
|
||||||
|
|
||||||
|
UseCachedImgRefresh._({required this.refreshNumber, required this.imageKey});
|
||||||
|
|
||||||
|
// 工厂构造函数
|
||||||
|
factory UseCachedImgRefresh.use() {
|
||||||
|
return UseCachedImgRefresh._(refreshNumber: useState(0), imageKey: useState(UniqueKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -165,7 +165,7 @@ Widget $continueToReview(BuildContext context, {bool isFloatingAction = false})
|
||||||
tooltip: "继续批阅",
|
tooltip: "继续批阅",
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
onPressed: callFun,
|
onPressed: callFun,
|
||||||
child: Icon(Icons.flip_camera_android_outlined, size: 20.sp, color: Theme.of(context).primaryColor),
|
child: Icon(Icons.flip_camera_android_outlined, size: 30.sp, color: Theme.of(context).primaryColor),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Expanded(
|
return Expanded(
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
|
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/config/request_config.dart';
|
||||||
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart';
|
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart';
|
||||||
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
|
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/utils/cached_network_img.dart';
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
||||||
|
|
||||||
import 'dropdown_switch_students_type.dart';
|
import 'dropdown_switch_students_type.dart';
|
||||||
|
|
@ -83,21 +85,74 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@hwidget
|
@swidget
|
||||||
Widget $mainBox(double maxWidth, double maxHeight) {
|
Widget $mainBox(double maxWidth, double maxHeight) {
|
||||||
|
final sateData = Get.find<HomeworkReviewLogic>().state;
|
||||||
|
final scrollController = useScrollController();
|
||||||
|
// 可选:添加滚动监听
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
return () {};
|
scrollController.addListener(() {
|
||||||
}, []);
|
// 执行滚动相关的逻辑,例如打印滚动位置
|
||||||
return Stack(
|
print(scrollController.offset);
|
||||||
alignment: const FractionalOffset(0.94, 0.94),
|
});
|
||||||
|
// 返回一个清理函数,在组件销毁时移除监听
|
||||||
|
return () => scrollController.dispose();
|
||||||
|
}, [scrollController]);
|
||||||
|
|
||||||
|
// ScrollController? controller;
|
||||||
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Expanded(
|
||||||
width: maxWidth,
|
flex: 7,
|
||||||
height: maxHeight,
|
child: Stack(
|
||||||
color: Colors.yellow,
|
alignment: const FractionalOffset(0.94, 0.94),
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxHeight,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
controller: scrollController,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
scrollDirection: Axis.vertical, // 设置垂直滚动
|
||||||
|
child: Obx(() {
|
||||||
|
var imageUrl = sateData.data.value?.zgtAnswer;
|
||||||
|
if (imageUrl == null) return const SizedBox();
|
||||||
|
return $TheCachedNetworkImage(
|
||||||
|
(context, imageProvider) {
|
||||||
|
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
|
||||||
|
// imageStream?.removeListener(theImageStreamListener);
|
||||||
|
// imageStream = imageWidget.image.resolve(ImageConfiguration())..addListener(theImageStreamListener);
|
||||||
|
return imageWidget;
|
||||||
|
},
|
||||||
|
imageUrl: RequestConfig.imgUrl + imageUrl,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// 继续批阅按钮
|
||||||
|
const $ContinueToReview(isFloatingAction: true)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(bottom: 14.h, top: 6.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color.fromRGBO(159, 159, 159, 0.97),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color.fromRGBO(46, 91, 255, 0.2),
|
||||||
|
offset: Offset(0, 8.w), //阴影y轴偏移量
|
||||||
|
blurRadius: 1, //阴影模糊程度
|
||||||
|
spreadRadius: 2, //阴影扩散程度
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
// 继续批阅按钮
|
|
||||||
const $ContinueToReview(isFloatingAction: true)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class _HomeworkReviewState extends State<HomeworkReview> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]);
|
// SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -81,6 +81,7 @@ dependencies:
|
||||||
syncfusion_flutter_datepicker: ^25.2.5
|
syncfusion_flutter_datepicker: ^25.2.5
|
||||||
easy_debounce: ^2.0.3 # 防抖节流
|
easy_debounce: ^2.0.3 # 防抖节流
|
||||||
flutter_hooks: ^0.20.5
|
flutter_hooks: ^0.20.5
|
||||||
|
flutter_spinkit: ^5.2.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue