notification count

merge-requests/140/head
Sultan Khan 4 years ago
parent d2f391ab7f
commit 6e152951b4

@ -47,6 +47,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
int currentTab = 0;
PageController pageController;
ProjectViewModel projectProvider;
var notificationCount = '';
///inject the user data
AuthenticatedUserObject authenticatedUserObject =
@ -344,23 +345,58 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
),
title: Text(
getText(currentTab).toUpperCase(),
style: TextStyle(fontWeight: FontWeight.bold,color: Colors.white,fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'),
// bold: true,
// color: Colors.white,
),
leading: Builder(
builder: (BuildContext context) {
return IconButton(
return new Stack(
children: <Widget>[
IconButton(
icon: Icon(Icons.menu),
color: Colors.white,
onPressed: () => Scaffold.of(context).openDrawer(),
),
notificationCount != ''
? new Positioned(
right: 0,
top: 10,
child: new Container(
padding: EdgeInsets.all(4),
decoration: new BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(20),
),
constraints: BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: new Text(
notificationCount,
style: new TextStyle(
color: Colors.white,
fontSize: 9,
),
textAlign: TextAlign.center,
),
),
)
: SizedBox()
],
);
},
),
actions: [
IconButton(
//iconSize: 70,
icon: Icon(projectViewModel.isLogin?Icons.settings : Icons.login,color: Colors.white,),
icon: Icon(
projectViewModel.isLogin ? Icons.settings : Icons.login,
color: Colors.white,
),
onPressed: () {
if (projectViewModel.isLogin)
Navigator.of(context).pushNamed(
@ -432,11 +468,17 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
if (await sharedPref.getObject(USER_PROFILE) != null) {
var data =
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
if (data != null)
if (data != null) {
authService
.registeredAuthenticatedUser(data, token, 0, 0)
.then((res) => {print(res)});
authService.getDashboard().then((value) => {
setState(() {
notificationCount = value['List_PatientDashboard']
[0]['UnreadPatientNotificationCount'].toString();
})
});
}
}
}

@ -236,7 +236,43 @@ class _GeneralSettings extends State<GeneralSettings>
break;
case 1:
{
themeNotifier.setTheme(await getTheme(value));
themeNotifier.setTheme(ThemeData(
fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans',
primarySwatch: Colors.grey,
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.light,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
},
),
hintColor: Colors.grey[400],
cardColor: Colors.black,
buttonColor: Colors.grey[400],
disabledColor: Colors.grey[300],
errorColor: Color.fromRGBO(235, 80, 60, 1.0),
scaffoldBackgroundColor: Colors.grey,
textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5),
textSelectionHandleColor: Colors.grey,
canvasColor: Colors.white,
backgroundColor: Colors.grey,
highlightColor: Colors.grey[100].withOpacity(0.4),
splashColor: Colors.transparent,
primaryColor: Colors.grey,
bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)),
cursorColor: Colors.grey,
iconTheme: IconThemeData(),
appBarTheme: AppBarTheme(
color: Colors.grey,
brightness: Brightness.dark,
elevation: 10.0,
actionsIconTheme: IconThemeData(
color: Colors.grey,
),
),
));
Screen.setBrightness(1.0);
}
break;
@ -257,7 +293,7 @@ class _GeneralSettings extends State<GeneralSettings>
}
break;
}
permission.setTheme(value);
//permission.setTheme(value);
}
setVibration(value){

@ -47,6 +47,7 @@ const LOGGED_IN_USER_URL =
const FORGOT_PATIENT_ID =
'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard';
class AuthProvider with ChangeNotifier {
bool isLogin = false;
@ -370,7 +371,8 @@ class AuthProvider with ChangeNotifier {
Future<Map> sendPatientIDSMS(mobileNo, context) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
Request req = appGlobal.getPublicRequest();
request = {
"LanguageID": languageID == 'ar' ? 1 : 2,
@ -427,4 +429,31 @@ class AuthProvider with ChangeNotifier {
//return Future.value(error);
}
}
Future<dynamic> getDashboard() async {
Map<String, dynamic> request = {};
request['VersionID'] = VERSION_ID;
request['Channel'] = CHANNEL;
request['IPAdress'] = IP_ADDRESS;
request['generalid'] = GENERAL_ID;
request['LanguageID'] = LANGUAGE_ID;
request['DeviceTypeID'] = DeviceTypeID;
request["PatientTypeID"] = 1;
request["PatientType"] = 1;
dynamic localRes;
try {
await new BaseAppClient().post(DASHBOARD,
onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
// throw error;
}, body: request);
return Future.value(localRes);
} catch (error) {
throw error;
//return Future.value(error);
}
}
}

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:localstorage/localstorage.dart';
class PermissionService extends BaseService {
@ -18,7 +19,12 @@ class PermissionService extends BaseService {
}
isVibrationEnabled() {
return storage.getItem('isVibration');
return storage.getItem('isVibration') ==null ? false :true;
}
vibrate(){
if(isVibrationEnabled() ==true){
HapticFeedback.vibrate();
}
}

@ -90,7 +90,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
onTapCancel: () {
_animationController.forward();
},
onTap: (){Feedback.wrapForTap(widget.onTap, context); if(permission.isVibrationEnabled()){ HapticFeedback.vibrate();}},
onTap: (){Feedback.wrapForTap(widget.onTap, context); permission.vibrate();},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

@ -24,6 +24,6 @@ class DefaultButton extends StatelessWidget {
this.text,
style: TextStyle(fontSize: SizeConfig.textMultiplier * 2),
),
onPressed: () =>{ this.onPress(), if(permission.isVibrationEnabled()){ HapticFeedback.vibrate()}}));
onPressed: () =>{ this.onPress(), permission.vibrate()}));
}
}

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
@ -23,7 +24,7 @@ class _FloatingButtonState extends State<FloatingButton>
double _buttonSize = 1.0;
AnimationController _animationController;
Animation _animation;
PermissionService permission = new PermissionService();
@override
void initState() {
_animationController = AnimationController(
@ -62,7 +63,7 @@ class _FloatingButtonState extends State<FloatingButton>
onTapCancel: () {
_animationController.forward();
},
onTap: Feedback.wrapForTap(widget.onTap, context),
onTap:(){ Feedback.wrapForTap(widget.onTap, context); permission.vibrate();},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

@ -1,5 +1,7 @@
import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
enum MINI_BUTTON { Secondary, Primary }
@ -30,7 +32,7 @@ class _MiniButtonState extends State<MiniButton> with TickerProviderStateMixin {
double _buttonSize = 1.0;
AnimationController _animationController;
Animation _animation;
PermissionService permission = new PermissionService();
@override
void initState() {
_animationController = AnimationController(
@ -85,7 +87,8 @@ class _MiniButtonState extends State<MiniButton> with TickerProviderStateMixin {
onTapCancel: () {
_animationController.forward();
},
onTap: Feedback.wrapForTap(widget.onTap, context),
// onTap: Feedback.wrapForTap(widget.onTap, context),
onTap: () =>{ widget.onTap(), permission.vibrate()},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

@ -1,5 +1,7 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
@ -51,7 +53,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
double _buttonSize = 1.0;
AnimationController _animationController;
Animation _animation;
PermissionService permission = new PermissionService();
double _rippleSize = 0.0;
AnimationController _rippleController;
Animation _rippleAnimation;
@ -142,7 +144,8 @@ class _SecondaryButtonState extends State<SecondaryButton>
onTapCancel: () {
_animationController.forward();
},
onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context),
onTap: () =>{ widget.disabled ? null : widget.onTap(), permission.vibrate()},
// onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context),
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

Loading…
Cancel
Save