Merge branch 'development' into development_new_design_2.0
# Conflicts: # lib/config/config.dart # lib/config/localized_values.dart # lib/core/service/client/base_app_client.dart # lib/core/service/parmacyModule/parmacy_module_service.dart # lib/core/service/parmacyModule/prescription_service.dart # lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart # lib/core/viewModels/pharmacyModule/product_detail_view_model.dart # lib/locator.dart # lib/main.dart # lib/pages/final_products_page.dart # lib/pages/landing/home_page.dart # lib/pages/parent_categorise_page.dart # lib/pages/pharmacies/product_detail.dart # lib/pages/pharmacies/screens/cart-order-preview.dart # lib/pages/pharmacies/screens/pharmacy_module_page.dart # lib/pages/pharmacies/widgets/ProductTileItem.dart # lib/pages/search_products_page.dart # lib/services/pharmacy_services/product_detail_service.dart # lib/uitl/translations_delegate_base.dart # lib/widgets/buttons/secondary_button.dart # lib/widgets/others/app_scaffold_widget.dart # lib/widgets/others/app_scafold_detail_page.dart # lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dartmerge-update-with-lab-changes
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 867 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,26 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
|
||||
class BestSellerViewModel extends BaseViewModel {
|
||||
|
||||
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
|
||||
|
||||
List<PharmacyProduct> get bestSellerProduct =>
|
||||
_pharmacyService.bestSellerProducts;
|
||||
|
||||
getBestSellerProducts() async {
|
||||
setState(ViewState.BusyLocal);
|
||||
await _pharmacyService.getBestSellerProducts();
|
||||
// if (_pharmacyService.hasError) {
|
||||
// error = _pharmacyService.error;
|
||||
// setState(ViewState.Error);
|
||||
// } else {
|
||||
setState(ViewState.Idle);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
|
||||
class BrandViewModel extends BaseViewModel {
|
||||
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
|
||||
|
||||
List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList;
|
||||
|
||||
Future getTopManufacturerList() async {
|
||||
setState(ViewState.BusyLocal);
|
||||
await _pharmacyService.getTopManufacturerList();
|
||||
// if (_pharmacyService.hasError) {
|
||||
// error = _pharmacyService.error;
|
||||
// setState(ViewState.Error);
|
||||
// } else {
|
||||
setState(ViewState.Idle);
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
|
||||
class LastVisitedViewModel extends BaseViewModel {
|
||||
|
||||
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
|
||||
|
||||
List<PharmacyProduct> get lastVisitedProducts =>
|
||||
_pharmacyService.lastVisitedProducts;
|
||||
|
||||
getLastVisitedProducts() async {
|
||||
setState(ViewState.BusyLocal);
|
||||
await _pharmacyService.getLastVisitedProducts();
|
||||
// if (_pharmacyService.hasError) {
|
||||
// error = _pharmacyService.error;
|
||||
// setState(ViewState.Error);
|
||||
// } else {
|
||||
setState(ViewState.Idle);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
|
||||
class PrescriptionViewModel extends BaseViewModel {
|
||||
|
||||
PrescriptionService _prescriptionService = locator<PrescriptionService>();
|
||||
|
||||
List<Prescriptions> get prescriptionsList =>
|
||||
_prescriptionService.prescriptionsList;
|
||||
|
||||
getPrescription() async {
|
||||
await getSavedLanguage();
|
||||
if(prescriptionsList.isNotEmpty){
|
||||
setState(ViewState.Busy);
|
||||
await _prescriptionService.getPrescription();
|
||||
if (_prescriptionService.hasError) {
|
||||
error = _prescriptionService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/locator.dart';
|
||||
|
||||
class ProductCategoriesViewModel extends BaseViewModel {
|
||||
bool hasError = false;
|
||||
|
||||
PharmacyCategoriseService _pharmacyCategoriseService =
|
||||
locator<PharmacyCategoriseService>();
|
||||
|
||||
List<PharmacyCategorise> get categorise =>
|
||||
_pharmacyCategoriseService.categoriseList;
|
||||
|
||||
Future getCategorise() async {
|
||||
hasError = false;
|
||||
// _insuranceCardService.clearInsuranceCard();
|
||||
setState(ViewState.Busy);
|
||||
await _pharmacyCategoriseService.getCategorise();
|
||||
if (_pharmacyCategoriseService.hasError) {
|
||||
error = _pharmacyCategoriseService.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,888 @@
|
||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/locator.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
|
||||
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart';
|
||||
import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'landing_page_pharmcy.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
final Function goToMyProfile;
|
||||
|
||||
HomePage({Key key, this.goToMyProfile});
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return BaseView<DashboardViewModel>(
|
||||
onModelReady: (model) => () async {},
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
isShowDecPage: false,
|
||||
isHelp: true,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 210,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover),
|
||||
),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
top: 15,
|
||||
left: 5,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 125,
|
||||
padding: EdgeInsets.all(5),
|
||||
margin: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/new-design/covid_bg_transparent.png"),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).covidTest,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 15.0,
|
||||
),
|
||||
child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).driveThru,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
minWidth: MediaQuery.of(context).size.width * 0.15,
|
||||
height: 25.0,
|
||||
child: RaisedButton(
|
||||
color: Colors.red[800],
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: new Color(0xFFbcc2c4),
|
||||
onPressed: (model.user != null && model.user.outSA == 1)
|
||||
? () {}
|
||||
: () {
|
||||
navigateToCovidDriveThru();
|
||||
},
|
||||
child: Center(
|
||||
child: Center(
|
||||
child: Center(
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).bookNow,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())),
|
||||
child: Container(
|
||||
height: 125,
|
||||
padding: EdgeInsets.all(15),
|
||||
margin: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
projectViewModel.isArabic ? 'assets/images/new-design/livecare_arabic_logo.svg' : 'assets/images/new-design/liveCare_white_logo.svg',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(width: double.infinity, height: projectViewModel.isArabic ? 110 : 80)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 155,
|
||||
left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03),
|
||||
right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03),
|
||||
child: (!model.isLogin)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: 125,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#A59E9E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(9)),
|
||||
image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)),
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).myMedicalFile,
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 23,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).myMedicalFileSubTitle,
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
),
|
||||
Align(
|
||||
alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
widget.goToMyProfile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
width: 90,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#D81A2E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(0)),
|
||||
),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).viewMore,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
width: double.infinity,
|
||||
height: projectViewModel.isArabic ? 160 : 130,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#A59E9E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(9)),
|
||||
image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover),
|
||||
),
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
if (projectViewModel.user != null && model.isLogin)
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
model.user.cRSVerificationStatus == 2
|
||||
? Row(
|
||||
children: [
|
||||
Texts(
|
||||
model.user.firstName + " " + model.user.lastName,
|
||||
color: Colors.grey[100],
|
||||
bold: true,
|
||||
fontSize: 15,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
|
||||
child: SvgPicture.asset("assets/images/new-design/verification_check.svg"),
|
||||
),
|
||||
],
|
||||
)
|
||||
: model.user.cRSVerificationStatus == 3
|
||||
? Row(
|
||||
children: [
|
||||
Texts(
|
||||
model.user.firstName + " " + model.user.lastName,
|
||||
color: Colors.grey[100],
|
||||
bold: true,
|
||||
fontSize: 15,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
|
||||
child: SvgPicture.asset("assets/images/new-design/pending.svg"),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Texts(
|
||||
model.user.firstName + " " + model.user.lastName,
|
||||
color: Colors.grey[100],
|
||||
bold: true,
|
||||
fontSize: 15,
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts(
|
||||
'${model.user.patientID}',
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Texts(
|
||||
'${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}',
|
||||
color: Colors.grey[100],
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
widget.goToMyProfile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(2),
|
||||
width: 90,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#D81A2E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).myMedicalFile,
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/height_icon.png',
|
||||
width: 35,
|
||||
height: 40,
|
||||
),
|
||||
Texts(
|
||||
"${model.heightCm} ${TranslationBase.of(context).cm}",
|
||||
color: Colors.white,
|
||||
fontSize: 17,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/weight_icon.png',
|
||||
width: 25,
|
||||
height: 40,
|
||||
),
|
||||
Texts('${model.weightKg} ${TranslationBase.of(context).kg}', color: Colors.white, fontSize: 17)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/blood_icon.png',
|
||||
width: 35,
|
||||
height: 40,
|
||||
),
|
||||
Texts('${model.booldType}', color: Colors.white, fontSize: 17)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage()));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Color(0xffB8382C),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).offerAndPackages,
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
Spacer(),
|
||||
Image.asset("assets/images/offer_icon.png"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (projectViewModel.havePrivilege(64) || projectViewModel.havePrivilege(65) || projectViewModel.havePrivilege(67))
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
if (projectViewModel.havePrivilege(64))
|
||||
DashboardItem(
|
||||
onTap: (model.user != null && model.user.outSA == 1)
|
||||
? () {}
|
||||
: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: HomeHealthCarePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/home_health_care_icon.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).homeHealthCare,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: SizeConfig.textMultiplier * 1.55,
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
imageName: 'home_healthcare_service_bg.png',
|
||||
opacity: 0.5,
|
||||
),
|
||||
if (projectViewModel.havePrivilege(65))
|
||||
DashboardItem(
|
||||
onTap: () => (model.user != null && model.user.outSA == 1) ? () {} : getPharmacyToken(model),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
// if (projectViewModel.user != null && model.isLogin && model.user.outSA == 1)
|
||||
// Image.asset(
|
||||
// 'assets/images/lock_icon.png',
|
||||
// width: 50,
|
||||
// height: 50,
|
||||
// ),
|
||||
Image.asset(
|
||||
'assets/images/pharmacy_logo.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).onlinePharmacy,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: SizeConfig.textMultiplier * 1.55,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
imageName: 'al-habib_onlne_pharmacy_bg.png',
|
||||
),
|
||||
if (projectViewModel.havePrivilege(67))
|
||||
DashboardItem(
|
||||
onTap: (model.user != null && model.user.outSA == 1)
|
||||
? () {}
|
||||
: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: CMCPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/comprehensive_medical_checkup_logo.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).cmcHeading,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: SizeConfig.textMultiplier * 1.55,
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
color: HexColor("#747C80"),
|
||||
imageName: 'emergency_service_image.png',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => Navigator.push(context, FadePage(page: PaymentService())),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.29,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/al-habib_online_payment_service_icon.png',
|
||||
height: 55,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).onlinePaymentService,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.black87,
|
||||
bold: false,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(context, FadePage(page: EReferralPage()));
|
||||
},
|
||||
child: Container(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/ereferral_service_icon.png',
|
||||
width: 50,
|
||||
height: 55,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).ereferral,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.black87,
|
||||
bold: false,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
width: MediaQuery.of(context).size.width * 0.29,
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
if (projectViewModel.havePrivilege(60))
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.29,
|
||||
child: InkWell(
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: ErOptions(
|
||||
isAppbar: true,
|
||||
))),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/Dr_Schedule_report.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).emergencyServices,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.black87,
|
||||
bold: false,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
DashboardItem(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).hMGService,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewAllHabibMedicalService,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(),
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewMore,
|
||||
color: Colors.white,
|
||||
//fontWeight: FontWeight.normal,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
height: 100,
|
||||
imageName: 'contact_us_bg.png',
|
||||
opacity: 0.5,
|
||||
color: Colors.grey[700],
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
onTap: () => Navigator.push(context, FadePage(page: AllHabibMedicalService())),
|
||||
),
|
||||
DashboardItem(
|
||||
onTap: () {
|
||||
// Navigator.push(
|
||||
// context, FadePage(page: FeedbackHomePage()));
|
||||
Navigator.push(context, FadePage(page: ContactUsPage()));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).reachUs,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewAllWaysReachUs,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(),
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewMore,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
height: 100,
|
||||
imageName: 'contact_us_bg.png',
|
||||
opacity: 0.5,
|
||||
color: Colors.grey[700],
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 120,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getPharmacyToken(DashboardViewModel model) async {
|
||||
if (!model.isLogin) {
|
||||
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
||||
} else {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
|
||||
|
||||
await pharmacyModuleViewModel.verifyCustomer().then((value) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
navigateToCovidDriveThru() {
|
||||
Navigator.push(context, FadePage(page: CovidDrivethruLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
class DashboardItem extends StatelessWidget {
|
||||
const DashboardItem({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4, this.hasColorFilter = true})
|
||||
: super(key: key);
|
||||
final bool hasBorder;
|
||||
final String imageName;
|
||||
final Widget child;
|
||||
final Function onTap;
|
||||
final double width;
|
||||
final double height;
|
||||
final Color color;
|
||||
final double opacity;
|
||||
final bool hasColorFilter;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: width != null ? width : MediaQuery.of(context).size.width * 0.29,
|
||||
height: height != null
|
||||
? height
|
||||
: MediaQuery.of(context).orientation == Orientation.portrait
|
||||
? MediaQuery.of(context).size.height * 0.17
|
||||
: MediaQuery.of(context).size.height * 0.35,
|
||||
decoration: BoxDecoration(
|
||||
color: !hasBorder
|
||||
? color != null
|
||||
? color
|
||||
: HexColor('#050705').withOpacity(opacity)
|
||||
: Colors.white,
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent),
|
||||
image: imageName != null
|
||||
? DecorationImage(
|
||||
image: ExactAssetImage('assets/images/$imageName'),
|
||||
fit: BoxFit.cover,
|
||||
colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
child: Center(
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,947 +0,0 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OrderPreviewPage extends StatelessWidget {
|
||||
final List<Addresses> addresses;
|
||||
|
||||
OrderPreviewPage(this.addresses);
|
||||
|
||||
MyInAppBrowser browser;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
|
||||
|
||||
return BaseView<OrderPreviewViewModel>(
|
||||
onModelReady: (model) => model.getShoppingCart(),
|
||||
builder: (_, model, wi) => ChangeNotifierProvider.value(
|
||||
value: model.paymentCheckoutData,
|
||||
child: AppScaffold(
|
||||
appBarTitle: "${TranslationBase.of(context).checkOut}",
|
||||
isShowAppBar: true,
|
||||
isPharmacy: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Colors.white,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
height: height * 0.90,
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
color: Color(0xFFF1F1F1),
|
||||
child: Column(
|
||||
children: [
|
||||
SelectAddressWidget(model, addresses),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SelectPaymentOptionWidget(model),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Consumer<PaymentCheckoutData>(
|
||||
builder: (ctx, paymentData, _) =>
|
||||
paymentData.lacumInformation != null
|
||||
? Container(
|
||||
child: Column(
|
||||
children: [
|
||||
LakumWidget(model),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container()),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.reviewOrder,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
...List.generate(
|
||||
model.cartResponse.shoppingCarts != null
|
||||
? model.cartResponse.shoppingCarts.length
|
||||
: 0,
|
||||
(index) =>
|
||||
ProductOrderPreviewItem(
|
||||
model.cartResponse
|
||||
.shoppingCarts[index]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: model.cartResponse.subtotal != null
|
||||
? Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.orderSummary,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.subtotal}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.sar} ${(model.cartResponse.subtotal)
|
||||
.toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.shipping}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.sar} ${(model
|
||||
.totalAdditionalShippingCharge)
|
||||
.toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.vat}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.sar} ${(model.cartResponse
|
||||
.subtotalVatAmount).toStringAsFixed(
|
||||
2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.total,
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.sar} ${(model.cartResponse.subtotal)
|
||||
.toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: model.cartResponse.shoppingCarts != null
|
||||
? height * 0.10
|
||||
: 0,
|
||||
color: Colors.white,
|
||||
child: PaymentBottomWidget(model),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class SelectAddressWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
final List<Addresses> addresses;
|
||||
|
||||
SelectAddressWidget(this.model, this.addresses);
|
||||
|
||||
@override
|
||||
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
|
||||
}
|
||||
|
||||
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
|
||||
Addresses address;
|
||||
|
||||
_navigateToAddressPage() {
|
||||
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
|
||||
.then((result) {
|
||||
if (result != null) {
|
||||
address = result;
|
||||
widget.model.paymentCheckoutData.address = address;
|
||||
widget.model.getInformationsByAddress();
|
||||
}
|
||||
|
||||
/* setState(() {
|
||||
if (result != null) {
|
||||
address = result;
|
||||
widget.model.paymentCheckoutData.address = address;
|
||||
widget.model.getInformationsByAddress();
|
||||
}
|
||||
})*/
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.model.paymentCheckoutData.address != null) {
|
||||
address = widget.model.paymentCheckoutData.address;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<PaymentCheckoutData>(
|
||||
builder: (ctx, paymentData, _) =>
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: address == null
|
||||
? InkWell(
|
||||
onTap: () => {_navigateToAddressPage()},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_address.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.selectAddress,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward,
|
||||
size: 20,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_mark.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.shippingAddress,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {_navigateToAddressPage()},
|
||||
child: Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.changeAddress,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Texts(
|
||||
"${address.firstName} ${address.lastName}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Texts(
|
||||
"${address.address1} ${address.address2} ${address
|
||||
.address2},, ${address.city}, ${address
|
||||
.country} ${address.zipPostalCode}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
child: Icon(
|
||||
Icons.phone,
|
||||
size: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${address.phoneNumber}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 8),
|
||||
child: SizedBox(
|
||||
height: 2,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_truck.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.shipBy}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Image.asset(
|
||||
paymentData.shippingOption
|
||||
.shippingRateComputationMethodSystemName ==
|
||||
"Shipping.FixedOrByWeight"
|
||||
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
|
||||
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
), // ic_shipping_mark.png
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SelectPaymentOptionWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
SelectPaymentOptionWidget(this.model);
|
||||
|
||||
@override
|
||||
_SelectPaymentOptionWidgetState createState() =>
|
||||
_SelectPaymentOptionWidgetState();
|
||||
}
|
||||
|
||||
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
|
||||
PaymentOption paymentOption;
|
||||
|
||||
_navigateToPaymentOption() {
|
||||
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
|
||||
.then((result) =>
|
||||
{
|
||||
setState(() {
|
||||
if (result != null) {
|
||||
paymentOption = result;
|
||||
widget.model.paymentCheckoutData.paymentOption =
|
||||
paymentOption;
|
||||
widget.model.paymentCheckoutData.updateData();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.model.paymentCheckoutData.paymentOption != null) {
|
||||
paymentOption = widget.model.paymentCheckoutData.paymentOption;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: paymentOption == null
|
||||
? InkWell(
|
||||
onTap: () => {_navigateToPaymentOption()},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_payment_option.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.selectPaymentOption,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward,
|
||||
size: 20,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_payment_option.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0),
|
||||
decoration: new BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Image.asset(
|
||||
widget.model.getPaymentOptionImage(paymentOption),
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
widget.model.getPaymentOptionName(paymentOption),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {_navigateToPaymentOption()},
|
||||
child: Texts(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.changeMethod,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LakumWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
LakumWidget(this.model);
|
||||
|
||||
@override
|
||||
_LakumWidgetState createState() => _LakumWidgetState();
|
||||
}
|
||||
|
||||
class _LakumWidgetState extends State<LakumWidget> {
|
||||
TextEditingController _pointsController = new TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectProvider = Provider.of(context);
|
||||
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/lakum_checkout.png",
|
||||
width: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(color: Color(0x99ffffff)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.lakumPoints}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"${widget.model.paymentCheckoutData.lacumInformation
|
||||
.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: Color(0x99ffffff)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.riyal}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Container(
|
||||
margin: projectProvider.isArabic
|
||||
? EdgeInsets.only(right: 4)
|
||||
: EdgeInsets.only(left: 4),
|
||||
width: 60,
|
||||
height: 50,
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 0.2),
|
||||
gapPadding: 0,
|
||||
borderRadius: projectProvider.isArabic
|
||||
? BorderRadius.only(
|
||||
topRight: Radius.circular(8),
|
||||
bottomRight: Radius.circular(8))
|
||||
: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8)),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 0.4),
|
||||
gapPadding: 0,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8)),
|
||||
),
|
||||
),
|
||||
controller: _pointsController,
|
||||
keyboardType: TextInputType.number,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount >
|
||||
0
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
enabled: widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount ==
|
||||
0
|
||||
? false
|
||||
: true,
|
||||
onChanged: (val) {
|
||||
var value = int.tryParse(val);
|
||||
if (value != null &&
|
||||
value <=
|
||||
widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount) {
|
||||
widget.model.paymentCheckoutData.usedLakumPoints =
|
||||
value;
|
||||
} else {
|
||||
widget.model.paymentCheckoutData.usedLakumPoints = 0;
|
||||
}
|
||||
_pointsController.text =
|
||||
"${widget.model.paymentCheckoutData.usedLakumPoints}";
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 50,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
||||
decoration: new BoxDecoration(
|
||||
color: Color(0xff3666E0),
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: projectProvider.isArabic
|
||||
? BorderRadius.only(
|
||||
topLeft: Radius.circular(6),
|
||||
bottomLeft: Radius.circular(6))
|
||||
: BorderRadius.only(
|
||||
topRight: Radius.circular(6),
|
||||
bottomRight: Radius.circular(6)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xff3666E0),
|
||||
width: 0.8,
|
||||
)),
|
||||
),
|
||||
child: Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.use}",
|
||||
fontSize: 12,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PaymentBottomWidget extends StatelessWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
BuildContext context;
|
||||
MyInAppBrowser browser;
|
||||
|
||||
PaymentBottomWidget(this.model);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scaffold = Scaffold.of(context);
|
||||
this.context = context;
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: Consumer<PaymentCheckoutData>(
|
||||
builder: (ctx, paymentData, _) =>
|
||||
paymentData.cartDataVisible
|
||||
? Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.sar} ${(model.cartResponse.subtotal)
|
||||
.toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff929295),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Texts(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.inclusiveVat}",
|
||||
fontSize: 8,
|
||||
color: Color(0xff929295),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${model.cartResponse.quantityCount} ${TranslationBase
|
||||
.of(context)
|
||||
.items}",
|
||||
fontSize: 10,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: RaisedButton(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Color(0xff929295),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
onPressed: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? () async {
|
||||
await model.makeOrder();
|
||||
if (model.state == ViewState.Idle) {
|
||||
AppToast.showSuccessToast(
|
||||
message: "Order has been placed successfully!!");
|
||||
openPayment(model.orderListModel[0], model.user);
|
||||
} else {
|
||||
AppToast.showErrorToast(message: model.error);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
: null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: new Text(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.proceedPay}",
|
||||
style: new TextStyle(
|
||||
color: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? Colors.white
|
||||
: Colors.grey.shade400,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12),
|
||||
),
|
||||
),
|
||||
color: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? Colors.green
|
||||
: Color(0xff929295),
|
||||
disabledColor: (paymentData.address != null &&
|
||||
paymentData.paymentOption != null)
|
||||
? Colors.green
|
||||
: Color(0xff929295),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
openPayment(OrderDetailModel order,
|
||||
AuthenticatedUser authenticatedUser,) {
|
||||
browser = new MyInAppBrowser(
|
||||
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
|
||||
|
||||
browser.openPharmacyPaymentBrowser(
|
||||
order,
|
||||
order.orderTotal,
|
||||
'ePharmacy Order',
|
||||
order.id,
|
||||
order.billingAddress.email,
|
||||
order.customValuesXml,
|
||||
"${authenticatedUser.firstName} ${authenticatedUser
|
||||
.middleName} ${authenticatedUser.lastName}",
|
||||
authenticatedUser.patientID,
|
||||
authenticatedUser,
|
||||
browser);
|
||||
}
|
||||
|
||||
onBrowserLoadStart(String url) {
|
||||
print("onBrowserLoadStart");
|
||||
print(url);
|
||||
|
||||
MyInAppBrowser.successURLS.forEach((element) {
|
||||
if (url.contains(element)) {
|
||||
if (browser.isOpened()) browser.close();
|
||||
MyInAppBrowser.isPaymentDone = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
MyInAppBrowser.errorURLS.forEach((element) {
|
||||
if (url.contains(element)) {
|
||||
if (browser.isOpened()) browser.close();
|
||||
MyInAppBrowser.isPaymentDone = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
||||
print("onBrowserExit Called!!!!");
|
||||
if (isPaymentMade) {
|
||||
AppToast.showSuccessToast(
|
||||
message: "شكراً\nPayment status for your order is Paid");
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
AppToast.showErrorToast(
|
||||
message:
|
||||
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,420 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CartOrderPage extends StatefulWidget {
|
||||
final Function(int) changeTab;
|
||||
|
||||
const CartOrderPage({Key key, this.changeTab}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CartOrderPageState createState() => _CartOrderPageState();
|
||||
}
|
||||
|
||||
class _CartOrderPageState extends State<CartOrderPage> {
|
||||
bool isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getData();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
OrderPreviewViewModel model = Provider.of(context);
|
||||
|
||||
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
|
||||
AppScaffold appScaffold;
|
||||
return NetworkBaseView(
|
||||
// baseViewModel: model,
|
||||
isLoading: isLoading,
|
||||
isLocalLoader: true,
|
||||
child: AppScaffold(
|
||||
appBarTitle: TranslationBase.of(context).shoppingCart,
|
||||
isShowAppBar: true,
|
||||
isPharmacy: true,
|
||||
showHomeAppBarIcon: false,
|
||||
isShowDecPage: true,
|
||||
baseViewModel: model,
|
||||
backButtonTab:
|
||||
widget.changeTab != null ? () => widget.changeTab(0) : null,
|
||||
backgroundColor: Colors.white,
|
||||
body: !(model.cartResponse.shoppingCarts == null ||
|
||||
model.cartResponse.shoppingCarts.length == 0)
|
||||
? Container(
|
||||
height: height * 0.85,
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GestureIconButton(
|
||||
TranslationBase.of(context).deleteAllItems,
|
||||
Icon(
|
||||
Icons.delete_outline_sharp,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
onTap: () => {model.deleteShoppingCart()},
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
...List.generate(
|
||||
model.cartResponse.shoppingCarts != null
|
||||
? model.cartResponse.shoppingCarts.length
|
||||
: 0,
|
||||
(index) => ProductOrderItem(
|
||||
model.cartResponse
|
||||
.shoppingCarts[index], () {
|
||||
print(model.cartResponse
|
||||
.shoppingCarts[index].quantity);
|
||||
model
|
||||
.changeProductQuantity(model
|
||||
.cartResponse
|
||||
.shoppingCarts[index])
|
||||
.then((value) {
|
||||
if (model.state != ViewState.Error) {
|
||||
appScaffold.appBar.badgeUpdater(
|
||||
'${value.quantityCount ?? 0}');
|
||||
}
|
||||
if (model.state ==
|
||||
ViewState.ErrorLocal) {
|
||||
Utils.showErrorToast(model.error);
|
||||
}
|
||||
});
|
||||
}, () {
|
||||
model
|
||||
.deleteProduct(model.cartResponse
|
||||
.shoppingCarts[index])
|
||||
.then((value) {
|
||||
if (model.state != ViewState.Error) {
|
||||
appScaffold.appBar.badgeUpdater(
|
||||
'${value.quantityCount ?? 0}');
|
||||
}
|
||||
});
|
||||
}))
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 2,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).subtotal,
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).vat}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).total,
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/payment_image.png",
|
||||
width: mediaQuery.size.width - 20,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
SizedBox(
|
||||
height: 120,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/new-design/empty_box.png',
|
||||
width: 100,
|
||||
height: 100,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
TranslationBase.of(context).noData,
|
||||
// 'There is no data',
|
||||
style: TextStyle(fontSize: 30),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: !(model.cartResponse.shoppingCarts == null ||
|
||||
model.cartResponse.shoppingCarts.length == 0)
|
||||
? height * 0.15
|
||||
: 0,
|
||||
color: Colors.white,
|
||||
child: OrderBottomWidget(model.addresses, height),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void getData() async {
|
||||
await Provider.of<OrderPreviewViewModel>(context, listen: false)
|
||||
.getShoppingCart();
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class OrderBottomWidget extends StatefulWidget {
|
||||
final List<Addresses> addresses;
|
||||
final double height;
|
||||
|
||||
OrderBottomWidget(this.addresses, this.height);
|
||||
|
||||
@override
|
||||
_OrderBottomWidgetState createState() => _OrderBottomWidgetState();
|
||||
}
|
||||
|
||||
class _OrderBottomWidgetState extends State<OrderBottomWidget> {
|
||||
bool isAgree = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectProvider = Provider.of(context);
|
||||
OrderPreviewViewModel cart = Provider.of(context);
|
||||
return !(cart.cartResponse.shoppingCarts == null ||
|
||||
cart.cartResponse.shoppingCarts.length == 0)
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Container(
|
||||
height: widget.height * 0.070,
|
||||
color: Color(0xffe6ffe0),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isAgree = !isAgree;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: 25.0,
|
||||
height: widget.height * 0.070,
|
||||
decoration: new BoxDecoration(
|
||||
color: !isAgree ? Color(0xffeeeeee) : Colors.green,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: !isAgree
|
||||
? null
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(0.0),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
size: 25,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Texts(
|
||||
TranslationBase.of(context)
|
||||
.pharmacyServiceTermsCondition,
|
||||
fontSize: 13,
|
||||
color: Colors.grey.shade800,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {
|
||||
Navigator.push(
|
||||
context, FadePage(page: PharmacyTermsConditions()))
|
||||
},
|
||||
child: Container(
|
||||
child: Icon(
|
||||
Icons.info,
|
||||
size: 25,
|
||||
color: Color(0xff005aff),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: widget.height * 0.065,
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 0, vertical: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: projectProvider.isArabic ? 12 : 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Texts(
|
||||
"${TranslationBase.of(context).inclusiveVat}",
|
||||
fontSize: 8,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
|
||||
fontSize: 10,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
onPressed: isAgree
|
||||
? () => {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page:
|
||||
OrderPreviewPage(widget.addresses)))
|
||||
}
|
||||
: null,
|
||||
child: new Text(
|
||||
"${TranslationBase.of(context).checkOut}",
|
||||
style: new TextStyle(
|
||||
color:
|
||||
isAgree ? Colors.white : Colors.grey.shade300,
|
||||
fontSize: 14),
|
||||
),
|
||||
color: Color(0xff005aff),
|
||||
disabledColor: Color(0xff005aff),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,238 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'lakum_widget.dart';
|
||||
|
||||
class OrderPreviewPage extends StatefulWidget {
|
||||
final List<Addresses> addresses;
|
||||
|
||||
OrderPreviewPage(this.addresses);
|
||||
|
||||
@override
|
||||
_OrderPreviewPageState createState() => _OrderPreviewPageState();
|
||||
}
|
||||
|
||||
class _OrderPreviewPageState extends State<OrderPreviewPage> {
|
||||
MyInAppBrowser browser;
|
||||
bool isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getData();
|
||||
}
|
||||
|
||||
void getData() async {
|
||||
if (isLoading)
|
||||
await Provider.of<OrderPreviewViewModel>(context, listen: false)
|
||||
.getShoppingCart();
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
|
||||
OrderPreviewViewModel model = Provider.of(context);
|
||||
return AppScaffold(
|
||||
appBarTitle: "${TranslationBase.of(context).checkOut}",
|
||||
isShowAppBar: true,
|
||||
isPharmacy: true,
|
||||
isShowDecPage: false,
|
||||
isLoading: isLoading,
|
||||
isLocalLoader: true,
|
||||
backgroundColor: Colors.white,
|
||||
// baseViewModel: model,
|
||||
body: Container(
|
||||
color: Color(0xFFF1F1F1),
|
||||
height: height * 0.90,
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
color: Color(0xFFF1F1F1),
|
||||
child: Column(
|
||||
children: [
|
||||
SelectAddressWidget(model, widget.addresses),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SelectPaymentOptionWidget(model),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
model.paymentCheckoutData.lacumInformation != null
|
||||
? Container(
|
||||
child: Column(
|
||||
children: [
|
||||
LakumWidget(model),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).reviewOrder,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
...List.generate(
|
||||
model.cartResponse.shoppingCarts != null
|
||||
? model.cartResponse.shoppingCarts.length
|
||||
: 0,
|
||||
(index) => ProductOrderPreviewItem(
|
||||
model.cartResponse.shoppingCarts[index]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: model.cartResponse.subtotal != null
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).orderSummary,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).subtotal}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).shipping}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).vat}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xFFD6D6D6),
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).total,
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
SizedBox(
|
||||
height: model.cartResponse.shoppingCarts != null
|
||||
? height * 0.10
|
||||
: 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
|
||||
color: Colors.white,
|
||||
child: PaymentBottomWidget(model),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,187 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LakumWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
LakumWidget(this.model);
|
||||
|
||||
@override
|
||||
_LakumWidgetState createState() => _LakumWidgetState();
|
||||
}
|
||||
|
||||
class _LakumWidgetState extends State<LakumWidget> {
|
||||
TextEditingController _pointsController = new TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectProvider = Provider.of(context);
|
||||
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/lakum/lakum_checkout.png",
|
||||
width: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(color: Color(0x99ffffff)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).lakumPoints}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Texts(
|
||||
"${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: Color(0x99ffffff)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).riyal}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Container(
|
||||
margin: projectProvider.isArabic
|
||||
? EdgeInsets.only(right: 4)
|
||||
: EdgeInsets.only(left: 4),
|
||||
width: 60,
|
||||
height: 50,
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 0.2),
|
||||
gapPadding: 0,
|
||||
borderRadius: projectProvider.isArabic
|
||||
? BorderRadius.only(
|
||||
topRight: Radius.circular(8),
|
||||
bottomRight: Radius.circular(8))
|
||||
: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8)),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 0.4),
|
||||
gapPadding: 0,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8)),
|
||||
),
|
||||
),
|
||||
controller: _pointsController,
|
||||
keyboardType: TextInputType.number,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount >
|
||||
0
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
enabled: widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount ==
|
||||
0
|
||||
? false
|
||||
: true,
|
||||
onChanged: (val) {
|
||||
var value = int.tryParse(val);
|
||||
if (value != null &&
|
||||
value <=
|
||||
widget
|
||||
.model
|
||||
.paymentCheckoutData
|
||||
.lacumInformation
|
||||
.lakumInquiryInformationObjVersion
|
||||
.pointsBalanceAmount) {
|
||||
widget.model.paymentCheckoutData.usedLakumPoints =
|
||||
value;
|
||||
} else {
|
||||
widget.model.paymentCheckoutData.usedLakumPoints = 0;
|
||||
}
|
||||
_pointsController.text =
|
||||
"${widget.model.paymentCheckoutData.usedLakumPoints}";
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 50,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
||||
decoration: new BoxDecoration(
|
||||
color: Color(0xff3666E0),
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: projectProvider.isArabic
|
||||
? BorderRadius.only(
|
||||
topLeft: Radius.circular(6),
|
||||
bottomLeft: Radius.circular(6))
|
||||
: BorderRadius.only(
|
||||
topRight: Radius.circular(6),
|
||||
bottomRight: Radius.circular(6)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xff3666E0),
|
||||
width: 0.8,
|
||||
)),
|
||||
),
|
||||
child: Texts(
|
||||
"${TranslationBase.of(context).use}",
|
||||
fontSize: 12,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,195 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PaymentBottomWidget extends StatelessWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
BuildContext context;
|
||||
MyInAppBrowser browser;
|
||||
|
||||
PaymentBottomWidget(this.model);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scaffold = Scaffold.of(context);
|
||||
this.context = context;
|
||||
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: orderPreviewViewModel.paymentCheckoutData.cartDataVisible
|
||||
? Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Texts(
|
||||
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff929295),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Texts(
|
||||
"${TranslationBase.of(context).inclusiveVat}",
|
||||
fontSize: 8,
|
||||
color: Color(0xff929295),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
|
||||
fontSize: 10,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: RaisedButton(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Color(0xff929295),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
onPressed: (orderPreviewViewModel
|
||||
.paymentCheckoutData.address !=
|
||||
null &&
|
||||
orderPreviewViewModel
|
||||
.paymentCheckoutData.paymentOption !=
|
||||
null)
|
||||
? () async {
|
||||
await model.makeOrder();
|
||||
if (model.state == ViewState.Idle) {
|
||||
AppToast.showSuccessToast(
|
||||
message:
|
||||
"Order has been placed successfully!!");
|
||||
openPayment(
|
||||
model.orderListModel[0], model.user);
|
||||
} else {
|
||||
AppToast.showErrorToast(message: model.error);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
: null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: new Text(
|
||||
"${TranslationBase.of(context).proceedPay}",
|
||||
style: new TextStyle(
|
||||
color: (orderPreviewViewModel
|
||||
.paymentCheckoutData.address !=
|
||||
null &&
|
||||
orderPreviewViewModel.paymentCheckoutData
|
||||
.paymentOption !=
|
||||
null)
|
||||
? Colors.white
|
||||
: Colors.grey.shade400,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12),
|
||||
),
|
||||
),
|
||||
color:
|
||||
(orderPreviewViewModel.paymentCheckoutData.address !=
|
||||
null &&
|
||||
orderPreviewViewModel
|
||||
.paymentCheckoutData.paymentOption !=
|
||||
null)
|
||||
? Colors.green
|
||||
: Color(0xff929295),
|
||||
disabledColor:
|
||||
(orderPreviewViewModel.paymentCheckoutData.address !=
|
||||
null &&
|
||||
orderPreviewViewModel
|
||||
.paymentCheckoutData.paymentOption !=
|
||||
null)
|
||||
? Colors.green
|
||||
: Color(0xff929295),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
);
|
||||
}
|
||||
|
||||
openPayment(
|
||||
OrderDetailModel order,
|
||||
AuthenticatedUser authenticatedUser,
|
||||
) {
|
||||
browser = new MyInAppBrowser(
|
||||
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
|
||||
|
||||
browser.openPharmacyPaymentBrowser(
|
||||
order,
|
||||
order.orderTotal,
|
||||
'ePharmacy Order',
|
||||
order.id,
|
||||
order.billingAddress.email,
|
||||
order.customValuesXml,
|
||||
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}",
|
||||
authenticatedUser.patientID,
|
||||
authenticatedUser,
|
||||
browser);
|
||||
}
|
||||
|
||||
onBrowserLoadStart(String url) {
|
||||
print("onBrowserLoadStart");
|
||||
print(url);
|
||||
|
||||
MyInAppBrowser.successURLS.forEach((element) {
|
||||
if (url.contains(element)) {
|
||||
if (browser.isOpened()) browser.close();
|
||||
MyInAppBrowser.isPaymentDone = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
MyInAppBrowser.errorURLS.forEach((element) {
|
||||
if (url.contains(element)) {
|
||||
if (browser.isOpened()) browser.close();
|
||||
MyInAppBrowser.isPaymentDone = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
||||
print("onBrowserExit Called!!!!");
|
||||
if (isPaymentMade) {
|
||||
AppToast.showSuccessToast(
|
||||
message: "شكراً\nPayment status for your order is Paid");
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
AppToast.showErrorToast(
|
||||
message:
|
||||
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,226 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SelectAddressWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
final List<Addresses> addresses;
|
||||
|
||||
SelectAddressWidget(this.model, this.addresses);
|
||||
|
||||
@override
|
||||
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
|
||||
}
|
||||
|
||||
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
|
||||
Addresses address;
|
||||
|
||||
_navigateToAddressPage() {
|
||||
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
|
||||
.then((result) {
|
||||
if (result != null) {
|
||||
address = result;
|
||||
widget.model.paymentCheckoutData.address = address;
|
||||
widget.model.getInformationsByAddress();
|
||||
}
|
||||
|
||||
/* setState(() {
|
||||
if (result != null) {
|
||||
address = result;
|
||||
widget.model.paymentCheckoutData.address = address;
|
||||
widget.model.getInformationsByAddress();
|
||||
}
|
||||
})*/
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.model.paymentCheckoutData.address != null) {
|
||||
address = widget.model.paymentCheckoutData.address;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
OrderPreviewViewModel model = Provider.of(context);
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: address == null
|
||||
? InkWell(
|
||||
onTap: () => {_navigateToAddressPage()},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_address.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).selectAddress,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_mark.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).shippingAddress,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {_navigateToAddressPage()},
|
||||
child: Texts(
|
||||
TranslationBase.of(context).changeAddress,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Texts(
|
||||
"${address.firstName} ${address.lastName}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Texts(
|
||||
"${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
child: Icon(
|
||||
Icons.phone,
|
||||
size: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"${address.phoneNumber}",
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 8),
|
||||
child: SizedBox(
|
||||
height: 2,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_shipping_truck.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
"${TranslationBase.of(context).shipBy}",
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Image.asset(
|
||||
model.paymentCheckoutData.shippingOption == null
|
||||
? ""
|
||||
: model.paymentCheckoutData.shippingOption
|
||||
.shippingRateComputationMethodSystemName ==
|
||||
"Shipping.FixedOrByWeight"
|
||||
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
|
||||
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
), // ic_shipping_mark.png
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,146 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SelectPaymentOptionWidget extends StatefulWidget {
|
||||
final OrderPreviewViewModel model;
|
||||
|
||||
SelectPaymentOptionWidget(this.model);
|
||||
|
||||
@override
|
||||
_SelectPaymentOptionWidgetState createState() =>
|
||||
_SelectPaymentOptionWidgetState();
|
||||
}
|
||||
|
||||
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
|
||||
PaymentOption paymentOption;
|
||||
|
||||
_navigateToPaymentOption() {
|
||||
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
|
||||
.then((result) => {
|
||||
setState(() {
|
||||
if (result != null) {
|
||||
paymentOption = result;
|
||||
widget.model.paymentCheckoutData.paymentOption =
|
||||
paymentOption;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.model.paymentCheckoutData.paymentOption != null) {
|
||||
paymentOption = widget.model.paymentCheckoutData.paymentOption;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: paymentOption == null
|
||||
? InkWell(
|
||||
onTap: () => {_navigateToPaymentOption()},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_payment_option.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).selectPaymentOption,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/pharmacy_module/ic_payment_option.png",
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0),
|
||||
decoration: new BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Image.asset(
|
||||
widget.model.getPaymentOptionImage(paymentOption),
|
||||
width: 30.0,
|
||||
height: 30.0,
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
|
||||
child: Texts(
|
||||
widget.model.getPaymentOptionName(paymentOption),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => {_navigateToPaymentOption()},
|
||||
child: Texts(
|
||||
TranslationBase.of(context).changeMethod,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Color(0xff0000ff),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AvailabilityInfo extends StatelessWidget {
|
||||
final ProductDetailViewModel previousModel;
|
||||
|
||||
const AvailabilityInfo({Key key, this.previousModel}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return previousModel.productLocationService.length == 0
|
||||
? Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
TranslationBase.of(context).noLocationAvailable,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
physics: ScrollPhysics(),
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: previousModel.productLocationService.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Image.network(previousModel
|
||||
.productLocationService[index].projectImageUrl),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
previousModel.productLocationService[index]
|
||||
.locationDescription +
|
||||
"\n" +
|
||||
convertCityName(
|
||||
previousModel.productLocationService[0].cityName
|
||||
.toString(),
|
||||
),
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.location_on),
|
||||
color: Colors.red,
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.phone),
|
||||
color: Colors.red,
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(height: 1.2, color: Colors.grey)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
convertCityName(txt) {
|
||||
String stringTxt;
|
||||
String newTxt;
|
||||
stringTxt = txt.toString();
|
||||
newTxt = stringTxt.split('.')[1];
|
||||
|
||||
return newTxt;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DetailsInfo extends StatelessWidget {
|
||||
|
||||
final PharmacyProduct product;
|
||||
|
||||
const DetailsInfo({Key key, this.product}) : super(key: key);
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Texts(
|
||||
TranslationBase.of(context)
|
||||
.description,
|
||||
fontSize: 17,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Divider(height: 1, color: Colors.grey),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Container(
|
||||
child: Texts(
|
||||
projectViewModel.isArabic
|
||||
? product.fullDescriptionn
|
||||
: product
|
||||
.fullDescription ??
|
||||
"",
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DiscountDescription extends StatelessWidget {
|
||||
final PharmacyProduct product;
|
||||
|
||||
const DiscountDescription({Key key, this.product}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
color: Colors.yellowAccent,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
product
|
||||
.discountDescription,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 17),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 0,
|
||||
child: Container(
|
||||
child: Image(
|
||||
image: AssetImage(
|
||||
'assets/images/offer.png'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,258 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import '../../../../../locator.dart';
|
||||
import '../../../../../routes.dart';
|
||||
import '../../cart-page/cart-order-page.dart';
|
||||
import '../product-detail.dart';
|
||||
|
||||
class FooterWidget extends StatefulWidget {
|
||||
final bool isAvailable;
|
||||
final int maxQuantity;
|
||||
final int minQuantity;
|
||||
final int quantityLimit;
|
||||
final PharmacyProduct item;
|
||||
final Function addToCartFunction;
|
||||
final ProductDetailViewModel model;
|
||||
|
||||
int quantity;
|
||||
bool isOverQuantity;
|
||||
|
||||
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
|
||||
this.quantityLimit, this.item,
|
||||
{this.quantity,
|
||||
this.isOverQuantity = false,
|
||||
this.addToCartFunction,
|
||||
this.model});
|
||||
|
||||
@override
|
||||
_FooterWidgetState createState() => _FooterWidgetState();
|
||||
}
|
||||
|
||||
class _FooterWidgetState extends State<FooterWidget> {
|
||||
double quantityUI = 80;
|
||||
bool showUI = false;
|
||||
AuthenticatedUserObject authenticatedUserObject =
|
||||
locator<AuthenticatedUserObject>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(0.0),
|
||||
),
|
||||
border: Border.all(color: HexColor('#707070'), width: 0),
|
||||
),
|
||||
width: double.infinity,
|
||||
height: quantityUI,
|
||||
child: Column(
|
||||
children: [
|
||||
showUI
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
color: Colors.white,
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"Quantity",
|
||||
style: TextStyle(
|
||||
fontSize: 15, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(Icons.close, color: Colors.black),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
quantityUI = 80;
|
||||
showUI = false;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
),
|
||||
Container(
|
||||
height: 50.0,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
for (int i = 1; i <= 10; i++)
|
||||
QuantityBox(
|
||||
label: i,
|
||||
onTapFunc: onChangeValue,
|
||||
isSelected: widget.quantity == i),
|
||||
Container(
|
||||
width: 100,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey[300]),
|
||||
color: Colors.white,
|
||||
),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: ' Quantity # '),
|
||||
onChanged: (text) {
|
||||
if (int.tryParse(text) == null) {
|
||||
text = '';
|
||||
} else {
|
||||
setState(() {
|
||||
widget.quantity = int.parse(text);
|
||||
if (widget.quantity >=
|
||||
widget.quantityLimit) {
|
||||
widget.isOverQuantity = true;
|
||||
} else {
|
||||
widget.isOverQuantity = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 70,
|
||||
height: 50,
|
||||
child: FlatButton(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
widget.quantity.toString(),
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
TranslationBase.of(context).quantityShortcut,
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (showUI) {
|
||||
quantityUI = 80;
|
||||
showUI = false;
|
||||
} else {
|
||||
quantityUI = 160;
|
||||
showUI = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
child: SecondaryButton(
|
||||
label: TranslationBase.of(context).addToCart.toUpperCase(),
|
||||
disabled: !widget.isAvailable && widget.quantity == 0 ||
|
||||
widget.quantity > widget.quantityLimit ||
|
||||
widget.item.rxMessage != null,
|
||||
disableColor: Color(0xFF4CAF50),
|
||||
onTap: () async {
|
||||
if (!authenticatedUserObject.isLogin) {
|
||||
Navigator.of(context).pushNamed(
|
||||
WELCOME_LOGIN,
|
||||
);
|
||||
} else
|
||||
await widget.addToCartFunction(
|
||||
quantity: widget.quantity,
|
||||
itemID: widget.item.id,
|
||||
model: widget.model);
|
||||
},
|
||||
fontWeight: FontWeight.w600,
|
||||
borderColor: Color(0xFF4CAF50),
|
||||
borderRadius: 3,
|
||||
color: Color(0xFF4CAF50),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.35,
|
||||
child: SecondaryButton(
|
||||
label: TranslationBase.of(context).buyNow.toUpperCase(),
|
||||
disabled: !widget.isAvailable && widget.quantity > 0 ||
|
||||
widget.quantity > widget.quantityLimit ||
|
||||
widget.item.rxMessage != null,
|
||||
onTap: () async {
|
||||
await widget.addToCartFunction(
|
||||
quantity: widget.quantity,
|
||||
itemID: widget.item.id,
|
||||
model: widget.model);
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(page: CartOrderPage()),
|
||||
);
|
||||
},
|
||||
fontWeight: FontWeight.w600,
|
||||
borderColor: Colors.grey[800],
|
||||
borderRadius: 3,
|
||||
disableColor: Colors.grey[700],
|
||||
color: !widget.isAvailable && widget.quantity > 0 ||
|
||||
widget.quantity > widget.quantityLimit ||
|
||||
widget.item.rxMessage != null
|
||||
? Colors.grey
|
||||
: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
onChangeValue(int i) {
|
||||
setState(() {
|
||||
widget.quantity = i;
|
||||
if (widget.quantity >= widget.quantityLimit) {
|
||||
widget.isOverQuantity = true;
|
||||
} else {
|
||||
widget.isOverQuantity = false;
|
||||
return widget.quantity;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class QuantityBox extends StatelessWidget {
|
||||
final int label;
|
||||
final bool isSelected;
|
||||
final Function(int) onTapFunc;
|
||||
|
||||
QuantityBox({
|
||||
Key key,
|
||||
this.label,
|
||||
this.onTapFunc, this.isSelected = false,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
InkWell(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color:isSelected?Colors.green: Colors.grey[300]),
|
||||
color: Colors.white,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
width: 50.0,
|
||||
|
||||
child: Text(
|
||||
'$label',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||
),
|
||||
),
|
||||
onTap:(){
|
||||
onTapFunc(label);
|
||||
}
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,365 @@
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'availability_info.dart';
|
||||
import 'details_info.dart';
|
||||
import 'discount_description.dart';
|
||||
import 'footor/footer-widget.dart';
|
||||
import 'shared/product_details_app_bar.dart';
|
||||
|
||||
String itemID;
|
||||
PharmacyProduct specificationData;
|
||||
|
||||
class ProductDetailPage extends StatefulWidget {
|
||||
final PharmacyProduct product;
|
||||
|
||||
ProductDetailPage(this.product);
|
||||
|
||||
@override
|
||||
__ProductDetailPageState createState() => __ProductDetailPageState();
|
||||
}
|
||||
|
||||
class __ProductDetailPageState extends State<ProductDetailPage> {
|
||||
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||
|
||||
bool isTrue = true;
|
||||
bool isDetails = true;
|
||||
bool isReviews = false;
|
||||
bool isAvailability = false;
|
||||
String customerId;
|
||||
bool isSelected = true;
|
||||
bool isOverQuantity = false;
|
||||
bool isInWishList = false;
|
||||
int quantity = 0;
|
||||
|
||||
checkWishlist() async {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
ProductDetailViewModel model = new ProductDetailViewModel();
|
||||
await model.checkWishlistData();
|
||||
|
||||
for (int i = 0; i < model.wishListItems.length; i++) {
|
||||
if (itemID == model.wishListItems[i].product.id) {
|
||||
isInWishList = true;
|
||||
break;
|
||||
} else {
|
||||
isInWishList = false;
|
||||
}
|
||||
}
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void initState() {
|
||||
quantity = 1;
|
||||
specificationData = widget.product;
|
||||
|
||||
userInfo();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void userInfo() async {
|
||||
print(specificationData);
|
||||
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
||||
if (customerId != null) {
|
||||
itemID = widget.product.id;
|
||||
checkWishlist();
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<ProductDetailViewModel>(
|
||||
allowAny: true,
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
appBarTitle: TranslationBase.of(context).productDetails,
|
||||
isShowAppBar: true,
|
||||
isPharmacy: true,
|
||||
isShowDecPage: false,
|
||||
customAppBar: ProductAppBar(
|
||||
product: widget.product,
|
||||
quantity: quantity,
|
||||
model: model,
|
||||
addToWishlistFunction: () async {
|
||||
await addToWishlistFunction(itemID: itemID, model: model);
|
||||
},
|
||||
deleteFromWishlistFunction: () async {
|
||||
await deleteFromWishlistFunction(itemID: itemID, model: model);
|
||||
},
|
||||
isInWishList:isInWishList,
|
||||
addToCartFunction:addToCartFunction ,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
if (widget.product.images.isNotEmpty)
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * .40,
|
||||
child: Image.network(
|
||||
widget.product.images[0].src.trim(),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
if (widget.product.discountDescription != null)
|
||||
DiscountDescription(product: widget.product)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: ProductNameAndPrice(
|
||||
context,
|
||||
widget.product,
|
||||
customerId: customerId,
|
||||
addToWishlistFunction: (item) {
|
||||
addToWishlistFunction(itemID: item, model: model);
|
||||
setState(() {});
|
||||
},
|
||||
deleteFromWishlistFunction: (item) {
|
||||
deleteFromWishlistFunction(
|
||||
itemID: item, model: model);
|
||||
setState(() {});
|
||||
},
|
||||
notifyMeWhenAvailable: (context, itemId) {
|
||||
notifyMeWhenAvailable(
|
||||
itemId: itemId,
|
||||
customerId: customerId,
|
||||
model: model);
|
||||
},
|
||||
isInWishList: isInWishList,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 15, horizontal: 10),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).specification,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
width: double.infinity,
|
||||
),
|
||||
// Divider(color: Colors.grey),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Container(
|
||||
// width: 500,
|
||||
margin: EdgeInsets.only(bottom: 6),
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
isDetails = true;
|
||||
isReviews = false;
|
||||
isAvailability = false;
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
TranslationBase.of(context).details,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
color: Colors.white,
|
||||
),
|
||||
CustomDivider(
|
||||
color: isDetails
|
||||
? Colors.green
|
||||
: Colors.transparent,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
FlatButton(
|
||||
onPressed: () async {
|
||||
if (widget.product.approvedTotalReviews >
|
||||
0) {
|
||||
GifLoaderDialogUtils.showMyDialog(
|
||||
context);
|
||||
await model.getProductReviewsData(
|
||||
widget.product.id);
|
||||
GifLoaderDialogUtils.hideDialog(
|
||||
context);
|
||||
} else {
|
||||
model.clearReview();
|
||||
}
|
||||
setState(() {
|
||||
isDetails = false;
|
||||
isReviews = true;
|
||||
isAvailability = false;
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
TranslationBase.of(context).reviews,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
color: Colors.white,
|
||||
),
|
||||
CustomDivider(
|
||||
color: isReviews
|
||||
? Colors.green
|
||||
: Colors.transparent,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
FlatButton(
|
||||
onPressed: () async {
|
||||
GifLoaderDialogUtils.showMyDialog(
|
||||
context);
|
||||
await model.getProductLocationData();
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
|
||||
setState(() {
|
||||
isDetails = false;
|
||||
isReviews = false;
|
||||
isAvailability = true;
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
TranslationBase.of(context).availability,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
color: Colors.white,
|
||||
),
|
||||
CustomDivider(
|
||||
color: isAvailability
|
||||
? Colors.green
|
||||
: Colors.transparent,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
isDetails
|
||||
? DetailsInfo(
|
||||
product: widget.product,
|
||||
)
|
||||
: isReviews
|
||||
? ReviewsInfo(
|
||||
product: widget.product,
|
||||
previousModel: model,
|
||||
)
|
||||
: isAvailability
|
||||
? AvailabilityInfo(
|
||||
previousModel: model,
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
RecommendedProducts(product: widget.product,productDetailViewModel: model,
|
||||
addToWishlistFunction: (itemID) async {
|
||||
await addToWishlistFunction(itemID: itemID, model: model);
|
||||
}, deleteFromWishlistFunction: (itemID) async {
|
||||
await deleteFromWishlistFunction(itemID: itemID, model: model);
|
||||
},)
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomSheet: FooterWidget(
|
||||
widget.product.stockAvailability != 'Out of stock',
|
||||
widget.product.orderMaximumQuantity,
|
||||
widget.product.orderMinimumQuantity,
|
||||
widget.product.stockQuantity,
|
||||
widget.product,
|
||||
quantity: quantity,
|
||||
isOverQuantity: isOverQuantity,
|
||||
addToCartFunction: addToCartFunction,
|
||||
model: model,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
|
||||
isInWishList = true;
|
||||
await model.addToWishlistData(itemID);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async {
|
||||
isInWishList = false;
|
||||
await model.deleteWishlistData(itemID);
|
||||
setState(() {});
|
||||
}
|
||||
addToCartFunction(
|
||||
{quantity,
|
||||
itemID,
|
||||
ProductDetailViewModel model}) async {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await model.addToCartData(quantity, itemID);
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
notifyMeWhenAvailable(
|
||||
{itemId, customerId, ProductDetailViewModel model}) async {
|
||||
await model.notifyMe(customerId, itemId);
|
||||
}
|
||||
@ -0,0 +1,203 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rating_bar/rating_bar.dart';
|
||||
|
||||
import '../../../../locator.dart';
|
||||
import 'shared/icon_with_bg.dart';
|
||||
|
||||
class ProductNameAndPrice extends StatefulWidget {
|
||||
BuildContext context;
|
||||
PharmacyProduct item;
|
||||
final customerId;
|
||||
final bool isInWishList;
|
||||
final Function notifyMeWhenAvailable;
|
||||
final Function addToWishlistFunction;
|
||||
final Function deleteFromWishlistFunction;
|
||||
|
||||
AuthenticatedUserObject authenticatedUserObject =
|
||||
locator<AuthenticatedUserObject>();
|
||||
|
||||
ProductNameAndPrice(this.context, this.item,
|
||||
{this.customerId,
|
||||
this.isInWishList,
|
||||
this.notifyMeWhenAvailable,
|
||||
this.addToWishlistFunction,
|
||||
this.deleteFromWishlistFunction});
|
||||
|
||||
@override
|
||||
_ProductNameAndPriceState createState() => _ProductNameAndPriceState();
|
||||
}
|
||||
|
||||
class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
FractionallySizedBox(
|
||||
widthFactor: 0.95,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(widget.item.price.toString() + " " + "SR",
|
||||
fontWeight: FontWeight.bold, fontSize: 20),
|
||||
Texts(
|
||||
projectViewModel.isArabic
|
||||
? widget.item.stockAvailabilityn
|
||||
: widget.item.stockAvailability,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
color: widget.item.stockAvailability == 'Out of stock'
|
||||
? Colors.red
|
||||
: Colors.green,
|
||||
),
|
||||
// SizedBox(width: 20),
|
||||
if (widget.authenticatedUserObject.isLogin)
|
||||
widget.item.stockAvailability == 'Out of stock' &&
|
||||
widget.customerId != null
|
||||
? InkWell(
|
||||
onTap: () => widget.notifyMeWhenAvailable(
|
||||
context, widget.item.id),
|
||||
child: Row(children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).notifyMe,
|
||||
decoration: TextDecoration.underline,
|
||||
color: Colors.blue,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Icon(
|
||||
FontAwesomeIcons.bell,
|
||||
color: Colors.blue,
|
||||
size: 15.0,
|
||||
)
|
||||
]),
|
||||
)
|
||||
: IconWithBg(
|
||||
icon: !widget.isInWishList
|
||||
? Icons.favorite_border
|
||||
: Icons.favorite,
|
||||
color: !widget.isInWishList
|
||||
? Colors.white
|
||||
: Colors.red[800],
|
||||
onPress: () async {
|
||||
{
|
||||
if (widget.customerId != null) {
|
||||
if (!widget.isInWishList) {
|
||||
|
||||
await widget
|
||||
.addToWishlistFunction(widget.item.id);
|
||||
|
||||
} else {
|
||||
await widget
|
||||
.deleteFromWishlistFunction(widget.item.id);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 5),
|
||||
child: Align(
|
||||
alignment: projectViewModel.isArabic
|
||||
? Alignment.topRight
|
||||
: Alignment.topLeft,
|
||||
child: Text(
|
||||
projectViewModel.isArabic
|
||||
? widget.item.namen
|
||||
: widget.item.name,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
FractionallySizedBox(
|
||||
widthFactor: 0.95,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Row(
|
||||
children: [
|
||||
RatingBar.readOnly(
|
||||
initialRating: double.parse(
|
||||
widget.item.approvedRatingSum.toString()),
|
||||
size: 15.0,
|
||||
filledColor: Colors.yellow[700],
|
||||
emptyColor: Colors.grey[400],
|
||||
isHalfAllowed: true,
|
||||
halfFilledIcon: Icons.star_half,
|
||||
filledIcon: Icons.star,
|
||||
emptyIcon: Icons.star,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Texts(
|
||||
"${widget.item.approvedRatingSum}",
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
SizedBox(
|
||||
width: 30,
|
||||
),
|
||||
Texts(
|
||||
"(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})",
|
||||
fontSize: 12,
|
||||
),
|
||||
SizedBox(
|
||||
width: 70,
|
||||
),
|
||||
if (widget.item.rxMessage != null)
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
projectViewModel.isArabic
|
||||
? widget.item.rxMessagen.toString()
|
||||
: widget.item.rxMessage.toString(),
|
||||
style: TextStyle(color: Colors.red, fontSize: 10),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Icon(
|
||||
FontAwesomeIcons.questionCircle,
|
||||
color: Colors.red,
|
||||
size: 15.0,
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,346 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/locator.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rating_bar/rating_bar.dart';
|
||||
|
||||
class RecommendedProducts extends StatefulWidget {
|
||||
final PharmacyProduct product;
|
||||
final String customerId;
|
||||
final ProductDetailViewModel productDetailViewModel;
|
||||
final bool isOverQuantity;
|
||||
final bool isInWishList;
|
||||
final Function addToWishlistFunction;
|
||||
final Function deleteFromWishlistFunction;
|
||||
|
||||
AuthenticatedUserObject authenticatedUserObject =
|
||||
locator<AuthenticatedUserObject>();
|
||||
|
||||
RecommendedProducts(
|
||||
{Key key,
|
||||
this.product,
|
||||
this.productDetailViewModel,
|
||||
this.customerId,
|
||||
this.isOverQuantity = false,
|
||||
this.isInWishList = false,
|
||||
this.addToWishlistFunction,
|
||||
this.deleteFromWishlistFunction})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_RecommendedProductsState createState() => _RecommendedProductsState();
|
||||
}
|
||||
|
||||
class _RecommendedProductsState extends State<RecommendedProducts> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return SingleChildScrollView(
|
||||
child: Container(
|
||||
width: 410,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 9),
|
||||
width: 410,
|
||||
color: Colors.white,
|
||||
child: Texts(
|
||||
TranslationBase.of(context).recommended,
|
||||
fontWeight: FontWeight.bold, fontSize: 16
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
height: 210,
|
||||
margin: EdgeInsets.only(bottom: 75),
|
||||
padding: EdgeInsets.only(bottom: 5),
|
||||
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
||||
child: BaseView<PharmacyModuleViewModel>(
|
||||
onModelReady: (model) =>
|
||||
model.getRecommendedProducts(widget.product.id),
|
||||
builder: (_, model, wi) => NetworkBaseView(
|
||||
isLocalLoader: true,
|
||||
baseViewModel: model,
|
||||
child: Container(
|
||||
child: model.state== ViewState.BusyLocal?Container(
|
||||
height: 80,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.white,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.grey[500],
|
||||
),
|
||||
),
|
||||
),
|
||||
):model.recommendedProductList.length != null
|
||||
? ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
// physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: model.recommendedProductList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
RecommendedProductModel data =
|
||||
model.recommendedProductList[index];
|
||||
var json = data.toJson();
|
||||
PharmacyProduct product =
|
||||
new PharmacyProduct.fromJson(json);
|
||||
await Navigator.pushReplacement(
|
||||
context,
|
||||
FadePage(
|
||||
page: ProductDetailPage(product),
|
||||
),
|
||||
);
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
},
|
||||
child: Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Colors.grey[300], width: 2),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
width: MediaQuery.of(context).size.width / 3,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(children: [
|
||||
Container(
|
||||
child: Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: IconButton(
|
||||
icon: Icon(model.recommendedProductList[index].isinwishlist != true
|
||||
? Icons.favorite_border : Icons.favorite),
|
||||
color: model.recommendedProductList[index].isinwishlist != true
|
||||
? Colors.grey : Colors.red,
|
||||
onPressed: () async {
|
||||
if (widget.authenticatedUserObject.isLogin
|
||||
) {
|
||||
if (!widget.isInWishList && model.recommendedProductList[index].isinwishlist != true) {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await widget.addToWishlistFunction(model.recommendedProductList[index].id,
|
||||
);
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
setState(() {
|
||||
model.recommendedProductList[index].isinwishlist = true;});
|
||||
} else {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await widget.deleteFromWishlistFunction(model.recommendedProductList[index].id,
|
||||
);
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
setState(() {
|
||||
model.recommendedProductList[index].isinwishlist = false;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
// checkWishlist();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(
|
||||
0, 16, 10, 16),
|
||||
alignment: Alignment.center,
|
||||
child: (model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.images !=
|
||||
null &&
|
||||
model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.images
|
||||
.length >
|
||||
0)
|
||||
? Image.network(
|
||||
model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.images[0]
|
||||
.src
|
||||
.toString(),
|
||||
fit: BoxFit.cover,
|
||||
height: 60,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/images/no_image.png",
|
||||
fit: BoxFit.cover,
|
||||
height: 60,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.rxMessage !=
|
||||
null
|
||||
? MediaQuery.of(context)
|
||||
.size
|
||||
.width /
|
||||
5
|
||||
: 0,
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffb23838),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(6),
|
||||
),
|
||||
),
|
||||
child: model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.rxMessage !=
|
||||
null
|
||||
? Texts(
|
||||
projectViewModel.isArabic
|
||||
? model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.rxMessagen
|
||||
: model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.rxMessage,
|
||||
color: Colors.white,
|
||||
regular: true,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w400,
|
||||
)
|
||||
: Texts(""),
|
||||
),
|
||||
]),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
projectViewModel.isArabic
|
||||
? model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.namen
|
||||
: model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.name,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 13.0,
|
||||
// fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
// padding: const EdgeInsets.only(top: 15, bottom: 10),
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10, bottom: 5),
|
||||
child: Texts(
|
||||
"SAR ${model.recommendedProductList[index].price}",
|
||||
bold: true,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.only(right: 10),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: RatingBar.readOnly(
|
||||
initialRating: model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.approvedRatingSum
|
||||
.toDouble(),
|
||||
size: 13.0,
|
||||
filledColor:
|
||||
Colors.yellow[700],
|
||||
emptyColor: Colors.grey[500],
|
||||
isHalfAllowed: true,
|
||||
halfFilledIcon:
|
||||
Icons.star_half,
|
||||
filledIcon: Icons.star,
|
||||
emptyIcon: Icons.star,
|
||||
),
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})",
|
||||
// bold: true,
|
||||
fontSize: 12,
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
: Container(
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).nonRecommended,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rating_bar/rating_bar.dart';
|
||||
|
||||
class ReviewsInfo extends StatelessWidget {
|
||||
final PharmacyProduct product;
|
||||
final ProductDetailViewModel previousModel;
|
||||
|
||||
const ReviewsInfo({Key key, this.product, this.previousModel})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return previousModel.productDetailService.length != 0 &&
|
||||
previousModel.productDetailService[0].reviews.length != 0
|
||||
? ListView.builder(
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: previousModel.productDetailService[0].reviews.length,
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
previousModel.productDetailService[0]
|
||||
.reviews[index].customerId
|
||||
.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 210),
|
||||
child: RatingBar.readOnly(
|
||||
initialRating: previousModel
|
||||
.productDetailService[0].reviews[index].rating
|
||||
.toDouble(),
|
||||
size: 15.0,
|
||||
filledColor: Colors.yellow[700],
|
||||
emptyColor: Colors.grey[500],
|
||||
isHalfAllowed: true,
|
||||
halfFilledIcon: Icons.star_half,
|
||||
filledIcon: Icons.star,
|
||||
emptyIcon: Icons.star,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
previousModel
|
||||
.productDetailService[0].reviews[index].reviewText,
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Divider(height: 1, color: Colors.grey),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
TranslationBase.of(context).noReviewsAvailable,
|
||||
),
|
||||
// Text('No Reviews Available'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomDivider extends StatelessWidget {
|
||||
const CustomDivider({
|
||||
Key key,
|
||||
this.color,
|
||||
}) : super(key: key);
|
||||
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 120,
|
||||
height: 2,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class IconWithBg extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
final Function onPress;
|
||||
|
||||
const IconWithBg({Key key, this.icon, this.color, this.onPress})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[200],
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Center(
|
||||
child: IconButton(
|
||||
icon: Icon(icon, size: 20,),
|
||||
color: color,
|
||||
onPressed: () async {
|
||||
onPress();
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../../../locator.dart';
|
||||
import '../../../compare-list.dart';
|
||||
import '../../cart-page/cart-order-page.dart';
|
||||
import 'icon_with_bg.dart';
|
||||
|
||||
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
final PharmacyProduct product;
|
||||
|
||||
final ProductDetailViewModel model;
|
||||
final Function addToWishlistFunction;
|
||||
final Function deleteFromWishlistFunction;
|
||||
final int quantity;
|
||||
final bool isInWishList;
|
||||
final Function addToCartFunction;
|
||||
|
||||
|
||||
ProductAppBar(
|
||||
{Key key,
|
||||
this.product,
|
||||
this.model,
|
||||
this.addToWishlistFunction,
|
||||
this.quantity,
|
||||
this.deleteFromWishlistFunction,
|
||||
this.isInWishList, this.addToCartFunction})
|
||||
: super(key: key);
|
||||
|
||||
AuthenticatedUserObject authenticatedUserObject =
|
||||
locator<AuthenticatedUserObject>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.95,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
IconWithBg(
|
||||
icon: Icons.arrow_back,
|
||||
color: Colors.grey,
|
||||
onPress: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
if (authenticatedUserObject.isLogin)
|
||||
Row(
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
IconWithBg(
|
||||
icon: Icons.shopping_cart,
|
||||
color: Colors.grey[800],
|
||||
onPress: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CartOrderPage()),
|
||||
);
|
||||
}),
|
||||
|
||||
if(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount !=0)
|
||||
Positioned(
|
||||
top:0, right: -1.0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red[800],
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
|
||||
),
|
||||
padding: EdgeInsets.only(left: 5, right: 4.5),
|
||||
height: 18,
|
||||
child: Center(child: Texts(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
IconWithBg(
|
||||
icon: FontAwesomeIcons.ellipsisV,
|
||||
color: Colors.grey,
|
||||
onPress: () {
|
||||
settingModalBottomSheet(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size(double.maxFinite, 50);
|
||||
|
||||
settingModalBottomSheet(context) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext bc) {
|
||||
return Container(
|
||||
child: new Wrap(
|
||||
children: <Widget>[
|
||||
if (product.stockAvailability != 'Out of stock')
|
||||
new ListTile(
|
||||
leading: Icon(Icons.shopping_cart),
|
||||
title: Text(
|
||||
TranslationBase.of(context).addToCart,
|
||||
),
|
||||
onTap: () async {
|
||||
if (quantity > 0) {
|
||||
{
|
||||
await addToCartFunction(
|
||||
quantity: quantity,
|
||||
itemID: itemID,
|
||||
model: model);
|
||||
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} else {
|
||||
AppToast.showErrorToast(
|
||||
message: "you should add quantity");
|
||||
}
|
||||
}),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
!isInWishList ? Icons.favorite_border : Icons.favorite,
|
||||
color: !isInWishList ? Colors.white : Colors.red[800],
|
||||
),
|
||||
title: Text(
|
||||
isInWishList
|
||||
? TranslationBase.of(context).removeFromWishlist
|
||||
: TranslationBase.of(context).addToWishlist,
|
||||
),
|
||||
onTap: () async {
|
||||
if (isInWishList)
|
||||
await deleteFromWishlistFunction();
|
||||
else
|
||||
await addToWishlistFunction();
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
ListTile(
|
||||
leading: Icon(Icons.compare),
|
||||
title: Text(
|
||||
TranslationBase.of(context).compare,
|
||||
),
|
||||
onTap: () {
|
||||
Provider.of<CompareList>(context, listen: false)
|
||||
.addItem(specificationData);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BestSellerViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../final_products_page.dart';
|
||||
import '../ProductTileItem.dart';
|
||||
import 'ViewAllHomeWidget.dart';
|
||||
|
||||
class BestSellerWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<BestSellerViewModel>(
|
||||
onModelReady: (model) => model.getBestSellerProducts(),
|
||||
allowAny: true,
|
||||
builder: (_, model, wi) => NetworkBaseView(
|
||||
isLocalLoader: true,
|
||||
baseViewModel: model,
|
||||
child: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
ViewAllHomeWidget(
|
||||
TranslationBase.of(context).bestSellers,
|
||||
FinalProductsPage(
|
||||
id: "",
|
||||
productType: 20,
|
||||
)),
|
||||
if (model.state != ViewState.BusyLocal)
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height / 3 + 20,
|
||||
child: ListView.builder(
|
||||
itemBuilder: (ctx, i) =>
|
||||
ProductTileItem(model.bestSellerProduct[i], MediaQuery.of(context).size.height / 4 + 20),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: model.bestSellerProduct.length,
|
||||
),
|
||||
) else
|
||||
Container(
|
||||
height: 80,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.white,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.grey[500],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../offers_categorise_page.dart';
|
||||
import 'GridViewCard.dart';
|
||||
|
||||
class GridViewButtons extends StatelessWidget {
|
||||
final PharmacyModuleViewModel model;
|
||||
|
||||
GridViewButtons(this.model);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
|
||||
return Container(
|
||||
child: SizedBox(
|
||||
height: gridHeight,
|
||||
child: GridView.count(
|
||||
childAspectRatio: 2.2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
controller: new ScrollController(keepScrollOffset: false),
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
crossAxisCount: 2,
|
||||
children: [
|
||||
DashboardItem(
|
||||
imageName: 'pharmacy_module/bg_1.png',
|
||||
hasColorFilter: false,
|
||||
opacity: 0.8,
|
||||
child: GridViewCard(
|
||||
TranslationBase.of(context).offersAndPromotions,
|
||||
'assets/images/pharmacy_module/offer_icon.png', () {
|
||||
Navigator.push(context, FadePage(page: OffersCategorisePage()));
|
||||
}),
|
||||
),
|
||||
DashboardItem(
|
||||
imageName: 'pharmacy_module/bg_2.png',
|
||||
opacity: 0,
|
||||
hasColorFilter: false,
|
||||
child: GridViewCard(TranslationBase.of(context).medicationRefill,
|
||||
'assets/images/pharmacy_module/medication_icon.png', () {
|
||||
// model.checkUserIsActivated().then((isActivated) {
|
||||
// if (isActivated) {
|
||||
// Navigator.push(context, FadePage(page: LakumMainPage()));
|
||||
// } else {
|
||||
// Navigator.push(
|
||||
// context, FadePage(page: LakumActivationVidaPage()));
|
||||
// }
|
||||
// });
|
||||
}),
|
||||
),
|
||||
DashboardItem(
|
||||
imageName: 'pharmacy_module/bg_3.png',
|
||||
opacity: 0,
|
||||
hasColorFilter: false,
|
||||
child: GridViewCard(TranslationBase.of(context).myPrescriptions,
|
||||
'assets/images/pharmacy_module/prescription_icon.png', () {
|
||||
Navigator.push(
|
||||
context, FadePage(page: HomePrescriptionsPage()));
|
||||
}),
|
||||
),
|
||||
DashboardItem(
|
||||
imageName: 'pharmacy_module/bg_4.png',
|
||||
opacity: 0,
|
||||
hasColorFilter: false,
|
||||
child: GridViewCard(
|
||||
TranslationBase.of(context).searchAndScanMedication,
|
||||
'assets/images/pharmacy_module/search_scan_icon.png',
|
||||
() {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class GridViewCard extends StatelessWidget {
|
||||
final String text;
|
||||
final String cardImage;
|
||||
final Function handler;
|
||||
|
||||
GridViewCard(this.text, this.cardImage, this.handler);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6),
|
||||
child: Column(
|
||||
children: [
|
||||
Texts(
|
||||
text,
|
||||
color: Colors.white,
|
||||
bold: true,
|
||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
BorderedButton(
|
||||
TranslationBase.of(context).viewAll,
|
||||
handler: handler,
|
||||
tPadding: 0,
|
||||
textColor: Color(0xFF5ab145),
|
||||
bPadding: 0,
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Image.asset(
|
||||
cardImage,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getDate(String date) {
|
||||
DateTime dateObj = DateUtil.convertStringToDate(date);
|
||||
return DateUtil.getWeekDay(dateObj.weekday) +
|
||||
", " +
|
||||
dateObj.day.toString() +
|
||||
" " +
|
||||
DateUtil.getMonth(dateObj.month) +
|
||||
" " +
|
||||
dateObj.year.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,233 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rating_bar/rating_bar.dart';
|
||||
|
||||
class PrescriptionsWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PrescriptionViewModel>(
|
||||
onModelReady: (model) async {
|
||||
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) {
|
||||
model.getPrescription();
|
||||
}
|
||||
},
|
||||
allowAny: true,
|
||||
builder: (_, model, wi) => model.prescriptionsList.length > 0
|
||||
? NetworkBaseView(
|
||||
isLocalLoader: true,
|
||||
baseViewModel: model,
|
||||
child: Container(
|
||||
height: model.prescriptionsList.length > 0
|
||||
? MediaQuery.of(context).size.height * 0.28
|
||||
: 0,
|
||||
child: Column(
|
||||
children: [
|
||||
ViewAllHomeWidget(
|
||||
TranslationBase.of(context).myPrescription,
|
||||
HomePrescriptionsPage()),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 18.0, vertical: 14.0),
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
// physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: model.prescriptionsList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 0.3,
|
||||
padding: EdgeInsets.only(
|
||||
bottom: 5.0, left: 5.0, right: 8.0),
|
||||
margin: EdgeInsets.only(right: 10.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
style: BorderStyle.solid,
|
||||
width: 1.0,
|
||||
),
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10.0)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Column(children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 10.0,
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
bottom: 15.0,
|
||||
),
|
||||
child: CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundColor:
|
||||
Colors.transparent,
|
||||
child: Image.network(
|
||||
model.prescriptionsList[index]
|
||||
.doctorImageURL,
|
||||
width: 60,
|
||||
height: 60,
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.only(left: 1),
|
||||
padding: EdgeInsets.only(
|
||||
left: 15.0, right: 15.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.green,
|
||||
style: BorderStyle.solid,
|
||||
width: 4.0,
|
||||
),
|
||||
color: Colors.green,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
30.0)),
|
||||
child: Text(
|
||||
model.languageID == "ar"
|
||||
? model
|
||||
.prescriptionsList[
|
||||
index]
|
||||
.isInOutPatientDescriptionN
|
||||
.toString()
|
||||
: model
|
||||
.prescriptionsList[
|
||||
index]
|
||||
.isInOutPatientDescription
|
||||
.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 15.0,
|
||||
),
|
||||
)),
|
||||
Row(children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/Icon-awesome-calendar.png',
|
||||
width: 30,
|
||||
height: 30,
|
||||
),
|
||||
Text(
|
||||
DateUtil.convertStringToDate(
|
||||
model
|
||||
.prescriptionsList[
|
||||
index]
|
||||
.appointmentDate
|
||||
.toString())
|
||||
.toString()
|
||||
.substring(0, 10),
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 15.0,
|
||||
),
|
||||
)
|
||||
]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 5),
|
||||
child: Row(children: <Widget>[
|
||||
Text(
|
||||
model.prescriptionsList[index]
|
||||
.doctorTitle
|
||||
.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
model.prescriptionsList[index]
|
||||
.doctorName
|
||||
.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 5),
|
||||
child: Text(
|
||||
model.prescriptionsList[index]
|
||||
.clinicDescription
|
||||
.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.green,
|
||||
fontSize: 15.0,
|
||||
// fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 5),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: RatingBar.readOnly(
|
||||
initialRating: model
|
||||
.prescriptionsList[index]
|
||||
.actualDoctorRate
|
||||
.toDouble(),
|
||||
// initialRating: productRate,
|
||||
size: 15.0,
|
||||
filledColor: Colors.yellow[700],
|
||||
emptyColor: Colors.grey[500],
|
||||
isHalfAllowed: true,
|
||||
halfFilledIcon: Icons.star_half,
|
||||
filledIcon: Icons.star,
|
||||
emptyIcon: Icons.star,
|
||||
),
|
||||
),
|
||||
)
|
||||
]),
|
||||
]),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../final_products_page.dart';
|
||||
import '../ProductTileItem.dart';
|
||||
import 'ViewAllHomeWidget.dart';
|
||||
|
||||
class RecentlyViewedWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<LastVisitedViewModel>(
|
||||
onModelReady: (model) => model.getLastVisitedProducts(),
|
||||
allowAny: true,
|
||||
builder: (_, model, wi) => NetworkBaseView(
|
||||
isLocalLoader: true,
|
||||
baseViewModel: model,
|
||||
child: model.lastVisitedProducts.isNotEmpty ? Container(
|
||||
child: Column(
|
||||
children: [
|
||||
ViewAllHomeWidget(
|
||||
TranslationBase.of(context).recentlyViewed,
|
||||
FinalProductsPage(
|
||||
id: "",
|
||||
productType: 3,
|
||||
)),
|
||||
if (model.state != ViewState.BusyLocal)
|
||||
Container(
|
||||
height: model.lastVisitedProducts.length > 0
|
||||
? MediaQuery.of(context).size.height / 3 + 20
|
||||
: 0,
|
||||
child: ListView.builder(
|
||||
itemBuilder: (ctx, i) =>
|
||||
ProductTileItem(model.lastVisitedProducts[i], MediaQuery.of(context).size.height / 4 + 20),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: model.lastVisitedProducts.length,
|
||||
),
|
||||
)
|
||||
else
|
||||
Container(
|
||||
height: 80,
|
||||
child: Center(
|
||||
child:CircularProgressIndicator(
|
||||
backgroundColor: Colors.white,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.grey[500],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
) : Container(),
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../product-brands.dart';
|
||||
import '../manufacturerItem.dart';
|
||||
import 'ViewAllHomeWidget.dart';
|
||||
|
||||
class ShopByBrandWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<BrandViewModel>(
|
||||
onModelReady: (model) => model.getTopManufacturerList(),
|
||||
allowAny: true,
|
||||
builder: (_, model, wi) => NetworkBaseView(
|
||||
isLocalLoader: true,
|
||||
baseViewModel: model,
|
||||
child: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
ViewAllHomeWidget(TranslationBase.of(context).shopByBrands,
|
||||
ProductBrandsPage()),
|
||||
if (model.state != ViewState.BusyLocal)
|
||||
Container(
|
||||
height: 150,
|
||||
child: ListView.builder(
|
||||
itemBuilder: (ctx, i) =>
|
||||
ManufacturerItem(model.manufacturerList[i]),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: model.manufacturerList.length,
|
||||
),
|
||||
)
|
||||
else
|
||||
Container(
|
||||
height: 80,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.white,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.grey[500],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ViewAllHomeWidget extends StatelessWidget {
|
||||
|
||||
final String title;
|
||||
final Widget navigationWidget;
|
||||
|
||||
|
||||
ViewAllHomeWidget(this.title, this.navigationWidget);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.fromLTRB(16, 10, 16, 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
title,
|
||||
bold: true,
|
||||
fontSize: 16,
|
||||
),
|
||||
BorderedButton(
|
||||
TranslationBase.of(context).viewAll,
|
||||
hasBorder: true,
|
||||
borderColor: Colors.green,
|
||||
textColor: Colors.green,
|
||||
fontWeight: FontWeight.bold,
|
||||
vPadding: 6,
|
||||
hPadding: 14,
|
||||
handler: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
navigationWidget));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'base/base_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
||||
|
||||
|
||||
class SubCategoriseModalsheet extends StatefulWidget {
|
||||
String id;
|
||||
String titleName;
|
||||
|
||||
SubCategoriseModalsheet({this.id, this.titleName});
|
||||
@override
|
||||
_SubCategoriseModalsheetState createState() => _SubCategoriseModalsheetState(id: id, titleName: titleName);
|
||||
|
||||
}
|
||||
|
||||
class _SubCategoriseModalsheetState extends State<SubCategoriseModalsheet> {
|
||||
String id;
|
||||
String titleName;
|
||||
// List<CategoriseParentModel> categoriesList = [];
|
||||
_SubCategoriseModalsheetState({this.id, this.titleName});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return BaseView<PharmacyCategoriseViewModel>(
|
||||
onModelReady: (model) => model.getCategoriseParent(i: id),
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
// appBarTitle: titleName,
|
||||
appBarTitle: TranslationBase.of(context).categorise,
|
||||
isBottomBar: false,
|
||||
isShowAppBar: true,
|
||||
isPharmacy: true,
|
||||
backgroundColor: Colors.white,
|
||||
isShowDecPage: false,
|
||||
baseViewModel: model,
|
||||
body: Container(
|
||||
color: Colors.white,
|
||||
child: Center(
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
itemCount: model.categoriseParent.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: InkWell(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(projectViewModel.isArabic
|
||||
? model.categoriseParent[index].namen
|
||||
: model.categoriseParent[index].name),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Divider(
|
||||
thickness: 0.6,
|
||||
color: Colors.black12,
|
||||
)
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: SubCategorisePage(
|
||||
title: model.categoriseParent[index].name,
|
||||
id: model.categoriseParent[index].id,
|
||||
parentId: id,
|
||||
)),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
// getCatName() {
|
||||
//
|
||||
// if (widget.id == '1' )
|
||||
// return Texts("text1");
|
||||
// else if (widget.id == '2' )
|
||||
// return Texts("text2");
|
||||
// else if (widget.id == '3')
|
||||
// return Texts("text3");
|
||||
// else if (widget.id == '4' )
|
||||
// return Texts("text4");
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@ -1,229 +0,0 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
|
||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
import '../progress_indicator/app_loader_widget.dart';
|
||||
import 'network_base_view.dart';
|
||||
import 'not_auh_page.dart';
|
||||
|
||||
class DetailPageScafold extends StatefulWidget {
|
||||
final String appBarTitle;
|
||||
final Widget body;
|
||||
final Widget bottomSheet;
|
||||
final bool isLoading;
|
||||
final bool isShowAppBar;
|
||||
final bool hasAppBarParam;
|
||||
final BaseViewModel baseViewModel;
|
||||
final bool isBottomBar;
|
||||
final Widget floatingActionButton;
|
||||
final bool isPharmacy;
|
||||
final String title;
|
||||
final String description;
|
||||
final String image;
|
||||
final bool isShowDecPage;
|
||||
final List<String> infoList;
|
||||
final Color backgroundColor;
|
||||
final double preferredSize;
|
||||
final List<Widget> appBarIcons;
|
||||
final PreferredSizeWidget appBarWidget;
|
||||
|
||||
DetailPageScafold(
|
||||
{@required this.body,
|
||||
this.appBarTitle = '',
|
||||
this.isLoading = false,
|
||||
this.isShowAppBar = false,
|
||||
this.hasAppBarParam,
|
||||
this.bottomSheet,
|
||||
this.baseViewModel,
|
||||
this.floatingActionButton,
|
||||
this.isPharmacy = false,
|
||||
this.title,
|
||||
this.description,
|
||||
this.isShowDecPage = true,
|
||||
this.isBottomBar,
|
||||
this.backgroundColor,
|
||||
this.preferredSize = 0.0,
|
||||
this.appBarIcons,
|
||||
this.appBarWidget,
|
||||
this.image,
|
||||
this.infoList});
|
||||
|
||||
@override
|
||||
_DetailPageScafoldState createState() => _DetailPageScafoldState();
|
||||
}
|
||||
|
||||
class _DetailPageScafoldState extends State<DetailPageScafold> {
|
||||
AuthenticatedUserObject authenticatedUserObject =
|
||||
locator<AuthenticatedUserObject>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AppGlobal.context = context;
|
||||
PreferredSizeWidget appBar;
|
||||
|
||||
if (this.widget.appBarWidget == null) {
|
||||
PreferredSizeWidget appBarWidget = AppBarWidget(
|
||||
widget.appBarTitle,
|
||||
widget.appBarIcons,
|
||||
widget.isShowAppBar,
|
||||
isPharmacy: widget.isPharmacy,
|
||||
isShowDecPage: widget.isShowDecPage,
|
||||
image: widget.image,
|
||||
);
|
||||
appBar = widget.preferredSize == 0
|
||||
? appBarWidget
|
||||
: PreferredSize(
|
||||
child: appBarWidget,
|
||||
preferredSize: Size.fromHeight(widget.preferredSize));
|
||||
} else {
|
||||
appBar = this.widget.appBarWidget;
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor:
|
||||
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: appBar,
|
||||
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
|
||||
widget.isShowDecPage)
|
||||
? NotAutPage(
|
||||
title: widget.appBarTitle,
|
||||
description: widget.description,
|
||||
infoList: widget.infoList,
|
||||
)
|
||||
: widget.baseViewModel != null
|
||||
? NetworkBaseView(
|
||||
child: buildBodyWidget(),
|
||||
baseViewModel: widget.baseViewModel,
|
||||
)
|
||||
: buildBodyWidget(),
|
||||
bottomSheet: widget.bottomSheet,
|
||||
//floatingActionButton: floatingActionButton ?? floatingActionButton,
|
||||
// bottomNavigationBar:
|
||||
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
|
||||
// floatingActionButton: FloatingSearchButton(),
|
||||
);
|
||||
}
|
||||
|
||||
buildAppLoaderWidget(bool isLoading) {
|
||||
return isLoading ? AppLoaderWidget() : Container();
|
||||
}
|
||||
|
||||
buildBodyWidget() {
|
||||
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
|
||||
return Stack(children: <Widget>[
|
||||
widget.body, /*FloatingSearchButton()*/
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
||||
final AuthenticatedUserObject authenticatedUserObject =
|
||||
locator<AuthenticatedUserObject>();
|
||||
|
||||
final String appBarTitle;
|
||||
final List<Widget> appBarIcons;
|
||||
final bool isShowAppBar;
|
||||
final bool isPharmacy;
|
||||
final bool isShowDecPage;
|
||||
final String image;
|
||||
|
||||
AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar,
|
||||
{this.isPharmacy = true, this.isShowDecPage = true, this.image});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return buildAppBar(context);
|
||||
}
|
||||
|
||||
Widget buildAppBar(BuildContext context) {
|
||||
return isShowAppBar
|
||||
? AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
// isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
|
||||
textTheme: TextTheme(
|
||||
headline6:
|
||||
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
||||
),
|
||||
title: Texts(
|
||||
authenticatedUserObject.isLogin || !isShowDecPage
|
||||
? appBarTitle.toUpperCase()
|
||||
: TranslationBase.of(context).serviceInformationTitle,
|
||||
color: Colors.white,
|
||||
bold: true,
|
||||
),
|
||||
leading: Builder(
|
||||
builder: (BuildContext context) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: Icon(Icons.arrow_back_ios, color: Colors.grey),
|
||||
);
|
||||
},
|
||||
),
|
||||
centerTitle: true,
|
||||
actions: <Widget>[
|
||||
isPharmacy
|
||||
? IconButton(
|
||||
icon: Icon(Icons.shopping_cart),
|
||||
color: Colors.grey,
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CartOrderPage()),
|
||||
);
|
||||
// Navigator.of(context)
|
||||
// .popUntil(ModalRoute.withName('/'));
|
||||
})
|
||||
: Container(),
|
||||
image != null
|
||||
? InkWell(
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: InsuranceUpdate(),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
image,
|
||||
height: SizeConfig.heightMultiplier * 5,
|
||||
width: SizeConfig.heightMultiplier * 5,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
icon: Icon(FontAwesomeIcons.ellipsisV),
|
||||
color: Colors.grey,
|
||||
onPressed: () {
|
||||
settingModalBottomSheet(context);
|
||||
},
|
||||
),
|
||||
if (appBarIcons != null) ...appBarIcons
|
||||
],
|
||||
)
|
||||
: Container(
|
||||
height: 0,
|
||||
width: 0,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size(double.maxFinite, 60);
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class AccountItem extends StatelessWidget {
|
||||
final String title;
|
||||
final String itemIcon;
|
||||
final bool isTerms;
|
||||
|
||||
const AccountItem({this.title, this.itemIcon, this.isTerms = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
isTerms == false
|
||||
? Container(
|
||||
height: 35.0,
|
||||
width: 35.0,
|
||||
child: SvgPicture.asset(
|
||||
'$itemIcon',
|
||||
width: 35,
|
||||
height: 35,
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
height: 35.0,
|
||||
width: 35.0,
|
||||
child: Image.asset(
|
||||
'$itemIcon',
|
||||
width: 35,
|
||||
height: 35,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Texts(
|
||||
title,
|
||||
fontSize: 15.0,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class AccountServices extends StatelessWidget {
|
||||
final String title;
|
||||
final String serviceImage;
|
||||
final Function onTap;
|
||||
|
||||
const AccountServices({this.title, this.onTap, this.serviceImage});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
// () {
|
||||
// if (customerId == null) {
|
||||
// AppToast.showErrorToast(
|
||||
// message: "Customer not found");
|
||||
// return;
|
||||
// }
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// FadePage(
|
||||
// page: OrderPage(
|
||||
// customerID: customerId)));
|
||||
// },
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')),
|
||||
SvgPicture.asset(
|
||||
'$serviceImage',
|
||||
width: 55,
|
||||
height: 55,
|
||||
),
|
||||
SizedBox(
|
||||
height: 7,
|
||||
),
|
||||
Texts(
|
||||
title,
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||