dev_v3.13.6_CS_V2
Haroon Amjad 1 year ago
parent 2c721830e9
commit 71861f9ba4

@ -70,40 +70,47 @@ class _HomePageState2 extends State<HomePage2> {
child: Container( child: Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( image: DecorationImage(
begin: Alignment.topRight, image: AssetImage("assets/images/HealthSnap/background.png"),
end: Alignment.bottomLeft, fit: BoxFit.cover,
// stops: [0.1, 0.3, 0.5],
colors: [
Color(0xff2B35E),
Color(0xff596C7C),
],
), ),
), ),
// decoration: BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topRight,
// end: Alignment.bottomLeft,
// // stops: [0.1, 0.3, 0.5],
// colors: [
// Color(0xff2B35E),
// Color(0xff596C7C),
// ],
// ),
// ),
child: Stack( child: Stack(
children: [ children: [
SvgPicture.asset("assets/images/HealthSnap/background.svg", height: MediaQuery.sizeOf(context).height,width: MediaQuery.sizeOf(context).width), // SvgPicture.asset("assets/images/HealthSnap/background.svg", height: MediaQuery.sizeOf(context).height,width: MediaQuery.sizeOf(context).width),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
mHeight(24.0),
SvgPicture.asset( SvgPicture.asset(
'assets/images/new/cloud_logo.svg', 'assets/images/HealthSnap/logo3.svg',
width: 80, width: 80,
height: 80, height: 80,
), ),
mHeight(96.0), mHeight(82.0),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Welcome To", "Welcome To",
style: TextStyle(color: Color(0XFF2B353E), fontSize: 22, letterSpacing: 1.28, fontWeight: FontWeight.normal), style: TextStyle(color: Colors.white, fontSize: 24, letterSpacing: 1.28, fontWeight: FontWeight.normal),
), ),
Text( Text(
"HealthSnap", "HealthSnap",
style: TextStyle(color: Color(0XFF2B353E), fontSize: 26, letterSpacing: 1.28, fontWeight: FontWeight.bold), style: TextStyle(color: Colors.white, fontSize: 26, letterSpacing: 1.28, fontWeight: FontWeight.bold),
), ),
mHeight(84.0), mHeight(84.0),
Row( Row(
@ -159,7 +166,7 @@ class _HomePageState2 extends State<HomePage2> {
userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117'); userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117');
Navigator.push(context, FadePage(page: VitalSigns(userInfo: userInfo))); Navigator.push(context, FadePage(page: VitalSigns(userInfo: userInfo)));
}, },
color: Color(0XFF2B353E), color: CustomColors.accentColor,
disabledColor: CustomColors.grey, disabledColor: CustomColors.grey,
), ),
], ],

@ -20,7 +20,7 @@ class ScanConditionChecklist extends StatelessWidget {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Material( child: Material(
color: Color(0xFF5d6b6c).withOpacity(.6), color: Color(0xFF596C7C).withOpacity(0.7),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32), padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32),

@ -24,7 +24,7 @@ class StartButton extends StatelessWidget {
: () { : () {
if (!disabled) onPressed(); if (!disabled) onPressed();
}, },
color: Colors.black, color: Color(0xFF2B353E),
disabledColor: Colors.grey, disabledColor: Colors.grey,
)); ));
} }

