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_banner.dart

132 lines
5.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/uitl/date_uitl.dart';
import 'package:provider/provider.dart';
class DiscountCardWidget extends StatefulWidget {
@override
State<DiscountCardWidget> createState() => _DiscountCardWidgetState();
}
class _DiscountCardWidgetState extends State<DiscountCardWidget> {
late ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return Directionality(
textDirection: TextDirection.ltr,
child: Container(
padding: EdgeInsets.only(left: 16, right: 16, top: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
),
child: Stack(
children: [
// Left icon (replace with your asset if needed)
SvgPicture.asset("assets/images/svg/main_banner.svg", height: 170, width: MediaQuery.sizeOf(context).width, fit: BoxFit.fill),
// Main content
Padding(
padding: const EdgeInsets.only(right: 8.0, left: 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(child: SizedBox.shrink()),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const SizedBox(height: 12),
/// Arabic Section (top-right)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
projectViewModel.hisProjectOffers.first.titleArabic!,
style: TextStyle(
fontSize: 18,
fontFamily: 'Cairo',
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
Text(
projectViewModel.hisProjectOffers.first.descriptionArabic!,
style: TextStyle(
fontSize: 12,
fontFamily: 'Cairo',
fontWeight: FontWeight.w300,
color: Colors.white,
),
),
],
),
const SizedBox(height: 8),
/// English Section (middle-left)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
projectViewModel.hisProjectOffers.first.titleName!,
style: TextStyle(
fontFamily: 'Poppins',
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
Text(
projectViewModel.hisProjectOffers.first.descriptionEnglish!,
style: TextStyle(
fontSize: 12,
fontFamily: 'Poppins',
color: Colors.white,
),
),
],
),
],
),
],
),
SizedBox(height: 16),
// Bottom row
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'This Offer is valid till ${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(projectViewModel.hisProjectOffers.first.validTo))}',
style: TextStyle(
fontFamily: 'Poppins',
fontSize: 10,
color: Colors.white,
),
),
Text(
"يسري العرض حتى ${DateUtil.getMonthDayYearDateFormattedAr(DateUtil.convertStringToDate(projectViewModel.hisProjectOffers.first.validTo))}",
style: TextStyle(
fontFamily: 'Cairo',
fontSize: 10,
fontWeight: FontWeight.w300,
color: Colors.white,
),
),
],
),
],
),
),
],
),
),
);
}
}