App update page implemented
parent
c6ee3c453f
commit
8309f311e6
@ -0,0 +1,96 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.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';
|
||||
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/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:in_app_update/in_app_update.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class AppUpdatePage extends StatelessWidget {
|
||||
AppUpdatePage({super.key, required this.appUpdateMessage});
|
||||
|
||||
String appUpdateMessage;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.whiteColor,
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24.h),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 120.h),
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Transform.flip(
|
||||
flipX: getIt.get<AppState>().isArabic() ? true : false,
|
||||
child: Lottie.asset(AppAnimations.onboarding_1,
|
||||
repeat: true, reverse: false, frameRate: FrameRate(60), width: MediaQuery.sizeOf(context).width - 50.w, height: MediaQuery.sizeOf(context).width - 50.w),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 50.h),
|
||||
appUpdateMessage.toText16(weight: FontWeight.w500),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 24.r,
|
||||
hasShadow: true,
|
||||
),
|
||||
child: CustomButton(
|
||||
text: LocaleKeys.updateAppNow.tr(context: context),
|
||||
onPressed: () {
|
||||
openAppUpdateLink();
|
||||
},
|
||||
backgroundColor: AppColors.primaryRedColor,
|
||||
borderColor: AppColors.primaryRedColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
borderRadius: 12.r,
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
height: 56.h,
|
||||
),
|
||||
).paddingAll(24.h),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
openAppUpdateLink() {
|
||||
if (Platform.isAndroid) {
|
||||
// _launchURL("https://play.google.com/store/apps/details?id=com.ejada.hmg");
|
||||
InAppUpdate.checkForUpdate().then((info) {
|
||||
print("checkForUpdate!!!");
|
||||
print(info.toString());
|
||||
if (info.immediateUpdateAllowed) {
|
||||
print("Immediate Allowed!!!");
|
||||
InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString()));
|
||||
}
|
||||
}).catchError((e) {
|
||||
print(e.toString());
|
||||
Utils.openWebView(
|
||||
url: "https://play.google.com/store/apps/details?id=com.ejada.hmg",
|
||||
);
|
||||
});
|
||||
}
|
||||
if (Platform.isIOS) {
|
||||
Utils.openWebView(
|
||||
url: "https://itunes.apple.com/app/id733503978",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue