You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
5.7 KiB
146 lines
5.7 KiB
3 weeks ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
import 'package:problem_check_system/modules/problem/components/date_picker_button.dart';
|
||
|
import 'package:problem_check_system/modules/problem/problem_card.dart';
|
||
|
|
||
|
class ProblemPage extends StatelessWidget {
|
||
|
ProblemPage({super.key});
|
||
|
|
||
|
final List<Map<String, bool>> problemData = [
|
||
|
{"initialBound": false, "initialUploaded": false},
|
||
|
{"initialBound": true, "initialUploaded": true},
|
||
|
{"initialBound": true, "initialUploaded": false},
|
||
|
{"initialBound": false, "initialUploaded": false},
|
||
|
{"initialBound": true, "initialUploaded": true},
|
||
|
{"initialBound": true, "initialUploaded": false},
|
||
|
{"initialBound": false, "initialUploaded": false},
|
||
|
{"initialBound": true, "initialUploaded": true},
|
||
|
{"initialBound": true, "initialUploaded": false},
|
||
|
{"initialBound": false, "initialUploaded": false},
|
||
|
{"initialBound": true, "initialUploaded": true},
|
||
|
{"initialBound": true, "initialUploaded": false},
|
||
|
];
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return DefaultTabController(
|
||
|
initialIndex: 0,
|
||
|
length: 2,
|
||
|
child: Scaffold(
|
||
|
body: ConstrainedBox(
|
||
|
constraints: BoxConstraints(maxHeight: 812.h),
|
||
|
child: Column(
|
||
|
mainAxisSize: MainAxisSize.min,
|
||
|
children: [
|
||
|
Container(
|
||
|
width: 375.w,
|
||
|
height: 83.5.h,
|
||
|
alignment: Alignment.bottomLeft,
|
||
|
decoration: const BoxDecoration(
|
||
|
gradient: LinearGradient(
|
||
|
begin: Alignment.centerLeft, // 从左开始
|
||
|
end: Alignment.centerRight, // 到右结束
|
||
|
colors: [
|
||
|
Color(0xFF418CFC), // 左侧颜色
|
||
|
Color(0xFF3DBFFC), // 右侧颜色
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
child: TabBar(
|
||
|
indicatorSize: TabBarIndicatorSize.tab,
|
||
|
indicator: BoxDecoration(
|
||
|
// border: const Border(
|
||
|
// bottom: BorderSide(color: Colors.blue, width: 5.0),
|
||
|
// ),
|
||
|
color: const Color(0xfffff7f7),
|
||
|
borderRadius: BorderRadius.only(
|
||
|
topLeft: Radius.circular(8),
|
||
|
topRight: Radius.circular(60),
|
||
|
),
|
||
|
),
|
||
|
tabs: const [
|
||
|
Tab(text: '问题列表'),
|
||
|
Tab(text: '历史问题列表'),
|
||
|
],
|
||
|
labelStyle: TextStyle(
|
||
|
fontFamily: 'MyFont', // 字体名称
|
||
|
fontWeight: FontWeight.w800, // 字重
|
||
|
fontSize: 14.sp, // 字体大小
|
||
|
),
|
||
|
unselectedLabelStyle: TextStyle(
|
||
|
fontFamily: 'MyFont',
|
||
|
fontWeight: FontWeight.w800,
|
||
|
fontSize: 14.sp,
|
||
|
),
|
||
|
labelColor: Colors.black, // 选中文字颜色
|
||
|
unselectedLabelColor: Colors.white, // 未选中文字颜色
|
||
|
),
|
||
|
),
|
||
|
Expanded(
|
||
|
child: TabBarView(
|
||
|
children: [
|
||
|
Column(
|
||
|
children: [
|
||
|
Container(
|
||
|
margin: EdgeInsets.all(16),
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
children: [DatePickerButton(), DatePickerButton()],
|
||
|
),
|
||
|
),
|
||
|
Expanded(
|
||
|
child: Stack(
|
||
|
children: [
|
||
|
SingleChildScrollView(
|
||
|
child: Column(
|
||
|
children: [
|
||
|
...problemData.map((data) {
|
||
|
return ProblemCard(
|
||
|
initialBound:
|
||
|
data["initialBound"] ?? false,
|
||
|
initialUploaded:
|
||
|
data["initialUploaded"] ?? false,
|
||
|
);
|
||
|
}),
|
||
|
SizedBox(height: 64.h),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Positioned(
|
||
|
bottom: 5.h,
|
||
|
right: 160.5.w,
|
||
|
child: FloatingActionButton(
|
||
|
onPressed: () {
|
||
|
print('object');
|
||
|
},
|
||
|
shape: CircleBorder(),
|
||
|
backgroundColor: Colors.blue[300],
|
||
|
foregroundColor: Colors.white,
|
||
|
child: const Icon(Icons.add),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
ProblemCard(initialBound: false, initialUploaded: false),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
floatingActionButton: FloatingActionButton(
|
||
|
onPressed: () {
|
||
|
print('object');
|
||
|
},
|
||
|
foregroundColor: Colors.white,
|
||
|
backgroundColor: Colors.red[300],
|
||
|
child: const Icon(Icons.file_upload_outlined),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|