second commit
This commit is contained in:
182
lib/View/Update/Updateview.dart
Normal file
182
lib/View/Update/Updateview.dart
Normal file
@@ -0,0 +1,182 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'dart:io';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/Logger.dart';
|
||||
|
||||
|
||||
class UpdateAppPage extends StatelessWidget {
|
||||
final bool mIsForceUpdate;
|
||||
final String mCurrentVersion;
|
||||
final String mUpdateVersion;
|
||||
|
||||
const UpdateAppPage(
|
||||
{super.key, this.mIsForceUpdate = true, required this.mCurrentVersion, required this.mUpdateVersion,});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
SystemNavigator.pop();
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
body: ListView(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: Lottie.asset(''
|
||||
'assets/Update.json',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 50,),
|
||||
const Text(
|
||||
"It's Time to Update",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Lato',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5,),
|
||||
Text(
|
||||
'Version $mUpdateVersion',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Lato',
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold),),
|
||||
const SizedBox(height: 10,),
|
||||
SizedBox(
|
||||
width: Get.width * 0.80,
|
||||
child: const Text(
|
||||
'We added lots of new features and fix some bugs to make your experience as smooth as possible',
|
||||
style: TextStyle(
|
||||
fontFamily: "Lato",
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: SizedBox(
|
||||
height: Get.height * 0.10,
|
||||
child: btnDownload(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget nearleLogoImg() {
|
||||
return Hero(
|
||||
tag: 'hero',
|
||||
child: Image.asset(
|
||||
AssetConstants.nearleDarkLogo,
|
||||
height: 200,
|
||||
width: 250,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget textContents() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Center(
|
||||
child: TextWidget(
|
||||
text: 'You are using an older version of Nearle Deals Business Application.',
|
||||
fontSize: 20,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
Center(
|
||||
child:
|
||||
TextWidget(
|
||||
text: 'Available version',
|
||||
fontSize: 20,
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 9,),
|
||||
Center(
|
||||
child: TextWidget(
|
||||
text: mUpdateVersion,
|
||||
textAlign: TextAlign.center,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget btnDownload() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
child: Container(margin: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(
|
||||
ColorConstants.primaryColor),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
5), // Adjust radius
|
||||
),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
downloadActions();
|
||||
},
|
||||
child: TextWidget(
|
||||
text: 'Update',
|
||||
fontSize: 16,
|
||||
color: ColorConstants.secondaryColor,
|
||||
)
|
||||
))
|
||||
],
|
||||
),),
|
||||
);
|
||||
}
|
||||
|
||||
skipAction() {
|
||||
Get.back();
|
||||
}
|
||||
|
||||
void downloadActions() async {
|
||||
String url;
|
||||
var s = Platform.isAndroid ? "Android" : "Ios";
|
||||
if (s == "Android") {
|
||||
// appInfo = await Utility.getApplicationInfo();
|
||||
|
||||
url = 'https://play.google.com/store/apps/details?id=com.nearle.bond';
|
||||
} else {
|
||||
url = 'https://apps.apple.com/us/app/gear/id1596895375ls=1';
|
||||
}
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
} else {
|
||||
throw 'Could not launch App';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user