# Conflicts:
#	lib/config/config.dart
#	lib/pages/landing/landing_page.dart
merge-requests/34/merge
haroon amjad 4 years ago
commit 7f4fbadfab

@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'dart:io';
const MAX_SMALL_SCREEN = 660;
//const BASE_URL = 'https://hmgwebservices.com/Services';
const GET_PROJECT = '/Lists.svc/REST/GetProject';
@ -32,6 +31,8 @@ const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointment
//URL to get patient appointment history
const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory";
const GET_PHARMCY_ITEMS = "/Lists.svc/REST/GetPharmcyItems_Region";
const GET_PHARMACY_LIST = "/Patients.svc/REST/GetPharmcyList";
class AppGlobal {
static var context;

@ -82,4 +82,10 @@ const Map<String, Map<String, String>> localizedValues = {
"dob": {"en": "Birth Date:", "ar": "تاريخ الميلاد"},
"hijri-date": {"en": "Hijri Date", "ar": "التاريخ الهجري"},
"gregorian-date": {"en": "Gregorian Date", "ar": "التاريخ الميلادي"},
'searchMedicine': {'en': 'Search Medicine', 'ar': 'البحث عن الدواء'},
'pharmaciesList': {'en': 'Pharmacies List', 'ar': 'قائمة الصيدلايات'},
'searchMedicineHere': {
'en': 'Search Medicine Here',
'ar': 'ابحث عن الدواء هنا'
},
};

@ -1 +1 @@
enum ViewState { Idle, Busy, Error }
enum ViewState { Idle, Busy, Error, BusyLocal, ErrorLocal }

@ -18,21 +18,21 @@ class HospitalsModel {
HospitalsModel(
{this.desciption,
this.desciptionN,
this.iD,
this.legalName,
this.legalNameN,
this.name,
this.nameN,
this.phoneNumber,
this.setupID,
this.distanceInKilometers,
this.isActive,
this.latitude,
this.longitude,
this.mainProjectID,
this.projectOutSA,
this.usingInDoctorApp});
this.desciptionN,
this.iD,
this.legalName,
this.legalNameN,
this.name,
this.nameN,
this.phoneNumber,
this.setupID,
this.distanceInKilometers,
this.isActive,
this.latitude,
this.longitude,
this.mainProjectID,
this.projectOutSA,
this.usingInDoctorApp});
HospitalsModel.fromJson(Map<String, dynamic> json) {
desciption = json['Desciption'];

@ -0,0 +1,69 @@
class PharmaciesListModel {
int itemID;
int patientTypeID;
int languageID;
String stamp;
String iPAdress;
double versionID;
String tokenID;
String sessionID;
bool isLoginForDoctorApp;
int patientOutSA;
int channel;
int doctorID;
int editedBy;
int projectID;
int clinicID;
PharmaciesListModel({
this.itemID,
this.patientTypeID = 1,
this.languageID = 2,
this.stamp = '2020-04-23T21:01:21.492Z',
this.iPAdress = '11.11.11.11',
this.versionID = 1.2,
this.tokenID,
this.sessionID = 'e29zoooEJ4',
this.isLoginForDoctorApp = true,
this.channel = 9,
//this.patientOutSA = true,
});
PharmaciesListModel.fromJson(Map<String, dynamic> json) {
itemID = json['ItemID'];
patientTypeID = json['PatientTypeID'];
languageID = json['LanguageID'];
stamp = json['stamp'];
iPAdress = json['IPAdress'];
versionID = json['VersionID'];
tokenID = json['TokenID'];
sessionID = json['SessionID'];
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
patientOutSA = json['PatientOutSA'];
channel = json['Channel'];
doctorID = json['DoctorID'];
editedBy = json['EditedBy'];
projectID = json['ProjectID'];
clinicID = json['ClinicID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ItemID'] = this.itemID;
data['PatientTypeID'] = this.patientTypeID;
data['LanguageID'] = this.languageID;
data['stamp'] = this.stamp;
data['IPAdress'] = this.iPAdress;
data['VersionID'] = this.versionID;
data['TokenID'] = this.tokenID;
data['SessionID'] = this.sessionID;
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
data['PatientOutSA'] = this.patientOutSA;
data['Channel'] = this.channel;
data['DoctorID'] = this.doctorID;
data['EditedBy'] = this.editedBy;
data['ProjectID'] = this.projectID;
data['ClinicID'] = this.clinicID;
return data;
}
}

@ -0,0 +1,94 @@
class PharmaciesModel {
String pHRItemName;
int pageIndex;
int pageSize;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
int doctorID;
int editedBy;
int projectID;
int clinicID;
String tokenID;
String stamp;
bool isLoginForDoctorApp;
String itemDes;
String productImage;
PharmaciesModel(
{this.pHRItemName,
this.pageIndex,
this.pageSize,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.doctorID,
this.editedBy,
this.projectID,
this.clinicID,
this.tokenID,
this.stamp,
this.itemDes,
this.productImage,
this.isLoginForDoctorApp});
PharmaciesModel.fromJson(Map<String, dynamic> json) {
productImage = json['ProductImageBase64'];
itemDes = json['ItemDescription'];
pHRItemName = json['PHR_itemName'];
pageIndex = json['PageIndex'];
pageSize = json['PageSize'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
doctorID = json['DoctorID'];
editedBy = json['EditedBy'];
projectID = json['ProjectID'];
clinicID = json['ClinicID'];
tokenID = json['TokenID'];
stamp = json['stamp'];
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PHR_itemName'] = this.pHRItemName;
data['PageIndex'] = this.pageIndex;
data['PageSize'] = this.pageSize;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['DoctorID'] = this.doctorID;
data['EditedBy'] = this.editedBy;
data['ProjectID'] = this.projectID;
data['ClinicID'] = this.clinicID;
data['TokenID'] = this.tokenID;
data['stamp'] = this.stamp;
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
return data;
}
}

@ -0,0 +1,72 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart';
class PharmacyService extends BaseService {
List<PharmaciesModel> _pharmaciesList = List();
List<PharmaciesModel> get pharmaciesList => _pharmaciesList;
bool isFinished = true;
bool hasError = false;
String errorMsg = '';
void clearPharmaciesLis() {
_pharmaciesList.clear();
}
PharmaciesModel _requestGetPharmaciesModel = PharmaciesModel(
channel: 3,
clinicID: 1,
deviceTypeID: 2,
doctorID: 1485,
editedBy: 1485,
generalid: "Cs2020@2016\$2958",
iPAdress: "11.11.11.11",
isDentalAllowedBackend: false,
isLoginForDoctorApp: true,
languageID: 2,
pageIndex: 0,
pageSize: 20,
patientOutSA: 0,
pHRItemName: "panadol",
projectID: 15,
sessionID: "BlUSkYymTt",
stamp: "2020-04-27T12:17:17.721Z",
tokenID: "6EfeKCLRu0GPdFutIt3m7Q==",
versionID: 5.3);
Future getMedicine({String drugName}) async {
hasError = false;
_requestGetPharmaciesModel.pHRItemName = drugName ?? 'panadol';
try {
await baseAppClient.post(GET_PHARMCY_ITEMS,
onSuccess: (dynamic response, int statusCode) {
_pharmaciesList.clear();
response['ListPharmcy_Region'].forEach((item) {
_pharmaciesList.add(PharmaciesModel.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestGetPharmaciesModel.toJson());
} catch (error) {
throw error;
}
}
Future getMedicineList({String name}) async {
_requestGetPharmaciesModel.pHRItemName = name ?? 'panadol';
await baseAppClient.post(GET_PHARMACY_LIST,
onSuccess: (dynamic response, int statusCode) {
_pharmaciesList.clear();
response['PharmList'].forEach((item) {
_pharmaciesList.add(PharmaciesModel.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestGetPharmaciesModel.toJson());
}
}

@ -0,0 +1,36 @@
import '../../locator.dart';
import 'base_view_model.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
import 'package:diplomaticquarterapp/core/service/pharmacies_service.dart';
class PharmacyViewModel extends BaseViewModel {
bool isFinished = true;
bool hasError = false;
String errorMsg = '';
PharmacyService _pharmacyService = locator<PharmacyService>();
List<PharmaciesModel> get pharmacy => _pharmacyService.pharmaciesList;
Future getMedicine() async {
setState(ViewState.Busy);
await _pharmacyService.getMedicine();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getMedicine2({String name}) async {
hasError = false;
_pharmacyService.clearPharmaciesLis();
setState(ViewState.BusyLocal);
await _pharmacyService.getMedicine(drugName: name);
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}

@ -2,6 +2,8 @@ import 'package:get_it/get_it.dart';
import 'core/service/hospital_service.dart';
import 'core/viewModels/hospital_view_model.dart';
import 'core/viewModels/pharmacies_view_model.dart';
import 'core/service/pharmacies_service.dart';
GetIt locator = GetIt.instance;
@ -9,7 +11,9 @@ GetIt locator = GetIt.instance;
void setupLocator() {
/// Services
locator.registerLazySingleton(() => HospitalService());
locator.registerLazySingleton(() => PharmacyService());
/// View Model
locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => PharmacyViewModel());
}

@ -4,6 +4,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
import '../base/base_view.dart';
@ -15,24 +17,23 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return BaseView<HospitalViewModel>(
onModelReady: (model) => model.getHospitals(),
builder: (BuildContext context, HospitalViewModel model, Widget child) =>
return BaseView<PharmacyViewModel>(
// onModelReady: (model) => model.getMedicine(),
builder: (BuildContext context, PharmacyViewModel model, Widget child) =>
AppScaffold(
baseViewModel: model,
body: Column(
children: <Widget>[
InkWell(
onTap: () {
model.getHospitals();
model.getMedicine();
},
child: Container(
child: Texts('call api '),
child: Texts('call api'),
),
),
Expanded(
child: _getHospitals(model.hospitals),
child: _getHospitals(model.pharmacy),
)
// BaseView<DoctorViewModel>(
// onModelReady: (dctorViewModel) => dctorViewModel.getHospitals(),
@ -60,10 +61,10 @@ class _HomePageState extends State<HomePage> {
);
}
Widget _getHospitals(List<HospitalsModel> hospitals) => ListView.builder(
itemCount: hospitals.length,
itemBuilder: (BuildContext context, int index) => Container(
child: Texts(hospitals[index].name),
),
);
Widget _getHospitals(List<PharmaciesModel> hospitals) => ListView.builder(
itemCount: hospitals.length,
itemBuilder: (BuildContext context, int index) => Container(
child: Texts(hospitals[index].itemDes),
),
);
}

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/pages/landing/replay_page.dart';
import 'package:diplomaticquarterapp/providers/auth_provider.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart';
import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
@ -50,7 +51,6 @@ class _LandingPageState extends State<LandingPage> {
return Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.grey,
textTheme: TextTheme(
headline6:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
@ -78,7 +78,7 @@ class _LandingPageState extends State<LandingPage> {
Container(),
ToDo(),
BookingOptions(),
],
]
),
bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab),
);
@ -89,7 +89,7 @@ class _LandingPageState extends State<LandingPage> {
case 0:
return TranslationBase.of(context).home;
case 1:
return 'asd';
return 'Search Medicine';
case 2:
return TranslationBase.of(context).mySchedule;
case 3:

@ -0,0 +1,145 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
import '../base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/buttons/BottomButton.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/drug_item.dart';
import '../../locator.dart';
import 'package:diplomaticquarterapp/core/service/pharmacies_service.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/pharmacies_list_screen.dart';
class MedicineSearch extends StatefulWidget {
@override
_MedicineSearchState createState() => _MedicineSearchState();
}
class _MedicineSearchState extends State<MedicineSearch> {
final textController = TextEditingController();
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return BaseView<PharmacyViewModel>(
builder: (BuildContext context, PharmacyViewModel model, Widget child) =>
AppScaffold(
baseViewModel: model,
appBarTitle: 'Search Medicine',
body: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.only(
bottom: SizeConfig.heightMultiplier * 1,
right: SizeConfig.heightMultiplier * 2.5,
top: SizeConfig.heightMultiplier * 4,
left: SizeConfig.heightMultiplier * 2.5,
),
child: Form(
key: _formKey,
child: TextFields(
hintText: 'Search Medicine here ',
inputAction: TextInputAction.search,
onSaved: (value) {},
onSubmit: (value) {
searchMedicine(model);
},
controller: textController,
validator: (value) {
if (value.isEmpty) {
return 'please enter medicine name';
}
return null;
},
),
),
),
Container(
margin: EdgeInsets.only(
bottom: SizeConfig.heightMultiplier * 0.0,
right: SizeConfig.heightMultiplier * 5,
top: SizeConfig.heightMultiplier * 1,
left: SizeConfig.heightMultiplier * 5,
),
child: Wrap(
children: <Widget>[
Container(
child: Button(
loading: model.state == ViewState.BusyLocal,
label: 'Search',
onTap: () {
searchMedicine(model);
}),
width: 350.0,
),
],
),
),
Container(
margin:
EdgeInsets.only(left: SizeConfig.heightMultiplier * 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
'You Can Find ' +
'${model.pharmacy == null ? '0' : model.pharmacy.length.toString()}'
' Item In Search ',
),
],
),
),
if (model.state == ViewState.ErrorLocal)
Container(
child: Texts(model.error),
),
Expanded(
child: Container(
width: SizeConfig.screenWidth * 0.85,
//child: _getHospitals(model.pharmacy),
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.pharmacy == null
? 0
: model.pharmacy.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: MedicineItemWidget(
label: model.pharmacy[index].itemDes,
url: model.pharmacy[index].productImage),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PharmaciesList()),
);
},
);
}),
),
)
],
)),
);
}
searchMedicine(PharmacyViewModel model) {
Utils.hideKeyboard(context);
if (_formKey.currentState.validate())
model.getMedicine2(name: textController.text);
}
Widget _getHospitals(List<PharmaciesModel> hospitals) => ListView.builder(
itemCount: hospitals.length,
itemBuilder: (BuildContext context, int index) => Container(
child: Texts(hospitals[index].itemDes),
),
);
}

@ -0,0 +1,99 @@
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import '../base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart';
import 'dart:typed_data';
import 'dart:convert';
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
import 'package:map_launcher/map_launcher.dart';
class PharmaciesList extends StatefulWidget {
String medicineID;
int url;
PharmaciesList({this.url, this.medicineID});
@override
_PharmaciesListState createState() => _PharmaciesListState();
//
}
class _PharmaciesListState extends State<PharmaciesList> {
@override
Widget build(BuildContext context) {
return BaseView<PharmacyViewModel>(
//onModelReady: (model) => model.getMedicine(),
builder: (BuildContext context, PharmacyViewModel model, Widget child) =>
AppScaffold(
appBarTitle: 'Pharmacies List',
body: !model.isFinished
? AppCircularProgressIndicator()
: model.hasError
? Center(
child: Text(
model.errorMsg,
style: TextStyle(color: Colors.red),
),
)
: Container(
height: SizeConfig.screenHeight,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
physics: AlwaysScrollableScrollPhysics(),
children: <Widget>[
RoundedContainer(
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(7),
),
child: Image.memory(
dataFromBase64String(
widget.url.toString()),
height:
SizeConfig.imageSizeMultiplier * 19,
width:
SizeConfig.imageSizeMultiplier * 18,
fit: BoxFit.cover,
),
),
),
Expanded(
flex: 3,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: <Widget>[],
),
)
],
))
],
),
)),
);
}
Image imageFromBase64String(String base64String) {
return Image.memory(base64Decode(base64String));
}
Uint8List dataFromBase64String(String base64String) {
return base64Decode(base64String);
}
String base64String(Uint8List data) {
return base64Encode(data);
}
}

