199 lines
8.3 KiB
Dart
199 lines
8.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:lamiter/Class/Diagnosis/diagnosis.dart';
|
|
import 'package:lamiter/Component/AppBar/title_app_bar.dart';
|
|
import 'package:lamiter/Component/Diagnosis/diagnosis_result_display_topbar.dart';
|
|
import 'package:lamiter/Component/Diagnosis/Report/basic_health_report_page.dart';
|
|
import 'package:lamiter/Component/Diagnosis/Report/constitution_report_page.dart';
|
|
import 'package:lamiter/Component/Diagnosis/Report/posture_issue_report_page.dart';
|
|
import 'package:lamiter/Component/bottom_popup_message.dart';
|
|
import 'package:lamiter/Extension/build_context.dart';
|
|
import 'package:lamiter/Extension/iterable.dart';
|
|
import 'package:lamiter/Page/Diagnosis/diagnosis_report_page.dart';
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
class DiagnosisCompareReportPage extends StatefulWidget {
|
|
final Diagnosis firstDiagnosis;
|
|
final Diagnosis secondDiagnosis;
|
|
|
|
const DiagnosisCompareReportPage({
|
|
super.key,
|
|
required this.firstDiagnosis,
|
|
required this.secondDiagnosis,
|
|
});
|
|
|
|
@override
|
|
State<DiagnosisCompareReportPage> createState() =>
|
|
_DiagnosisCompareReportPageState();
|
|
}
|
|
|
|
class _DiagnosisCompareReportPageState
|
|
extends State<DiagnosisCompareReportPage> {
|
|
final GlobalKey<BottomPopupMessageState> errorMessageKey =
|
|
GlobalKey<BottomPopupMessageState>();
|
|
|
|
int _index = 0;
|
|
|
|
void onValueChanged(DiagnosisReportType? value) {
|
|
if (value == null) return;
|
|
_index = value.index;
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
|
child: Scaffold(
|
|
appBar: TitleAppBar(
|
|
title: AppLocalizations.of(context).diagnosis_compare_report,
|
|
shadowColor: Colors.transparent,
|
|
),
|
|
body: Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [
|
|
// _BackgroundImage(),
|
|
SafeArea(
|
|
bottom: false,
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
child: Column(
|
|
children: [
|
|
DiagnosisResultDisplayTopbar(
|
|
onValueChanged: onValueChanged,
|
|
),
|
|
Expanded(
|
|
child: Stack(
|
|
children: [
|
|
SingleChildScrollView(
|
|
child: Column(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
<Widget>[
|
|
// 尚未處理沒有診斷報告的頁面
|
|
// 尚未處理沒有診斷報告的頁面// 尚未處理沒有診斷報告的頁面
|
|
// 尚未處理沒有診斷報告的頁面// 尚未處理沒有診斷報告的頁面// 尚未處理沒有診斷報告的頁面
|
|
|
|
BasicHealthReportPage(
|
|
healthIndexResult:
|
|
widget.firstDiagnosis.healthIndexResult,
|
|
physicalIndexResult: widget
|
|
.firstDiagnosis.physicalIndexResult,
|
|
urbanDiseaseResult: widget
|
|
.firstDiagnosis.urbanDiseaseResult,
|
|
stressIndexResult:
|
|
widget.firstDiagnosis.stressIndexResult,
|
|
sleepWellIndexResult: widget
|
|
.firstDiagnosis.sleepWellIndexResult,
|
|
),
|
|
ConstitutionReportPage(
|
|
constitutionResult: widget
|
|
.firstDiagnosis.constitutionResult,
|
|
),
|
|
PostureIssueReportPage(
|
|
postureIssueResult: widget
|
|
.firstDiagnosis.postureIssueResult,
|
|
),
|
|
][_index],
|
|
]
|
|
.lastPadding(EdgeInsets.only(bottom: 32.sp))
|
|
.toList(),
|
|
),
|
|
),
|
|
_DiagnosisDateLayout(
|
|
diagnosis: widget.firstDiagnosis,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Stack(
|
|
children: [
|
|
SingleChildScrollView(
|
|
child: Column(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
<Widget>[
|
|
// 尚未處理沒有診斷報告的頁面
|
|
// 尚未處理沒有診斷報告的頁面// 尚未處理沒有診斷報告的頁面
|
|
// 尚未處理沒有診斷報告的頁面// 尚未處理沒有診斷報告的頁面// 尚未處理沒有診斷報告的頁面
|
|
|
|
BasicHealthReportPage(
|
|
healthIndexResult: widget
|
|
.secondDiagnosis.healthIndexResult,
|
|
physicalIndexResult: widget
|
|
.secondDiagnosis.physicalIndexResult,
|
|
urbanDiseaseResult: widget
|
|
.secondDiagnosis.urbanDiseaseResult,
|
|
stressIndexResult: widget
|
|
.secondDiagnosis.stressIndexResult,
|
|
sleepWellIndexResult: widget
|
|
.secondDiagnosis.sleepWellIndexResult,
|
|
),
|
|
ConstitutionReportPage(
|
|
constitutionResult: widget
|
|
.secondDiagnosis.constitutionResult,
|
|
),
|
|
PostureIssueReportPage(
|
|
postureIssueResult: widget
|
|
.secondDiagnosis.postureIssueResult,
|
|
),
|
|
][_index],
|
|
]
|
|
.lastPadding(EdgeInsets.only(bottom: 32.sp))
|
|
.toList(),
|
|
),
|
|
),
|
|
_DiagnosisDateLayout(
|
|
diagnosis: widget.secondDiagnosis,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
]
|
|
.separator(
|
|
Container(color: context.primary, height: 0.5.sp),
|
|
)
|
|
.toList(),
|
|
),
|
|
),
|
|
),
|
|
BottomPopupMessage(
|
|
key: errorMessageKey,
|
|
height: 32.sp,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _DiagnosisDateLayout extends StatelessWidget {
|
|
final Diagnosis diagnosis;
|
|
|
|
const _DiagnosisDateLayout({required this.diagnosis});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 2.sp),
|
|
child: RotatedBox(
|
|
quarterTurns: 1,
|
|
child: Text(
|
|
'${diagnosis.startTime.year}-${diagnosis.startTime.month}-${diagnosis.startTime.day} ${diagnosis.startTime.hour}:${diagnosis.startTime.minute}:${diagnosis.startTime.second}',
|
|
style: context.lS!.copyWith(
|
|
fontSize: 9.sp,
|
|
color: context.inverseSurface.withOpacity(0.5),
|
|
fontWeight: FontWeight.w700,
|
|
letterSpacing: 1.sp,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|