@ -3,6 +3,7 @@ import 'dart:math';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:lottie/lottie.dart';
import 'package:vital_sign_camera/vital_sign_camera.dart'; import 'package:vital_sign_camera/vital_sign_camera.dart';
// import 'package:wakelock/wakelock.dart'; // import 'package:wakelock/wakelock.dart';
@ -14,20 +15,18 @@ import 'components/start_button.dart';
import 'result_screen.dart'; import 'result_screen.dart';
// import 'package:lottie/lottie.dart'; // import 'package:lottie/lottie.dart';
final UserInfo userInfo = UserInfo( // final UserInfo userInfo = UserInfo(
age: 30, // age: 30,
gender: Gender.male, // gender: Gender.male,
weight: 75, // weight: 75,
// kg, Optional // // kg, Optional
height: 164, // height: 164,
// cm, Optional // // cm, Optional
waistCircumference: 83, // waistCircumference: 83,
// cm Optional // // cm Optional
userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117'); // userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117');
final VitalSignCameraConfig config = VitalSignCameraConfig( final VitalSignCameraConfig config = VitalSignCameraConfig(apiKey: 'nIsZO45woSXSfIxsL1t79MWeIpsnGQr6B941MSF2', serverId: ServerId.awsEnterpriseProd);
apiKey: 'nIsZO45woSXSfIxsL1t79MWeIpsnGQr6B941MSF2',
serverId: ServerId.awsEnterpriseProd);
class VitalSigns extends StatefulWidget { class VitalSigns extends StatefulWidget {
const VitalSigns({super.key, required this.userInfo}); const VitalSigns({super.key, required this.userInfo});
@ -56,10 +55,8 @@ class _VitalSignsState extends State<VitalSigns> with RouteAware {
return queryCameraDevice(CameraPosition.front); return queryCameraDevice(CameraPosition.front);
} }
bool startedScanning = bool startedScanning = false; // set true when start button is pressed, set false when health result is tapped or error occurs
false; // set true when start button is pressed, set false when health result is tapped or error occurs bool isAllConditionsMet = false; // check for the 6 scan conditions before enabling the start button
bool isAllConditionsMet =
false; // check for the 6 scan conditions before enabling the start button
ScanConditions? _conditions; ScanConditions? _conditions;
GetHealthStage? _scanningStage; GetHealthStage? _scanningStage;
@ -105,39 +102,27 @@ class _VitalSignsState extends State<VitalSigns> with RouteAware {
final deviceSize = MediaQuery.of(context).size; final deviceSize = MediaQuery.of(context).size;
return Stack( return Stack(
children: [ children: [
VitalSignCamera( VitalSignCamera(onCreated: _onVitalSignCameraCreated, isActive: isCameraActive, userInfo: widget.userInfo, config: config, device: cameraDevice, onVideoFrameProcessed: _onVideoFrameProcessed),
onCreated: _onVitalSignCameraCreated, if (_scanningStage != GetHealthStage.idle) // show remaining time count down during scan
isActive: isCameraActive,
userInfo: widget.userInfo,
config: config,
device: cameraDevice,
onVideoFrameProcessed: _onVideoFrameProcessed),
if (_scanningStage !=
GetHealthStage.idle) // show remaining time count down during scan
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: Padding( child: Padding(
padding: const EdgeInsets.only(bottom: 16.0), padding: const EdgeInsets.only(bottom: 16.0),
child: ScanStatus( child: ScanStatus(stage: _scanningStage, remainingTime: _remainingTime),
stage: _scanningStage, remainingTime: _remainingTime),
)), )),
if (mounted) if (mounted)
Column(children: [ Column(children: [
Expanded( Expanded(
child: CircularOverlay( child: CircularOverlay(
state: (_scanningStage == null || state: (_scanningStage == null || _scanningStage == GetHealthStage.idle) ? AnimationState.stop : AnimationState.playing,
_scanningStage == GetHealthStage.idle)
? AnimationState.stop
: AnimationState.playing,
)), )),
if (_conditions != null) // Lottie.asset('assets/breathing.json', width: 200, height: 200, fit: BoxFit.fill),
ScanConditionChecklist( if (_conditions != null) ScanConditionChecklist(deviceSize: deviceSize, conditions: _conditions!),
deviceSize: deviceSize, conditions: _conditions!),
SizedBox( SizedBox(
height: 16, height: 16,
), ),
if (_scanningStage == GetHealthStage.idle && if (_scanningStage == GetHealthStage.idle && isCameraActive) // show start button only when it is not scanning
isCameraActive) // show start button only when it is not scanning
...{ ...{
StartButton( StartButton(
onPressed: () { onPressed: () {
@ -248,9 +233,7 @@ class _VitalSignsState extends State<VitalSigns> with RouteAware {
} }
void _onVideoFrameProcessed(VideoFrameProcessedEvent event) { void _onVideoFrameProcessed(VideoFrameProcessedEvent event) {
if (!_showedHealthResult && if (!_showedHealthResult && _healthResult == null && event.healthResult?.health != null) {
_healthResult == null &&
event.healthResult?.health != null) {
_showedHealthResult = true; _showedHealthResult = true;
Navigator.push( Navigator.push(
context, context,
@ -304,15 +287,13 @@ enum AnimationState { playing, stop }
class CircularOverlay extends StatefulWidget { class CircularOverlay extends StatefulWidget {
final AnimationState state; final AnimationState state;
const CircularOverlay({Key? key, this.state = AnimationState.stop}) const CircularOverlay({Key? key, this.state = AnimationState.stop}) : super(key: key);
: super(key: key);
@override @override
State<CircularOverlay> createState() => _CircularOverlayState(); State<CircularOverlay> createState() => _CircularOverlayState();
} }
class _CircularOverlayState extends State<CircularOverlay> class _CircularOverlayState extends State<CircularOverlay> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
late AnimationController _controller; late AnimationController _controller;
@override @override
@ -361,8 +342,7 @@ class _CircularOverlayState extends State<CircularOverlay>
builder: (context, child) { builder: (context, child) {
return CustomPaint( return CustomPaint(
painter: CircularBarsPainter(animationValue: _controller.value), painter: CircularBarsPainter(animationValue: _controller.value),
size: Size(MediaQuery.sizeOf(context).width * .9, size: Size(MediaQuery.sizeOf(context).width * .9, MediaQuery.sizeOf(context).height * .8),
MediaQuery.sizeOf(context).height * .8),
); );
}, },
); );

Loading…
Cancel
Save