Merge branch 'replied_count' into 'development'

add badge on bottom bar in order to show number of un replied msg

See merge request Cloud_Solution/doctor_app_flutter!784
merge-requests/788/merge
Mohammad Aljammal 5 years ago
commit 4bfcca230e

@ -235,6 +235,7 @@ const GET_SICK_LEAVE_DOCTOR_APP = "Services/DoctorApplication.svc/REST/GetAllSic
const ADD_PATIENT_TO_DOCTOR = "LiveCareApi/DoctorApp/AssignPatientToDoctor";
const REMOVE_PATIENT_FROM_DOCTOR = "LiveCareApi/DoctorApp/BackPatientToQueue";
const CREATE_DOCTOR_RESPONSE = "Services/DoctorApplication.svc/REST/CreateDoctorResponse";
const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts";
var selectedPatientType = 1;

@ -16,6 +16,7 @@ class DoctorReplyService extends BaseService {
RequestDoctorReply _requestDoctorReply = RequestDoctorReply();
List<MyReferralPatientModel> _listMyReferralPatientModel = [];
List<MyReferralPatientModel> get listMyReferralPatientModel => _listMyReferralPatientModel;
int notRepliedCount = 0;
Future getDoctorReply() async {
hasError = false;
@ -39,7 +40,23 @@ class DoctorReplyService extends BaseService {
CREATE_DOCTOR_RESPONSE,
body: createDoctorResponseModel.toJson(),
onSuccess: (dynamic body, int statusCode) {
print("succsss");
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
Future getNotRepliedCount() async {
hasError = false;
await baseAppClient.post(
GET_DOCTOR_NOT_REPLIED_COUNTS,
body: {},
onSuccess: (dynamic body
, int statusCode) {
notRepliedCount = body["DoctorNotRepliedCounts"];
},
onFailure: (String error, int statusCode) {
hasError = true;

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';
import 'package:doctor_app_flutter/core/service/home/doctor_reply_service.dart';
import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
@ -17,6 +18,7 @@ class DashboardViewModel extends BaseViewModel {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
DashboardService _dashboardService = locator<DashboardService>();
SpecialClinicsService _specialClinicsService = locator<SpecialClinicsService>();
DoctorReplyService _doctorReplyService = locator<DoctorReplyService>();
List<DashboardModel> get dashboardItemsList =>
_dashboardService.dashboardItemsList;
@ -24,6 +26,7 @@ class DashboardViewModel extends BaseViewModel {
bool get hasVirtualClinic => _dashboardService.hasVirtualClinic;
String get sServiceID => _dashboardService.sServiceID;
int get notRepliedCount => _doctorReplyService.notRepliedCount;
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicsService.specialClinicalCareList;
@ -114,4 +117,16 @@ class DashboardViewModel extends BaseViewModel {
return special;
}
Future getNotRepliedCount() async {
setState(ViewState.Busy);
await getDoctorProfile();
await _doctorReplyService.getNotRepliedCount();
if (_doctorReplyService.hasError) {
error = _doctorReplyService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
}

@ -23,7 +23,6 @@ class DoctorReplayViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future createDoctorResponse(
String response, ListGtMyPatientsQuestions model) async {
await getDoctorProfile();
@ -41,7 +40,10 @@ class DoctorReplayViewModel extends BaseViewModel {
if (_doctorReplyService.hasError) {
error = _doctorReplyService.error;
setState(ViewState.ErrorLocal);
} else
} else {
setState(ViewState.Idle);
_doctorReplyService.getNotRepliedCount();
}
}
}

@ -72,6 +72,7 @@ class _HomeScreenState extends State<HomeScreen> {
await model.getDoctorProfile(isGetProfile: true);
await model.checkDoctorHasLiveCare();
await model.getSpecialClinicalCareList();
await model.getNotRepliedCount();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart';

@ -1,5 +1,11 @@
import 'package:badges/badges.dart';
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
class BottomNavigationItem extends StatelessWidget {
final IconData icon;
@ -19,6 +25,8 @@ class BottomNavigationItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
DashboardViewModel model = DashboardViewModel();
return Expanded(
child: SizedBox(
height: 70.0,
@ -28,26 +36,51 @@ class BottomNavigationItem extends StatelessWidget {
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () => changeIndex(currentIndex),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 15,),
Container(
child: Icon(currentIndex == index ? activeIcon : icon,
color: currentIndex == index
? Color(0xFF333C45)
: Theme.of(context).dividerColor,
size: 22.0),
child: Stack(
alignment: AlignmentDirectional.center,
children: [
Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 15,),
Container(
child: Icon(currentIndex == index ? activeIcon : icon,
color: currentIndex == index
? Color(0xFF333C45)
: Theme.of(context).dividerColor,
size: 22.0),
),
SizedBox(height: 5,),
Expanded(
child: Text(
name,
style: TextStyle(
color: currentIndex == index
? Theme.of(context).primaryColor
: Theme.of(context).dividerColor,
),
),
),
],
),
SizedBox(height: 5,),
Expanded(
child: Text(
name,
style: TextStyle(
color: currentIndex == index
? Theme.of(context).primaryColor
: Theme.of(context).dividerColor,
if(currentIndex == 3)
Positioned(
right: 18.0,
bottom: 40.0,
child: Badge(
toAnimate: false,
position: BadgePosition.topEnd(),
shape: BadgeShape.circle,
badgeColor: Colors.red[800],
borderRadius: BorderRadius.circular(8),
badgeContent: Container(
// padding: EdgeInsets.all(2.0),
child: Text(model.notRepliedCount.toString(),
style: TextStyle(
color: Colors.white, fontSize: 12.0)),
),
),
),

@ -96,6 +96,9 @@ dependencies:
# Html Editor Enhanced
html_editor_enhanced: ^1.3.0
# Badges
badges: ^1.1.4
dev_dependencies:
flutter_test:
sdk: flutter

Loading…
Cancel
Save