95 lines
3.9 KiB
Dart
95 lines
3.9 KiB
Dart
// 右侧抽屉(评阅记录)
|
|
import 'package:collection/collection.dart';
|
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
|
|
import 'package:marking_app/common/mixin/common.dart';
|
|
import 'package:marking_app/common/model/common/base_structure_result.dart';
|
|
import 'package:marking_app/common/model/enum/KeyboardType.dart';
|
|
import 'package:marking_app/common/model/marking/rating_progress_model.dart';
|
|
import 'package:marking_app/utils/index.dart';
|
|
import 'package:marking_app/utils/my_text.dart';
|
|
import 'package:marking_app/utils/request/rest_client.dart';
|
|
|
|
// part 'rating_progress_view.g.dart';
|
|
|
|
class RatingProgressView extends StatelessWidget with CommonMixin {
|
|
final int markingUserId;
|
|
final ScreenDirection direction;
|
|
const RatingProgressView({required this.markingUserId, required this.direction, super.key});
|
|
|
|
Future<List<RatingProgressModel>?> _getData() async {
|
|
RestClient _client = await getClient();
|
|
BaseStructureResult<List<RatingProgressModel>> result = await _client.getMarkingRatingInfo(markingUserId);
|
|
if (result.success) {
|
|
return result.data;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SafeArea(
|
|
top: false,
|
|
bottom: false,
|
|
child: Drawer(
|
|
width: MediaQuery.of(context).size.width * (ScreenDirection.HORIZONTAL_SCREEN != direction ? 0.7 : 0.35),
|
|
child: MyFutureBuilder.buildFutureBuilderOfSingleInstance<List<RatingProgressModel>>(
|
|
context,
|
|
_getData(),
|
|
(val) {
|
|
if (val == null) {
|
|
return Container(
|
|
alignment: Alignment.center,
|
|
child: quickText('获取数据失败,请重试'),
|
|
);
|
|
}
|
|
return Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(top: 4.w),
|
|
padding: EdgeInsets.only(left: 6.w),
|
|
alignment: Alignment.centerLeft,
|
|
child: quickText('评分进度数据每分钟更新一次', size: 14.sp, fontWeight: FontWeight.bold),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.symmetric(horizontal: 6.w),
|
|
child: DataTable(
|
|
horizontalMargin: 0,
|
|
columnSpacing: 0,
|
|
columns: [
|
|
DataColumn(label: Container(child: Text('题号'))),
|
|
DataColumn(label: Container(child: Text('整体进度'))),
|
|
DataColumn(label: Container(child: Text('整体均分'))),
|
|
DataColumn(label: Container(child: Text('我的均分'))),
|
|
],
|
|
rows: val
|
|
.map(
|
|
(e) => DataRow(
|
|
cells: [
|
|
DataCell(quickText(e.questionNum + '题')),
|
|
DataCell(quickText(getDoubleRemoveZero(e.schedule) + '%')),
|
|
DataCell(quickText(getDoubleRemoveZero(e.avgScore) + '分')),
|
|
DataCell(quickText(getDoubleRemoveZero(e.myAvgScore) + '分'))
|
|
],
|
|
),
|
|
)
|
|
.toList(),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|