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/pubspec.lock
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_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -18,7 +17,6 @@ class BottomAnnotationSwitch extends StatefulWidget {
class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with SingleTickerProviderStateMixin {
late AnimationController _animationController; //
final _logicControl = Get.find<HomeworkReviewLogic>().annotationState;
StreamSubscription? _opControllisten;
@override
void initState() {
@ -29,14 +27,6 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
upperBound: 1,
duration: const Duration(milliseconds: 300),
)..addListener(toUp);
_opControllisten = _logicControl.opControl.listen((e) {
if (e) {
_animationController.forward();
} else {
_animationController.reverse();
}
});
super.initState();
}
@ -45,7 +35,6 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
_animationController
..removeListener(toUp)
..dispose();
_opControllisten?.cancel();
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
void initState() {
_listen = _controller.state.data.listen((e) {
if (e == null) return;
if (favorite.value != e.isFav) favorite.value = !favorite.value;
getData(); //
});
super.initState();
}
@ -40,21 +39,35 @@ class _FavoriteState extends State<FavoriteWidget> with RequestToolMixin {
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 {
try {
var data = sateData.data.value!;
var param = sateData.param.value;
await getClient().toFavStudent(FavorParam(
homeworkId: param.homeworkId,
studentId: data.studentId,
templateId: data.templateId,
questionNo: data.studentQuestions[0].questionNo,
isFav: !data.isFav,
));
favorite.value = !data.isFav;
data.isFav = favorite.value;
// ToastUtils.showLoading();
RetrofitClient _client = await getClient();
// _client.toFavStudent(FavorParam(homeworkId: sateData.homeworkId, studentId: null, templateId: null, questionNo: null, isFav: null));
// favoriteVal.isCollect = !favoriteVal.isCollect;
// favoriteVal.paperId = _eventModel!.paperId;
// BaseStructureResult<bool> res = await _client.toJobFavoriteCancel(favoriteVal);
// if (res.success) {
// _future = getData(favoriteVal.taskId, favoriteVal.studentId, _eventModel!.paperId);
// widget.call();
// toUpState(setState, () {}, mounted);
// } else {
// ToastUtils.showError(res.message ?? '操作失败,请重试');
// }
} 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 'components/bottom_operation_bar.dart';
import 'components/button_floating_action.dart';
import 'components/dropdown_switch_students_type.dart';
import 'components/favorite_widget.dart';
import 'configuration_files/index.dart';
@ -25,7 +24,7 @@ class _HomeworkReviewState extends State<HomeworkReview> {
@override
void initState() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]);
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
super.initState();
}
@ -63,8 +62,6 @@ class _HomeworkReviewState extends State<HomeworkReview> {
],
),
),
floatingActionButton: const ButtonFloatingAction(),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
);
}
}