|
@@ -0,0 +1,382 @@
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+import 'package:luojigou_thinking_core/src/view/evaluation_records/evaluation_records_page_view.dart';
|
|
|
+
|
|
|
+//评估记录/报告
|
|
|
+class EvaluationRecordsOrReportsPpage extends StatefulWidget {
|
|
|
+ @override
|
|
|
+ EvaluationRecordsOrReportsPpageState createState() => new EvaluationRecordsOrReportsPpageState();
|
|
|
+}
|
|
|
+
|
|
|
+class EvaluationRecordsOrReportsPpageState extends State<EvaluationRecordsOrReportsPpage> {
|
|
|
+ late ValueNotifier<int> _notifier;
|
|
|
+ late PageController _pageController;
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ // TODO: implement initState
|
|
|
+ super.initState();
|
|
|
+ _pageController = PageController(initialPage: 0);
|
|
|
+ _notifier = ValueNotifier(0);
|
|
|
+ _notifier.addListener(() {
|
|
|
+ _pageController.jumpToPage(_notifier.value);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return Scaffold(
|
|
|
+ body: Container(
|
|
|
+ decoration: BoxDecoration(gradient: LinearGradient(colors: [Color(0xFFBFD6FF), Color(0xFFFEFEFE)], begin: Alignment.topLeft, end: Alignment.bottomRight, stops: [0, 0.5])),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ AppNavBar(context),
|
|
|
+ EvaluationRecordsTabBar(notifier: _notifier, categorys: [TbaBarModel(), TbaBarModel(), TbaBarModel()]),
|
|
|
+ EvaluationPageView(context),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Container AppNavBar(BuildContext context) {
|
|
|
+ return Container(
|
|
|
+ width: MediaQuery
|
|
|
+ .of(context)
|
|
|
+ .size
|
|
|
+ .width,
|
|
|
+ height: MediaQuery
|
|
|
+ .of(context)
|
|
|
+ .padding
|
|
|
+ .top + 44,
|
|
|
+ alignment: Alignment.bottomLeft,
|
|
|
+ child: Stack(
|
|
|
+ alignment: Alignment.bottomCenter,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ color: Colors.transparent,
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 18, vertical: 15),
|
|
|
+ child: Image.asset(
|
|
|
+ "assets/thinking_core/back.png",
|
|
|
+ width: 10.5,
|
|
|
+ height: 19,
|
|
|
+ )),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(right: 18),
|
|
|
+ child: Text(
|
|
|
+ "逻辑狗小班",
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ style: TextStyle(color: Color(0xFF666666), fontSize: 14, height: 20 / 14, fontWeight: FontWeight.w400),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(bottom: 12),
|
|
|
+ child: Text(
|
|
|
+ "评估记录/报告",
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ style: TextStyle(color: Colors.black, fontSize: 18, height: 25 / 18, fontWeight: FontWeight.w600),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget EvaluationPageView(BuildContext context) {
|
|
|
+ List<Widget> list = List.filled(3, EvaluationRecordsPageView()).toList();
|
|
|
+
|
|
|
+ return Expanded(
|
|
|
+ child: PageView(
|
|
|
+ controller: _pageController,
|
|
|
+ children: list,
|
|
|
+ onPageChanged: (index){
|
|
|
+ _notifier.value = index;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class TbaBarModel {}
|
|
|
+
|
|
|
+//评估记录TabBar
|
|
|
+class EvaluationRecordsTabBar extends StatefulWidget {
|
|
|
+ final ValueNotifier<int> notifier;
|
|
|
+ final List<TbaBarModel> categorys;
|
|
|
+
|
|
|
+ const EvaluationRecordsTabBar({
|
|
|
+ Key? key,
|
|
|
+ required this.notifier,
|
|
|
+ required this.categorys,
|
|
|
+ }) : super(key: key);
|
|
|
+
|
|
|
+ @override
|
|
|
+ EvaluationRecordsTabBarState createState() => new EvaluationRecordsTabBarState();
|
|
|
+}
|
|
|
+
|
|
|
+class EvaluationRecordsTabBarState extends State<EvaluationRecordsTabBar> {
|
|
|
+ late int _currentIndex;
|
|
|
+ late ScrollController _scrollController;
|
|
|
+ GlobalKey _key = GlobalKey();
|
|
|
+ late List<GlobalKey> _tabKeys;
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ _currentIndex = widget.notifier.value;
|
|
|
+ _scrollController = ScrollController();
|
|
|
+ _tabKeys = widget.categorys.map((TbaBarModel tab) => GlobalKey()).toList();
|
|
|
+ widget.notifier.addListener(_changeIndex);
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void dispose() {
|
|
|
+ widget.notifier.removeListener(_changeIndex);
|
|
|
+ _scrollController.dispose();
|
|
|
+ super.dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ void _changeIndex() {
|
|
|
+ if (_currentIndex != widget.notifier.value) {
|
|
|
+ setState(() {
|
|
|
+ _currentIndex = widget.notifier.value;
|
|
|
+ _scrollToCurrentIndex();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void _scrollToCurrentIndex() {
|
|
|
+ double distanceToLeft = 18;
|
|
|
+ for (int i = 0; i < _currentIndex; i++) {
|
|
|
+ distanceToLeft += 16.0 + _tabKeys[i].currentContext!.size!.width;
|
|
|
+ }
|
|
|
+ double distanceToWindow = _scrollController.position.viewportDimension / 2 - _tabKeys[_currentIndex].currentContext!.size!.width / 2;
|
|
|
+ _scrollController.animateTo(
|
|
|
+ distanceToLeft - distanceToWindow,
|
|
|
+ duration: Duration(milliseconds: 200),
|
|
|
+ curve: Curves.easeOut,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ List<Widget> tabs = List.generate(widget.categorys.length, (index) {
|
|
|
+ return Padding(
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ if (widget.notifier.value != index) {
|
|
|
+ widget.notifier.value = index;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: RecordCellView(index, context),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ return Container(
|
|
|
+ height: 169.0 + 44,
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ key: _key,
|
|
|
+ controller: _scrollController,
|
|
|
+ physics: ClampingScrollPhysics(),
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 10),
|
|
|
+ scrollDirection: Axis.horizontal,
|
|
|
+ child: Row(children: tabs),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ //评估报告
|
|
|
+ Container ReportCellView(int index, BuildContext context) {
|
|
|
+ return Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Color(0xFFFFFFFF),
|
|
|
+ borderRadius: BorderRadius.circular(15),
|
|
|
+ boxShadow: [BoxShadow(color: Color(0xB3BFD8FF), offset: Offset(0, 2), blurRadius: 20, spreadRadius: 0)],
|
|
|
+ ),
|
|
|
+ key: _tabKeys[index],
|
|
|
+ height: double.infinity,
|
|
|
+ width: 289,
|
|
|
+ //记录:MediaQuery.of(context).size.width - 62 报告:MediaQuery.of(context).size.width - 86
|
|
|
+ margin: EdgeInsets.symmetric(vertical: 22),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ width: double.infinity,
|
|
|
+ alignment: Alignment.centerLeft,
|
|
|
+ height: 37,
|
|
|
+ decoration: BoxDecoration(color: Color(0xFFD2DFFF), borderRadius: BorderRadius.only(topLeft: Radius.circular(15), topRight: Radius.circular(15))),
|
|
|
+ child: Stack(
|
|
|
+ fit: StackFit.expand,
|
|
|
+ alignment: Alignment.center,
|
|
|
+ children: [
|
|
|
+ Image.asset("assets/thinking_core/report_tab_bar_bg.png", fit: BoxFit.fitWidth),
|
|
|
+ Positioned(
|
|
|
+ left: 15,
|
|
|
+ child: Text(
|
|
|
+ "综合区",
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ style: TextStyle(color: Color(0xFF5F87F0), fontSize: 18, height: 23.5 / 18, fontFamily: "YouSheBiaoTiHei"),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: GridView.builder(
|
|
|
+ physics: NeverScrollableScrollPhysics(),
|
|
|
+ padding: EdgeInsets.all(20),
|
|
|
+ itemCount: 5,
|
|
|
+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
+ crossAxisCount: 3, //横轴三个子widget
|
|
|
+ mainAxisSpacing: 12,
|
|
|
+ crossAxisSpacing: 12,
|
|
|
+ childAspectRatio: 75 / 40),
|
|
|
+ itemBuilder: (_, index) {
|
|
|
+ return Container(
|
|
|
+ // padding: EdgeInsets.symmetric(horizontal: 7.5, vertical: 11),
|
|
|
+ alignment: Alignment.center,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Color(0xFFDDE7FF),
|
|
|
+ borderRadius: BorderRadius.circular(7),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ "观察能力",
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ maxLines: 2,
|
|
|
+ style: TextStyle(color: Color(0xFF5F87F0),
|
|
|
+ fontSize: 13,
|
|
|
+ height: 18.5 / 13,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ overflow: TextOverflow.ellipsis),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 评估记录
|
|
|
+ Container RecordCellView(int index, BuildContext context) {
|
|
|
+ return Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Color(0xFFFFFFFF),
|
|
|
+ borderRadius: BorderRadius.circular(15),
|
|
|
+ boxShadow: [BoxShadow(color: Color(0xB3BFD8FF), offset: Offset(0, 2), blurRadius: 20, spreadRadius: 0)],
|
|
|
+ ),
|
|
|
+ key: _tabKeys[index],
|
|
|
+ height: double.infinity,
|
|
|
+ width: MediaQuery
|
|
|
+ .of(context)
|
|
|
+ .size
|
|
|
+ .width - 62,
|
|
|
+ margin: EdgeInsets.symmetric(vertical: 22),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ width: double.infinity,
|
|
|
+ alignment: Alignment.centerLeft,
|
|
|
+ padding: EdgeInsets.only(left: 15),
|
|
|
+ height: 37,
|
|
|
+ decoration: BoxDecoration(color: Color(0xFFD2DFFF), borderRadius: BorderRadius.only(topLeft: Radius.circular(15), topRight: Radius.circular(15))),
|
|
|
+ child: Text(
|
|
|
+ "科学探索区域",
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ style: TextStyle(color: Color(0xFF5F87F0), fontSize: 18, height: 23.5 / 18, fontFamily: "YouSheBiaoTiHei"),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 15),
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ // color: Colors.red,
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 15),
|
|
|
+ ClipOval(
|
|
|
+ child: Container(width: 4, height: 4, color: Color(0xFF5F87F0)),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 4),
|
|
|
+ Text(
|
|
|
+ "活动名称:《有趣的溶解》",
|
|
|
+ style: TextStyle(color: Color(0xFF333333), fontSize: 14, fontWeight: FontWeight.w500),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ // color: Colors.orange,
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 15),
|
|
|
+ ClipOval(
|
|
|
+ child: Container(width: 4, height: 4, color: Color(0xFF5F87F0)),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 4),
|
|
|
+ Text(
|
|
|
+ "核心领域:科学领域",
|
|
|
+ style: TextStyle(color: Color(0xFF333333), fontSize: 14, fontWeight: FontWeight.w500),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ // color: Colors.cyan,
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 15),
|
|
|
+ ClipOval(
|
|
|
+ child: Container(width: 4, height: 4, color: Color(0xFF5F87F0)),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 4),
|
|
|
+ Text(
|
|
|
+ "核心观察能力:探索与研究",
|
|
|
+ style: TextStyle(color: Color(0xFF333333), fontSize: 14, fontWeight: FontWeight.w500),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.symmetric(vertical: 16, horizontal: 15),
|
|
|
+ height: 19,
|
|
|
+ // color: Colors.red,
|
|
|
+ child: ListView.separated(
|
|
|
+ itemCount: 4,
|
|
|
+ scrollDirection: Axis.horizontal,
|
|
|
+ separatorBuilder: (context, index) {
|
|
|
+ return SizedBox(width: 8);
|
|
|
+ },
|
|
|
+ itemBuilder: (context, index) {
|
|
|
+ return Container(
|
|
|
+ height: 19,
|
|
|
+ padding: EdgeInsets.only(left: 2.5, right: 1.5),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: Border.all(color: Color(0xFFCBCBCB), width: 1),
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ "反应能力",
|
|
|
+ style: TextStyle(color: Color(0xFF999999), fontSize: 12, height: 16.5 / 12, fontWeight: FontWeight.w500),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|