|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
|
|
|
|
@ -8,12 +9,17 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
|
|
|
|
import 'package:lottie/lottie.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
|
@ -23,10 +29,12 @@ class LiveChatPage extends StatelessWidget {
|
|
|
|
|
String chatURL = "";
|
|
|
|
|
|
|
|
|
|
late AppState appState;
|
|
|
|
|
late AuthenticationViewModel authVm;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
appState = getIt.get<AppState>();
|
|
|
|
|
authVm = context.read<AuthenticationViewModel>();
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
|
|
|
body: Consumer<ContactUsViewModel>(builder: (context, contactUsVM, child) {
|
|
|
|
|
@ -158,13 +166,71 @@ class LiveChatPage extends StatelessWidget {
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.liveChat.tr(context: context),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (contactUsVM.chatRequestID != null) {
|
|
|
|
|
chatURL = "https://chat.hmg.com/Index.aspx?RequestedId=${contactUsVM.chatRequestID}";
|
|
|
|
|
debugPrint("Chat URL: $chatURL");
|
|
|
|
|
Uri uri = Uri.parse(chatURL);
|
|
|
|
|
launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: "");
|
|
|
|
|
if(appState.isAuthenticated) {
|
|
|
|
|
if (contactUsVM.chatRequestID != null) {
|
|
|
|
|
chatURL = "${ApiConsts.CHAT_URL}${contactUsVM.chatRequestID}";
|
|
|
|
|
debugPrint("Chat URL: $chatURL");
|
|
|
|
|
Uri uri = Uri.parse(chatURL);
|
|
|
|
|
launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: "");
|
|
|
|
|
} else {
|
|
|
|
|
debugPrint("Chat Request ID is null");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
debugPrint("Chat Request ID is null");
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
title: LocaleKeys.notice.tr(context: context),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Lottie.asset(AppAnimations.errorAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
(LocaleKeys.loginToUseService.tr(context: context)).toText16(color: AppColors.blackColor),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.cancel.tr(context: context),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
borderColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
textColor: AppColors.primaryRedColor,
|
|
|
|
|
icon: AppAssets.cancel,
|
|
|
|
|
iconColor: AppColors.primaryRedColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 8.h),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.confirm.tr(context: context),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
page: LandingNavigation(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
await authVm.onLoginPressed();
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.bgGreenColor,
|
|
|
|
|
borderColor: AppColors.bgGreenColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
icon: AppAssets.confirm,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
],
|
|
|
|
|
).center,
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: contactUsVM.selectedLiveChatProjectIndex == -1 ? AppColors.greyColor : AppColors.primaryRedColor,
|
|
|
|
|
|