Compare commits
2 Commits
597b758cf2
...
8d27f76311
| Author | SHA1 | Date |
|---|---|---|
|
|
8d27f76311 | |
|
|
bdc136ba71 |
|
|
@ -46,3 +46,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
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';
|
||||||
|
|
@ -17,6 +18,7 @@ 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() {
|
||||||
|
|
@ -27,6 +29,14 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,6 +45,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
|
||||||
_animationController
|
_animationController
|
||||||
..removeListener(toUp)
|
..removeListener(toUp)
|
||||||
..dispose();
|
..dispose();
|
||||||
|
_opControllisten?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
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),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -28,7 +28,8 @@ 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) {
|
||||||
getData(); // 更新数据
|
if (e == null) return;
|
||||||
|
if (favorite.value != e.isFav) favorite.value = !favorite.value;
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
@ -39,35 +40,21 @@ 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 {
|
||||||
// ToastUtils.showLoading();
|
var data = sateData.data.value!;
|
||||||
RetrofitClient _client = await getClient();
|
var param = sateData.param.value;
|
||||||
// _client.toFavStudent(FavorParam(homeworkId: sateData.homeworkId, studentId: null, templateId: null, questionNo: null, isFav: null));
|
await getClient().toFavStudent(FavorParam(
|
||||||
// favoriteVal.isCollect = !favoriteVal.isCollect;
|
homeworkId: param.homeworkId,
|
||||||
// favoriteVal.paperId = _eventModel!.paperId;
|
studentId: data.studentId,
|
||||||
// BaseStructureResult<bool> res = await _client.toJobFavoriteCancel(favoriteVal);
|
templateId: data.templateId,
|
||||||
// if (res.success) {
|
questionNo: data.studentQuestions[0].questionNo,
|
||||||
// _future = getData(favoriteVal.taskId, favoriteVal.studentId, _eventModel!.paperId);
|
isFav: !data.isFav,
|
||||||
// widget.call();
|
));
|
||||||
// toUpState(setState, () {}, mounted);
|
favorite.value = !data.isFav;
|
||||||
// } else {
|
data.isFav = favorite.value;
|
||||||
// ToastUtils.showError(res.message ?? '操作失败,请重试');
|
|
||||||
// }
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
ToastUtils.showError('操作失败,请重试');
|
||||||
ToastUtils.dismiss();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ 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';
|
||||||
|
|
@ -24,7 +25,7 @@ class _HomeworkReviewState extends State<HomeworkReview> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,6 +63,8 @@ class _HomeworkReviewState extends State<HomeworkReview> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
floatingActionButton: const ButtonFloatingAction(),
|
||||||
|
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue