244 lines
11 KiB
Dart
244 lines
11 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:get_storage/get_storage.dart';
|
|
import 'package:school_asignment_app/common/store/app_storage_key.dart';
|
|
import 'package:school_asignment_app/common/utils/storage.dart';
|
|
import 'package:school_asignment_app/page/global_widget/global_scaffold.dart';
|
|
import 'package:school_asignment_app/page/global_widget/my_text.dart';
|
|
import 'package:school_asignment_app/page/home_page/widget/top_user_info.dart';
|
|
import 'package:school_asignment_app/routes/app_pages.dart';
|
|
|
|
import 'home_logic.dart';
|
|
|
|
class HomePage extends StatefulWidget {
|
|
const HomePage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<HomePage> createState() => _HomePageState();
|
|
}
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
final logic = Get.find<HomeLogic>();
|
|
final state = Get
|
|
.find<HomeLogic>()
|
|
.state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GlobalScaffold(
|
|
active: state.active,
|
|
body: AnnotatedRegion(
|
|
value: const SystemUiOverlayStyle(
|
|
systemNavigationBarColor: Color(0xFF000000),
|
|
systemNavigationBarDividerColor: null,
|
|
statusBarColor: Colors.white,
|
|
systemNavigationBarIconBrightness: Brightness.light,
|
|
statusBarIconBrightness: Brightness.dark,
|
|
statusBarBrightness: Brightness.light,
|
|
),
|
|
child: Scaffold(
|
|
backgroundColor: const Color.fromRGBO(244, 244, 244, 1),
|
|
body: OrientationBuilder(
|
|
builder: (BuildContext context, Orientation orientation) {
|
|
return Column(
|
|
children: <Widget>[
|
|
Container(
|
|
color: Colors.white,
|
|
margin: EdgeInsets.only(top: MediaQuery
|
|
.of(context)
|
|
.padding
|
|
.top),
|
|
padding: EdgeInsets.only(bottom: 9.h, top: 4.h),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Expanded(flex: 1, child: SizedBox()),
|
|
Expanded(
|
|
flex: 4,
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 2.h),
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: const Color.fromRGBO(243, 243, 243, 1),
|
|
borderRadius: BorderRadius.circular(8.r),
|
|
),
|
|
child: TabBar(
|
|
padding: EdgeInsets.zero,
|
|
indicatorPadding: EdgeInsets.zero,
|
|
indicatorWeight: 0,
|
|
labelPadding: EdgeInsets.symmetric(
|
|
horizontal: 2.w),
|
|
controller: logic.tabController,
|
|
unselectedLabelStyle: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: const Color.fromRGBO(69, 83, 100, 1),
|
|
),
|
|
labelStyle: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: const Color.fromRGBO(104, 136, 253, 1),
|
|
),
|
|
// labelColor: const Color.fromRGBO(45, 56, 76, 1),
|
|
indicator: const BoxDecoration(),
|
|
onTap: (index) {
|
|
state.tabIndex.value = index;
|
|
if (index == 1 && state.completedToRefresh) {
|
|
// 已阅卷
|
|
// _refreshController2.callRefresh();
|
|
state.completedToRefresh = false;
|
|
}
|
|
},
|
|
tabs: <Widget>[
|
|
Tab(
|
|
iconMargin: EdgeInsets.zero,
|
|
height: 34.h,
|
|
child: Obx(() {
|
|
return Container(
|
|
width: 140.w,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: state.tabIndex.value == 0
|
|
? const Color.fromRGBO(
|
|
255, 255, 255, 1)
|
|
: null,
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(8.r)),
|
|
),
|
|
child: quickText(
|
|
'待批阅',
|
|
size: 14.sp,
|
|
color: state.tabIndex.value == 0
|
|
? Theme
|
|
.of(context)
|
|
.primaryColor
|
|
: const Color.fromRGBO(
|
|
80, 94, 110, 1),
|
|
fontWeight: state.tabIndex.value == 0
|
|
? FontWeight.bold
|
|
: null,
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
Tab(
|
|
iconMargin: EdgeInsets.zero,
|
|
height: 34.h,
|
|
child: Obx(() {
|
|
return Container(
|
|
width: 140.w,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: state.tabIndex.value == 1
|
|
? const Color.fromRGBO(
|
|
255, 255, 255, 1)
|
|
: null,
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(8.r)),
|
|
),
|
|
child: quickText(
|
|
'已批阅',
|
|
size: 14.sp,
|
|
color: state.tabIndex.value == 1
|
|
? Theme
|
|
.of(context)
|
|
.primaryColor
|
|
: const Color.fromRGBO(
|
|
80, 94, 110, 1),
|
|
fontWeight: state.tabIndex.value == 1
|
|
? FontWeight
|
|
.bold
|
|
: null,
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
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 (state.tabIndex.value == 1)
|
|
$CompletedJobConditionFilter(
|
|
controller: _tabController2,
|
|
jobType: params2.markingType ?? 1,
|
|
customTime: _tabController2.index != 3 ||
|
|
(params2.startTime == null && params2.endTime == null)
|
|
? null
|
|
: PickerDateRange(
|
|
params2.startTime == null ? null : DateTime.parse(
|
|
params2.startTime!),
|
|
params2.endTime == null ? null : DateTime.parse(params2
|
|
.endTime!),
|
|
),
|
|
onJobTypeTap: (int jobTypeVal) {
|
|
params2.markingType = jobTypeVal;
|
|
_refreshController2.callRefresh();
|
|
},
|
|
onTimeFilter: (String? startTime, String? endTime) {
|
|
if (startTime == null && endTime == null &&
|
|
_tabController2.index == 3) {
|
|
_tabController2.animateTo(0);
|
|
}
|
|
params2.endTime = endTime;
|
|
params2.startTime = startTime;
|
|
_refreshController2.callRefresh();
|
|
},
|
|
),*/
|
|
/* Expanded(
|
|
child: Obx(() {
|
|
return IndexedStack(
|
|
index: state.tabIndex.value,
|
|
children: <Widget>[
|
|
$EasyRefresh(
|
|
controller: _refreshController1,
|
|
params: params1,
|
|
tab: 1,
|
|
data: markingDatas1,
|
|
onLoad: onMyLoad,
|
|
onRefresh: onMyRefresh,
|
|
),
|
|
$EasyRefresh(
|
|
controller: _refreshController2,
|
|
params: params2,
|
|
tab: 2,
|
|
data: markingDatas2,
|
|
onLoad: onMyLoad,
|
|
onRefresh: onMyRefresh,
|
|
),
|
|
],
|
|
);
|
|
}),
|
|
),*/
|
|
],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
Get.delete<HomeLogic>();
|
|
super.dispose();
|
|
}
|
|
} |