import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; 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'; class CovidPaymentAlert extends StatefulWidget { PatientShareResponse patientShareResponse; CovidPaymentAlert({@required this.patientShareResponse}); @override _CovidPaymentAlertState createState() => _CovidPaymentAlertState(); } class _CovidPaymentAlertState extends State { @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: "COVID-19 TEST", isShowAppBar: true, body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: 200.0, color: new Color(0xFFc5272d), child: Row( children: [ Container( margin: EdgeInsets.only(left: 50.0), child: SvgPicture.asset( 'assets/images/new-design/alert_icon.svg', width: 80.0, height: 80.0), ), Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( margin: EdgeInsets.only(left: 30.0, right: 20.0), child: Text("Alert", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 24.0)), ), Container( width: MediaQuery.of(context).size.width * 0.55, margin: EdgeInsets.only( left: 30.0, right: 20.0, top: 5.0), child: Text( "Pay With-in 15 mins to confirm the appointment", overflow: TextOverflow.clip, style: TextStyle( color: Colors.white, fontSize: 20.0)), ), ], ), ), ], ), ), Container( margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( alignment: Alignment.center, child: Text("Pay With-in 15 mins", overflow: TextOverflow.clip, style: TextStyle( color: new Color(0xFFc5272d), fontSize: 24.0, fontWeight: FontWeight.bold)), ), Container( alignment: Alignment.center, margin: EdgeInsets.only(top: 15.0), child: Text( "Payment for Covid-19 Test should Be made with-in 15 mins otherwise The system will Cancel the Scheduled appointment automatically​.", textAlign: TextAlign.center, style: TextStyle( color: Colors.grey[700], fontSize: 18.0, letterSpacing: 0.8)), ), Container( margin: EdgeInsets.only( top: 40.0, bottom: 10.0, left: 0.0, right: 20.0), child: Text(TranslationBase.of(context).appoInfo, style: TextStyle( fontSize: 18.0, color: Colors.grey[700], fontWeight: FontWeight.bold)), ), Container( margin: EdgeInsets.only(left: 0.0, bottom: 20.0), width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.grey[200], boxShadow: [ BoxShadow(color: Colors.grey, spreadRadius: 2), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only( top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), child: Text("COVID-19 TEST", style: TextStyle( fontSize: 18.0, color: Colors.black, fontWeight: FontWeight.bold)), ), Container( margin: EdgeInsets.only(bottom: 10.0), child: Row( children: [ Container( margin: EdgeInsets.only(left: 20.0, right: 20.0), child: Icon( Icons.local_hospital, size: 24, color: Colors.grey[700], )), Container( child: Text( widget.patientShareResponse.projectName != null ? widget.patientShareResponse.projectName : "NULL", style: TextStyle( fontSize: 18.0, color: Colors.grey[700])), ), ], ), ), Container( margin: EdgeInsets.only(bottom: 10.0), child: Row( children: [ Container( margin: EdgeInsets.only(left: 20.0, right: 20.0), child: Icon( Icons.date_range, size: 24, color: Colors.grey[700], )), Container( child: Text( widget.patientShareResponse.appointmentDate != null ? getDate(widget.patientShareResponse .appointmentDate) .split(" ")[0] : "NULL", style: TextStyle( fontSize: 18.0, color: Colors.grey[700])), ), ], ), ), Container( margin: EdgeInsets.only(bottom: 10.0), child: Row( children: [ Container( margin: EdgeInsets.only(left: 20.0, right: 20.0), child: Icon( Icons.access_time, size: 24, color: Colors.grey[700], )), Container( child: Text( widget.patientShareResponse.appointmentDate != null ? getDate(widget.patientShareResponse .appointmentDate) .split(" ")[1] : "NULL", style: TextStyle( fontSize: 18.0, color: Colors.grey[700])), ), ], ), ), Container( margin: EdgeInsets.only(bottom: 10.0), child: Row( children: [ Container( margin: EdgeInsets.only(left: 20.0, right: 20.0), child: SvgPicture.asset( "assets/images/new-design/track_icon.svg", width: 20.0, height: 20.0)), Container( child: Text( widget.patientShareResponse.doctorNameObj != null ? widget .patientShareResponse.doctorNameObj : "NULL", style: TextStyle( fontSize: 18.0, color: Colors.grey[700])), ), ], ), ), ], ), ), ], ), ), ], ), ), bottomSheet: Container( margin: EdgeInsets.all(10.0), child: Flex( direction: Axis.horizontal, children: [ Expanded( flex: 1, child: Container( margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), child: ButtonTheme( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: Colors.grey[500], onPressed: () { // bookCovidTestAppointment(); }, child: Text("NEXT", style: TextStyle(fontSize: 18.0)), ), ), ), ), ], ), ), ); } 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; } }