@ -155,6 +155,10 @@ class TranslationBase {
String get gregorianDate =>
localizedValues['gregorian-date'][locale.languageCode];
String get searchMedicine =>
localizedValues['searchMedicine'][locale.languageCode];
String get searchMedicineHere =>
localizedValues['searchMedicineHere'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -15,6 +15,7 @@ class Texts extends StatefulWidget {
final String style;
final bool allowExpand;
final double fontSize;
final String fontWeight;
Texts(this.text,
{Key key,
@ -30,7 +31,8 @@ class Texts extends StatefulWidget {
this.maxLines,
this.readMore = false,
this.style,
this.fontSize})
this.fontSize,
this.fontWeight})
: super(key: key);
@override
@ -208,8 +210,7 @@ class _TextsState extends State<Texts> {
)
: TextStyle(
fontStyle: widget.italic ? FontStyle.italic : null,
color:
widget.color ?? Colors.black,
color: widget.color ?? Colors.black,
fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing:
widget.variant == "overline" ? 1.5 : null,

@ -19,7 +19,9 @@ class NetworkBaseView extends StatelessWidget {
buildBaseViewWidget() {
switch (baseViewModel.state) {
case ViewState.ErrorLocal:
case ViewState.Idle:
case ViewState.BusyLocal:
return child;
break;
case ViewState.Busy:

@ -0,0 +1,84 @@
import 'package:flutter/material.dart';
class RoundedContainer extends StatefulWidget {
final double width;
final double height;
final double raduis;
final Color backgroundColor;
final double margin;
final double elevation;
final bool showBorder;
final Color borderColor;
final bool customCornerRaduis;
final double topLeft;
final double bottomRight;
final double topRight;
final double bottomLeft;
final Widget child;
final double borderWidth;
RoundedContainer(
{@required this.child,
this.width,
this.height,
this.raduis = 10,
this.backgroundColor = Colors.white,
this.margin = 10,
this.elevation = 1,
this.showBorder = false,
this.borderColor = Colors.red,
this.customCornerRaduis = false,
this.topLeft = 0,
this.topRight = 0,
this.bottomRight = 0,
this.bottomLeft = 0,
this.borderWidth = 1});
@override
_RoundedContainerState createState() => _RoundedContainerState();
}
class _RoundedContainerState extends State<RoundedContainer> {
@override
Widget build(BuildContext context) {
return Container(
width: widget.width,
height: widget.height,
margin: EdgeInsets.all(widget.margin),
decoration: widget.showBorder == true
? BoxDecoration(
color: Theme.of(context).primaryColor,
border: Border.all(
color: widget.borderColor, width: widget.borderWidth),
borderRadius: widget.customCornerRaduis
? BorderRadius.only(
topLeft: Radius.circular(widget.topLeft),
topRight: Radius.circular(widget.topRight),
bottomRight: Radius.circular(widget.bottomRight),
bottomLeft: Radius.circular(widget.bottomLeft))
: BorderRadius.circular(widget.raduis),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 10,
blurRadius: 5,
offset: Offset(0, 5), // changes position of shadow
),
])
: null,
child: Card(
margin: EdgeInsets.all(0),
shape: RoundedRectangleBorder(
borderRadius: widget.customCornerRaduis
? BorderRadius.only(
topLeft: Radius.circular(widget.topLeft),
topRight: Radius.circular(widget.topRight),
bottomRight: Radius.circular(widget.bottomRight),
bottomLeft: Radius.circular(widget.bottomLeft))
: BorderRadius.circular(widget.raduis),
),
color: widget.backgroundColor,
child: widget.child,
));
}
}

@ -0,0 +1,84 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:flutter/material.dart';
class MedicineItemWidget extends StatefulWidget {
final String label;
final Color backgroundColor;
final bool showBorder;
final Color borderColor;
final String url;
MedicineItemWidget(
{@required this.label,
this.backgroundColor = Colors.white,
this.showBorder = false,
this.borderColor = Colors.white,
this.url});
@override
_MedicineItemWidgetState createState() => _MedicineItemWidgetState();
}
class _MedicineItemWidgetState extends State<MedicineItemWidget> {
@override
Widget build(BuildContext context) {
return new RoundedContainer(
height: SizeConfig.heightMultiplier * 10.5,
child: Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
if (widget.url != null)
Container(
height: 39,
width: 39,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(7)),
child: Image.memory(
dataFromBase64String(widget.url),
height: SizeConfig.imageSizeMultiplier * 11,
width: SizeConfig.imageSizeMultiplier * 11,
fit: BoxFit.cover,
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(3),
child: Align(
alignment: Alignment.centerLeft,
child: Texts(widget.label),
),
),
)
],
),
),
backgroundColor: widget.backgroundColor,
showBorder: widget.showBorder,
borderColor: widget.borderColor,
margin: 4,
raduis: 10,
);
}
Image imageFromBase64String(String base64String) {
return Image.memory(base64Decode(base64String));
}
Uint8List dataFromBase64String(String base64String) {
return base64Decode(base64String);
}
String base64String(Uint8List data) {
return base64Encode(data);
}
}

@ -39,7 +39,7 @@ dependencies:
shared_preferences: ^0.5.8
flutter_flexible_toast: ^0.1.4
firebase_messaging: ^6.0.16
# Progress bar
progress_hud_v2: ^2.0.0
percent_indicator: ^2.1.5
@ -78,6 +78,11 @@ dependencies:
# SVG Images
flutter_svg: ^0.17.4
# Location Helper
map_launcher: ^0.8.1

Loading…
Cancel
Save