Compare commits

..

No commits in common. "8d27f763115fd630b5365478f1b696581d7ff957" and "597b758cf2251f22932d89bdcf5a76e62879ef39" have entirely different histories.

5 changed files with 28 additions and 56 deletions

3
.gitignore vendored
View File

@ -46,6 +46,3 @@ app.*.map.json
making_school_asignment_app/*.g.dart making_school_asignment_app/*.g.dart
making_school_asignment_app/pubspec.lock making_school_asignment_app/pubspec.lock
making_school_asignment_app/lib/common/api/retrofit_client.g.dart making_school_asignment_app/lib/common/api/retrofit_client.g.dart
making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.g.dart
making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.g.dart
making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.g.dart

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -18,7 +17,6 @@ class BottomAnnotationSwitch extends StatefulWidget {
class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with SingleTickerProviderStateMixin { class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with SingleTickerProviderStateMixin {
late AnimationController _animationController; // late AnimationController _animationController; //
final _logicControl = Get.find<HomeworkReviewLogic>().annotationState; final _logicControl = Get.find<HomeworkReviewLogic>().annotationState;
StreamSubscription? _opControllisten;
@override @override
void initState() { void initState() {
@ -29,14 +27,6 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
upperBound: 1, upperBound: 1,
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
)..addListener(toUp); )..addListener(toUp);
_opControllisten = _logicControl.opControl.listen((e) {
if (e) {
_animationController.forward();
} else {
_animationController.reverse();
}
});
super.initState(); super.initState();
} }
@ -45,7 +35,6 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
_animationController _animationController
..removeListener(toUp) ..removeListener(toUp)
..dispose(); ..dispose();
_opControllisten?.cancel();
super.dispose(); super.dispose();
} }

View File

@ -1,24 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
//
class ButtonFloatingAction extends GetView<HomeworkReviewLogic> {
const ButtonFloatingAction({super.key});
@override
Widget build(BuildContext context) {
return Obx(() {
if (controller.annotationState.opControl.value) return const SizedBox();
return FloatingActionButton(
elevation: 8,
tooltip: "点击打开工具栏",
backgroundColor: Colors.white,
onPressed: () => controller.annotationState.opControl.value = true,
child: Icon(Icons.edit, size: 20.sp, color: Theme.of(context).primaryColor),
);
});
}
}

View File

@ -28,8 +28,7 @@ class _FavoriteState extends State<FavoriteWidget> with RequestToolMixin {
@override @override
void initState() { void initState() {
_listen = _controller.state.data.listen((e) { _listen = _controller.state.data.listen((e) {
if (e == null) return; getData(); //
if (favorite.value != e.isFav) favorite.value = !favorite.value;
}); });
super.initState(); super.initState();
} }
@ -40,21 +39,35 @@ class _FavoriteState extends State<FavoriteWidget> with RequestToolMixin {
super.dispose(); super.dispose();
} }
Future<void> getData() async {
// int taskId, int studentId, int paperId
// try {
// RestClient _client = await getClient();
// BaseStructureResult<bool> res = await _client.getJobCollect(taskId, studentId, paperId);
// if (res.success) return JobCollectParams(paperId, taskId, studentId, res.data ?? false);
// } catch (e) {}
// return null;
}
Future<void> toFavorite() async { Future<void> toFavorite() async {
try { try {
var data = sateData.data.value!; // ToastUtils.showLoading();
var param = sateData.param.value; RetrofitClient _client = await getClient();
await getClient().toFavStudent(FavorParam( // _client.toFavStudent(FavorParam(homeworkId: sateData.homeworkId, studentId: null, templateId: null, questionNo: null, isFav: null));
homeworkId: param.homeworkId, // favoriteVal.isCollect = !favoriteVal.isCollect;
studentId: data.studentId, // favoriteVal.paperId = _eventModel!.paperId;
templateId: data.templateId, // BaseStructureResult<bool> res = await _client.toJobFavoriteCancel(favoriteVal);
questionNo: data.studentQuestions[0].questionNo, // if (res.success) {
isFav: !data.isFav, // _future = getData(favoriteVal.taskId, favoriteVal.studentId, _eventModel!.paperId);
)); // widget.call();
favorite.value = !data.isFav; // toUpState(setState, () {}, mounted);
data.isFav = favorite.value; // } else {
// ToastUtils.showError(res.message ?? '操作失败,请重试');
// }
} catch (e) { } catch (e) {
ToastUtils.showError('操作失败,请重试'); } finally {
ToastUtils.dismiss();
} }
} }

View File

@ -6,7 +6,6 @@ import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.
import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'components/bottom_operation_bar.dart'; import 'components/bottom_operation_bar.dart';
import 'components/button_floating_action.dart';
import 'components/dropdown_switch_students_type.dart'; import 'components/dropdown_switch_students_type.dart';
import 'components/favorite_widget.dart'; import 'components/favorite_widget.dart';
import 'configuration_files/index.dart'; import 'configuration_files/index.dart';
@ -25,7 +24,7 @@ class _HomeworkReviewState extends State<HomeworkReview> {
@override @override
void initState() { void initState() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
super.initState(); super.initState();
} }
@ -63,8 +62,6 @@ class _HomeworkReviewState extends State<HomeworkReview> {
], ],
), ),
), ),
floatingActionButton: const ButtonFloatingAction(),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
); );
} }
} }