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.
272 lines
10 KiB
Dart
272 lines
10 KiB
Dart
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
|
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
|
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-summary.dart';
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CovidPaymentAlert extends StatefulWidget {
|
|
PatientShareResponse patientShareResponse;
|
|
|
|
CovidPaymentAlert({@required this.patientShareResponse});
|
|
|
|
@override
|
|
_CovidPaymentAlertState createState() => _CovidPaymentAlertState();
|
|
}
|
|
|
|
class _CovidPaymentAlertState extends State<CovidPaymentAlert> {
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
AuthenticatedUser authUser;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: TranslationBase.of(context).covidTest,
|
|
isShowAppBar: true,
|
|
showNewAppBarTitle: true,
|
|
showNewAppBar: true,
|
|
backgroundColor: CustomColors.appBackgroudGrey2Color,
|
|
body: Column(
|
|
children: [
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
color: new Color(0xFFc5272d),
|
|
padding: EdgeInsets.all(20),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Icon(
|
|
Icons.warning_outlined,
|
|
color: Colors.white,
|
|
),
|
|
mWidth(12),
|
|
Expanded(
|
|
child: Text(
|
|
TranslationBase.of(context).covidAlertHeader,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 16.0,
|
|
letterSpacing: -0.64,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Text(
|
|
TranslationBase.of(context).covidAlertMins,
|
|
style: TextStyle(
|
|
fontSize: 19.0,
|
|
letterSpacing: -1.6,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
TranslationBase.of(context).covidAlertInfo,
|
|
style: TextStyle(
|
|
color: Colors.grey[700],
|
|
fontSize: 14.0,
|
|
letterSpacing: -0.56,
|
|
),
|
|
),
|
|
mHeight(20),
|
|
Container(
|
|
width: double.infinity,
|
|
child: Card(
|
|
margin: EdgeInsets.zero,
|
|
shape: cardRadius(12),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
TranslationBase.of(context).appoInfo,
|
|
style: TextStyle(
|
|
fontSize: 16.0,
|
|
letterSpacing: -0.64,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
mHeight(16),
|
|
Row(
|
|
children: [
|
|
_getNormalText(
|
|
TranslationBase.of(context).hospital + ":",
|
|
),
|
|
mWidth(6),
|
|
_getNormalText(
|
|
widget.patientShareResponse.projectName != null ? widget.patientShareResponse.projectName : "NULL",
|
|
isBold: true,
|
|
),
|
|
],
|
|
),
|
|
mHeight(4),
|
|
Row(
|
|
children: [
|
|
_getNormalText(
|
|
TranslationBase.of(context).date + ":",
|
|
),
|
|
mWidth(6),
|
|
_getNormalText(
|
|
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.patientShareResponse.appointmentDate)),
|
|
isBold: true,
|
|
),
|
|
],
|
|
),
|
|
mHeight(4),
|
|
Row(
|
|
children: [
|
|
_getNormalText(
|
|
TranslationBase.of(context).time + ":",
|
|
),
|
|
mWidth(6),
|
|
_getNormalText(
|
|
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.patientShareResponse.appointmentDate), false),
|
|
isBold: true,
|
|
),
|
|
],
|
|
),
|
|
mHeight(4),
|
|
Row(
|
|
children: [
|
|
_getNormalText(
|
|
TranslationBase.of(context).route + ":",
|
|
),
|
|
mWidth(6),
|
|
_getNormalText(
|
|
widget.patientShareResponse.doctorNameObj != null ? widget.patientShareResponse.doctorNameObj : "NULL",
|
|
isBold: true,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.zero,
|
|
elevation: 20,
|
|
child: Container(
|
|
margin: EdgeInsets.all(12),
|
|
width: double.infinity,
|
|
child: ButtonTheme(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
minWidth: MediaQuery.of(context).size.width * 0.7,
|
|
height: 45.0,
|
|
child: RaisedButton(
|
|
color: CustomColors.accentColor,
|
|
textColor: Colors.white,
|
|
disabledTextColor: Colors.white,
|
|
disabledColor: Colors.grey[500],
|
|
elevation: 0,
|
|
onPressed: () {
|
|
startPaymentProcess();
|
|
},
|
|
child: Text(
|
|
TranslationBase.of(context).next,
|
|
style: TextStyle(
|
|
fontSize: 16.0,
|
|
letterSpacing: -0.48,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
_getNormalText(text, {bool isBold = false}) {
|
|
return Text(
|
|
text,
|
|
style: TextStyle(
|
|
fontSize: isBold ? 12 : 10,
|
|
letterSpacing: -0.5,
|
|
color: isBold ? Colors.black : Colors.grey[700],
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
);
|
|
}
|
|
|
|
startPaymentProcess() {
|
|
navigateToPaymentMethod(context, widget.patientShareResponse);
|
|
}
|
|
|
|
Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse) async {
|
|
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
|
|
var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
|
|
setState(() {
|
|
authUser = data;
|
|
});
|
|
}
|
|
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: CovidPaymentSummary(patientShareResponse: widget.patientShareResponse, selectedPaymentMethod: "MADA"),
|
|
),
|
|
);
|
|
// Navigator.push(context, FadePage(page: PaymentMethod())).then((value) {
|
|
// print(value);
|
|
// if (value != null) {
|
|
// Navigator.push(
|
|
// context,
|
|
// FadePage(
|
|
// page: CovidPaymentSummary(patientShareResponse: widget.patientShareResponse, selectedPaymentMethod: value.toString()),
|
|
// ),
|
|
// );
|
|
// }
|
|
// });
|
|
}
|
|
|
|
String getDate(String appoDate) {
|
|
var appoDateFormatted = "";
|
|
|
|
var dateObj = DateUtil.convertStringToDate(appoDate);
|
|
|
|
setState(() {
|
|
appoDateFormatted = DateUtil.getWeekDay(dateObj.weekday) +
|
|
", " +
|
|
dateObj.day.toString() +
|
|
" " +
|
|
DateUtil.getMonth(dateObj.month) +
|
|
" " +
|
|
dateObj.year.toString() +
|
|
" " +
|
|
dateObj.hour.toString() +
|
|
":" +
|
|
dateObj.minute.toString() +
|
|
":00";
|
|
});
|
|
return appoDateFormatted;
|
|
}
|
|
}
|