From 396daee1be7be1b8f23cc11c1bf589187312809d Mon Sep 17 00:00:00 2001 From: Trang Nguyen <thi_huyen_trang.nguyen@student.reutlingen-university.de> Date: Wed, 6 Jan 2021 12:07:03 +0100 Subject: [PATCH] KAT-newBranch: TEST for dynamization of initial pages --- .../after_opening_airways.dart | 19 ++- .../lib/start_triage_system/ambulatory.dart | 16 ++- .../breathing_frequency_per_minute.dart | 23 +++- .../start_triage_system/camera_access.dart | 115 ++++++++++++++---- .../lib/start_triage_system/circulation.dart | 22 +++- .../lib/start_triage_system/lock_screen.dart | 22 +++- .../lib/start_triage_system/neurology.dart | 29 ++++- .../spontaneous_breathing_present.dart | 30 ++++- .../lib/start_triage_system/triage_data.dart | 56 +++++++++ 9 files changed, 279 insertions(+), 53 deletions(-) create mode 100644 rescueapp/lib/start_triage_system/triage_data.dart diff --git a/rescueapp/lib/start_triage_system/after_opening_airways.dart b/rescueapp/lib/start_triage_system/after_opening_airways.dart index 55f0538..fd175e2 100644 --- a/rescueapp/lib/start_triage_system/after_opening_airways.dart +++ b/rescueapp/lib/start_triage_system/after_opening_airways.dart @@ -1,9 +1,12 @@ import 'package:flutter/material.dart'; +import 'triage_data.dart'; import 'camera_access.dart'; class AfterOpeningAirways extends StatefulWidget { - AfterOpeningAirways({Key key, this.title}) : super(key: key); + AfterOpeningAirways(bool isSpontaneousBreathingPresent, {Key key, this.title}) + : super(key: key); + final String title; @override @@ -11,6 +14,8 @@ class AfterOpeningAirways extends StatefulWidget { } class _AfterOpeningAirwaysState extends State<AfterOpeningAirways> { + CategoryT1A categoryT1A = new CategoryT1A(true); + CategoryT4 categoryT4 = new CategoryT4(false); @override Widget build(BuildContext context) { return Scaffold( @@ -117,11 +122,12 @@ class _AfterOpeningAirwaysState extends State<AfterOpeningAirways> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + categoryT1A.isAfterOpeningAirways = true; Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CameraAccess()), - ); + context, + MaterialPageRoute( + builder: (context) => + CameraAccess(categoryT1A))); }))), SizedBox( height: 10, @@ -138,10 +144,11 @@ class _AfterOpeningAirwaysState extends State<AfterOpeningAirways> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + categoryT4.isAfterOpeningAirways = false; Navigator.push( context, MaterialPageRoute( - builder: (context) => CameraAccess()), + builder: (context) => CameraAccess(categoryT4)), ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/ambulatory.dart b/rescueapp/lib/start_triage_system/ambulatory.dart index 29d975a..e561c93 100644 --- a/rescueapp/lib/start_triage_system/ambulatory.dart +++ b/rescueapp/lib/start_triage_system/ambulatory.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'triage_data.dart'; import 'camera_access.dart'; import 'spontaneous_breathing_present.dart'; @@ -11,6 +12,8 @@ class Ambulatory extends StatefulWidget { } class _AmbulatoryState extends State<Ambulatory> { + CategoryT3 get categoryT3 => new CategoryT3(); + Category get category => new Category(null, null); @override Widget build(BuildContext context) { return Scaffold( @@ -62,7 +65,8 @@ class _AmbulatoryState extends State<Ambulatory> { context, MaterialPageRoute( builder: (context) => - CameraAccess()), + CameraAccess( + categoryT3)), ); } ))), SizedBox( @@ -73,18 +77,24 @@ class _AmbulatoryState extends State<Ambulatory> { height: 50, child: Container( child: RaisedButton( - child: new Text('Nein', + child + : new Text('Nein', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + category.isAmbulatory=false; + }); + Navigator.push( context, MaterialPageRoute( builder: (context) => - SpontaneousBreathingPresent()), + SpontaneousBreathingPresent(category.isAmbulatory)), + ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart b/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart index a7df891..69c5f29 100644 --- a/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart +++ b/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart @@ -1,9 +1,14 @@ import 'package:flutter/material.dart'; +import 'camera_access.dart'; +import 'triage_data.dart'; import 'circulation.dart'; class BreathingFrequencyPerMinute extends StatefulWidget { - BreathingFrequencyPerMinute({Key key, this.title}) : super(key: key); + + + BreathingFrequencyPerMinute(bool isSpontaneousBreathingPresent, {Key key, this.title}) : super(key: key); final String title; + @override _BreathingFrequencyPerMinuteState createState() => _BreathingFrequencyPerMinuteState(); @@ -11,6 +16,9 @@ class BreathingFrequencyPerMinute extends StatefulWidget { class _BreathingFrequencyPerMinuteState extends State<BreathingFrequencyPerMinute> { + Category2 get category2 => new Category2 (null, null); + CategoryT1B get categoryT1B => new CategoryT1B (false); + @override Widget build(BuildContext context) { return Scaffold( @@ -113,7 +121,13 @@ class _BreathingFrequencyPerMinuteState fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CameraAccess(categoryT1B)), + ); + }))), SizedBox( height: 10, ), @@ -129,10 +143,13 @@ class _BreathingFrequencyPerMinuteState color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + category2. isBreathingFrequencyPerMinute= false; + }); Navigator.push( context, MaterialPageRoute( - builder: (context) => CapillaryFillingTime()), + builder: (context) => CapillaryFillingTime(category2.isBreathingFrequencyPerMinute)), ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/camera_access.dart b/rescueapp/lib/start_triage_system/camera_access.dart index c35c347..2e8cd7e 100644 --- a/rescueapp/lib/start_triage_system/camera_access.dart +++ b/rescueapp/lib/start_triage_system/camera_access.dart @@ -1,25 +1,20 @@ import 'package:flutter/material.dart'; - +import 'triage_data.dart'; import 'lock_screen.dart'; class CameraAccess extends StatefulWidget { - - CameraAccess({Key key, this.title}) : super(key: key); final String title; + final Category category; + + CameraAccess(this.category, {Key key, this.title}) : super(key: key); @override _CameraAccessState createState() => _CameraAccessState(); } class _CameraAccessState extends State<CameraAccess> { - @override - void initState() { - super.initState(); - } - @override Widget build(BuildContext context) { - return Scaffold( appBar: AppBar( title: Text("KatApp"), @@ -49,12 +44,11 @@ class _CameraAccessState extends State<CameraAccess> { height: 250, width: 250, child: RaisedButton( - child: - Icon(Icons.photo_library, color: Colors.black, size: 35), + child: Icon(Icons.photo_library, + color: Colors.black, size: 35), color: Colors.grey, onPressed: null), ), - SizedBox( height: 50, ), @@ -62,18 +56,89 @@ class _CameraAccessState extends State<CameraAccess> { height: 50, width: 200, child: RaisedButton( - child: Text('Absenden', - style: TextStyle(color: Colors.white, fontSize: 20)), - color: Colors.red, - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - LockScreen()), - ); - }, - ), + child: Text('Absenden', + style: TextStyle(color: Colors.white, fontSize: 20)), + color: Colors.red, + onPressed: () { + Category category = widget.category; + if (category is CategoryT1A) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen( + categorygroup: "Kategorie T1A", + patientID: '1', + place: + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + dateTime: '15.07.2020/11:13'), + )); + } else if (category is CategoryT1B) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen( + categorygroup: "Kategorie T1B", + patientID: '1', + place: + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + dateTime: '15.07.2020/11:13'))); + } else if (category is CategoryT1C) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen( + categorygroup: "Kategorie T1C", + patientID: '1', + place: + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + dateTime: '15.07.2020/11:13'), + )); + } else if (category is CategoryT1D) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen( + categorygroup: "Kategorie T1D", + patientID: '1', + place: + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + dateTime: '15.07.2020/11:13'), + )); + } else if (category is CategoryT2) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen( + categorygroup: "Kategorie T2", + patientID: '1', + place: + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + dateTime: '15.07.2020/11:13'), + )); + } else if (category is CategoryT3) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen( + categorygroup: "Kategorie T3", + patientID: '1', + place: + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + dateTime: '15.07.2020/11:13'), + )); + } else if (category is CategoryT4) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen( + categorygroup: "Kategorie T4", + patientID: '1', + place: + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + dateTime: '15.07.2020/11:13'), + )); + } + }), ), SizedBox( height: 20, @@ -99,4 +164,4 @@ class _CameraAccessState extends State<CameraAccess> { ), ); } -} +} \ No newline at end of file diff --git a/rescueapp/lib/start_triage_system/circulation.dart b/rescueapp/lib/start_triage_system/circulation.dart index 15394d1..a6796d0 100644 --- a/rescueapp/lib/start_triage_system/circulation.dart +++ b/rescueapp/lib/start_triage_system/circulation.dart @@ -1,14 +1,21 @@ import 'package:flutter/material.dart'; +import 'camera_access.dart'; +import 'triage_data.dart'; import 'neurology.dart'; class CapillaryFillingTime extends StatefulWidget { - CapillaryFillingTime({Key key, this.title}) : super(key: key); + CapillaryFillingTime(bool isBreathingFrequencyPerMinute, {Key key, this.title}) : super(key: key); final String title; + @override _CapillaryFillingTimeState createState() => _CapillaryFillingTimeState(); } class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { + Category2 get category2 => new Category2 (false, null); + CategoryT1C get categoryT1C => new CategoryT1C (); + + @override Widget build(BuildContext context) { return Scaffold( @@ -130,7 +137,13 @@ class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CameraAccess(categoryT1C)), + ); + }))), SizedBox( height: 10, ), @@ -146,10 +159,13 @@ class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + category2.isCirculation = false; + }); Navigator.push( context, MaterialPageRoute( - builder: (context) => Neurology()), + builder: (context) => Neurology(category2.isCirculation )), ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/lock_screen.dart b/rescueapp/lib/start_triage_system/lock_screen.dart index 0d6c18a..ed10fcb 100644 --- a/rescueapp/lib/start_triage_system/lock_screen.dart +++ b/rescueapp/lib/start_triage_system/lock_screen.dart @@ -1,17 +1,26 @@ import 'package:flutter/material.dart'; + class LockScreen extends StatefulWidget { - LockScreen({Key key, this.title}) : super(key: key); + + LockScreen( {Key key, this.title, @required this.categorygroup, @required this.patientID,@required this.place,@required this.dateTime, }) : super(key: key); final String title; + final String categorygroup; + final String patientID; + final String place; + final String dateTime; + + @override _LockScreenState createState() => _LockScreenState(); } class _LockScreenState extends State<LockScreen> { + final Color myColor = Colors.white; @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.green, + backgroundColor: Colors.green, appBar: AppBar( title: Text('KatApp'), ), @@ -22,8 +31,9 @@ class _LockScreenState extends State<LockScreen> { SizedBox( height: 200, child: Container( + alignment: Alignment.center, - child: Text('Kategorie T3', + child: Text(widget.categorygroup, style: TextStyle( fontSize: 50, fontWeight: FontWeight.w900, @@ -45,7 +55,7 @@ class _LockScreenState extends State<LockScreen> { height: 40, child: Container( alignment: Alignment.centerLeft, - child: Text('1', + child: Text(widget.patientID, style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -66,7 +76,7 @@ class _LockScreenState extends State<LockScreen> { height: 90, child: Container( alignment: Alignment.centerLeft, - child: Text('Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + child: Text(widget.place, style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -88,7 +98,7 @@ class _LockScreenState extends State<LockScreen> { height: 50, child: Container( alignment: Alignment.centerLeft, - child: Text('15.07.2020/11:13', + child: Text(widget.dateTime, style: TextStyle( fontSize: 20, color: Colors.blue[900], diff --git a/rescueapp/lib/start_triage_system/neurology.dart b/rescueapp/lib/start_triage_system/neurology.dart index 5a4aa16..1f08fcd 100644 --- a/rescueapp/lib/start_triage_system/neurology.dart +++ b/rescueapp/lib/start_triage_system/neurology.dart @@ -1,13 +1,18 @@ import 'package:flutter/material.dart'; +import 'camera_access.dart'; +import 'triage_data.dart'; class Neurology extends StatefulWidget { - Neurology({Key key, this.title}) : super(key: key); + Neurology(bool isCirculation, {Key key, this.title}) : super(key: key); final String title; + @override _NeurologyState createState() => _NeurologyState(); } class _NeurologyState extends State<Neurology> { + CategoryT2 get categoryT2 => new CategoryT2 (false); + CategoryT1D get categoryT1D => new CategoryT1D (false); @override Widget build(BuildContext context) { return Scaffold( @@ -154,7 +159,16 @@ class _NeurologyState extends State<Neurology> { fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + setState(() { + categoryT1D.isNeurology = true; + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CameraAccess(categoryT2)), + ); + }))), SizedBox( height: 10, ), @@ -169,7 +183,16 @@ class _NeurologyState extends State<Neurology> { fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + setState(() { + categoryT1D.isNeurology = false; + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CameraAccess(categoryT1D)), + ); + }))), SizedBox( height: 20, ), diff --git a/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart b/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart index 75b3fe8..7d3afbe 100644 --- a/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart +++ b/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart @@ -1,10 +1,17 @@ import 'package:flutter/material.dart'; +import 'triage_data.dart'; + import 'after_opening_airways.dart'; import 'breathing_frequency_per_minute.dart'; class SpontaneousBreathingPresent extends StatefulWidget { - SpontaneousBreathingPresent({Key key, this.title}) : super(key: key); + SpontaneousBreathingPresent( + bool isAmbulatory, { + Key key, + this.title, + }) : super(key: key); final String title; + @override _SpontaneousBreathingPresentState createState() => _SpontaneousBreathingPresentState(); @@ -12,6 +19,13 @@ class SpontaneousBreathingPresent extends StatefulWidget { class _SpontaneousBreathingPresentState extends State<SpontaneousBreathingPresent> { + Category get category => new Category(false, null); + + @override + void initState() { + super.initState(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -96,12 +110,17 @@ class _SpontaneousBreathingPresentState color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + category.isSpontaneousBreathingPresent = true; + }); Navigator.push( context, MaterialPageRoute( - builder: (context) => BreathingFrequencyPerMinute()), + builder: (context) => + BreathingFrequencyPerMinute(category + .isSpontaneousBreathingPresent = true)), ); - } ))), + }))), SizedBox( height: 10, ), @@ -120,7 +139,10 @@ class _SpontaneousBreathingPresentState Navigator.push( context, MaterialPageRoute( - builder: (context) => AfterOpeningAirways()), + builder: (context) => AfterOpeningAirways( + category + .isSpontaneousBreathingPresent = false)), + ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/triage_data.dart b/rescueapp/lib/start_triage_system/triage_data.dart new file mode 100644 index 0000000..77c135e --- /dev/null +++ b/rescueapp/lib/start_triage_system/triage_data.dart @@ -0,0 +1,56 @@ +// Superclasses ---------------------------------------------------------------- + +class Category { + bool isAmbulatory; + bool isSpontaneousBreathingPresent; + + Category(this.isAmbulatory, this.isSpontaneousBreathingPresent); +} + +class Category2 extends Category { + bool isBreathingFrequencyPerMinute; + bool isCirculation; + + Category2(this.isBreathingFrequencyPerMinute, this.isCirculation) + : super(false, true); +} + +// Subclasses ------------------------------------------------------------------ + +class CategoryT1A extends Category { + bool isAfterOpeningAirways = true; + + CategoryT1A(this.isAfterOpeningAirways) : super(false, false); +} + +class CategoryT1B extends Category { + bool isBreathingFrequencyPerMinute = true; + + CategoryT1B( + this.isBreathingFrequencyPerMinute, + ) : super(false, true); +} + +class CategoryT1C extends Category2 { + CategoryT1C() : super(false, true); +} + +class CategoryT1D extends Category2 { + bool isNeurology = false; + CategoryT1D(this.isNeurology) : super(false, false); +} + +class CategoryT2 extends Category2 { + bool isNeurology = true; + CategoryT2(this.isNeurology) : super(false, false); +} + +class CategoryT3 extends Category { + CategoryT3() : super(true, null); +} + +class CategoryT4 extends Category { + bool isAfterOpeningAirways = false; + + CategoryT4(this.isAfterOpeningAirways) : super(false, false); +} -- GitLab