123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- import 'package:fis_i18n/i18n.dart';
- import 'package:fis_measure/view/paint/date_structure.dart';
- import 'package:flutter/material.dart';
- /// AI诊断结果
- class ResultInfo extends StatelessWidget {
- const ResultInfo(
- this.aiDetectedObject, this.diagnosisOrgan, this.aiResultIndex,
- {Key? key})
- : super(key: key);
- final List<AIDetectedObject> aiDetectedObject;
- final int aiResultIndex;
- get isBenignlabel => aiDetectedObject[aiResultIndex].label <= 3;
- /// ai部位
- final DiagnosisOrganEnum diagnosisOrgan;
- @override
- Widget build(BuildContext context) {
- return Container(
- decoration: BoxDecoration(
- border: Border.all(
- color: Colors.grey,
- ),
- borderRadius: BorderRadius.circular(4),
- color: Colors.transparent,
- ),
- padding: const EdgeInsets.only(bottom: 10),
- child: Column(
- children: [
- Row(
- mainAxisSize: MainAxisSize.max,
- children: [
- Expanded(
- child: Container(
- decoration: const BoxDecoration(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(4),
- topRight: Radius.circular(4),
- ),
- color: Color.fromRGBO(54, 169, 206, 1),
- ),
- padding: const EdgeInsets.only(
- top: 4,
- bottom: 10,
- left: 8,
- right: 8,
- ),
- child: const Text(
- 'AI诊断结果',
- style: TextStyle(
- color: Colors.white,
- ),
- ),
- ),
- )
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- padding: const EdgeInsets.only(
- left: 10,
- ),
- child: Column(
- children: [
- _buildTitle(
- '疾病标签',
- _buildAIDiagnosticOrgans(),
- ),
- _buildTitle(
- '病灶性质',
- Text(
- isBenignlabel ? '良性' : '恶性',
- style: const TextStyle(
- color: Colors.white,
- ),
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- width: 70,
- height: 70,
- child: Stack(
- children: [
- SizedBox(
- width: 70,
- height: 70,
- child: CircularProgressIndicator(
- valueColor: AlwaysStoppedAnimation(
- _buildAITextColor(
- aiDetectedObject[aiResultIndex].label,
- ),
- ),
- backgroundColor: Colors.grey,
- value: aiDetectedObject[aiResultIndex].confidence,
- ),
- ),
- Center(
- child: SizedBox(
- width: 45,
- height: 45,
- child: Text(
- '可能性${(aiDetectedObject[aiResultIndex].confidence * 100).toStringAsFixed(1)}%',
- style: const TextStyle(
- color: Colors.white,
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ],
- ),
- );
- }
- Widget _buildTitle(String label, Widget value) {
- return Column(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- label,
- style: const TextStyle(
- color: Color.fromRGBO(54, 169, 206, 1),
- ),
- ),
- value,
- const SizedBox(
- height: 5,
- ),
- ],
- );
- }
- Widget _buildAIDiagnosticOrgans() {
- switch (diagnosisOrgan) {
- case DiagnosisOrganEnum.Null:
- return const SizedBox();
- case DiagnosisOrganEnum.placeHolder_1:
- return const SizedBox();
- case DiagnosisOrganEnum.Breast:
- return Text(
- i18nBook.remedical.breast.t,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 14,
- ),
- );
- case DiagnosisOrganEnum.Abdomen:
- return Text(
- i18nBook.bodyParts.abdomen.t,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 14,
- ),
- );
- case DiagnosisOrganEnum.Liver:
- return Text(
- i18nBook.remedical.liver.t,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 14,
- ),
- );
- case DiagnosisOrganEnum.Cholecyst:
- return Text(
- i18nBook.remedical.cholecyst.t,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 14,
- ),
- );
- case DiagnosisOrganEnum.Kidney:
- return Text(
- i18nBook.remedical.kidney.t,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 14,
- ),
- );
- case DiagnosisOrganEnum.Spleen:
- return Text(
- i18nBook.remedical.spleen.t,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 14,
- ),
- );
- default:
- return Container();
- }
- }
- Color _buildAITextColor(int label) {
- switch (label) {
- case 0:
- return Colors.lightBlue;
- case 1:
- case 2:
- case 3:
- return Colors.greenAccent;
- default:
- return Colors.redAccent;
- }
- }
- }
|