Blood donation fixes

merge-update-with-lab-changes
haroon amjad 4 years ago
parent e82b8d4439
commit e7f5fc8434

@ -223,8 +223,6 @@ class _AllHabibMedicalSevicePage2State extends State<AllHabibMedicalSevicePage2>
var data = await this.sharedPref.getObject(WEATHER);
if (data == null) {
var d = await _weatherService.getWeatherData();
print(d);
weatherNum = d.temperature;
setState(() {
weather = d != null ? d.temperature.toString() + '\u2103' : '--';

@ -72,14 +72,38 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
super.initState();
}
int getSelectedCityID(MyBalanceViewModel model) {
int cityID = 1;
model.CitiesModelList.forEach((element) {
if (element.description == model.bloodModelList[0].city) {
cityID = element.iD;
}
});
return cityID;
}
@override
Widget build(BuildContext context) {
projectProvider = Provider.of(context);
return BaseView<MyBalanceViewModel>(
onModelReady: (model) {
model.getCities();
model.getBlood();
model.getCities().then((value) {
model.getBlood().then((value) {
if (model.bloodModelList.length > 0) {
CitiesModel citiesModel = new CitiesModel();
citiesModel.iD = getSelectedCityID(model);
_selectedHospitalIndex = (citiesModel.iD - 1);
citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description;
citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN;
_selectedHospital = citiesModel;
} else {
_selectedHospital = model.CitiesModelList[0];
}
});
});
},
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
@ -108,11 +132,10 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
if (projectProvider.isLogin && model.state != ViewState.Busy)
CommonDropDownView(
TranslationBase.of(context).city,
(model.bloodModelList.isNotEmpty && model.CitiesModelList.isNotEmpty)
? model.bloodModelList[0].city
: projectProvider.isArabic
? model.CitiesModelList[_selectedHospitalIndex].descriptionN
: model.CitiesModelList[_selectedHospitalIndex].description, () {
// (model.bloodModelList.isNotEmpty && model.CitiesModelList.isNotEmpty)
// ? model.bloodModelList[0].city
// :
projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description, () {
List<RadioSelectionDialogModel> list = [
for (int i = 0; i < model.CitiesModelList.length; i++)
RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i),
@ -127,6 +150,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
onValueSelected: (index) {
_selectedHospitalIndex = index;
_selectedHospital = model.CitiesModelList[index];
setState(() {});
},
),
);
@ -249,7 +273,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
AppToast.showErrorToast(message: TranslationBase.of(context).selectCity);
return;
}
bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description;
bloodDetails.city = _selectedHospital.description;
bloodDetails.cityCode = _selectedHospital.iD.toString();
bloodDetails.gender = _selectedGenderIndex;
bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex);

@ -29,7 +29,6 @@ import 'package:diplomaticquarterapp/uitl/location_util.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart';
import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/not_auh_page.dart';
@ -242,7 +241,6 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
pageController = PageController(keepPage: true);
_firebaseMessaging.setAutoInitEnabled(true);
// signalRUtil = new SignalRUtil(hubName: "http://192.168.8.101:5001/chatHub", context: context);
signalRUtil = new SignalRUtil(hubName: "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273", context: context);
locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context);
@ -250,7 +248,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
if (projectViewModel.isLogin && !projectViewModel.isLoginChild) {
familyFileProvider.getSharedRecordByStatus();
}
signalRUtil.startSignalRConnection();
if (!signalRUtil.getConnectionState()) signalRUtil.startSignalRConnection();
});
// HMG (Guest/Internet) Wifi Access [Zohaib Kambrani]
//for now commented to reduce this call will enable it when needed
@ -507,91 +505,93 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
model = Provider.of<ToDoCountProviderModel>(context);
// currentTab == 0 ? 45 : 0.0
return Scaffold(
appBar: currentTab == 0 ? PreferredSize(
preferredSize: Size.fromHeight(currentTab == 0 ? 45 : 0.0),
child: AppBar(
elevation: 0,
backgroundColor: CustomColors.backgroudGreyColor,
textTheme: TextTheme(
headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold),
),
title: Text(
getText(currentTab).toUpperCase(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: currentTab == 0 ? CustomColors.backgroudGreyColor : Theme.of(context).textTheme.headline1.color,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
// bold: true,
),
leading: Builder(
builder: (BuildContext context) {
return new Stack(
children: <Widget>[
currentTab == 0
? IconButton(
icon: SvgPicture.asset("assets/images/new/menu.svg"),
color: Theme.of(context).textTheme.headline1.color,
onPressed: () => Scaffold.of(context).openDrawer(),
)
: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
setState(() {
currentTab = 0;
});
pageController.jumpToPage(0);
},
),
projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild
? new Positioned(
right: projectViewModel.isArabic ? 35 : 0,
top: 5,
child: new Container(
padding: EdgeInsets.all(4),
decoration: new BoxDecoration(
color: CustomColors.accentColor,
borderRadius: BorderRadius.circular(20),
),
constraints: BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: new Text(
model.notificationsCount.toString(),
style: new TextStyle(
color: Colors.white,
fontSize: projectViewModel.isArabic ? 8 : 9,
appBar: currentTab == 0
? PreferredSize(
preferredSize: Size.fromHeight(currentTab == 0 ? 45 : 0.0),
child: AppBar(
elevation: 0,
backgroundColor: CustomColors.backgroudGreyColor,
textTheme: TextTheme(
headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold),
),
title: Text(
getText(currentTab).toUpperCase(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: currentTab == 0 ? CustomColors.backgroudGreyColor : Theme.of(context).textTheme.headline1.color,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
// bold: true,
),
leading: Builder(
builder: (BuildContext context) {
return new Stack(
children: <Widget>[
currentTab == 0
? IconButton(
icon: SvgPicture.asset("assets/images/new/menu.svg"),
color: Theme.of(context).textTheme.headline1.color,
onPressed: () => Scaffold.of(context).openDrawer(),
)
: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
setState(() {
currentTab = 0;
});
pageController.jumpToPage(0);
},
),
textAlign: TextAlign.center,
),
),
)
: SizedBox()
projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild
? new Positioned(
right: projectViewModel.isArabic ? 35 : 0,
top: 5,
child: new Container(
padding: EdgeInsets.all(4),
decoration: new BoxDecoration(
color: CustomColors.accentColor,
borderRadius: BorderRadius.circular(20),
),
constraints: BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: new Text(
model.notificationsCount.toString(),
style: new TextStyle(
color: Colors.white,
fontSize: projectViewModel.isArabic ? 8 : 9,
),
textAlign: TextAlign.center,
),
),
)
: SizedBox()
],
);
},
),
actions: [
// IconButton(
// //iconSize: 70,
// icon: Icon(
// projectViewModel.isLogin ? Icons.settings : Icons.login,
// color: Theme.of(context).textTheme.headline1.color,
// ),
// onPressed: () {
// if (projectViewModel.isLogin)
// Navigator.of(context).pushNamed(
// SETTINGS,
// );
// else
// login();
// }, //do something,
// )
],
);
},
),
actions: [
// IconButton(
// //iconSize: 70,
// icon: Icon(
// projectViewModel.isLogin ? Icons.settings : Icons.login,
// color: Theme.of(context).textTheme.headline1.color,
// ),
// onPressed: () {
// if (projectViewModel.isLogin)
// Navigator.of(context).pushNamed(
// SETTINGS,
// );
// else
// login();
// }, //do something,
// )
],
centerTitle: true,
),
) : null,
centerTitle: true,
),
)
: null,
drawer: SafeArea(child: AppDrawer()),
extendBody: false,
body: WillPopScope(

@ -29,6 +29,10 @@ class SignalRUtil {
});
}
void closeSignalRConnection() {
connectionBuilder.stop();
}
void handleIncomingMessage(List<dynamic> message) {
print(message.toString());
}
@ -38,7 +42,7 @@ class SignalRUtil {
}
bool getConnectionState() {
if (connectionBuilder.state == HubConnectionState.connected) return true;
if (connectionBuilder.state == HubConnectionState.connected) return true;
if (connectionBuilder.state == HubConnectionState.connected || connectionBuilder.state == HubConnectionState.connecting) return true;
if (connectionBuilder.state == HubConnectionState.disconnected || connectionBuilder.state == HubConnectionState.disconnecting) return false;
}
}

@ -570,10 +570,6 @@ bool timeCalculator(int startHour, int startMint, int endHour, int endMint) {
DateTime now = DateTime.now();
DateTime startDate = DateTime(now.year, now.month, now.day, startHour, startHour);
DateTime endDate = DateTime(now.year, now.month, now.day, endHour, endMint);
print(startDate.toString());
print(endDate.toString());
print(now);
print("------------");
if (startDate.isBefore(now) && endDate.isAfter(now))
return true;
else

Loading…
Cancel
Save