|
|
|
@ -1,5 +1,4 @@
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:ui' as ui;
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
@ -33,24 +32,19 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
|
|
|
|
|
|
|
|
|
|
|
|
late AppState appState;
|
|
|
|
late AppState appState;
|
|
|
|
|
|
|
|
|
|
|
|
// static Duration countdownDuration = Duration(minutes: 1, seconds: 0);
|
|
|
|
|
|
|
|
// late ValueNotifier<Duration> durationNotifier = ValueNotifier<Duration>(immediateLiveCareViewModel.countdownDuration);
|
|
|
|
|
|
|
|
// Timer? timer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
scheduleMicrotask(() {
|
|
|
|
|
|
|
|
// countdownDuration = Duration(minutes: immediateLiveCareViewModel.patientLiveCareHistoryList[0].watingtimeInteger!, seconds: 0);
|
|
|
|
|
|
|
|
// durationNotifier = ValueNotifier<Duration>(immediateLiveCareViewModel.countdownDuration);
|
|
|
|
|
|
|
|
// startTimer();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
void dispose() {
|
|
|
|
// timer?.cancel();
|
|
|
|
// Cancel the timer when leaving the page
|
|
|
|
// durationNotifier.dispose();
|
|
|
|
try {
|
|
|
|
|
|
|
|
immediateLiveCareViewModel.stopTimer();
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
// Handle case where viewModel might not be initialized
|
|
|
|
|
|
|
|
}
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -65,7 +59,7 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: CollapsingListView(
|
|
|
|
child: CollapsingListView(
|
|
|
|
title: LocaleKeys.liveCarePendingRequest.tr(),
|
|
|
|
title: LocaleKeys.livecareAppo.tr(),
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.all(24.0),
|
|
|
|
padding: EdgeInsets.all(24.0),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
@ -147,7 +141,7 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
buildTime(duration),
|
|
|
|
Directionality(textDirection: ui.TextDirection.ltr, child: buildTime(duration)),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -176,7 +170,7 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
|
|
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
height: 50.h,
|
|
|
|
height: 50.h,
|
|
|
|
icon: AppAssets.livechatMessage,
|
|
|
|
icon: AppAssets.livechatMessage,
|
|
|
|
iconColor: AppColors.whiteColor,
|
|
|
|
iconColor: !Utils.havePrivilege(118) ? AppColors.textColor : AppColors.whiteColor,
|
|
|
|
iconSize: 21.h,
|
|
|
|
iconSize: 21.h,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
@ -186,8 +180,8 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
LocaleKeys.oR.tr().toText19(
|
|
|
|
LocaleKeys.oR.tr().toText19(
|
|
|
|
color: AppColors.textColor,
|
|
|
|
color: AppColors.textColor,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
@ -208,7 +202,7 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
|
|
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
height: 50.h,
|
|
|
|
height: 50.h,
|
|
|
|
icon: AppAssets.call_fill,
|
|
|
|
icon: AppAssets.call_fill,
|
|
|
|
iconColor: AppColors.whiteColor,
|
|
|
|
iconColor: AppColors.primaryRedColor,
|
|
|
|
iconSize: 21.h,
|
|
|
|
iconSize: 21.h,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -216,140 +210,139 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// void startTimer() {
|
|
|
|
// void startTimer() {
|
|
|
|
// // timer = Timer.periodic(const Duration(seconds: 1), (_) => addTime());
|
|
|
|
// // timer = Timer.periodic(const Duration(seconds: 1), (_) => addTime());
|
|
|
|
// // setState(() {});
|
|
|
|
// // setState(() {});
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// void addTime() {
|
|
|
|
// void addTime() {
|
|
|
|
// final seconds = durationNotifier.value.inSeconds - 1;
|
|
|
|
// final seconds = durationNotifier.value.inSeconds - 1;
|
|
|
|
// if (seconds < 0) {
|
|
|
|
// if (seconds < 0) {
|
|
|
|
// timer?.cancel();
|
|
|
|
// timer?.cancel();
|
|
|
|
// // Handle end of timer here
|
|
|
|
// // Handle end of timer here
|
|
|
|
// // showEndMessage();
|
|
|
|
// // showEndMessage();
|
|
|
|
// } else {
|
|
|
|
// } else {
|
|
|
|
// durationNotifier.value = Duration(seconds: seconds);
|
|
|
|
// durationNotifier.value = Duration(seconds: seconds);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Future<bool> _onWillPop() async {
|
|
|
|
// Future<bool> _onWillPop() async {
|
|
|
|
// timer?.cancel();
|
|
|
|
// timer?.cancel();
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
// return true;
|
|
|
|
// return true;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Widget buildTime(Duration duration) {
|
|
|
|
// Widget buildTime(Duration duration) {
|
|
|
|
// String twoDigits(int n) => n.toString().padLeft(2, '0');
|
|
|
|
// String twoDigits(int n) => n.toString().padLeft(2, '0');
|
|
|
|
// final hours = twoDigits(duration.inHours);
|
|
|
|
// final hours = twoDigits(duration.inHours);
|
|
|
|
// final minutes = twoDigits(duration.inMinutes.remainder(60));
|
|
|
|
// final minutes = twoDigits(duration.inMinutes.remainder(60));
|
|
|
|
// final seconds = twoDigits(duration.inSeconds.remainder(60));
|
|
|
|
// final seconds = twoDigits(duration.inSeconds.remainder(60));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// return Row(
|
|
|
|
// return Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// children: [
|
|
|
|
// children: [
|
|
|
|
// buildTimeColumn(hours, "Hours".needTranslation),
|
|
|
|
// buildTimeColumn(hours, "Hours".needTranslation),
|
|
|
|
// buildTimeColumn(minutes, "Mins".needTranslation),
|
|
|
|
// buildTimeColumn(minutes, "Mins".needTranslation),
|
|
|
|
// buildTimeColumn(seconds, "Secs".needTranslation, isLast: true),
|
|
|
|
// buildTimeColumn(seconds, "Secs".needTranslation, isLast: true),
|
|
|
|
// ],
|
|
|
|
// ],
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Widget buildTimeColumn(String time, String label, {bool isLast = false}) {
|
|
|
|
// Widget buildTimeColumn(String time, String label, {bool isLast = false}) {
|
|
|
|
// return Column(
|
|
|
|
// return Column(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// children: [
|
|
|
|
// children: [
|
|
|
|
// Row(
|
|
|
|
// Row(
|
|
|
|
// children: [
|
|
|
|
// children: [
|
|
|
|
// buildDigit(time[0]),
|
|
|
|
// buildDigit(time[0]),
|
|
|
|
// buildDigit(time[1]),
|
|
|
|
// buildDigit(time[1]),
|
|
|
|
// if (!isLast) buildTimeSeparator(),
|
|
|
|
// if (!isLast) buildTimeSeparator(),
|
|
|
|
// ],
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// buildLabel(label),
|
|
|
|
// buildLabel(label),
|
|
|
|
// ],
|
|
|
|
// ],
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Widget buildDigit(String digit) {
|
|
|
|
// Widget buildDigit(String digit) {
|
|
|
|
// return Container(
|
|
|
|
// return Container(
|
|
|
|
// padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
|
|
// padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
|
|
// // margin: const EdgeInsets.symmetric(horizontal: 2),
|
|
|
|
// // margin: const EdgeInsets.symmetric(horizontal: 2),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// color: Colors.white,
|
|
|
|
// color: Colors.white,
|
|
|
|
// borderRadius: BorderRadius.circular(8),
|
|
|
|
// borderRadius: BorderRadius.circular(8),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// child: ClipRect(
|
|
|
|
// child: ClipRect(
|
|
|
|
// child: AnimatedSwitcher(
|
|
|
|
// child: AnimatedSwitcher(
|
|
|
|
// duration: const Duration(milliseconds: 600),
|
|
|
|
// duration: const Duration(milliseconds: 600),
|
|
|
|
// switchInCurve: Curves.easeOutExpo,
|
|
|
|
// switchInCurve: Curves.easeOutExpo,
|
|
|
|
// switchOutCurve: Curves.easeInExpo,
|
|
|
|
// switchOutCurve: Curves.easeInExpo,
|
|
|
|
// transitionBuilder: (Widget child, Animation<double> animation) {
|
|
|
|
// transitionBuilder: (Widget child, Animation<double> animation) {
|
|
|
|
// return Stack(
|
|
|
|
// return Stack(
|
|
|
|
// children: <Widget>[
|
|
|
|
// children: <Widget>[
|
|
|
|
// SlideTransition(
|
|
|
|
// SlideTransition(
|
|
|
|
// position: Tween<Offset>(
|
|
|
|
// position: Tween<Offset>(
|
|
|
|
// begin: const Offset(0, -1),
|
|
|
|
// begin: const Offset(0, -1),
|
|
|
|
// end: const Offset(0, 1),
|
|
|
|
// end: const Offset(0, 1),
|
|
|
|
// ).animate(CurvedAnimation(
|
|
|
|
// ).animate(CurvedAnimation(
|
|
|
|
// parent: animation,
|
|
|
|
// parent: animation,
|
|
|
|
// curve: Curves.easeOutCubic,
|
|
|
|
// curve: Curves.easeOutCubic,
|
|
|
|
// )),
|
|
|
|
// )),
|
|
|
|
// child: FadeTransition(
|
|
|
|
// child: FadeTransition(
|
|
|
|
// opacity: animation,
|
|
|
|
// opacity: animation,
|
|
|
|
// child: child,
|
|
|
|
// child: child,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// SlideTransition(
|
|
|
|
// SlideTransition(
|
|
|
|
// position: Tween<Offset>(
|
|
|
|
// position: Tween<Offset>(
|
|
|
|
// begin: const Offset(0, -1),
|
|
|
|
// begin: const Offset(0, -1),
|
|
|
|
// end: const Offset(0, 0),
|
|
|
|
// end: const Offset(0, 0),
|
|
|
|
// ).animate(CurvedAnimation(
|
|
|
|
// ).animate(CurvedAnimation(
|
|
|
|
// parent: animation,
|
|
|
|
// parent: animation,
|
|
|
|
// curve: Curves.bounceIn,
|
|
|
|
// curve: Curves.bounceIn,
|
|
|
|
// )),
|
|
|
|
// )),
|
|
|
|
// child: FadeTransition(
|
|
|
|
// child: FadeTransition(
|
|
|
|
// opacity: animation,
|
|
|
|
// opacity: animation,
|
|
|
|
// child: child,
|
|
|
|
// child: child,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ],
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// child: Text(
|
|
|
|
// child: Text(
|
|
|
|
// digit,
|
|
|
|
// digit,
|
|
|
|
// key: ValueKey<String>(digit),
|
|
|
|
// key: ValueKey<String>(digit),
|
|
|
|
// style: TextStyle(
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// color: Colors.black,
|
|
|
|
// color: Colors.black,
|
|
|
|
// fontSize: 20.f,
|
|
|
|
// fontSize: 20.f,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Widget buildLabel(String label) {
|
|
|
|
// Widget buildLabel(String label) {
|
|
|
|
// return label.toText14(isBold: true);
|
|
|
|
// return label.toText14(isBold: true);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Widget buildTimeSeparator() {
|
|
|
|
// Widget buildTimeSeparator() {
|
|
|
|
// return const Padding(
|
|
|
|
// return const Padding(
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 2.0),
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 2.0),
|
|
|
|
// child: Text(
|
|
|
|
// child: Text(
|
|
|
|
// ":",
|
|
|
|
// ":",
|
|
|
|
// style: TextStyle(
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: Colors.black,
|
|
|
|
// color: Colors.black,
|
|
|
|
// fontSize: 20,
|
|
|
|
// fontSize: 20,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|