diff --git a/lib/pages/conference/conference_page.dart b/lib/pages/conference/conference_page.dart index 7848d4f7..dc00bf6e 100644 --- a/lib/pages/conference/conference_page.dart +++ b/lib/pages/conference/conference_page.dart @@ -101,7 +101,7 @@ class _ConferencePageState extends State { return WillPopScope( onWillPop: () async => false, child: Scaffold( - backgroundColor: Colors.black, + backgroundColor: Colors.white, body: _conferenceRoom == null ? showProgress() : buildLayout(), ), ); diff --git a/lib/pages/conference/web_rtc/call_home_page.dart b/lib/pages/conference/web_rtc/call_home_page.dart new file mode 100644 index 00000000..7153bf92 --- /dev/null +++ b/lib/pages/conference/web_rtc/call_home_page.dart @@ -0,0 +1,172 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +import '../conference_button_bar.dart'; + +class CallHomePage extends StatefulWidget { + @override + _CallHomePageState createState() => _CallHomePageState(); +} + +class _CallHomePageState extends State { + bool showNoise = false; + RTCVideoRenderer _localRenderer = RTCVideoRenderer(); + RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); + + final StreamController _audioButton = StreamController.broadcast(); + final StreamController _videoButton = StreamController.broadcast(); + final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); + final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); + + //Stream to enable video + MediaStream stream; + + @override + void initState() { + // TODO: implement initState + super.initState(); + _localRenderer.initialize(); + _remoteRenderer.initialize(); + + enableVideo(); + } + + enableVideo() async { + //Stream to enable video + stream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); + // _audioButton.add(false); + } + + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + _localRenderer.dispose(); + _remoteRenderer.dispose(); + _audioButton.close(); + _videoButton.close(); + stream.dispose(); + _disposeStreamsAndSubscriptions(); + } + + Future _disposeStreamsAndSubscriptions() async { + if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); + if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); + } + + @override + Widget build(BuildContext context) { + // return WillPopScope( + // onWillPop: () async => false, + // child: Scaffold( + // backgroundColor: Colors.black, + // // body: , + // ), + // ); + + return Scaffold( + backgroundColor: Colors.white, + body: showNoise ? _buildNoiseBox() : buildLayout(), + ); + } + + LayoutBuilder buildLayout() { + return LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + return Stack( + children: [ + CamViewWidget( + localRenderer: _localRenderer, + remoteRenderer: _remoteRenderer, + stream: stream, + constraints: constraints, + onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, + onButtonBarHeightStreamController: _onButtonBarHeightStreamController, + ), + ConferenceButtonBar( + audioEnabled: _audioButton.stream, + videoEnabled: _videoButton.stream, + onAudioEnabled: _onAudioEnable, + onVideoEnabled: _onVideoEnabled, + onSwitchCamera: _onSwitchCamera, + onHangup: _onHangup, + onPersonAdd: () {}, + onPersonRemove: () {}, + onHeight: _onHeightBar, + onShow: _onShowBar, + onHide: _onHideBar, + ), + ], + ); + }, + ); + } + + NoiseBox _buildNoiseBox() { + return NoiseBox( + density: NoiseBoxDensity.xLow, + backgroundColor: Colors.grey.shade900, + child: Center( + child: Container( + color: Colors.black54, + width: double.infinity, + height: 40, + child: Center( + child: Text( + 'Waiting for another participant to connect to the call...', + key: Key('text-wait'), + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), + ), + ), + ), + ); + } + + Function _onAudioEnable() { + bool enabled = stream.getAudioTracks()[0].enabled; + stream.getAudioTracks()[0].enabled = !enabled; + _audioButton.add(!enabled); + } + + Function _onVideoEnabled() { + bool enabled = stream.getVideoTracks()[0].enabled; + stream.getVideoTracks()[0].enabled = !enabled; + _videoButton.add(!enabled); + } + + Function _onSwitchCamera() { + // stream.getAudioTracks()[0].enabled = false; + // stream.getVideoTracks()[0].enabled = false; + Helper.switchCamera(stream.getVideoTracks()[0]); + } + + void _onShowBar() { + setState(() { + SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]); + }); + _onButtonBarVisibleStreamController.add(true); + } + + void _onHeightBar(double height) { + _onButtonBarHeightStreamController.add(height); + } + + void _onHideBar() { + setState(() { + SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); + }); + _onButtonBarVisibleStreamController.add(false); + } + + Future _onHangup() async { + print('onHangup'); + Navigator.of(context).pop(); + } +} diff --git a/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart new file mode 100644 index 00000000..3db0c74b --- /dev/null +++ b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart @@ -0,0 +1,61 @@ +import 'dart:async'; +import 'dart:core'; + +import 'package:flutter/material.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +import 'draggable_cam.dart'; + +class CamViewWidget extends StatefulWidget { + RTCVideoRenderer localRenderer; + RTCVideoRenderer remoteRenderer; + MediaStream stream; + BoxConstraints constraints; + StreamController onButtonBarVisibleStreamController; + StreamController onButtonBarHeightStreamController; + + CamViewWidget({this.localRenderer, this.remoteRenderer, this.stream, this.constraints, this.onButtonBarVisibleStreamController, this.onButtonBarHeightStreamController}); + + @override + _CamViewWidgetState createState() => _CamViewWidgetState(); +} + +class _CamViewWidgetState extends State { + @override + void initState() { + super.initState(); + Future.delayed(const Duration(milliseconds: 300), () { + showCamera(); + }); + } + + showCamera() async { + setState(() async { + widget.localRenderer.srcObject = widget.stream; + widget.remoteRenderer.srcObject = widget.stream; + }); + } + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: double.infinity, + child: Stack( + children: [ + Container( + child: RTCVideoView(widget.localRenderer, mirror: true), + ), + DraggableCam( + key: Key('publisher'), + onButtonBarHeight: widget.onButtonBarHeightStreamController.stream, + onButtonBarVisible: widget.onButtonBarVisibleStreamController.stream, + availableScreenSize: widget.constraints.biggest, + child: RTCVideoView(widget.remoteRenderer), + ), + // Expanded(child: RTCVideoView(widget.remoteRenderer)), + ], + ), + ); + } +} diff --git a/lib/pages/conference/web_rtc/widgets/draggable_cam.dart b/lib/pages/conference/web_rtc/widgets/draggable_cam.dart new file mode 100644 index 00000000..efc59301 --- /dev/null +++ b/lib/pages/conference/web_rtc/widgets/draggable_cam.dart @@ -0,0 +1,173 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:diplomaticquarterapp/pages/conference/clipped_video.dart'; +import 'package:flutter/material.dart'; + +class DraggableCam extends StatefulWidget { + final Size availableScreenSize; + final Widget child; + final double scaleFactor; + final Stream onButtonBarVisible; + final Stream onButtonBarHeight; + + const DraggableCam({ + Key key, + @required this.availableScreenSize, + this.child, + @required this.onButtonBarVisible, + @required this.onButtonBarHeight, + + /// The portion of the screen the DraggableWidget should use. + this.scaleFactor = .25, + }) : assert(scaleFactor != null && scaleFactor > 0 && scaleFactor <= .4), + assert(availableScreenSize != null), + assert(onButtonBarVisible != null), + assert(onButtonBarHeight != null), + super(key: key); + + @override + _DraggablePublisherState createState() => _DraggablePublisherState(); +} + +class _DraggablePublisherState extends State { + bool _isButtonBarVisible = true; + double _buttonBarHeight = 0; + double _width; + double _height; + double _top; + double _left; + double _viewPaddingTop; + double _viewPaddingBottom; + final double _padding = 8.0; + final Duration _duration300ms = const Duration(milliseconds: 300); + final Duration _duration0ms = const Duration(milliseconds: 0); + Duration _duration; + StreamSubscription _streamSubscription; + StreamSubscription _streamHeightSubscription; + + @override + void initState() { + super.initState(); + _duration = _duration300ms; + _width = widget.availableScreenSize.width * widget.scaleFactor; + _height = _width * (widget.availableScreenSize.height / widget.availableScreenSize.width); + _top = widget.availableScreenSize.height - (_buttonBarHeight + _padding) - _height; + _left = widget.availableScreenSize.width - _padding - _width; + + _streamSubscription = widget.onButtonBarVisible.listen(_buttonBarVisible); + _streamHeightSubscription = widget.onButtonBarHeight.listen(_getButtonBarHeight); + } + + @override + void didChangeDependencies() { + final mediaQuery = MediaQuery.of(context); + _viewPaddingTop = mediaQuery.viewPadding.top; + _viewPaddingBottom = mediaQuery.viewPadding.bottom; + super.didChangeDependencies(); + } + + @override + void dispose() { + _streamSubscription.cancel(); + _streamHeightSubscription.cancel(); + super.dispose(); + } + + void _getButtonBarHeight(double height) { + setState(() { + _buttonBarHeight = height; + _positionWidget(); + }); + } + + void _buttonBarVisible(bool visible) { + if (!mounted) { + return; + } + setState(() { + _isButtonBarVisible = visible; + if (_duration == _duration300ms) { + // only position the widget when we are not currently dragging it around + _positionWidget(); + } + }); + } + + @override + Widget build(BuildContext context) { + return AnimatedPositioned( + top: _top, + left: _left, + width: _width, + height: _height, + duration: _duration, + child: Listener( + onPointerDown: (_) => _duration = _duration0ms, + onPointerMove: (PointerMoveEvent event) { + setState(() { + _left = (_left + event.delta.dx).roundToDouble(); + _top = (_top + event.delta.dy).roundToDouble(); + }); + }, + onPointerUp: (_) => _positionWidget(), + onPointerCancel: (_) => _positionWidget(), + child: ClippedVideo( + height: _height, + width: _width, + child: widget.child, + ), + ), + ); + } + + double _getCurrentStatusBarHeight() { + if (_isButtonBarVisible) { + return _viewPaddingTop; + } + final _defaultViewPaddingTop = Platform.isIOS ? 20.0 : Platform.isAndroid ? 24.0 : 0.0; + if (_viewPaddingTop > _defaultViewPaddingTop) { + // There must be a hardware notch in the display. + return _viewPaddingTop; + } + return 0.0; + } + + double _getCurrentButtonBarHeight() { + if (_isButtonBarVisible) { + return _buttonBarHeight + _viewPaddingBottom; + } + return _viewPaddingBottom; + } + + void _positionWidget() { + // Determine the center of the object being dragged so we can decide + // in which corner the object should be placed. + var dx = (_width / 2) + _left; + dx = dx < 0 ? 0 : dx >= widget.availableScreenSize.width ? widget.availableScreenSize.width - 1 : dx; + var dy = (_height / 2) + _top; + dy = dy < 0 ? 0 : dy >= widget.availableScreenSize.height ? widget.availableScreenSize.height - 1 : dy; + final draggableCenter = Offset(dx, dy); + + setState(() { + _duration = _duration300ms; + if (Rect.fromLTRB(0, 0, widget.availableScreenSize.width / 2, widget.availableScreenSize.height / 2).contains(draggableCenter)) { + // Top-left + _top = _getCurrentStatusBarHeight() + _padding; + _left = _padding; + } else if (Rect.fromLTRB(widget.availableScreenSize.width / 2, 0, widget.availableScreenSize.width, widget.availableScreenSize.height / 2).contains(draggableCenter)) { + // Top-right + _top = _getCurrentStatusBarHeight() + _padding; + _left = widget.availableScreenSize.width - _padding - _width; + } else if (Rect.fromLTRB(0, widget.availableScreenSize.height / 2, widget.availableScreenSize.width / 2, widget.availableScreenSize.height).contains(draggableCenter)) { + // Bottom-left + _top = widget.availableScreenSize.height - (_getCurrentButtonBarHeight() + _padding) - _height; + _left = _padding; + } else if (Rect.fromLTRB(widget.availableScreenSize.width / 2, widget.availableScreenSize.height / 2, widget.availableScreenSize.width, widget.availableScreenSize.height).contains(draggableCenter)) { + // Bottom-right + _top = widget.availableScreenSize.height - (_getCurrentButtonBarHeight() + _padding) - _height; + _left = widget.availableScreenSize.width - _padding - _width; + } + }); + } +} diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 08509085..f9a8ebf7 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -22,6 +22,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart'; import 'dart:math' as math; class HomePageFragment2 extends StatefulWidget { @@ -96,6 +97,7 @@ class _HomePageFragment2State extends State { child: SliderView( onLoginClick: () { widget.onLoginClick(); + // navigateTo(context, CallHomePage()); }, ), // height: MediaQuery.of(context).size.width / 2.6, diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index de80b4ae..9e164c09 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart'; import 'package:diplomaticquarterapp/pages/conference/conference_page.dart'; +import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart'; import 'package:diplomaticquarterapp/pages/conference/widgets/platform_exception_alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -15,16 +16,14 @@ class IncomingCall extends StatefulWidget { _IncomingCallState createState() => _IncomingCallState(); } -class _IncomingCallState extends State - with SingleTickerProviderStateMixin { +class _IncomingCallState extends State with SingleTickerProviderStateMixin { AnimationController _animationController; final player = AudioPlayer(); @override void initState() { - _animationController = - AnimationController(vsync: this, duration: Duration(milliseconds: 500)); + _animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 500)); WidgetsBinding.instance.addPostFrameCallback((_) => _runAnimation()); @@ -57,18 +56,12 @@ class _IncomingCallState extends State Container( margin: EdgeInsets.only(top: 30.0), alignment: Alignment.center, - child: Text("Incoming Video Call", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 26.0, - color: Colors.white, - letterSpacing: 1.0)), + child: Text("Incoming Video Call", textAlign: TextAlign.center, style: TextStyle(fontSize: 26.0, color: Colors.white, letterSpacing: 1.0)), ), Container( alignment: Alignment.center, margin: EdgeInsets.fromLTRB(50.0, 30.0, 50.0, 20.0), - child: Image.asset( - 'assets/images/new-design/hmg_full_logo_hd_white.png'), + child: Image.asset('assets/images/new-design/hmg_full_logo_hd_white.png'), ), Container( margin: EdgeInsets.fromLTRB(30.0, 10.0, 30.0, 0.0), @@ -80,33 +73,17 @@ class _IncomingCallState extends State Container( margin: EdgeInsets.only(top: 20.0), alignment: Alignment.center, - child: Text("Dr Eyad Ismail Abu Jayab", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - letterSpacing: 0.8, - color: Colors.white)), + child: Text("Dr Eyad Ismail Abu Jayab", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold, letterSpacing: 0.8, color: Colors.white)), ), Container( margin: EdgeInsets.only(top: 10.0), alignment: Alignment.center, - child: Text("ENT Clinic", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22.0, - letterSpacing: 0.8, - color: Colors.white)), + child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), ), Container( margin: EdgeInsets.only(top: 10.0), alignment: Alignment.center, - child: Text("Speciality", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22.0, - letterSpacing: 0.8, - color: Colors.white)), + child: Text("Speciality", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), ), Container( decoration: BoxDecoration( @@ -117,30 +94,14 @@ class _IncomingCallState extends State margin: EdgeInsets.only(top: 20.0), child: Column( children: [ - Text("Appointment Information", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - letterSpacing: 1.0, - color: Colors.white)), + Text("Appointment Information", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, letterSpacing: 1.0, color: Colors.white)), Container( margin: EdgeInsets.only(top: 20.0), - child: Text("Sun, 15th Dec, 2019, 09:00", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - letterSpacing: 1.0, - color: Colors.white)), + child: Text("Sun, 15th Dec, 2019, 09:00", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), ), Container( margin: EdgeInsets.only(top: 20.0), - child: Text("ENT Clinic", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - letterSpacing: 1.0, - color: Colors.white)), + child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), ), ], ), @@ -153,9 +114,7 @@ class _IncomingCallState extends State mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ RotationTransition( - turns: Tween(begin: 0.0, end: -.1) - .chain(CurveTween(curve: Curves.elasticIn)) - .animate(_animationController), + turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), child: Container( child: RawMaterialButton( onPressed: () { @@ -208,16 +167,19 @@ class _IncomingCallState extends State Future _submit() async { backToHome(); try { - final roomModel = RoomModel( - name: widget.incomingCallData.name, - token: widget.incomingCallData.sessionId, - identity: widget.incomingCallData.identity); - + final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity); + + // await Navigator.of(context).push( + // MaterialPageRoute( + // fullscreenDialog: true, + // builder: (BuildContext context) => + // ConferencePage(roomModel: roomModel), + // ), + // ); await Navigator.of(context).push( MaterialPageRoute( fullscreenDialog: true, - builder: (BuildContext context) => - ConferencePage(roomModel: roomModel), + builder: (BuildContext context) => CallHomePage(), ), ); } catch (err) { diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 02be8fdb..4d012cce 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -1,282 +1,181 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class PrescriptionDetailsPage extends StatelessWidget { final PrescriptionReport prescriptionReport; - - PrescriptionDetailsPage({Key key, this.prescriptionReport}); + final Prescriptions prescriptions; + PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).prescriptions, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReport.imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(prescriptionReport.itemDescription.isNotEmpty - ? prescriptionReport.itemDescription - : prescriptionReport.itemDescriptionN ?? ''), - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PharmacyForPrescriptionsPage( - itemID: prescriptionReport.itemID, - prescriptionReport: prescriptionReport, - ), - ), - ), - child: Center( - child: Column( - children: [ - Container( - width: 50, - decoration: BoxDecoration(color: Colors.white, shape: BoxShape.rectangle), - child: Column( - children: [ - Icon( - Icons.pin_drop, - color: Colors.red[800], - size: 55, - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Texts(TranslationBase.of(context).availability) - ], - ), - )), - ), - _addReminderButton(context) - ], - ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DoctorHeader( + headerModel: HeaderModel( + prescriptions.doctorName, + prescriptions.doctorImageURL, + prescriptions.speciality, + "", + prescriptions.name, + DateUtil.convertStringToDate(prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + prescriptions.nationalityFlagURL, + prescriptions.doctorRate, + prescriptions.actualDoctorRate, + prescriptions.noOfPatientsRate, + "", ), - Container( - color: Colors.white, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - child: Table( - border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)), - children: [ - TableRow( - children: [ - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).route, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).frequency, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 4), - child: Center( - child: Texts( - "${TranslationBase.of(context).dailyDoses}", - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).duration, - fontSize: 14, - ))), + isNeedToShowButton: false, + ), + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + Container( + padding: EdgeInsets.all(14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10.0)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), ], ), - TableRow( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text(prescriptionReport.routeN ?? ''))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text(prescriptionReport.frequencyN ?? ''))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text('${prescriptionReport.days}'))) + Row( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + borderRadius: BorderRadius.all(Radius.circular(30.0)), + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(30)), + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 48, + ), + ), + ), + SizedBox(width: 12), + Expanded( + child: Text( + (prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + ) + ], + ), + SizedBox(height: 12), + Table(children: fullData(context)), + Text( + TranslationBase.of(context).remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), + ), + Text( + prescriptionReport.remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), ], ), - ], - ), + ), + ], ), - Container( - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - width: double.infinity, - color: Colors.white, - padding: EdgeInsets.all(5), - child: Center( - child: Column( - children: [ - Texts(TranslationBase.of(context).notes), - SizedBox( - height: 5, - ), - Divider( - height: 0.5, - color: Colors.grey[300], - ), - SizedBox( - height: 5, - ), - Texts(prescriptionReport.remarks ?? ''), - ], + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).availability, + () { + Navigator.push( + context, + FadePage( + page: PharmacyForPrescriptionsPage( + itemID: prescriptionReport.itemID, + prescriptionReport: prescriptionReport, + ), + ), + ); + }, + iconData: Icons.location_on, + color: Color(0xff359846), + ), ), - ), - ) - ], - ), - ), - ); - } - - Widget _addReminderButton(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).addReminder, + () { + DateTime startDate = DateTime.now(); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - return GestureDetector( - onTap: () { - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - - print(prescriptionReport); - showGeneralDialog( - barrierColor: Colors.black.withOpacity(0.5), - transitionBuilder: (context, a1, a2, widget) { - final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; - return Transform( - transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), - child: Opacity( - opacity: a1.value, - child: PrescriptionReminderDialog( - eventId: prescriptionReport.itemID.toString(), - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: - "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - startDate: startDate, - endDate: endDate, - location: prescriptionReport.remarks, - days: 1, + print(prescriptionReport); + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: PrescriptionReminderDialog( + eventId: prescriptionReport.itemID.toString(), + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + startDate: startDate, + endDate: endDate, + location: prescriptionReport.remarks, + days: 1, + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + }, + iconData: Icons.notifications_active, + color: Color(0xffEAEAEA), + textColor: Color(0xff2B353E), ), ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); - }, - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - // height: 100.0, - margin: EdgeInsets.all(7.0), - padding: EdgeInsets.only(bottom: 4.0), - decoration: BoxDecoration( - boxShadow: [BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)], - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0), - child: Text("add", - overflow: TextOverflow.clip, - style: TextStyle(color: new Color(0xffB8382C), letterSpacing: 1.0, fontSize: 18.0)), - ), - Container( - margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Text("reminder", - overflow: TextOverflow.clip, - style: TextStyle(color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), - ), - Container( - alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, - margin: projectViewModel.isArabic - ? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0) - : EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0), - child: Image.asset("assets/images/new-design/reminder_icon.png", width: 45.0, height: 45.0), - ), ], ), ), @@ -284,4 +183,29 @@ class PrescriptionDetailsPage extends StatelessWidget { ), ); } + + List fullData(context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).route), + Utils.tableColumnTitle(TranslationBase.of(context).frequency), + Utils.tableColumnTitle(TranslationBase.of(context).dailyDoses), + Utils.tableColumnTitle(TranslationBase.of(context).duration) + ], + ), + ); + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true), + Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true), + Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true), + Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true), + ], + ), + ); + return tableRow; + } } diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 8951236c..f8ae8aa8 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart'; @@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -59,6 +61,7 @@ class PrescriptionItemsPage extends StatelessWidget { model.user.emailAddress, ), isNeedToShowButton: projectViewModel.havePrivilege(13), + showConfirmMessageDialog: false, onTap: () { showConfirmMessage(context, model); }, @@ -188,6 +191,7 @@ class PrescriptionItemsPage extends StatelessWidget { itemCount: model.prescriptionReportListINP.length) else ListView.separated( + padding: EdgeInsets.all(21), itemBuilder: (context, index) { return InkWell( onTap: () { @@ -207,103 +211,78 @@ class PrescriptionItemsPage extends StatelessWidget { FadePage( page: PrescriptionDetailsPage( prescriptionReport: prescriptionReport, + prescriptions: prescriptions, ), ), ); }, - child: Card( - margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), - shape: cardRadius(12), + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), child: Padding( padding: const EdgeInsets.only(top: 12, bottom: 20, left: 20, right: 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.prescriptionReportEnhList[index].itemDescription.isNotEmpty - ? model.prescriptionReportEnhList[index].itemDescription - : model.prescriptionReportEnhList[index].itemDescriptionN ?? '', + (model.prescriptionReportEnhList[index].itemDescription.isNotEmpty + ? model.prescriptionReportEnhList[index].itemDescription + : model.prescriptionReportEnhList[index].itemDescriptionN ?? '') + .toLowerCase() + .capitalizeFirstofEach, style: TextStyle( fontSize: 16, + color: Color(0xff2E303A), letterSpacing: -0.64, fontWeight: FontWeight.w600, ), ), mHeight(10), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Card( - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 60, - ), - margin: EdgeInsets.zero, - clipBehavior: Clip.antiAlias, - shape: cardRadius(2000), + Card( + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 48, ), + margin: EdgeInsets.zero, clipBehavior: Clip.antiAlias, - decoration: containerColorRadiusBorderWidth(Colors.white, 200, Colors.grey[200], 1), + shape: cardRadius(2000), ), mWidth(12), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - TranslationBase.of(context).route + ": ", - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), - ), - Text( - model.prescriptionReportEnhList[index].route, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - Row( - children: [ - Text( - TranslationBase.of(context).dailyDoses + ": ", - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), - ), - Text( - model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + myRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route, projectViewModel.isArabic), + myRichText( + TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), projectViewModel.isArabic), + mHeight(9), + Text( + model.prescriptionReportEnhList[index].remarks, + style: TextStyle( + color: Color(0xff575757), + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, ), - ], - ), - mHeight(12), - Text( - model.prescriptionReportEnhList[index].remarks, - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, ), - ), - ], + ], + ), ) ], ), @@ -314,7 +293,7 @@ class PrescriptionItemsPage extends StatelessWidget { ); }, separatorBuilder: (context, index) { - return mHeight(8); + return mHeight(12); }, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), @@ -343,10 +322,10 @@ class PrescriptionItemsPage extends StatelessWidget { ), ); }, - color: Colors.green[800], + color: Color(0xff359846), ), ), - ), + ) ], ), ), diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index 84691773..3ce724bf 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -21,64 +21,112 @@ class PrescriptionsHistoryPage extends StatelessWidget { return AppScaffold( baseViewModel: prescriptionsViewModel, - body: ListView.builder( + body: ListView.separated( physics: BouncingScrollPhysics(), - itemBuilder: (context, index) => InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionsHistoryDetailsPage( - prescriptionsOrder: - prescriptionsViewModel.prescriptionsHistory[index], - ), - ), - ), - child: Container( - padding: EdgeInsets.all(15.0), - margin: EdgeInsets.all(8.0), - decoration: - BoxDecoration(shape: BoxShape.rectangle, color: Colors.white), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - DateUtil.getDayMonthYearHourMinuteDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), - fontWeight: FontWeight.w300, - ), - SizedBox( - height: 5, - ), - Texts( - '${TranslationBase.of(context).orderNo} ${prescriptionsViewModel.prescriptionsHistory[index].iD}'), - SizedBox( - height: 5, - ), - Texts( - '${prescriptionsViewModel.prescriptionsHistory[index].descriptionN}'), - SizedBox( - height: 5, + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) { + return SizedBox(height: 12); + }, + itemBuilder: (context, index) { + int status = prescriptionsViewModel.prescriptionsHistory[index].status; + String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4) { + //cancel // Rejected + _color = Color(0xffD02127); + } + + return InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionsHistoryDetailsPage( + prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], ), - Texts( - '${TranslationBase.of(context).orderNo}', - fontWeight: FontWeight.w300, + ), + ), + child: Container( + height: 65, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: 6, + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), + bottomLeft: Radius.circular(10.0), + ), ), - SizedBox( - height: 5, + ), + Expanded( + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.formatDateToDate(prescriptionsViewModel.prescriptionsHistory[index].createdOn, projectViewModel.isArabic), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + DateUtil.formatDateToTime(prescriptionsViewModel.prescriptionsHistory[index].createdOn), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) + ], + ), ), - ], - ), + ) + ], ), - Icon( - Icons.arrow_forward_ios, - size: 25, - ) - ], - ), - ), - ), + )); + }, itemCount: prescriptionsViewModel.prescriptionsHistory.length, ), ); diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 7d65837d..204d917f 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -76,7 +76,10 @@ class _HomePrescriptionsPageState extends State with Sing fontWeight: FontWeight.w600, letterSpacing: -0.48, ), - tabs: [Text(TranslationBase.of(context).prescriptions, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), Text(TranslationBase.of(context).history, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'))], + tabs: [ + Text(TranslationBase.of(context).prescriptions, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + Text(TranslationBase.of(context).orderLog, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + ], ), Expanded( child: TabBarView( diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index f8991b50..774b11a4 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -42,6 +42,7 @@ class PrescriptionsPage extends StatelessWidget { ListView.separated( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, + padding: EdgeInsets.only(top: 12), separatorBuilder: (context, index) { return Container( height: 12, diff --git a/lib/pages/medical/vital_sign/LineChartCurved.dart b/lib/pages/medical/vital_sign/LineChartCurved.dart index f097f44c..55e5581f 100644 --- a/lib/pages/medical/vital_sign/LineChartCurved.dart +++ b/lib/pages/medical/vital_sign/LineChartCurved.dart @@ -17,6 +17,8 @@ class LineChartCurved extends StatelessWidget { double minY = 0; double maxY = 0; + double intialY = 0; + double lastY = 0; double minX = 0; double maxX = 0; @@ -26,6 +28,7 @@ class LineChartCurved extends StatelessWidget { Widget build(BuildContext context) { getXaxix(); getYaxix(); + getInitialY(); calculateMaxAndMin(); return AspectRatio( aspectRatio: 1.0, @@ -100,7 +103,7 @@ class LineChartCurved extends StatelessWidget { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true,horizontalInterval: 14,verticalInterval: 14), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -165,12 +168,14 @@ class LineChartCurved extends StatelessWidget { ), minX: minX, maxX: maxX, - maxY: maxY, - minY: 0, + maxY: lastY+50, + minY: intialY, lineBarsData: getData(context), ); } + + calculateMaxAndMin() { getMaxY(); getMaxX(); @@ -185,12 +190,29 @@ class LineChartCurved extends StatelessWidget { maxY = 0; timeSeries.forEach((element) { double resultValueDouble = element.sales; - if (resultValueDouble > maxY) maxY = resultValueDouble; + if (resultValueDouble > maxY) { + lastY = resultValueDouble; + maxY = resultValueDouble; + } }); - + print("maxY " + lastY.toString()); return maxY.roundToDouble(); } + double getInitialY() { + try { + intialY = timeSeries.first.sales; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < intialY) intialY = resultValueDouble; + }); + } catch (e) { + intialY = 0; + } + + return intialY.roundToDouble(); + } + getMaxX() { maxX = (timeSeries.length - 1).toDouble(); } diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index eaac78b9..c1d6fb3d 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -6,7 +6,8 @@ class DefaultButton extends StatelessWidget { final Color textColor; final Color color; final Color disabledColor; - DefaultButton(this.text, this.onPress, {this.color, this.disabledColor, this.textColor = Colors.white}); + final IconData iconData; + DefaultButton(this.text, this.onPress, {this.color, this.disabledColor, this.textColor = Colors.white, this.iconData}); @override Widget build(BuildContext context) { @@ -15,9 +16,17 @@ class DefaultButton extends StatelessWidget { width: double.infinity, child: FlatButton( onPressed: onPress, - child: Text( - text, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + child: Row( + children: [ + if (iconData != null) Icon(iconData, color: textColor), + Expanded( + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + ), + ), + ], ), // color: Color(0xffD02127), color: color ?? const Color(0xffD02127), diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 33e08399..607d7e8f 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -55,12 +55,12 @@ class DoctorCard extends StatelessWidget { Radius.circular(10.0), ), border: Border.all( - width: 1, // - color: Color(0xffEFEFEF) // <--- border width here + width: 1, + color: Color(0xffEFEFEF) ), boxShadow: [ BoxShadow( - color: Color(0xff000000).withOpacity(.01), + color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, blurRadius: 27, offset: Offset(0, -3), diff --git a/lib/widgets/dialogs/confirm_send_email_dialog.dart b/lib/widgets/dialogs/confirm_send_email_dialog.dart index 540824ee..1e1baa28 100644 --- a/lib/widgets/dialogs/confirm_send_email_dialog.dart +++ b/lib/widgets/dialogs/confirm_send_email_dialog.dart @@ -1,15 +1,10 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/settings/settings.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../routes.dart'; - class ConfirmSendEmailDialog extends StatefulWidget { final String email; final GestureTapCallback onTapSendEmail; @@ -28,93 +23,103 @@ class _ConfirmSendEmailDialogState extends State { @override Widget build(BuildContext context) { - return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), - title: Center( - child: Texts( - TranslationBase.of(context).confirm, - color: Colors.black, - ), - ), - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder(), + insetPadding: EdgeInsets.only(left: 21, right: 21), + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, top: 36, bottom: 36), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Center( - child: Texts( - TranslationBase.of(context).sendConfEmail, - fontSize: 14, - color: Colors.grey, - ), - ), - Texts( - widget.email, - color: Colors.grey, - ), - SizedBox( - height: 5, - ), - Divider(), - SizedBox( - height: 5.0, - ), - InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts( - TranslationBase.of(context).cancel, - color: Colors.red, + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), ), ), - ), + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.close), + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], ), - SizedBox( - height: 15.0, + Text( + TranslationBase.of(context).sendConfEmail, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48), ), - InkWell( - onTap: () { - Navigator.pop(context); - widget.onTapSendEmail(); - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts(TranslationBase.of(context).sendEmail), - ), + SizedBox(height: 18), + Container( + padding: EdgeInsets.symmetric(vertical: 16, horizontal: 11), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + color: Color(0xffEAEAEA), ), - ), - SizedBox( - height: 15.0, - ), - InkWell( - onTap: () - { - Navigator.pop(context); - Navigator.push( - context, - FadePage( - page: Settings(type: 1,), + child: Row( + children: [ + Expanded( + child: Text( + widget.email, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), ), - ); - - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts(TranslationBase.of(context).updateEmail), - ), + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.edit), + iconSize: 16, + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + Navigator.push( + context, + FadePage( + page: Settings( + type: 1, + ), + ), + ); + }, + ) + ], ), ), - SizedBox( - height: 20.0, + SizedBox(height: 18), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancel, + () { + Navigator.pop(context); + }, + textColor: Color(0xff2B353E), + color: Color(0xffEAEAEA), + ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).send, + () { + Navigator.pop(context); + widget.onTapSendEmail(); + }, + ), + ), + ], ), ], - ) - ], + ), + ), ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 0d6b4756..bf0e4465 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -71,6 +71,7 @@ dependencies: #GIF image flutter_gifimage: ^1.0.1 + flutter_webrtc: any # UI Reqs dotted_border: 1.0.5