From 71861f9ba488ec362ea2677c9a47151aca2fcd66 Mon Sep 17 00:00:00 2001 From: Haroon Amjad <> Date: Wed, 26 Feb 2025 20:17:36 +0300 Subject: [PATCH] updates --- lib/pages/landing/home_page_2.dart | 35 +++++---- .../components/scan_condition_checklist.dart | 2 +- lib/vital_signs/components/start_button.dart | 2 +- lib/vital_signs/vital_sign.dart | 74 +++++++------------ 4 files changed, 50 insertions(+), 63 deletions(-) diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart index 31ed8b0d..6b42761d 100644 --- a/lib/pages/landing/home_page_2.dart +++ b/lib/pages/landing/home_page_2.dart @@ -70,40 +70,47 @@ class _HomePageState2 extends State { child: Container( height: MediaQuery.of(context).size.height, decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topRight, - end: Alignment.bottomLeft, - // stops: [0.1, 0.3, 0.5], - colors: [ - Color(0xff2B35E), - Color(0xff596C7C), - ], + image: DecorationImage( + image: AssetImage("assets/images/HealthSnap/background.png"), + fit: BoxFit.cover, ), ), + // decoration: BoxDecoration( + // gradient: LinearGradient( + // begin: Alignment.topRight, + // end: Alignment.bottomLeft, + // // stops: [0.1, 0.3, 0.5], + // colors: [ + // Color(0xff2B35E), + // Color(0xff596C7C), + // ], + // ), + // ), child: Stack( 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: const EdgeInsets.symmetric(horizontal: 12, vertical: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + mHeight(24.0), SvgPicture.asset( - 'assets/images/new/cloud_logo.svg', + 'assets/images/HealthSnap/logo3.svg', width: 80, height: 80, ), - mHeight(96.0), + mHeight(82.0), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "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( "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), Row( @@ -159,7 +166,7 @@ class _HomePageState2 extends State { userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117'); Navigator.push(context, FadePage(page: VitalSigns(userInfo: userInfo))); }, - color: Color(0XFF2B353E), + color: CustomColors.accentColor, disabledColor: CustomColors.grey, ), ], diff --git a/lib/vital_signs/components/scan_condition_checklist.dart b/lib/vital_signs/components/scan_condition_checklist.dart index dae17101..7335ed0f 100644 --- a/lib/vital_signs/components/scan_condition_checklist.dart +++ b/lib/vital_signs/components/scan_condition_checklist.dart @@ -20,7 +20,7 @@ class ScanConditionChecklist extends StatelessWidget { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Material( - color: Color(0xFF5d6b6c).withOpacity(.6), + color: Color(0xFF596C7C).withOpacity(0.7), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32), diff --git a/lib/vital_signs/components/start_button.dart b/lib/vital_signs/components/start_button.dart index 9193091c..d0094790 100644 --- a/lib/vital_signs/components/start_button.dart +++ b/lib/vital_signs/components/start_button.dart @@ -24,7 +24,7 @@ class StartButton extends StatelessWidget { : () { if (!disabled) onPressed(); }, - color: Colors.black, + color: Color(0xFF2B353E), disabledColor: Colors.grey, )); } diff --git a/lib/vital_signs/vital_sign.dart b/lib/vital_signs/vital_sign.dart index da71ab15..2aa7f308 100644 --- a/lib/vital_signs/vital_sign.dart +++ b/lib/vital_signs/vital_sign.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:lottie/lottie.dart'; import 'package:vital_sign_camera/vital_sign_camera.dart'; // import 'package:wakelock/wakelock.dart'; @@ -14,20 +15,18 @@ import 'components/start_button.dart'; import 'result_screen.dart'; // import 'package:lottie/lottie.dart'; -final UserInfo userInfo = UserInfo( - age: 30, - gender: Gender.male, - weight: 75, - // kg, Optional - height: 164, - // cm, Optional - waistCircumference: 83, - // cm Optional - userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117'); - -final VitalSignCameraConfig config = VitalSignCameraConfig( - apiKey: 'nIsZO45woSXSfIxsL1t79MWeIpsnGQr6B941MSF2', - serverId: ServerId.awsEnterpriseProd); +// final UserInfo userInfo = UserInfo( +// age: 30, +// gender: Gender.male, +// weight: 75, +// // kg, Optional +// height: 164, +// // cm, Optional +// waistCircumference: 83, +// // cm Optional +// userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117'); + +final VitalSignCameraConfig config = VitalSignCameraConfig(apiKey: 'nIsZO45woSXSfIxsL1t79MWeIpsnGQr6B941MSF2', serverId: ServerId.awsEnterpriseProd); class VitalSigns extends StatefulWidget { const VitalSigns({super.key, required this.userInfo}); @@ -56,10 +55,8 @@ class _VitalSignsState extends State with RouteAware { return queryCameraDevice(CameraPosition.front); } - bool startedScanning = - 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 startedScanning = 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 ScanConditions? _conditions; GetHealthStage? _scanningStage; @@ -105,39 +102,27 @@ class _VitalSignsState extends State with RouteAware { final deviceSize = MediaQuery.of(context).size; return Stack( children: [ - VitalSignCamera( - onCreated: _onVitalSignCameraCreated, - isActive: isCameraActive, - userInfo: widget.userInfo, - config: config, - device: cameraDevice, - onVideoFrameProcessed: _onVideoFrameProcessed), - if (_scanningStage != - GetHealthStage.idle) // show remaining time count down during scan + VitalSignCamera(onCreated: _onVitalSignCameraCreated, isActive: isCameraActive, userInfo: widget.userInfo, config: config, device: cameraDevice, onVideoFrameProcessed: _onVideoFrameProcessed), + if (_scanningStage != GetHealthStage.idle) // show remaining time count down during scan Align( alignment: Alignment.bottomCenter, child: Padding( padding: const EdgeInsets.only(bottom: 16.0), - child: ScanStatus( - stage: _scanningStage, remainingTime: _remainingTime), + child: ScanStatus(stage: _scanningStage, remainingTime: _remainingTime), )), if (mounted) Column(children: [ Expanded( child: CircularOverlay( - state: (_scanningStage == null || - _scanningStage == GetHealthStage.idle) - ? AnimationState.stop - : AnimationState.playing, + state: (_scanningStage == null || _scanningStage == GetHealthStage.idle) ? AnimationState.stop : AnimationState.playing, )), - if (_conditions != null) - ScanConditionChecklist( - deviceSize: deviceSize, conditions: _conditions!), + // Lottie.asset('assets/breathing.json', width: 200, height: 200, fit: BoxFit.fill), + if (_conditions != null) ScanConditionChecklist(deviceSize: deviceSize, conditions: _conditions!), + SizedBox( height: 16, ), - if (_scanningStage == GetHealthStage.idle && - isCameraActive) // show start button only when it is not scanning + if (_scanningStage == GetHealthStage.idle && isCameraActive) // show start button only when it is not scanning ...{ StartButton( onPressed: () { @@ -248,9 +233,7 @@ class _VitalSignsState extends State with RouteAware { } void _onVideoFrameProcessed(VideoFrameProcessedEvent event) { - if (!_showedHealthResult && - _healthResult == null && - event.healthResult?.health != null) { + if (!_showedHealthResult && _healthResult == null && event.healthResult?.health != null) { _showedHealthResult = true; Navigator.push( context, @@ -304,15 +287,13 @@ enum AnimationState { playing, stop } class CircularOverlay extends StatefulWidget { final AnimationState state; - const CircularOverlay({Key? key, this.state = AnimationState.stop}) - : super(key: key); + const CircularOverlay({Key? key, this.state = AnimationState.stop}) : super(key: key); @override State createState() => _CircularOverlayState(); } -class _CircularOverlayState extends State - with SingleTickerProviderStateMixin { +class _CircularOverlayState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; @override @@ -361,8 +342,7 @@ class _CircularOverlayState extends State builder: (context, child) { return CustomPaint( painter: CircularBarsPainter(animationValue: _controller.value), - size: Size(MediaQuery.sizeOf(context).width * .9, - MediaQuery.sizeOf(context).height * .8), + size: Size(MediaQuery.sizeOf(context).width * .9, MediaQuery.sizeOf(context).height * .8), ); }, );