no message
This commit is contained in:
parent
17738ff29e
commit
8ab319c32e
|
|
@ -290,7 +290,11 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
|
||||||
var _currentTab = _useSwitchStudentAndType.currentTab.value;
|
var _currentTab = _useSwitchStudentAndType.currentTab.value;
|
||||||
var _pageIndex = _currentTab?.pageIndex;
|
var _pageIndex = _currentTab?.pageIndex;
|
||||||
if (_currentTab == null || _pageIndex == null) return;
|
if (_currentTab == null || _pageIndex == null) return;
|
||||||
_useSwitchStudentAndType.refreshQuestionTypeData(context, taskId: taskId, exitCallback: exitCallback, getNewData: false).then((value) {
|
|
||||||
|
var theLastQuestion = _currentTab.finishCount + 1 == _currentTab.total; // 当前提交的题是最后一题
|
||||||
|
_useSwitchStudentAndType
|
||||||
|
.refreshQuestionTypeData(context, taskId: taskId, exitCallback: exitCallback, getNewData: theLastQuestion)
|
||||||
|
.then((value) {
|
||||||
var params = MarkingTextQuestionJobTabParamsBus(taskId, _pageIndex);
|
var params = MarkingTextQuestionJobTabParamsBus(taskId, _pageIndex);
|
||||||
if (_currentTab.finishCount < _currentTab.total) {
|
if (_currentTab.finishCount < _currentTab.total) {
|
||||||
if (_currentTab.finishCount + 1 == _currentTab.total) {
|
if (_currentTab.finishCount + 1 == _currentTab.total) {
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
|
||||||
return tabJob;
|
return tabJob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToastUtils.showSuccess('最后一题提交成功');
|
// ToastUtils.showSuccess('最后一题提交成功');
|
||||||
}
|
}
|
||||||
return tabJob;
|
return tabJob;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -261,19 +261,10 @@ class _HomeworkCorrectionState extends ConsumerState<HomeworkCorrection>
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(flex: 1, child: SizedBox()),
|
||||||
flex: 1,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
RouterManager.router.navigateTo(context, RouterManager.jobStudentGroupPath, transition: getTransition());
|
|
||||||
},
|
|
||||||
child: Icon(IconData(0xe63e, fontFamily: "AlibabaIcon"), color: Color.fromRGBO(44, 48, 63, 1), size: 24.sp),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
if (_tabIndex == 1)
|
if (_tabIndex == 1)
|
||||||
$CompletedJobConditionFilter(
|
$CompletedJobConditionFilter(
|
||||||
controller: _tabController2,
|
controller: _tabController2,
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ class AnswerHandwritingMainBox extends HookWidget {
|
||||||
HandwritingInfo? _dataDetail = _useStateModel.handwritingDetail.value;
|
HandwritingInfo? _dataDetail = _useStateModel.handwritingDetail.value;
|
||||||
|
|
||||||
if (_data == null || _dataDetail == null) return Container();
|
if (_data == null || _dataDetail == null) return Container();
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|
@ -209,7 +210,6 @@ class UseMainBoxState with CommonMixin {
|
||||||
|
|
||||||
HandwritingInfo? getHandwritingDetail(JobHandwriting? theData) {
|
HandwritingInfo? getHandwritingDetail(JobHandwriting? theData) {
|
||||||
if (theData == null) return null;
|
if (theData == null) return null;
|
||||||
print('开始时间:${DateTime.now().millisecondsSinceEpoch}');
|
|
||||||
// 笔画分组
|
// 笔画分组
|
||||||
// var lattices = Map<int, List<Lattices>>.fromIterable(
|
// var lattices = Map<int, List<Lattices>>.fromIterable(
|
||||||
// theData.lattices,
|
// theData.lattices,
|
||||||
|
|
@ -374,6 +374,9 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
TestQuestionsImageInfo? imagInfoModel; // 试题图片数据
|
TestQuestionsImageInfo? imagInfoModel; // 试题图片数据
|
||||||
late ImageStreamListener theImageStreamListener;
|
late ImageStreamListener theImageStreamListener;
|
||||||
|
|
||||||
|
late ValueNotifier<List<GestureHandwritingRecording>> _vnHandWritings;
|
||||||
|
|
||||||
|
late RemoveListener _jobHandwritingDrawingTrajectoryListener; // 批注关闭监听
|
||||||
List<List<GestureHandwritingRecording>> _packagedHandwritingDatas = [];
|
List<List<GestureHandwritingRecording>> _packagedHandwritingDatas = [];
|
||||||
List<GestureHandwritingRecording> _packagedHandwritingDataAll = [];
|
List<GestureHandwritingRecording> _packagedHandwritingDataAll = [];
|
||||||
List<GestureHandwritingRecording> pendingData = []; // 待执行数据
|
List<GestureHandwritingRecording> pendingData = []; // 待执行数据
|
||||||
|
|
@ -384,7 +387,10 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_vnHandWritings = ValueNotifier<List<GestureHandwritingRecording>>([]);
|
||||||
|
_jobHandwritingDrawingTrajectoryListener = ref.read(jobHandwritingDrawingTrajectoryProvider.notifier).addListener((state) {
|
||||||
|
_vnHandWritings.value = state;
|
||||||
|
}, fireImmediately: false);
|
||||||
eventOn(callback: (e) {
|
eventOn(callback: (e) {
|
||||||
switch (e.runtimeType) {
|
switch (e.runtimeType) {
|
||||||
case JobHandwritingRunTimeBus:
|
case JobHandwritingRunTimeBus:
|
||||||
|
|
@ -440,6 +446,8 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
timers.forEach((e) {
|
timers.forEach((e) {
|
||||||
if (e.isActive) e.cancel();
|
if (e.isActive) e.cancel();
|
||||||
});
|
});
|
||||||
|
_jobHandwritingDrawingTrajectoryListener();
|
||||||
|
_vnHandWritings.dispose();
|
||||||
try {
|
try {
|
||||||
imageStream?.removeListener(theImageStreamListener);
|
imageStream?.removeListener(theImageStreamListener);
|
||||||
eventCancel();
|
eventCancel();
|
||||||
|
|
@ -471,7 +479,6 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
/// @param startTime 起始时间 单位秒
|
/// @param startTime 起始时间 单位秒
|
||||||
Future<void> dragProgressBarInitData(int startTime, int totalDuration) async {
|
Future<void> dragProgressBarInitData(int startTime, int totalDuration) async {
|
||||||
eventFire(model: JobHandwritingPlaybarBus(false, false));
|
eventFire(model: JobHandwritingPlaybarBus(false, false));
|
||||||
|
|
||||||
timers.forEach((e) {
|
timers.forEach((e) {
|
||||||
if (e.isActive) e.cancel();
|
if (e.isActive) e.cancel();
|
||||||
});
|
});
|
||||||
|
|
@ -486,10 +493,11 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
startTime = startTime * 1000; // 转为毫秒
|
startTime = startTime * 1000; // 转为毫秒
|
||||||
List<GestureHandwritingRecording> executeImmediately = []; // 立即执行数据
|
List<GestureHandwritingRecording> executeImmediately = []; // 立即执行数据
|
||||||
List<GestureHandwritingRecording> waitingExecution = []; // 等待执行数据
|
List<GestureHandwritingRecording> waitingExecution = []; // 等待执行数据
|
||||||
|
|
||||||
for (var i = 0; i < _packagedHandwritingDataAll.length; i++) {
|
for (var i = 0; i < _packagedHandwritingDataAll.length; i++) {
|
||||||
var item = _packagedHandwritingDataAll[i];
|
var item = _packagedHandwritingDataAll[i];
|
||||||
|
|
||||||
if (item.intervalTime <= startTime) {
|
if (item.intervalTime < startTime) {
|
||||||
// 需要直接装配到直接打印的容器
|
// 需要直接装配到直接打印的容器
|
||||||
executeImmediately.add(item);
|
executeImmediately.add(item);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -499,7 +507,7 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
stroke: item.stroke,
|
stroke: item.stroke,
|
||||||
data: item.data,
|
data: item.data,
|
||||||
usageTime: item.usageTime,
|
usageTime: item.usageTime,
|
||||||
intervalTime: intervalTime < 0 ? 0 : intervalTime,
|
intervalTime: intervalTime,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -569,26 +577,29 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List<GestureHandwritingRecording> points = ref.watch(jobHandwritingDrawingTrajectoryProvider);
|
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: CustomPaint(
|
child: RepaintBoundary(
|
||||||
foregroundPainter: DrawingPainter(points: points),
|
child: CustomPaint(
|
||||||
// size: Size(ScreenUtil().screenWidth - 60.r, widget.boxHeight),
|
willChange: true,
|
||||||
child: RepaintBoundary(
|
isComplex: true,
|
||||||
child: $TheCachedNetworkImage(
|
foregroundPainter: HandWritingDrawingPainter(ctrl: _vnHandWritings),
|
||||||
imageUrl: widget.image,
|
// size: Size(ScreenUtil().screenWidth - 60.r, widget.boxHeight),
|
||||||
(context, imageProvider) {
|
child: RepaintBoundary(
|
||||||
Image imageWidget = Image(image: imageProvider, fit: BoxFit.contain);
|
child: $TheCachedNetworkImage(
|
||||||
if (imagInfoModel == null) {
|
imageUrl: widget.image,
|
||||||
imageStream?.removeListener(theImageStreamListener);
|
(context, imageProvider) {
|
||||||
// 视图中展示图片的尺寸计算获取
|
Image imageWidget = Image(image: imageProvider, fit: BoxFit.contain);
|
||||||
imageStream = imageWidget.image.resolve(ImageConfiguration());
|
if (imagInfoModel == null) {
|
||||||
imageStream?.addListener(theImageStreamListener);
|
imageStream?.removeListener(theImageStreamListener);
|
||||||
}
|
// 视图中展示图片的尺寸计算获取
|
||||||
|
imageStream = imageWidget.image.resolve(ImageConfiguration());
|
||||||
|
imageStream?.addListener(theImageStreamListener);
|
||||||
|
}
|
||||||
|
|
||||||
return imageWidget;
|
return imageWidget;
|
||||||
},
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -596,16 +607,9 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DrawingPainter extends CustomPainter {
|
class HandWritingDrawingPainter extends CustomPainter {
|
||||||
List<GestureHandwritingRecording> points;
|
final ValueNotifier<List<GestureHandwritingRecording>> ctrl;
|
||||||
|
HandWritingDrawingPainter({required this.ctrl}) : super(repaint: ctrl);
|
||||||
DrawingPainter({required this.points}) : super();
|
|
||||||
|
|
||||||
// Paint paintBrush = Paint()
|
|
||||||
// ..color = Colors.black
|
|
||||||
// ..strokeCap = StrokeCap.round
|
|
||||||
// ..strokeWidth = 0.5.sp;
|
|
||||||
|
|
||||||
//[定义画笔]
|
//[定义画笔]
|
||||||
final Paint paintBrush = Paint()
|
final Paint paintBrush = Paint()
|
||||||
//画笔颜色
|
//画笔颜色
|
||||||
|
|
@ -613,30 +617,43 @@ class DrawingPainter extends CustomPainter {
|
||||||
//画笔笔触类型
|
//画笔笔触类型
|
||||||
..strokeCap = StrokeCap.round
|
..strokeCap = StrokeCap.round
|
||||||
//是否启动抗锯齿
|
//是否启动抗锯齿
|
||||||
// ..isAntiAlias = true
|
..isAntiAlias = true
|
||||||
//绘画风格,默认为填充
|
//绘画风格,默认为填充
|
||||||
// ..style = PaintingStyle.fill
|
// ..style = PaintingStyle.fill
|
||||||
//画笔的宽度
|
//画笔的宽度
|
||||||
..strokeWidth = 0.6.r;
|
..style = PaintingStyle.stroke
|
||||||
|
..strokeWidth = 0.5.r;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
// canvas.drawPoints(PointMode.points, thePoints, paintBrush);
|
// canvas.drawPoints(PointMode.points, thePoints, paintBrush);
|
||||||
|
canvas.save();
|
||||||
|
|
||||||
|
var points = ctrl.value;
|
||||||
var _length = points.length;
|
var _length = points.length;
|
||||||
|
print('正在绘制 ${_length}');
|
||||||
for (int i = 0; i < _length; i++) {
|
for (int i = 0; i < _length; i++) {
|
||||||
GestureHandwritingRecording item = points[i];
|
GestureHandwritingRecording item = points[i];
|
||||||
GestureHandwritingRecording? nextItem = i + 1 >= _length ? null : points[i + 1];
|
GestureHandwritingRecording? nextItem = i + 1 < _length ? points[i + 1] : null;
|
||||||
Offset? offsetData = item.data;
|
|
||||||
|
|
||||||
|
Offset offsetData = item.data;
|
||||||
Offset? nextOffsetData = nextItem?.data;
|
Offset? nextOffsetData = nextItem?.data;
|
||||||
if (nextOffsetData != null && item.stroke == nextItem?.stroke) {
|
if (nextOffsetData != null && item.stroke == nextItem?.stroke) {
|
||||||
canvas.drawLine(offsetData, nextOffsetData, paintBrush);
|
canvas.drawLine(offsetData, nextOffsetData, paintBrush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldRepaint(DrawingPainter oldDelegate) => true;
|
bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
||||||
|
if (oldDelegate is HandWritingDrawingPainter) {
|
||||||
|
var repaint = ctrl.value.length != oldDelegate.ctrl.value.length || oldDelegate.ctrl.value != ctrl.value;
|
||||||
|
print('调用是否绘制:$repaint');
|
||||||
|
return repaint;
|
||||||
|
}
|
||||||
|
return true; // 如果 oldDelegate 不是 MyCustomPainter 的实例,则总是重绘
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@swidget
|
@swidget
|
||||||
|
|
@ -665,11 +682,13 @@ Widget $pageNumberBox(int pageNum, int totalNum) {
|
||||||
@hwidget
|
@hwidget
|
||||||
Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, List<PauseIntervalTime> pauseIntervals) {
|
Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, List<PauseIntervalTime> pauseIntervals) {
|
||||||
var usePlaybar = UseBottomPlaybar.use(timeConsuming);
|
var usePlaybar = UseBottomPlaybar.use(timeConsuming);
|
||||||
|
|
||||||
useValueChanged<int, void>(timeConsuming, (_, __) {
|
useValueChanged<int, void>(timeConsuming, (_, __) {
|
||||||
|
usePlaybar.playTimingSuspend();
|
||||||
|
usePlaybar.playPause.value = false;
|
||||||
var seds = timeConsuming ~/ 1000;
|
var seds = timeConsuming ~/ 1000;
|
||||||
if ((timeConsuming % 1000) > 500) seds += 1;
|
if ((timeConsuming % 1000) > 500) seds += 1;
|
||||||
usePlaybar.handwritingDuration.value = seds;
|
usePlaybar.handwritingDuration.value = seds;
|
||||||
|
usePlaybar.constantFastSpeed.value = PlaybackSpeed.ORIGINAL_SPEED;
|
||||||
});
|
});
|
||||||
|
|
||||||
useValueChanged<int, void>(usePlaybar.handwritingDuration.value, (_, __) {
|
useValueChanged<int, void>(usePlaybar.handwritingDuration.value, (_, __) {
|
||||||
|
|
@ -700,11 +719,11 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
|
||||||
if (_val.play) {
|
if (_val.play) {
|
||||||
// 开始播放
|
// 开始播放
|
||||||
usePlaybar.playTimingStarts();
|
usePlaybar.playTimingStarts();
|
||||||
if (!usePlaybar.playPause.value) usePlaybar.playPause.value = true;
|
if (!usePlaybar.playPause.value) Future.delayed(Duration.zero, () => usePlaybar.playPause.value = true);
|
||||||
} else {
|
} else {
|
||||||
// 暂停播放
|
// 暂停播放
|
||||||
usePlaybar.playTimingSuspend();
|
usePlaybar.playTimingSuspend();
|
||||||
if (usePlaybar.playPause.value) usePlaybar.playPause.value = false;
|
if (usePlaybar.playPause.value) Future.delayed(Duration.zero, () => usePlaybar.playPause.value = false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JobHandwritingGetReadyBus:
|
case JobHandwritingGetReadyBus:
|
||||||
|
|
@ -736,6 +755,8 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
|
||||||
if (usePlaybar.handWritingReady.value)
|
if (usePlaybar.handWritingReady.value)
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => easyThrottle('job_handwriting_play_pause', () {
|
onTap: () => easyThrottle('job_handwriting_play_pause', () {
|
||||||
|
if (usePlaybar.handwritingDuration.value == 0) return ToastUtils.showInfo('没有笔迹');
|
||||||
|
|
||||||
usePlaybar.playPause.value = !usePlaybar.playPause.value;
|
usePlaybar.playPause.value = !usePlaybar.playPause.value;
|
||||||
usePlaybar.eventFire(model: JobHandwritingPlaybarBus(usePlaybar.playPause.value));
|
usePlaybar.eventFire(model: JobHandwritingPlaybarBus(usePlaybar.playPause.value));
|
||||||
}),
|
}),
|
||||||
|
|
@ -749,93 +770,96 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
|
||||||
SpinKitPouringHourGlassRefined(size: 40.sp, color: Colors.white),
|
SpinKitPouringHourGlassRefined(size: 40.sp, color: Colors.white),
|
||||||
SizedBox(width: 6.w),
|
SizedBox(width: 6.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(builder: (context, constraints) {
|
||||||
builder: (context, constraints) {
|
final double containerWidth = constraints.maxWidth; // 展示区域总宽度
|
||||||
final double containerWidth = constraints.maxWidth; // 展示区域总宽度
|
var unitScale = containerWidth / timeConsuming; // 单位刻度
|
||||||
// print('总刻度:$timeConsuming,宽度:$containerWidth');
|
var pauseIntervalsLength = pauseIntervals.length;
|
||||||
// print('总时长:${pauseIntervals.map((e) => e.toJson()).toList()}');
|
|
||||||
var unitScale = containerWidth / timeConsuming; // 单位刻度
|
|
||||||
var pauseIntervalsLength = pauseIntervals.length;
|
|
||||||
List<Widget> pauseTickMarks = pauseIntervals.asMap().keys.map((e) {
|
|
||||||
bool isLast = e == pauseIntervalsLength - 1;
|
|
||||||
bool isFirst = e == 0;
|
|
||||||
var item = pauseIntervals[e];
|
|
||||||
return Positioned(
|
|
||||||
top: 0,
|
|
||||||
left: unitScale * item.startTime,
|
|
||||||
child: Container(
|
|
||||||
width: unitScale * (item.apart ?? 0),
|
|
||||||
height: 8.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color.fromRGBO(202, 201, 201, 1),
|
|
||||||
borderRadius: isFirst
|
|
||||||
? BorderRadius.only(topLeft: Radius.circular(8.r), bottomLeft: Radius.circular(10.r))
|
|
||||||
: (isLast ? BorderRadius.only(topRight: Radius.circular(8.r), bottomRight: Radius.circular(10.r)) : null),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
return Column(
|
List<Widget> pauseTickMarks = pauseIntervals.asMap().keys.map((e) {
|
||||||
mainAxisSize: MainAxisSize.min,
|
bool isLast = e == pauseIntervalsLength - 1;
|
||||||
children: [
|
bool isFirst = e == 0;
|
||||||
Stack(
|
var item = pauseIntervals[e];
|
||||||
children: [
|
return Positioned(
|
||||||
Container(
|
top: 0,
|
||||||
height: 8.h,
|
left: unitScale * item.startTime,
|
||||||
width: containerWidth,
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
width: unitScale * (item.apart ?? 0),
|
||||||
// color: Color.fromRGBO(146, 146, 146, 1),
|
height: 8.h,
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(50.r),
|
color: Color.fromRGBO(202, 201, 201, 1),
|
||||||
),
|
borderRadius: isFirst
|
||||||
),
|
? BorderRadius.only(topLeft: Radius.circular(8.r), bottomLeft: Radius.circular(10.r))
|
||||||
...pauseTickMarks,
|
: (isLast ? BorderRadius.only(topRight: Radius.circular(8.r), bottomRight: Radius.circular(10.r)) : null),
|
||||||
Container(
|
|
||||||
height: 8.h,
|
|
||||||
// color: Theme.of(context).primaryColor,
|
|
||||||
child: SliderTheme(
|
|
||||||
data: SliderTheme.of(context).copyWith(
|
|
||||||
trackHeight: 8.h, // 轨道高度
|
|
||||||
trackShape: RoundedRectSliderTrackShape(), // 轨道形状,可以自定义
|
|
||||||
activeTrackColor: Theme.of(context).primaryColor, // 激活的轨道颜色
|
|
||||||
inactiveTrackColor: Colors.transparent, // 未激活的轨道颜色
|
|
||||||
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 0, disabledThumbRadius: 0),
|
|
||||||
thumbColor: Colors.white, // 滑块颜色
|
|
||||||
overlayShape: RoundSliderOverlayShape(overlayRadius: 0),
|
|
||||||
overlayColor: Colors.black54, // 滑块外圈颜色
|
|
||||||
// valueIndicatorShape: PaddleSliderValueIndicatorShape(), // 标签形状,可以自定义
|
|
||||||
),
|
|
||||||
child: Slider(
|
|
||||||
value: (usePlaybar.handwritingDuration.value - usePlaybar.useTime.value).toDouble(),
|
|
||||||
min: 0.0,
|
|
||||||
max: usePlaybar.handwritingDuration.value.toDouble(),
|
|
||||||
inactiveColor: Colors.transparent,
|
|
||||||
onChangeEnd: (value) {
|
|
||||||
usePlaybar.playTimingSuspend(); // 暂停计时器得暂停
|
|
||||||
usePlaybar.eventFire(model: JobHandwritingDragProgressBarBus(value.toInt(), usePlaybar.handwritingDuration.value));
|
|
||||||
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
|
|
||||||
},
|
|
||||||
onChanged: (double value) {
|
|
||||||
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 4.h),
|
),
|
||||||
Row(
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 8.h,
|
||||||
|
width: containerWidth,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
// color: Color.fromRGBO(146, 146, 146, 1),
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(50.r),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
...pauseTickMarks,
|
||||||
|
Container(
|
||||||
|
height: 8.h,
|
||||||
|
width: containerWidth,
|
||||||
|
// color: Theme.of(context).primaryColor,
|
||||||
|
child: SliderTheme(
|
||||||
|
data: SliderTheme.of(context).copyWith(
|
||||||
|
trackHeight: 8.h, // 轨道高度
|
||||||
|
trackShape: RoundedRectSliderTrackShape(), // 轨道形状,可以自定义
|
||||||
|
activeTrackColor: Theme.of(context).primaryColor, // 激活的轨道颜色
|
||||||
|
inactiveTrackColor: Colors.transparent, // 未激活的轨道颜色
|
||||||
|
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 0, disabledThumbRadius: 0),
|
||||||
|
thumbColor: Colors.white, // 滑块颜色
|
||||||
|
overlayShape: RoundSliderOverlayShape(overlayRadius: 0),
|
||||||
|
overlayColor: Colors.black54, // 滑块外圈颜色
|
||||||
|
// valueIndicatorShape: PaddleSliderValueIndicatorShape(), // 标签形状,可以自定义
|
||||||
|
),
|
||||||
|
child: Slider(
|
||||||
|
value: (usePlaybar.handwritingDuration.value - usePlaybar.useTime.value).toDouble(),
|
||||||
|
min: 0.0,
|
||||||
|
max: usePlaybar.handwritingDuration.value.toDouble(),
|
||||||
|
inactiveColor: Colors.transparent,
|
||||||
|
onChangeEnd: (value) {
|
||||||
|
if (!usePlaybar.handWritingReady.value) return;
|
||||||
|
usePlaybar.playTimingSuspend(); // 暂停计时器得暂停
|
||||||
|
usePlaybar.eventFire(model: JobHandwritingDragProgressBarBus(value.toInt(), usePlaybar.handwritingDuration.value));
|
||||||
|
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
|
||||||
|
},
|
||||||
|
onChanged: (double value) {
|
||||||
|
if (!usePlaybar.handWritingReady.value) return;
|
||||||
|
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 4.h),
|
||||||
|
SizedBox(
|
||||||
|
width: containerWidth,
|
||||||
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
quickText('累计停顿:$pauseCount次', color: Colors.white, size: 7.sp),
|
quickText('累计停顿:$pauseCount次', color: Colors.white, size: 7.sp),
|
||||||
quickText(convertSeconds(usePlaybar.useTime.value)?.toString() ?? '', color: Colors.white, size: 7.sp),
|
quickText(convertSeconds(usePlaybar.useTime.value)?.toString() ?? '', color: Colors.white, size: 7.sp),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
],
|
)
|
||||||
);
|
],
|
||||||
},
|
);
|
||||||
),
|
}),
|
||||||
),
|
),
|
||||||
SizedBox(width: 16.w),
|
SizedBox(width: 16.w),
|
||||||
InkWell(
|
InkWell(
|
||||||
|
|
@ -863,9 +887,34 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@swidget
|
class SysjTime extends StatefulWidget {
|
||||||
Widget $pauseTickMark() {
|
const SysjTime({super.key});
|
||||||
return Container();
|
|
||||||
|
@override
|
||||||
|
State<SysjTime> createState() => _SysjTimeState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SysjTimeState extends State<SysjTime> with EventBusMixin<JobHandwritingRunTimeBus> {
|
||||||
|
int useTime = 0;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
eventOn(callback: (JobHandwritingRunTimeBus e) {
|
||||||
|
useTime = e.runTimeVal;
|
||||||
|
toUpState(setState, () {}, mounted);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
eventCancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return quickText(convertSeconds(useTime)?.toString() ?? '', color: Colors.white, size: 7.sp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UseBottomPlaybar with EventBusMixin {
|
class UseBottomPlaybar with EventBusMixin {
|
||||||
|
|
@ -908,6 +957,7 @@ class UseBottomPlaybar with EventBusMixin {
|
||||||
timer.value = Timer.periodic(Duration(milliseconds: 1000 ~/ constantFastSpeed.value.speed), (theTime) {
|
timer.value = Timer.periodic(Duration(milliseconds: 1000 ~/ constantFastSpeed.value.speed), (theTime) {
|
||||||
useTime.value -= 1;
|
useTime.value -= 1;
|
||||||
if (useTime.value < 0) {
|
if (useTime.value < 0) {
|
||||||
|
theTime.cancel();
|
||||||
timer.value?.cancel();
|
timer.value?.cancel();
|
||||||
timer.value = null;
|
timer.value = null;
|
||||||
useTime.value = handwritingDuration.value;
|
useTime.value = handwritingDuration.value;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue