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.
HMG_Patient_App/lib/pages/landing/fragments/offer_details_page.dart

269 lines
11 KiB
Dart

import 'dart:ui';
import 'package:auto_size_text/auto_size_text.dart' show AutoSizeText;
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hmg_patient_app/core/model/hospitals/hospitals_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils.dart';
import 'package:hmg_patient_app/uitl/utils_new.dart';
import 'package:hmg_patient_app/widgets/buttons/custom_text_button.dart';
import 'package:hmg_patient_app/widgets/dialogs/location_selection_dialog.dart' show LocationSelectionDialog;
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:provider/provider.dart';
class OfferDetailsPage extends StatefulWidget {
final String title;
const OfferDetailsPage({super.key, required this.title});
@override
State<OfferDetailsPage> createState() => _OfferDetailsPageState();
}
class _OfferDetailsPageState extends State<OfferDetailsPage> {
HospitalsModel? selectedHospital;
@override
Widget build(BuildContext context) {
return Directionality(
// lock the whole page to LTR
textDirection: TextDirection.ltr,
child:AppScaffold(
isShowDecPage: false,
isShowAppBar: false,
showNewAppBar: true,
isHelp: true,
showNewAppBarTitle: true,
appBarTitle: widget.title,
body: Column(
children: [
Expanded(child: SingleChildScrollView(
child: Column(
children: [
/// Banner
SvgPicture.asset(
"assets/images/svg/details_page_banner.svg",
height: 120,
fit: BoxFit.fill,
),
/// Arabic Offer Section
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 32.0),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 32),
child: Directionality(
textDirection: TextDirection.rtl,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text(
"خصم %25",
style: TextStyle(
fontFamily: 'Cairo',
fontSize: 22,
fontWeight: FontWeight.bold,
),
),
Text(
"عرض على الفحوصات الطبية",
style: TextStyle(
fontFamily: 'Cairo',
fontWeight: FontWeight.w300,
fontSize: 16,
),
),
SizedBox(height: 12),
Text(
"تفاصيل العرض هنا تفاصيل العرض هنا تفاصيل العرض هنا تفاصيل العرض هنا تفاصيل العرض هنا تفاصيل العرض هنا تفاصيل العرض هنا تفاصيل العرض هنا تفاصيل العرض هنا",
style: TextStyle(
fontFamily: 'Cairo',
fontWeight: FontWeight.w300,
fontSize: 14,
),
),
],
),
),
),
const SizedBox(height: 20),
const Divider(thickness: 1, color: Colors.green),
const SizedBox(height: 20),
/// English Offer Section
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text(
"25% Discount",
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
Text(
"On a medical examination or test",
style: TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 12),
Text(
"OFFER DETAILS HERE OFFER DETAILS HERE OFFER DETAILS HERE OFFER DETAILS HERE OFFER DETAILS HERE",
style: TextStyle(
fontSize: 14,
fontFamily: 'Poppins',
),
),
],
),
),
const SizedBox(height: 24),
/// Hospital Dropdown (mock UI)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 12),
decoration: BoxDecoration(
color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(12),
),
child: InkWell(
onTap: (){
openHospitalSelection(context);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
children: [
Directionality(
textDirection: TextDirection.rtl,
child: Text(
selectedHospital?.nameN ??"مستشفى المحمدية",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Cairo',
),
),
),
Text(
selectedHospital?.name??"Al Muhammadiya Hospital",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
),
),
],
),
),
Icon(Icons.arrow_drop_down),
],
),
),
),
),
const SizedBox(height: 24),
/// Buttons
],
),
),
const SizedBox(height: 30),
],
),
),),
Padding(
padding: const EdgeInsets.only(
left: 12.0, right:12, bottom: 8),
child: Row(
children: [
SizedBox(
width: MediaQuery.of(context).size.width-24,
height: 56,
child: CustomTextButton(
shape: cardRadiusNew(8),
//shape: OutlinedBorder(),
backgroundColor: Color(0xFFFBF2E31),
elevation: 0,
onPressed: () {},
child: Center(
child: RichText(
text: TextSpan(
text: "Pay Now",
style: TextStyle(
fontFamily: 'Poppins',
),
children: [
TextSpan(
text:" ادفع الآن",
style: TextStyle(
fontWeight: FontWeight.w300,
fontFamily: 'Cairo',
),
),
]
),
),
),
),
),
],
),
),
],
),
),
);
}
openHospitalSelection(BuildContext context) {
var projectViewModel = Provider.of<ProjectViewModel>(context, listen: false);
int _selectedHospitalIndex = 0;
List<HospitalsModel> projectsListLocal = [];
Utils.navigationProjectsList.forEach((v) {
projectsListLocal.add(new HospitalsModel.fromJson(v));
});
showDialog(
context: context,
builder: (cxt) => LocationSelectionDialog(
isArabic: projectViewModel.isArabic,
data: projectsListLocal,
title: TranslationBase.of(context).selectHospital,
selectedIndex: _selectedHospitalIndex,
onValueSelected: (index) {
_selectedHospitalIndex = index;
setState(() {
selectedHospital = projectsListLocal[index];
});
},
),
);
}
}