You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PatientApp-KKUMC/lib/pages/appUpdatePage/app_update_page.dart

110 lines
3.8 KiB
Dart

4 years ago
import 'dart:io';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:url_launcher/url_launcher.dart';
class AppUpdatePage extends StatefulWidget {
String appUpdateText;
AppUpdatePage({@required this.appUpdateText});
@override
_AppUpdatePageState createState() => _AppUpdatePageState();
}
class _AppUpdatePageState extends State<AppUpdatePage> {
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: "App Update",
backgroundColor: Colors.white,
isShowAppBar: false,
isShowDecPage: false,
body: SingleChildScrollView(
child: Container(
child: Column(
children: [
Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SvgPicture.asset(
"assets/images/new-design/update_rocket_image.svg",
fit: BoxFit.fill),
]),
Container(
margin: EdgeInsets.only(top: 40.0),
width: MediaQuery.of(context).size.width,
child: Text(TranslationBase.of(context).appUpdate,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xff2d6c90).withOpacity(1.0),
fontSize: 22.0,
fontWeight: FontWeight.bold))),
],
),
Container(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
child: SvgPicture.asset("assets/images/new-design/HMG_logo.svg",
fit: BoxFit.fill),
),
Container(
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0),
width: MediaQuery.of(context).size.width,
child: Text(widget.appUpdateText,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey[600],
fontSize: 16.0,
height: 1.5,
fontWeight: FontWeight.bold))),
Container(
margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
minWidth: MediaQuery.of(context).size.width,
height: 45.0,
child: RaisedButton(
color: Colors.red[800],
textColor: Colors.white,
disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4),
onPressed: () {
openAppUpdateLink();
},
child: Text(TranslationBase.of(context).appUpdate,
style: TextStyle(fontSize: 18.0)),
),
),
),
],
),
),
),
);
}
openAppUpdateLink() {
if (Platform.isAndroid) {
_launchURL("https://play.google.com/store/apps/details?id=com.ejada.hmg");
}
if (Platform.isIOS) {
_launchURL("https://itunes.apple.com/app/id733503978");
}
}
_launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
}