diff --git a/.gitignore b/.gitignore index 0cb371a..8d99daf 100644 --- a/.gitignore +++ b/.gitignore @@ -221,3 +221,4 @@ marking_app/lib/pages/homework_correction/job_knowledge_points.g.dart marking_app/lib/pages/homework_correction/job_knowledge_points_detail.g.dart marking_app/lib/common/model/job/job_knowledge_detail_student.g.dart marking_app/lib/common/model/job/job_knowledge_detail_student.g.dart +marking_app/lib/pages/homework_correction/job_home.g.dart diff --git a/marking_app/assets/images/2.0x/job_home_top_bgm.png b/marking_app/assets/images/2.0x/job_home_top_bgm.png new file mode 100644 index 0000000..6983041 Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_top_bgm.png differ diff --git a/marking_app/assets/images/3.0x/job_home_top_bgm.png b/marking_app/assets/images/3.0x/job_home_top_bgm.png new file mode 100644 index 0000000..7a62344 Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_top_bgm.png differ diff --git a/marking_app/assets/images/4.0x/job_home_top_bgm.png b/marking_app/assets/images/4.0x/job_home_top_bgm.png new file mode 100644 index 0000000..11513dc Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_top_bgm.png differ diff --git a/marking_app/assets/images/job_home_top_bgm.png b/marking_app/assets/images/job_home_top_bgm.png new file mode 100644 index 0000000..2515c1e Binary files /dev/null and b/marking_app/assets/images/job_home_top_bgm.png differ diff --git a/marking_app/lib/pages/homework_correction/job_home.dart b/marking_app/lib/pages/homework_correction/job_home.dart index f82a76c..fe15daa 100644 --- a/marking_app/lib/pages/homework_correction/job_home.dart +++ b/marking_app/lib/pages/homework_correction/job_home.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.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/event_bus/job_home_refresh_bus.dart'; import 'package:marking_app/common/model/marking/marking_list_params.dart'; @@ -13,6 +14,8 @@ import 'package:badges/badges.dart' as badges; import '../../utils/my_future_builder.dart'; +part 'job_home.g.dart'; + class JobHome extends StatefulWidget { const JobHome({super.key}); @@ -35,8 +38,7 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto title: '学生历史作业', image: '', navigationUrl: RouterManager.jobStudentGroupPath, - page:'history', - + page: 'history', ), EntranceModel( title: '知识点掌握', @@ -52,7 +54,7 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto title: '优先批阅设定', image: '', navigationUrl: RouterManager.jobStudentGroupPath, - page:'set', + page: 'set', ), EntranceModel( title: '批阅设置', @@ -111,6 +113,7 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto centerTitle: true, // 标题居中 title: quickText('我的作业管理'), systemOverlayStyle: SystemUiOverlayStyle.dark, + elevation: 0, ), backgroundColor: Color.fromRGBO(244, 244, 244, 1), body: RefreshIndicator( @@ -133,56 +136,97 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto ); return Container( - padding: EdgeInsets.symmetric(vertical: 40.h, horizontal: 20.w), - child: GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - mainAxisSpacing: 24.r, - crossAxisSpacing: 24.r, - childAspectRatio: 556 / 200, - ), - children: entrances.map((e) { - bool isJob = e.title == '作业批阅'; + child: Column( + children: [ + Container( + height: 200.h, + width: double.infinity, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/job_home_top_bgm.png'), + fit: BoxFit.fill, // 完全填充 + ), + ), + ), + $TermRow([ + EntranceModel( + title: '答题轨迹', + image: '', + navigationUrl: '', + ), + EntranceModel( + title: '优先批阅设定', + image: '', + navigationUrl: RouterManager.jobStudentGroupPath, + page: 'set', + ), + ], 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), - quickText(e.title, size: 12.sp), - ], - ), - ), - )); - }).toList(), + // 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(), + // ), + // ), + ], ), ); }), @@ -197,5 +241,157 @@ class EntranceModel extends Object { String image; String navigationUrl; String? page; - EntranceModel({required this.title, required this.image, required this.navigationUrl,this.page = ''}); + EntranceModel({required this.title, required this.image, required this.navigationUrl, this.page = ''}); +} + +@swidget +Widget $termRow(BuildContext context, List items, int data) { + var leng = items.length; + Widget childWidget; + switch (leng) { + case 1: + var e = items[0]; + bool isJob = e.title == '作业批阅'; + childWidget = 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), + ], + ), + ), + )); + break; + case 2: + childWidget = Row( + children: items.map((e) { + var e = items[0]; + 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(), + ); + + break; + case 3: + var e = items[0]; + bool isJob = e.title == '作业批阅'; + childWidget = 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), + ], + ), + ), + )); + break; + default: + childWidget = Container(); + } + + return Container(child: childWidget); }