no message
This commit is contained in:
parent
4c78d903a1
commit
d9adbe845b
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.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';
|
||||
|
|
@ -27,15 +28,10 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
|
|||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
late Future<int> _future;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_future = getData();
|
||||
eventOn(callback: (JobHomeRefreshBus item) {
|
||||
_future = getData();
|
||||
toUpState(setState, () {}, mounted);
|
||||
});
|
||||
getData();
|
||||
eventOn(callback: (JobHomeRefreshBus item) => getData());
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +50,9 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
|
|||
limit: 1,
|
||||
pageType: 0,
|
||||
));
|
||||
return _result.data?.total ?? 0;
|
||||
var data = _result.data?.total ?? 0;
|
||||
eventFire(model: QuantityToBeReviewedData(data));
|
||||
return data;
|
||||
} catch (e) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -73,36 +71,9 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
|
|||
statusBarIconBrightness: Brightness.dark,
|
||||
statusBarBrightness: Brightness.light,
|
||||
),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
centerTitle: true, // 标题居中
|
||||
title: quickText('我的作业管理'),
|
||||
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
||||
elevation: 0,
|
||||
),
|
||||
backgroundColor: Color.fromRGBO(244, 244, 244, 1),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
_future = getData();
|
||||
toUpState(setState, () {}, mounted);
|
||||
},
|
||||
child: MyFutureBuilder.buildFutureBuilderOfSingleInstance<int>(context, _future, (data) {
|
||||
if (data == null)
|
||||
return Center(
|
||||
child: Container(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
_future = getData();
|
||||
toUpState(setState, () {}, mounted);
|
||||
},
|
||||
child: quickText('没有获取到数据,点击重试'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return Container(
|
||||
child: Column(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () async => eventFire(model: JobHomeRefreshBus()),
|
||||
child: ListView(
|
||||
children: [
|
||||
Container(
|
||||
height: 200.h,
|
||||
|
|
@ -115,96 +86,28 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
|
|||
),
|
||||
),
|
||||
SizedBox(height: 30.h),
|
||||
$TermRow([
|
||||
EntranceModel(
|
||||
title: '作业批阅',
|
||||
image: 'assets/images/job_home_marking.png',
|
||||
navigationUrl: '',
|
||||
),
|
||||
SlidingData([
|
||||
EntranceModel(title: '作业批阅', image: 'assets/images/job_home_marking.png', navigationUrl: ''),
|
||||
EntranceModel(
|
||||
title: '学生历史作业',
|
||||
image: 'assets/images/job_home_history.png',
|
||||
navigationUrl: '${RouterManager.jobStudentGroupPath}?page=history'),
|
||||
navigationUrl: '${RouterManager.jobStudentGroupPath}?page=history',
|
||||
),
|
||||
EntranceModel(title: '知识点点掌握', image: 'assets/images/job_home_knowledge.png', navigationUrl: '')
|
||||
], data),
|
||||
]),
|
||||
spaceWidth,
|
||||
$TermRow([
|
||||
EntranceModel(title: '答题轨迹', image: 'assets/images/job_home_answer_record.png', navigationUrl: ''),
|
||||
EntranceModel(
|
||||
title: '优先批阅设定', image: 'assets/images/job_home_youxian.png', navigationUrl: '${RouterManager.jobStudentGroupPath}?page=set')
|
||||
], data),
|
||||
title: '优先批阅设定',
|
||||
image: 'assets/images/job_home_youxian.png',
|
||||
navigationUrl: '${RouterManager.jobStudentGroupPath}?page=set',
|
||||
)
|
||||
], 0),
|
||||
spaceWidth,
|
||||
$TermRow([EntranceModel(title: '批阅设置', image: 'assets/images/job_home_marking_set.png', navigationUrl: '')], data),
|
||||
// Row(
|
||||
// children: [
|
||||
// Expanded(child: Container(
|
||||
// child: ,
|
||||
// )),
|
||||
// Expanded(child: Container()),
|
||||
// ],
|
||||
// ),
|
||||
// Expanded(
|
||||
// child:
|
||||
// GridView(
|
||||
// padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 20.w),
|
||||
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// crossAxisCount: 2,
|
||||
// mainAxisSpacing: 24.r,
|
||||
// crossAxisSpacing: 24.r,
|
||||
// childAspectRatio: 556 / 200,
|
||||
// ),
|
||||
// children: entrances.map((e) {
|
||||
// bool isJob = e.title == '作业批阅';
|
||||
|
||||
// return InkWell(
|
||||
// onTap: () => easyThrottle('GO_TO_JOB_HOME_NAVIGATION', () {
|
||||
// if (e.page != '') {
|
||||
// RouterManager.router.navigateTo(context, '${e.navigationUrl}?page=${e.page}', transition: getTransition());
|
||||
// } else {
|
||||
// RouterManager.router.navigateTo(context, e.navigationUrl, transition: getTransition());
|
||||
// }
|
||||
// }),
|
||||
// child: badges.Badge(
|
||||
// showBadge: isJob && data > 0,
|
||||
// ignorePointer: false,
|
||||
// badgeContent: quickText(data, color: Colors.white),
|
||||
// badgeAnimation: badges.BadgeAnimation.rotation(
|
||||
// animationDuration: Duration(seconds: 1),
|
||||
// colorChangeAnimationDuration: Duration(seconds: 1),
|
||||
// loopAnimation: false,
|
||||
// curve: Curves.fastOutSlowIn,
|
||||
// colorChangeAnimationCurve: Curves.easeInCubic,
|
||||
// ),
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.all(Radius.circular(6.r)),
|
||||
// border: Border.all(
|
||||
// width: 0.5.w,
|
||||
// color: Color.fromARGB(255, 219, 226, 250),
|
||||
// ),
|
||||
// ),
|
||||
// alignment: Alignment.center,
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// // Image(image: e.image),
|
||||
// Icon(
|
||||
// const IconData(0xe642, fontFamily: "AlibabaIcon"),
|
||||
// size: 12.sp,
|
||||
// ),
|
||||
// quickText(e.title, size: 12.sp),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ));
|
||||
// }).toList(),
|
||||
// ),
|
||||
// ),
|
||||
$TermRow([EntranceModel(title: '批阅设置', image: 'assets/images/job_home_marking_set.png', navigationUrl: '')], 0),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -217,6 +120,11 @@ class EntranceModel extends Object {
|
|||
EntranceModel({required this.title, required this.image, required this.navigationUrl});
|
||||
}
|
||||
|
||||
class QuantityToBeReviewedData extends Object {
|
||||
int num;
|
||||
QuantityToBeReviewedData(this.num);
|
||||
}
|
||||
|
||||
@swidget
|
||||
Widget $termRow(BuildContext context, List<EntranceModel> items, int data) {
|
||||
var leng = items.length;
|
||||
|
|
@ -263,14 +171,23 @@ Widget $termRow(BuildContext context, List<EntranceModel> items, int data) {
|
|||
@swidget
|
||||
Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHeight}) {
|
||||
bool isJob = e.title == '作业批阅';
|
||||
return InkWell(
|
||||
|
||||
return Material(
|
||||
color: Colors.white,
|
||||
elevation: 3.r,
|
||||
shadowColor: const Color.fromRGBO(231, 231, 231, 1),
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.r)),
|
||||
child: InkWell(
|
||||
onTap: () => easyThrottle('GO_TO_JOB_HOME_NAVIGATION', () {
|
||||
RouterManager.router.navigateTo(context, e.navigationUrl, transition: getTransition());
|
||||
}),
|
||||
|
||||
// splashColor: splashColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.r)),
|
||||
child: badges.Badge(
|
||||
showBadge: isJob && data > 0,
|
||||
ignorePointer: false,
|
||||
badgeContent: quickText(data, color: Colors.white),
|
||||
badgeContent: quickText(data, color: Colors.white, size: 10.sp),
|
||||
badgeAnimation: badges.BadgeAnimation.rotation(
|
||||
animationDuration: Duration(seconds: 1),
|
||||
colorChangeAnimationDuration: Duration(seconds: 1),
|
||||
|
|
@ -278,30 +195,68 @@ Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHe
|
|||
curve: Curves.fastOutSlowIn,
|
||||
colorChangeAnimationCurve: Curves.easeInCubic,
|
||||
),
|
||||
badgeStyle: badges.BadgeStyle(
|
||||
badgeColor: Color.fromRGBO(255, 105, 105, 1),
|
||||
shape: badges.BadgeShape.square,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(8.5.r), bottomRight: Radius.circular(8.5.r)),
|
||||
// borderSide: BorderSide(color: Colors.white, width: 2),
|
||||
elevation: 1,
|
||||
padding: EdgeInsets.symmetric(horizontal: isPad() ? 11.w : 16.w, vertical: 2.h),
|
||||
),
|
||||
position: badges.BadgePosition.topEnd(top: 10.r, end: 10.r),
|
||||
child: Container(
|
||||
height: theHeight,
|
||||
padding: EdgeInsets.symmetric(vertical: 18.h),
|
||||
padding: EdgeInsets.symmetric(vertical: 12.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6.r)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color.fromRGBO(231, 231, 231, 1),
|
||||
offset: Offset(4.w, 6.h), //阴影y轴偏移量
|
||||
blurRadius: 8, //阴影模糊程度
|
||||
spreadRadius: 0.2, //阴影扩散程度
|
||||
)
|
||||
],
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.r)),
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// color: const Color.fromRGBO(231, 231, 231, 1),
|
||||
// offset: Offset(4.w, 6.h), //阴影y轴偏移量
|
||||
// blurRadius: 8, //阴影模糊程度
|
||||
// spreadRadius: 0.2, //阴影扩散程度
|
||||
// )
|
||||
// ],
|
||||
// border: Border.all(width: 0.5.w, color: Color.fromARGB(255, 219, 226, 250)),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
child: isJob
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(e.image, height: 32.w, width: 32.w, fit: BoxFit.cover),
|
||||
Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
|
||||
SizedBox(height: 6.r),
|
||||
quickText(e.title, size: 12.sp, color: Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
|
||||
SizedBox(width: 6.r),
|
||||
quickText(e.title, size: 12.sp, color: Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
class SlidingData extends HookWidget with EventBusMixin {
|
||||
final List<EntranceModel> items;
|
||||
SlidingData(this.items);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var dataNumber = useState<QuantityToBeReviewedData?>(null);
|
||||
|
||||
useEffect(() {
|
||||
eventOn(callback: (QuantityToBeReviewedData data) => (dataNumber.value = data));
|
||||
return () {
|
||||
eventCancel();
|
||||
};
|
||||
}, []);
|
||||
|
||||
return $TermRow(items, dataNumber.value?.num ?? 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,8 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
|
|||
child: Scaffold(
|
||||
body: PageView(
|
||||
controller: _pageController,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
// physics: const BouncingScrollPhysics(),
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
onPageChanged: (index) => toUpState(setState, () => tabIndex = index, mounted),
|
||||
children: _bodyList,
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue