login auth , verfication

This commit is contained in:
snehalathad@aissel.com 2024-12-16 16:56:32 +05:30
parent 602230270b
commit e46c5e3e1d
20 changed files with 1378 additions and 838 deletions

View File

@ -5,6 +5,7 @@
"method": "POST", "method": "POST",
"module": "eventapis" "module": "eventapis"
}, },
{ {
"api": "saveUserInterestedEvent", "api": "saveUserInterestedEvent",
"interval": 0, "interval": 0,
@ -17,6 +18,12 @@
"method": "POST", "method": "POST",
"module": "eventapis" "module": "eventapis"
}, },
{
"api": "eventOverview",
"interval": 0,
"method": "POST",
"module": "eventapis"
},
{ {
"api": "getSpecialitiesDonutChart", "api": "getSpecialitiesDonutChart",
"interval": 0, "interval": 0,

View File

@ -34,7 +34,7 @@ class CustomButton extends StatelessWidget {
backgroundColor: backgroundColor:
MaterialStateColor.resolveWith((states) => backgroundColor), MaterialStateColor.resolveWith((states) => backgroundColor),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), // <-- Radius borderRadius: BorderRadius.circular(20), // <-- Radius
), ),
), ),

View File

@ -283,7 +283,7 @@ Future main() async {
print("isLoggedIn_is : $isLoggedIn"); print("isLoggedIn_is : $isLoggedIn");
print("secret : $secretkey"); print("secret : $secretkey");
return isLoggedIn return isLoggedIn
? IntroductionAnimationScreen() ? NavigationHomeScreen()
: IntroductionAnimationScreen(); : IntroductionAnimationScreen();
} }
}, },
@ -329,8 +329,7 @@ class _MyAppState extends State<MyApp> {
systemNavigationBarDividerColor: Colors.transparent, systemNavigationBarDividerColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.dark, systemNavigationBarIconBrightness: Brightness.dark,
)); ));
return OverlaySupport( return MaterialApp(
child: MaterialApp(
title: 'Flutter UI', title: 'Flutter UI',
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
// theme: ThemeData( // theme: ThemeData(
@ -339,7 +338,6 @@ class _MyAppState extends State<MyApp> {
// platform: TargetPlatform.iOS, // platform: TargetPlatform.iOS,
// ), // ),
home: NavigationHomeScreen(), home: NavigationHomeScreen(),
),
); );
} }

View File

@ -53,7 +53,7 @@ class AllSessionNotesResponse {
note: json["note"], note: json["note"],
sessionName: json["session_name"], sessionName: json["session_name"],
eventTopics: json["event_topics"], eventTopics: json["event_topics"],
userName: json["user_name"]!, userName: json["user_name"],
users: json["users"], users: json["users"],
notes: json["notes"] == null notes: json["notes"] == null
? [] ? []

View File

@ -0,0 +1,63 @@
// To parse this JSON data, do
//
// final verificationResponse = verificationResponseFromJson(jsonString);
import 'dart:convert';
VerificationResponse verificationResponseFromJson(String str) =>
VerificationResponse.fromJson(json.decode(str));
String verificationResponseToJson(VerificationResponse data) =>
json.encode(data.toJson());
class VerificationResponse {
int? status;
String? message;
String? verification_code;
String? accessToken;
User? user;
VerificationResponse({
this.status,
this.message,
this.accessToken,
this.verification_code,
this.user,
});
factory VerificationResponse.fromJson(Map<String, dynamic> json) =>
VerificationResponse(
status: json["status"],
message: json["message"],
verification_code: json["verification_code"],
accessToken: json["access_token"],
user: json["user"] == null ? null : User.fromJson(json["user"]),
);
Map<String, dynamic> toJson() => {
"status": status,
"message": message,
"access_token": accessToken,
"user": user?.toJson(),
};
}
class User {
String? email;
String? userFullName;
User({
this.email,
this.userFullName,
});
factory User.fromJson(Map<String, dynamic> json) => User(
email: json["email"],
userFullName: json["user_full_name"],
);
Map<String, dynamic> toJson() => {
"email": email,
"user_full_name": userFullName,
};
}

View File

@ -23,11 +23,16 @@ import 'package:konectar_events/model/sessionnotesmodel.dart';
import 'package:konectar_events/model/sessionstopics_model.dart'; import 'package:konectar_events/model/sessionstopics_model.dart';
import 'package:konectar_events/model/specialtymodel.dart'; import 'package:konectar_events/model/specialtymodel.dart';
import 'package:konectar_events/model/topics_cloud_model.dart'; import 'package:konectar_events/model/topics_cloud_model.dart';
import 'package:konectar_events/model/verify_user_resp.dart';
import 'package:konectar_events/utils/constants.dart'; import 'package:konectar_events/utils/constants.dart';
import 'package:konectar_events/viewmodel/hive_repository.dart'; import 'package:konectar_events/viewmodel/hive_repository.dart';
import 'package:shared_preferences/shared_preferences.dart';
class ApiCall { class ApiCall {
final dio = Dio(); final dio = Dio();
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
late Future<String> _token;
//K1 API CALLS //K1 API CALLS
Future<dynamic> parseInfo() async { Future<dynamic> parseInfo() async {
@ -119,16 +124,21 @@ class ApiCall {
}; };
Response response; Response response;
var formData = FormData.fromMap({ var formData = FormData.fromMap({
"user_email": "vinodh@aissel.com",
"start": "2024-12-05", "start": "2024-12-05",
"end": "2024-12-31", "end": "2024-12-31",
"order_by": 8, "order_by": 8,
'type': type ?? 1 'type': type ?? 1
}); });
// "end": DateTime(2024, 12, 14).toIso8601String(), // "end": DateTime(2024, 12, 14).toIso8601String(),
_token = _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? "";
});
print("SAVED TOKEN :${await _token}");
response = response =
await dio.post('${EventsConstants.url}${EventsConstants.eventslistapi}', await dio.post('${EventsConstants.url}${EventsConstants.eventslistapi}',
options: Options(), options: Options(headers: {
"Authorization": "Bearer ${await _token}",
}),
// queryParameters: { // queryParameters: {
// "user_email": "vinodh@aissel.com", // "user_email": "vinodh@aissel.com",
// "project_id": "", // "project_id": "",
@ -576,6 +586,96 @@ class ApiCall {
} }
} }
//VERIFY EMAIL K1
Future<dynamic> verifyEmail(
String email, String deviceid, String platform) async {
Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
return client;
};
Response response;
var formData = FormData.fromMap({
"email_id": email,
"device_id": deviceid,
});
response = await dio.post(
'${EventsConstants.loginUrl}${EventsConstants.getVerificationCode}',
options: Options(),
data: formData);
if (response.statusCode == 200) {
print("response user login!!!!!!!!!!!!!!!!!!!!! \n ${response.data} ");
Map<String, dynamic> jsondata = json.decode(response.data);
VerificationResponse verificationResponse =
verificationResponseFromJson(response.data);
return verificationResponse;
} else {
print("isEmpty");
return null;
}
}
//VERIFY CODE OR LOGIN
Future<dynamic> verifyCode(String email, String code) async {
Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
return client;
};
Response response;
var formData = FormData.fromMap({
"verification_code": code,
"email_id": email,
});
response = await dio.post(
'${EventsConstants.loginUrl}${EventsConstants.login}',
options: Options(),
data: formData);
if (response.statusCode == 200) {
print("response user login!!!!!!!!!!!!!!!!!!!!! \n ${response.data} ");
Map<String, dynamic> jsondata = json.decode(response.data);
VerificationResponse verificationResponse =
verificationResponseFromJson(response.data);
return verificationResponse;
} else {
print("isEmpty");
return null;
}
}
//LOGOUT
Future<dynamic> logout(String email, String deviceid) async {
Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
return client;
};
Response response;
print("url :${EventsConstants.loginUrl}${EventsConstants.logout}");
var formData = FormData.fromMap({
"email_id": email,
"device_id": deviceid,
});
response = await dio.post(
'${EventsConstants.loginUrl}${EventsConstants.logout}',
data: formData,
// queryParameters: {
// "token": token,
// },
);
if (response.statusCode == 200) {
print("response user LoGOUT!!!!!!!!!!!!!!!!!!!!! \n ${response.data} ");
}
print(response.data.toString());
return response.data;
}
//************ K2 API CALLS *********************************************************************************************************************************** //************ K2 API CALLS ***********************************************************************************************************************************
Future<List<EventsList>> getEventsFromK2(int page, String search, Future<List<EventsList>> getEventsFromK2(int page, String search,
@ -760,58 +860,6 @@ class ApiCall {
//GET MY EVENTS //GET MY EVENTS
Future<dynamic> verifyCode(String email, String code) async {
Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
return client;
};
Response response;
var formData = FormData.fromMap({
"email": email,
});
response = await dio.post('${EventsConstants.validateTokenApi}',
options: Options(),
queryParameters: {
"email": email,
"token": code,
},
data: formData);
print("response user login!!!!!!!!!!!!!!!!!!!!! ");
print(response.data.toString());
return response.data;
}
//LOGOUT
Future<dynamic> logout(String token) async {
print("token:::::$token");
Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
return client;
};
Response response;
// var formData = FormData.fromMap({
// "email": email,
// });
response = await dio.post(
'${EventsConstants.logoutApi}',
options: Options(headers: {"Authorization": "Bearer $token"}),
// queryParameters: {
// "token": token,
// },
);
print("response user LOGOUT!!!!!!!!!!!!!!!!!!!!! ");
print(response.data.toString());
return response.data;
}
//SEARCH EVENTS API FROM K2 //SEARCH EVENTS API FROM K2
Future<List<EventsList>> getSearchedEventsFromK2( Future<List<EventsList>> getSearchedEventsFromK2(
@ -955,37 +1003,6 @@ class ApiCall {
return response.data; return response.data;
} }
Future<dynamic> verifyEmail(
String email, String deviceid, String platform) async {
Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
return client;
};
Response response;
var formData = FormData.fromMap({
"email": email,
});
response = await dio.post('${EventsConstants.getTokenApi}',
options: Options(),
queryParameters: {
"email": email,
"device_id": deviceid,
"platform": platform,
},
data: formData);
if (response.statusCode == 200) {
print("response user login!!!!!!!!!!!!!!!!!!!!! ");
print(response.data.toString());
return response.data;
} else {
print("isEmplty");
return null;
}
}
Future<List<EventsList>?> getEvents() async { Future<List<EventsList>?> getEvents() async {
Dio dio = Dio(); Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =

View File

@ -21,7 +21,8 @@ class EventsConstants {
//192.0.0.2:8007 - iphone //192.0.0.2:8007 - iphone
// 192.168.2.109:8007 - office jkqehjkq // 192.168.2.109:8007 - office jkqehjkq
//K1 API~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //K1 API~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static const String moduleName = "eventapis"; static const String moduleName = "apis/v1/events";
static const String loginmodule = "apiauths";
static const String stagingUrl = static const String stagingUrl =
"https://cardio-staging.konectar.io/$moduleName/"; "https://cardio-staging.konectar.io/$moduleName/";
@ -30,6 +31,9 @@ class EventsConstants {
static const String devUrl = static const String devUrl =
"http://192.168.2.130/konectar-sandbox/$moduleName/"; "http://192.168.2.130/konectar-sandbox/$moduleName/";
static const String loginUrl =
"https://cardio-staging.konectar.io/$loginmodule/";
static const String eventslistapi = "loadFutureEvents"; static const String eventslistapi = "loadFutureEvents";
static const String followUnfollowEvent = "saveUserInterestedEvent"; static const String followUnfollowEvent = "saveUserInterestedEvent";
static const String attendNotAttendEvent = "saveUserAttendingEvent"; static const String attendNotAttendEvent = "saveUserAttendingEvent";
@ -42,9 +46,16 @@ class EventsConstants {
static const String getTopicNotes = "getTopicNotes"; static const String getTopicNotes = "getTopicNotes";
static const String saveEventsTopicNote = "saveEventsTopicNote"; static const String saveEventsTopicNote = "saveEventsTopicNote";
static const String eventUserAnalytics = "eventUserAnalytics"; static const String eventUserAnalytics = "eventUserAnalytics";
static const String getVerificationCode = "getVerificationCode";
static const String login = "login";
static const String logout = "logout";
static const String medInsightApi = "medInsightApi";
//MY CONSTANTS //MY CONSTANTS
static const String saveEventOffline = "saveEventOffline"; static const String saveEventOffline = "saveEventOffline";
static const String contactsListapi = "contactslistapi"; static const String contactsListapi = "contactslistapi";
static const String filtersApi = "filtersApi";
//Hive //Hive
/* /*

View File

@ -55,7 +55,7 @@ class _EventsListingScreenState extends State<EventsListingScreen>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
tabController = TabController(length: 2, vsync: this); tabController = TabController(vsync: this, length: 2);
final provider = Provider.of<EventsProvider>(context, listen: false); final provider = Provider.of<EventsProvider>(context, listen: false);
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
@ -67,11 +67,6 @@ class _EventsListingScreenState extends State<EventsListingScreen>
}); });
} }
@override
void didChangeDependencies() {
super.didChangeDependencies();
}
Future<void> _fetchPage(int pageKey) async { Future<void> _fetchPage(int pageKey) async {
//await initConnectivity(); //await initConnectivity();
// if (connectionStatus.toString().contains("ConnectivityResult.none")) { // if (connectionStatus.toString().contains("ConnectivityResult.none")) {
@ -174,7 +169,7 @@ class _EventsListingScreenState extends State<EventsListingScreen>
return Consumer<EventsProvider>( return Consumer<EventsProvider>(
builder: (BuildContext context, provider, Widget? child) { builder: (BuildContext context, provider, Widget? child) {
return DefaultTabController( return DefaultTabController(
length: 3, length: provider.tabs.length,
//child: SafeArea( //child: SafeArea(
// appBar: CustomAppBar(title: "", backgroundcolor: Constants.bgcolor), // appBar: CustomAppBar(title: "", backgroundcolor: Constants.bgcolor),
//body: //body:
@ -543,16 +538,22 @@ class _EventsListingScreenState extends State<EventsListingScreen>
); );
} }
showModalBottomSheet<void>( showModalBottomSheet<void>(
//constraints: BoxConstraints(maxHeight: 200, minHeight: 120),
isScrollControlled: true,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Container( return Wrap(children: [
// child:
Container(
color: EventsConstants.bgcolor, color: EventsConstants.bgcolor,
width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
height: 240, // constraints: BoxConstraints(minHeight: 120, maxHeight: 130),
//height: 240,
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// Padding( // Padding(
@ -598,19 +599,23 @@ class _EventsListingScreenState extends State<EventsListingScreen>
), ),
), ),
), ),
InkWell( provider.addOffline
? InkWell(
onTap: () async { onTap: () async {
if (provider.offlineEvents.isEmpty) { if (provider.offlineEvents.isEmpty) {
await provider.saveEventsData(widget.event); await provider
.saveEventsData(widget.event);
SnackBarWidget.displaySnackBar( SnackBarWidget.displaySnackBar(
"Event Saved Offline", context); "Event Saved Offline", context);
} else { } else {
if (!provider.offlineExists) { if (!provider.offlineExists) {
await provider.saveEventsData(widget.event); await provider
.saveEventsData(widget.event);
SnackBarWidget.displaySnackBar( SnackBarWidget.displaySnackBar(
"Event Saved Offline", context); "Event Saved Offline", context);
} else { } else {
await provider.delateOfflineEvent(widget.event); await provider
.delateOfflineEvent(widget.event);
provider.offlineExists = false; provider.offlineExists = false;
SnackBarWidget.displaySnackBar( SnackBarWidget.displaySnackBar(
"Removed from Offline", context); "Removed from Offline", context);
@ -628,8 +633,10 @@ class _EventsListingScreenState extends State<EventsListingScreen>
color: Colors.blue, color: Colors.blue,
), ),
), ),
), )
InkWell( : SizedBox.shrink(),
provider.enableAttending
? InkWell(
onTap: () { onTap: () {
if (widget.event.eventUserAttendee!) { if (widget.event.eventUserAttendee!) {
widget.event.eventUserAttendee = false; widget.event.eventUserAttendee = false;
@ -654,7 +661,8 @@ class _EventsListingScreenState extends State<EventsListingScreen>
color: Colors.red, color: Colors.red,
), ),
), ),
), )
: SizedBox.shrink(),
// Container( // Container(
// padding: EdgeInsets.symmetric(horizontal: 8.0), // padding: EdgeInsets.symmetric(horizontal: 8.0),
// width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
@ -689,7 +697,8 @@ class _EventsListingScreenState extends State<EventsListingScreen>
], ],
), ),
), ),
); ),
]);
}, },
); );
}, },
@ -772,31 +781,32 @@ class _EventsListingScreenState extends State<EventsListingScreen>
pagingController.refresh(); pagingController.refresh();
} }
}, },
tabs: _tabs, tabs: provider.tabs,
), ),
), ),
), ),
]; ];
}, },
body: TabBarView( body: TabBarView(
//controller: _tabController, // controller: tabController,
children: [ children: returnTabWidget(provider)
expandableDetails(provider), // [
speakersList(context, provider), // expandableDetails(provider),
// speakersList(context, provider),
EventsInsights( // EventsInsights(
eid: widget.event.id!, // eid: widget.event.id!,
eventsdetail: widget.event, // eventsdetail: widget.event,
eventid: widget.event.eventId!, // eventid: widget.event.eventId!,
kFlutterHashtags: provider.kFlutterHashtags, // kFlutterHashtags: provider.kFlutterHashtags,
specialtyList: provider.specialtyList, // specialtyList: provider.specialtyList,
affiliations: provider.affiliations, // affiliations: provider.affiliations,
allSessionNotes: provider.allSessionNotes, // allSessionNotes: provider.allSessionNotes,
), // ),
// medicalInsights(), // // medicalInsights(),
//SocialMedia(), // //SocialMedia(),
], // ],
), ),
), ),
), ),
@ -815,6 +825,30 @@ class _EventsListingScreenState extends State<EventsListingScreen>
); );
} }
List<Widget> returnTabWidget(EventsProvider provider) {
List<Widget> widgets = [];
for (var tabs in provider.tabs) {
if (tabs.text == "Speakers") {
widgets.add(speakersList(context, provider));
}
if (tabs.text == "Details") {
widgets.add(expandableDetails(provider));
}
if (tabs.text == "Insights") {
widgets.add(EventsInsights(
eid: widget.event.id!,
eventsdetail: widget.event,
eventid: widget.event.eventId!,
kFlutterHashtags: provider.kFlutterHashtags,
specialtyList: provider.specialtyList,
affiliations: provider.affiliations,
allSessionNotes: provider.allSessionNotes,
));
}
}
return widgets;
}
Widget getSearchBarUI() { Widget getSearchBarUI() {
return Padding( return Padding(
padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8), padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8),
@ -1162,10 +1196,14 @@ class _EventsListingScreenState extends State<EventsListingScreen>
], ],
), ),
), ),
SizedBox( provider.getLocationDetails(event) == ""
? SizedBox.shrink()
: SizedBox(
height: 8.0, height: 8.0,
), ),
RichText( provider.getLocationDetails(event) == ""
? SizedBox.shrink()
: RichText(
text: TextSpan( text: TextSpan(
children: [ children: [
WidgetSpan( WidgetSpan(
@ -1176,8 +1214,7 @@ class _EventsListingScreenState extends State<EventsListingScreen>
), ),
), ),
TextSpan( TextSpan(
text: text: ' ${provider.getLocationDetails(event)}',
' ${event.city != null && event.city != "" ? "${event.city}, " : ""}${event.region != null && event.region != "" ? "${event.region}, " : ""}${event.country != null && event.country != "" ? "${event.country}" : ""}',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
//fontStyle: FontStyle.italic, //fontStyle: FontStyle.italic,
@ -1187,10 +1224,14 @@ class _EventsListingScreenState extends State<EventsListingScreen>
], ],
), ),
), ),
SizedBox( event.url1 == null
? SizedBox.shrink()
: SizedBox(
height: 8.0, height: 8.0,
), ),
InkWell( event.url1 == null
? SizedBox.shrink()
: InkWell(
onTap: () async { onTap: () async {
print("URL:${event.url1!}"); print("URL:${event.url1!}");
await _launchUrl(event.url1!); await _launchUrl(event.url1!);
@ -1250,9 +1291,13 @@ class _EventsListingScreenState extends State<EventsListingScreen>
// SizedBox( // SizedBox(
// width: 15, // width: 15,
// ), // ),
attendingbtn(widget.event, provider), provider.enableAttending
? attendingbtn(widget.event, provider)
: SizedBox.shrink(),
// const Spacer(), // const Spacer(),
favbtn(widget.event, provider) provider.enableFollow
? favbtn(widget.event, provider)
: SizedBox.shrink(),
], ],
), ),
), ),
@ -2031,13 +2076,6 @@ class ProfileInfoItem {
); );
} }
const _tabs = [
Tab(text: "Details"),
Tab(text: "Speakers"),
Tab(text: "Insights"),
// Tab(text: "Medical Insights"),
];
class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
_SliverAppBarDelegate(this._tabBar); _SliverAppBarDelegate(this._tabBar);

View File

@ -183,14 +183,21 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
} }
init() async { init() async {
await Provider.of<EventsProvider>(context, listen: false).initFiltersData();
// await Provider.of<EventsProvider>(context, listen: false).getMyEvents(0);
await Provider.of<EventsProvider>(context, listen: false) await Provider.of<EventsProvider>(context, listen: false)
.getAddedSessionNotes(); .initConfigModules();
// await Provider.of<EventsProvider>(context, listen: false).initFiltersData();
// await Provider.of<EventsProvider>(context, listen: false).getMyEvents(0);
//await ApiCall().dummyapi(); //await ApiCall().dummyapi();
setState(() {}); setState(() {});
} }
@override
void didChangeDependencies() {
super.didChangeDependencies();
init();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<EventsProvider>( return Consumer<EventsProvider>(
@ -615,7 +622,9 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
// ), // ),
// ), // ),
// ), // ),
Material( !provider.enableFilters
? SizedBox.shrink()
: Material(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
focusColor: Colors.transparent, focusColor: Colors.transparent,
@ -1711,18 +1720,36 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),
RichText( provider.getLocationDetails(event).length == 0
? SizedBox.shrink()
: Container(
constraints: BoxConstraints(
minWidth: 100, maxWidth: double.maxFinite),
//width: MediaQuery.of(context).size.width / 2,
// padding: EdgeInsets.only(right: 13),
child: RichText(
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
text: TextSpan( text: TextSpan(
children: [ children: [
WidgetSpan( WidgetSpan(
child: Icon(Icons.location_on, size: 16), child: Icon(Icons.location_on, size: 16),
), ),
// WidgetSpan(
// child: Flexible(
// // width: 200,
// child: Text(
// provider.getLocationDetails(event),
// overflow: TextOverflow.fade,
// ),
// )),
TextSpan( TextSpan(
spellOut: true,
text: text:
' ${event.city != null && event.city != "" ? "${event.city}, " : ""}${event.region != null && event.region != "" ? "${event.region}, " : ""}${event.country != null && event.country != "" ? "${event.country}" : ""}', ' ${provider.getLocationDetails(event)}',
// ' ${event.city != null && event.city != "" ? "${event.city}, " : ""}${event.region != null && event.region != "" ? "${event.region}, " : ""}${event.country != null && event.country != "" ? "${event.country}" : ""}',
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
overflow: TextOverflow.ellipsis,
//fontStyle: FontStyle.italic, //fontStyle: FontStyle.italic,
fontSize: isTablet ? 16 : 12), fontSize: isTablet ? 16 : 12),
@ -1730,32 +1757,49 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
], ],
), ),
), ),
),
provider.ifOfflineExists(event.eventId ?? "")
? Padding(
padding: EdgeInsets.only(right: 10),
child: RichText(
text: TextSpan(children: [
WidgetSpan(
child: Icon(Icons.bookmark,
color: EventsConstants.blueColor,
size: isTablet ? 14 : 16),
),
TextSpan(
text: ' Saved',
style: TextStyle(
color: Colors.black,
//fontStyle: FontStyle.italic,
fontSize: isTablet ? 16 : 12),
),
]),
))
: SizedBox.shrink(),
], ],
), ),
Align( provider.enableFollow
? Align(
alignment: FractionalOffset.bottomRight, alignment: FractionalOffset.bottomRight,
child: Row( child: Row(
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
provider.ifOfflineExists(event.eventId ?? "")
? Padding(
padding: EdgeInsets.only(right: 10),
child: Icon(Icons.bookmark,
color: EventsConstants.blueColor,
size: isTablet ? 14 : 18),
)
: SizedBox.shrink(),
SizedBox( SizedBox(
width: 40, width: 40,
height: 30, height: 30,
child: FloatingActionButton.extended( child: FloatingActionButton.extended(
elevation: 1, elevation: 1,
shape: CircleBorder(), shape: CircleBorder(),
backgroundColor: EventsConstants.bgcolor, backgroundColor:
EventsConstants.bgcolor,
//backgroundColor: EventsConstants.homeCardBackgound, //backgroundColor: EventsConstants.homeCardBackgound,
onPressed: () async { onPressed: () async {
// event.isfav = !event.isfav; // event.isfav = !event.isfav;
@ -1763,12 +1807,15 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
if (event.eventUserInterest!) { if (event.eventUserInterest!) {
//If event is added to fav then unfollow //If event is added to fav then unfollow
String msg = await provider String msg = await provider
.removeEventsToFavs(event.eventId!); .removeEventsToFavs(
event.eventId!);
SnackBarWidget.displaySnackBar( SnackBarWidget.displaySnackBar(
"Removed from My Events!", context); "Removed from My Events!",
context);
} else { } else {
String msg = await provider String msg =
.addEventsToFavs(event.eventId!); await provider.addEventsToFavs(
event.eventId!);
SnackBarWidget.displaySnackBar( SnackBarWidget.displaySnackBar(
"Added to My Events", context); "Added to My Events", context);
} }
@ -1783,7 +1830,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
label: AnimatedSwitcher( label: AnimatedSwitcher(
duration: Duration(seconds: 1), duration: Duration(seconds: 1),
transitionBuilder: (Widget child, transitionBuilder: (Widget child,
Animation<double> animation) => Animation<double>
animation) =>
FadeTransition( FadeTransition(
opacity: animation, opacity: animation,
child: SizeTransition( child: SizeTransition(
@ -1824,7 +1872,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
text: ' Following', text: ' Following',
style: TextStyle( style: TextStyle(
color: Colors.grey[600], color: Colors.grey[600],
fontSize: isTablet ? 14 : 10), fontSize:
isTablet ? 14 : 10),
), ),
], ],
), ),
@ -1837,7 +1886,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
text: 'Follow ', text: 'Follow ',
style: TextStyle( style: TextStyle(
color: Colors.grey[600], color: Colors.grey[600],
fontSize: isTablet ? 14 : 10), fontSize:
isTablet ? 14 : 10),
), ),
], ],
), ),
@ -1847,7 +1897,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
), ),
], ],
), ),
), )
: SizedBox.shrink(),
// Align( // Align(
// alignment: Alignment.bottomRight, // alignment: Alignment.bottomRight,
// child: SizedBox( // child: SizedBox(

View File

@ -2,10 +2,12 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:konectar_events/firebaseexample.dart'; import 'package:konectar_events/firebaseexample.dart';
import 'package:konectar_events/model/userdata_model.dart'; import 'package:konectar_events/model/userdata_model.dart';
import 'package:konectar_events/model/verify_user_resp.dart';
import 'package:konectar_events/utils/apicall.dart'; import 'package:konectar_events/utils/apicall.dart';
import 'package:konectar_events/utils/constants.dart'; import 'package:konectar_events/utils/constants.dart';
import 'package:konectar_events/utils/sessionmanager.dart'; import 'package:konectar_events/utils/sessionmanager.dart';
@ -19,6 +21,7 @@ import 'package:konectar_events/widgets/custombutton.dart';
import 'package:konectar_events/widgets/customtextfield.dart'; import 'package:konectar_events/widgets/customtextfield.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:mobile_device_identifier/mobile_device_identifier.dart';
class LoginScreen extends StatefulWidget { class LoginScreen extends StatefulWidget {
const LoginScreen({super.key}); const LoginScreen({super.key});
@ -40,7 +43,10 @@ class _LoginScreenState extends State<LoginScreen> {
late Future<String> _key; late Future<String> _key;
late Future<bool> _login; late Future<bool> _login;
late Future<bool> _logout; late Future<bool> _logout;
late Future<String> _verification_code;
String platform = "android"; String platform = "android";
String? deviceId;
final _mobileDeviceIdentifierPlugin = MobileDeviceIdentifier();
var provider; var provider;
@override @override
void initState() { void initState() {
@ -48,7 +54,7 @@ class _LoginScreenState extends State<LoginScreen> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
init(); init();
provider = Provider.of<LoginProvider>(context, listen: false); provider = Provider.of<LoginProvider>(context, listen: false);
provider.initDeviceId(); initDeviceId();
if (Platform.isAndroid) { if (Platform.isAndroid) {
platform = "android"; platform = "android";
} else if (Platform.isIOS) { } else if (Platform.isIOS) {
@ -77,6 +83,21 @@ class _LoginScreenState extends State<LoginScreen> {
}); });
} }
Future<void> initDeviceId() async {
String _deviceId;
try {
_deviceId = await _mobileDeviceIdentifierPlugin.getDeviceId() ??
'Unknown platform version';
} on PlatformException {
_deviceId = 'Failed to get platform version.';
}
if (!mounted) return;
deviceId = _deviceId;
print("DEVICE ID########################## :$deviceId");
}
init() async { init() async {
await ApiCall().parseInfo(); await ApiCall().parseInfo();
} }
@ -285,68 +306,19 @@ class _LoginScreenState extends State<LoginScreen> {
Center( Center(
child: CustomButton( child: CustomButton(
backgroundColor: EventsConstants.onboardButtonColor, backgroundColor: EventsConstants.onboardButtonColor,
// onPressed: () async { onPressed: () async {
// setState(() { setState(() {
// print("loading"); print("loading");
// provider.loading = true; provider.loading = true;
// }); });
// if (textFieldsValidation(provider).isEmpty) { if (textFieldsValidation(provider).isEmpty) {
// print("email:${emailTextController.text}"); print("email:${emailTextController.text}");
// // if (await _logout) { // if (await _logout) {
// // print("LOGOUT"); // print("LOGOUT");
// // provider.code = secretKeyTextConrtroller.text;
// // Map<String, dynamic> resp = await provider.verifyCode(
// // emailTextController.text, secretKeyTextConrtroller.text);
// // if (resp["code"] == "1200") {
// // provider.loading = false;
// // provider.showCodeField = false;
// // provider.showMessage = true;
// // _displaySnackBar("You have logged in successfully");
// // _saveprefs(resp["token"], emailTextController.text,
// // secretKeyTextConrtroller.text, true)
// // .then((value) {
// // Navigator.of(context).pushReplacement(
// // MaterialPageRoute(
// // builder: (context) => NavigationHomeScreen()),
// // );
// // });
// // } else {
// // provider.message = resp["message"];
// // }
// // } else {
// print("FIRST LOGIN");
// if (!provider.showCodeField) {
// provider.email = emailTextController.text;
// String encoded =
// base64.encode(utf8.encode(provider.deviceId));
// Map<String, dynamic> resp = await provider.verifyEmail(
// emailTextController.text, encoded, platform);
// print("resp:${resp["code"]}");
// if (resp.isEmpty) {
// print("isEmplty");
// }
// if (resp["code"] == "1200") {
// provider.loading = false;
// provider.showCodeField = true;
// provider.showMessage = true;
// } else {
// provider.loading = false;
// provider.showCodeField = false;
// provider.showMessage = true;
// }
// provider.message = resp["message"];
// setState(() {
// emailTextController.text = provider.email!;
// });
// } else {
// provider.code = secretKeyTextConrtroller.text; // provider.code = secretKeyTextConrtroller.text;
// Map<String, dynamic> resp = await provider.verifyCode( // Map<String, dynamic> resp = await provider.verifyCode(
// emailTextController.text, // emailTextController.text, secretKeyTextConrtroller.text);
// secretKeyTextConrtroller.text);
// if (resp["code"] == "1200") { // if (resp["code"] == "1200") {
// provider.loading = false; // provider.loading = false;
// provider.showCodeField = false; // provider.showCodeField = false;
@ -363,42 +335,111 @@ class _LoginScreenState extends State<LoginScreen> {
// } else { // } else {
// provider.message = resp["message"]; // provider.message = resp["message"];
// } // }
// setState(() {
// emailTextController.text = provider.email!;
// secretKeyTextConrtroller.text = provider.code!;
// });
// }
// // }
// //_joinMeeting(roomText.text, "demo meet2");
// // _saveprefs(
// // emailTextController.text,
// // true)
// // .then((value) {
// // Navigator.of(context).pushReplacement(
// // MaterialPageRoute(
// // builder: (context) => FirebaseExample(
// // title: secretKeyTextConrtroller.text,
// // )),
// // );
// // }
// // );
// } else { // } else {
// _displaySnackBar(textFieldsValidation(provider)); print("FIRST LOGIN");
// } if (!provider.showCodeField) {
// }, provider.email = emailTextController.text;
onPressed: () async { // String encoded =
await ApiCall().fetchApiConstants().then( // base64.encode(utf8.encode(deviceId));
(value) {
VerificationResponse resp = await provider.verifyEmail(
emailTextController.text, deviceId!, platform);
print("resp:${resp.status}");
if (resp.status == 1200 &&
resp.verification_code != null) {
provider.loading = false;
provider.showCodeField = true;
provider.showMessage = true;
} else if (resp.status == 1200 &&
resp.accessToken != "") {
provider.loading = false;
provider.showCodeField = false;
provider.showMessage = true;
_displaySnackBar("You have logged in successfully");
_saveprefs(
resp.accessToken!,
resp.user?.email ?? emailTextController.text,
secretKeyTextConrtroller.text,
deviceId!,
true)
.then((value) {
Navigator.of(context).pushReplacement( Navigator.of(context).pushReplacement(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => NavigationHomeScreen()), builder: (context) => NavigationHomeScreen()),
); );
}, });
} else {
provider.loading = false;
provider.showCodeField = false;
provider.showMessage = true;
}
provider.message = resp.message;
setState(() {
emailTextController.text = provider.email!;
});
} else {
provider.code = secretKeyTextConrtroller.text;
VerificationResponse resp = await provider.verifyCode(
emailTextController.text,
secretKeyTextConrtroller.text);
if (resp.status == 1200) {
provider.loading = false;
provider.showCodeField = false;
provider.showMessage = true;
_displaySnackBar("You have logged in successfully");
_saveprefs(
resp.accessToken!,
emailTextController.text,
secretKeyTextConrtroller.text,
deviceId!,
true)
.then((value) {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => NavigationHomeScreen()),
); );
});
} else {
provider.message = resp.message;
}
setState(() {
emailTextController.text = provider.email!;
secretKeyTextConrtroller.text = provider.code!;
});
}
// }
//_joinMeeting(roomText.text, "demo meet2");
// _saveprefs(
// emailTextController.text,
// true)
// .then((value) {
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (context) => FirebaseExample(
// title: secretKeyTextConrtroller.text,
// )),
// );
// }
// );
} else {
_displaySnackBar(textFieldsValidation(provider));
}
}, },
// onPressed: () async {
// await ApiCall().fetchApiConstants().then(
// (value) {
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (context) => NavigationHomeScreen()),
// );
// },
// );
// },
textColor: Colors.white, textColor: Colors.white,
fontsize: isTablet ? 22 : 18, fontsize: isTablet ? 22 : 18,
title: provider.showCodeField ? "Verify" : "Sign In"), title: provider.showCodeField ? "Verify" : "Sign In"),
@ -416,12 +457,14 @@ class _LoginScreenState extends State<LoginScreen> {
} }
Future<void> _saveprefs( Future<void> _saveprefs(
String token, String email, String key, bool login) async { String token, String email, String key, String vcode, bool login) async {
final SharedPreferences prefs = await _prefs; final SharedPreferences prefs = await _prefs;
final String useremail = (prefs.getString('useremail') ?? ''); final String useremail = (prefs.getString('useremail') ?? '');
final String username = (prefs.getString('username') ?? ''); final String username = (prefs.getString('username') ?? '');
final String secretkey = (prefs.getString('secretkey') ?? ''); final String secretkey = (prefs.getString('secretkey') ?? '');
final String verification_code =
(prefs.getString('verfication_code') ?? '');
final bool isloggedin = (prefs.getBool('isloggedin') ?? false); final bool isloggedin = (prefs.getBool('isloggedin') ?? false);
final bool isloggedout = (prefs.getBool('isloggedout') ?? false); final bool isloggedout = (prefs.getBool('isloggedout') ?? false);
setState(() { setState(() {
@ -435,6 +478,10 @@ class _LoginScreenState extends State<LoginScreen> {
_key = prefs.setString('secretkey', key).then((bool success) { _key = prefs.setString('secretkey', key).then((bool success) {
return secretkey; return secretkey;
}); });
_verification_code =
prefs.setString('verfication_code', key).then((bool success) {
return verification_code;
});
_login = prefs.setBool('isloggedin', login).then((bool success) { _login = prefs.setBool('isloggedin', login).then((bool success) {
return isloggedin; return isloggedin;
}); });

View File

@ -76,12 +76,12 @@ class CareView extends StatelessWidget {
child: SlideTransition( child: SlideTransition(
position: _secondHalfAnimation, position: _secondHalfAnimation,
child: Stack(children: [ child: Stack(children: [
SvgPicture.asset( // SvgPicture.asset(
'assets/images/sc2bg500.svg', // 'assets/images/sc2bg500.svg',
fit: BoxFit.fill, // fit: BoxFit.fill,
// width: MediaQuery.of(context).size.width, // // width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.height, // // height: MediaQuery.of(context).size.height,
), // ),
Container( Container(
padding: const EdgeInsets.only(bottom: 100), padding: const EdgeInsets.only(bottom: 100),
child: Column( child: Column(

View File

@ -76,15 +76,15 @@ class MoodDiaryVew extends StatelessWidget {
child: SlideTransition( child: SlideTransition(
position: _secondHalfAnimation, position: _secondHalfAnimation,
child: Stack(children: [ child: Stack(children: [
Padding( // Padding(
padding: const EdgeInsets.only(left: 4.0), // padding: const EdgeInsets.only(left: 4.0),
child: SvgPicture.asset( // child: SvgPicture.asset(
'assets/images/sc1bg1500.svg', // 'assets/images/sc1bg1500.svg',
fit: BoxFit.cover, // fit: BoxFit.cover,
// width: MediaQuery.of(context).size.width, // // width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.height, // // height: MediaQuery.of(context).size.height,
), // ),
), // ),
Container( Container(
padding: const EdgeInsets.only(bottom: 100), padding: const EdgeInsets.only(bottom: 100),
child: Column( child: Column(

View File

@ -71,12 +71,12 @@ class RelaxView extends StatelessWidget {
child: SlideTransition( child: SlideTransition(
position: _secondHalfAnimation, position: _secondHalfAnimation,
child: Stack(children: [ child: Stack(children: [
SvgPicture.asset( // SvgPicture.asset(
'assets/images/sc1bg1500.svg', // 'assets/images/sc1bg1500.svg',
fit: BoxFit.cover, // fit: BoxFit.cover,
// width: MediaQuery.of(context).size.width, // // width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.height, // // height: MediaQuery.of(context).size.height,
), // ),
Container( Container(
padding: const EdgeInsets.only(bottom: 100), padding: const EdgeInsets.only(bottom: 100),
child: Column( child: Column(

View File

@ -47,7 +47,7 @@ class _NavigationHomeScreenState extends State<NavigationHomeScreen> {
drawerWidth: MediaQuery.of(context).size.width * 0.75, drawerWidth: MediaQuery.of(context).size.width * 0.75,
onDrawerCall: (DrawerIndex drawerIndexdata) async { onDrawerCall: (DrawerIndex drawerIndexdata) async {
bool checkContacts = await HiveOperations.checkIfApiExists( bool checkContacts = await HiveOperations.checkIfApiExists(
EventsConstants.contactsListapi); EventsConstants.contactsListapi, EventsConstants.moduleName);
if (!checkContacts && drawerIndexdata.name == "Contacts") { if (!checkContacts && drawerIndexdata.name == "Contacts") {
} else { } else {
changeIndex(drawerIndexdata); changeIndex(drawerIndexdata);

View File

@ -6,6 +6,7 @@ import 'package:avatar_stack/avatar_stack.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
@ -65,6 +66,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
String attachedFileName = ''; String attachedFileName = '';
String attachedFilePath = ''; String attachedFilePath = '';
bool isLoading = false; bool isLoading = false;
bool enableCancel = false;
String btnText = "Add Notes"; String btnText = "Add Notes";
final List<String> _fruits = ['Events', 'Sessions']; final List<String> _fruits = ['Events', 'Sessions'];
final List<String> topics = [ final List<String> topics = [
@ -75,7 +77,8 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
"Program Committee", "Program Committee",
"Practical Application of CDK 4/6 Inhibitor" "Practical Application of CDK 4/6 Inhibitor"
]; ];
final ValueNotifier<List<int>> valueList = ValueNotifier<List<int>>([]); final ValueNotifier<List<int>> valueList =
ValueNotifier<List<int>>([0, 0, 0]);
TextEditingController notesController = TextEditingController(text: ""); TextEditingController notesController = TextEditingController(text: "");
List<String> sessionNotesList = []; List<String> sessionNotesList = [];
Future<void> dialogBuilder(BuildContext context, Eventsdetail eventsdetail, Future<void> dialogBuilder(BuildContext context, Eventsdetail eventsdetail,
@ -170,7 +173,9 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
notesController.text = newValue.note ?? ""; notesController.text = newValue.note ?? "";
if (newValue.note != "" && notesController.text.length != 0) { if (newValue.note != "" && notesController.text.length != 0) {
btnText = "Update"; btnText = "Update";
enableCancel = true;
} }
setState(() {}); setState(() {});
}); });
}, },
@ -182,7 +187,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
@override @override
void initState() { void initState() {
valueList.value = [0, 0, 0]; //valueList.value = [0, 0, 0];
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
init(); init();
}); });
@ -191,10 +196,23 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
} }
init() async { init() async {
// await Provider.of<HcpProfileProvider>(context, listen: false)
// .initConfigModules();
await Provider.of<HcpProfileProvider>(context, listen: false) await Provider.of<HcpProfileProvider>(context, listen: false)
.getSessionData(); .getSessionData();
await Provider.of<HcpProfileProvider>(context, listen: false) await Provider.of<HcpProfileProvider>(context, listen: false)
.getSessionTopics(widget.eventsdetail); .getSessionTopics(widget.eventsdetail)
.then(
(value) {
valueList.value[0] =
Provider.of<HcpProfileProvider>(context, listen: false).totalNotes;
valueList.value[1] =
Provider.of<HcpProfileProvider>(context, listen: false)
.totalSessions;
valueList.value[2] =
Provider.of<HcpProfileProvider>(context, listen: false).totalTopics;
},
);
Provider.of<HcpProfileProvider>(context, listen: false).getCounts(); Provider.of<HcpProfileProvider>(context, listen: false).getCounts();
await Provider.of<InteractionProvider>(context, listen: false) await Provider.of<InteractionProvider>(context, listen: false)
@ -208,12 +226,6 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
await Provider.of<ViewInteractionProvider>(context, listen: false) await Provider.of<ViewInteractionProvider>(context, listen: false)
.getRecords(formname, hcp: widget.kolFullName); .getRecords(formname, hcp: widget.kolFullName);
valueList.value[0] =
Provider.of<HcpProfileProvider>(context, listen: false).totalNotes;
valueList.value[1] =
Provider.of<HcpProfileProvider>(context, listen: false).totalSessions;
valueList.value[2] =
Provider.of<HcpProfileProvider>(context, listen: false).totalTopics;
setState(() {}); setState(() {});
} }
@ -221,8 +233,9 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
return Consumer<HcpProfileProvider>( return Consumer<HcpProfileProvider>(
builder: (BuildContext context, provider, Widget? child) { builder: (BuildContext context, provider, Widget? child) {
return DefaultTabController( return DefaultTabController(
length: 3, length: provider.tabs.length,
child: Scaffold( child: Scaffold(
backgroundColor: EventsConstants.bgcolor,
appBar: AppBar( appBar: AppBar(
// title: Text(""), // title: Text(""),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
@ -279,6 +292,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
expandedHeight: 280.0, expandedHeight: 280.0,
// expandedHeight: MediaQuery.of(context).size.height * 0.25, // expandedHeight: MediaQuery.of(context).size.height * 0.25,
backgroundColor: EventsConstants.bgcolor, backgroundColor: EventsConstants.bgcolor,
//backgroundColor: Colors.white,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
floating: false, floating: false,
pinned: false, pinned: false,
@ -305,32 +319,29 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
pinned: true, pinned: true,
floating: true, floating: true,
delegate: _SliverAppBarDelegate( delegate: _SliverAppBarDelegate(
const TabBar( TabBar(
isScrollable: false, isScrollable: false,
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
tabAlignment: TabAlignment.fill, tabAlignment: TabAlignment.fill,
labelColor: Colors.white, labelColor: Colors.black,
indicatorColor: Colors.white, indicatorColor: EventsConstants.blueColor,
labelStyle: TextStyle( labelStyle: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
labelPadding: EdgeInsets.all(2), labelPadding: EdgeInsets.all(2),
indicatorWeight: 4.0, indicatorWeight: 2.0,
//Color.fromARGB(255, 5, 36, 62) //Color.fromARGB(255, 5, 36, 62)
unselectedLabelColor: Colors.grey, unselectedLabelColor: Colors.grey,
tabs: _tabs, tabs: provider.tabs,
), ),
), ),
), ),
]; ];
}, },
body: TabBarView(children: [ body: provider.tabs.length == 0
topicsTab(widget.eventsdetail, provider), ? Container()
sessionNotes(context, widget.eventsdetail, provider), : TabBarView(children: returnTabWidget(provider)
medicalInsights(),
// sessionNotes(context)
]
// _tabs // _tabs
// .map((e) => Center( // .map((e) => Center(
// child: FloatingActionButton.extended( // child: FloatingActionButton.extended(
@ -351,8 +362,25 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
}); });
} }
buildprofile( List<Widget> returnTabWidget(HcpProfileProvider provider) {
BuildContext context, EventSpeakersData eventsdetail, String title) { List<Widget> widgets = [];
for (var tabs in provider.tabs) {
if (tabs.text == "Sessions") {
widgets.add(topicsTab(widget.eventsdetail, provider));
}
if (tabs.text == "Notes") {
widgets.add(sessionNotes(context, widget.eventsdetail, provider));
}
if (tabs.text == "Medical Insights") {
widgets.add(medicalInsights());
}
}
return widgets;
}
buildprofile(BuildContext context, EventSpeakersData eventsdetail,
String title, HcpProfileProvider provider) {
MediaQuery.of(context).size.height * 0.35; MediaQuery.of(context).size.height * 0.35;
print("ORG:${eventsdetail.orgName}"); print("ORG:${eventsdetail.orgName}");
@ -402,10 +430,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan(children: [ text: TextSpan(children: [
TextSpan( TextSpan(
text: eventsdetail.orgName != null || text: provider.getUserLoc(eventsdetail),
eventsdetail.orgName!.trim() != ""
? '${eventsdetail.orgName}'
: "",
style: TextStyle( style: TextStyle(
// decoration: TextDecoration.underline, // decoration: TextDecoration.underline,
// decorationColor: Colors.blue, // decorationColor: Colors.blue,
@ -420,34 +445,34 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
// softWrap: true, // softWrap: true,
// overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
), ),
TextSpan( // TextSpan(
text: eventsdetail.country != null // text: eventsdetail.country != null
? '${eventsdetail.country},' // ? '${eventsdetail.country},'
: "", // : "",
style: TextStyle( // style: TextStyle(
// decoration: TextDecoration.underline, // // decoration: TextDecoration.underline,
// decorationColor: Colors.blue, // // decorationColor: Colors.blue,
color: Colors.white, // color: Colors.white,
fontSize: 14, // fontSize: 14,
// fontFamily: "SourceSerif", // // fontFamily: "SourceSerif",
), // ),
), // ),
TextSpan( // TextSpan(
text: eventsdetail.city != null // text: eventsdetail.city != null
? '${eventsdetail.city}' // ? '${eventsdetail.city}'
: "", // : "",
style: TextStyle( // style: TextStyle(
// decoration: TextDecoration.underline, // // decoration: TextDecoration.underline,
// decorationColor: Colors.blue, // // decorationColor: Colors.blue,
color: Colors.white, // color: Colors.white,
fontSize: 14, // fontSize: 14,
// fontFamily: "SourceSerif", // // fontFamily: "SourceSerif",
), // ),
) // )
])), ])),
// Text( // Text(
@ -535,7 +560,8 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
// title: eventsdetail.kolFullName!, // title: eventsdetail.kolFullName!,
// eventsdetail: eventsdetail, // eventsdetail: eventsdetail,
// ), // ),
buildprofile(context, eventsdetail, eventsdetail.kolFullName!), buildprofile(
context, eventsdetail, eventsdetail.kolFullName!, provider),
// Padding( // Padding(
// padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
// child: Column( // child: Column(
@ -722,6 +748,24 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
// SizedBox( // SizedBox(
// width: 10, // width: 10,
// ), // ),
// SizedBox(
// width: 140,
// height: 30,
// child: OutlinedButton(
// onPressed: () {
// enableCancel = false;
// notesController.clear();
// sessionsTopicsData = null;
// _selectedFruit = "";
// btnText = "Add Notes";
// setState(() {});
// },
// style: ButtonStyle(
// shape: MaterialStateProperty.all(CircleBorder()),
// ),
// child: Icon(Icons.attach_file)),
// ),
CustomButton( CustomButton(
backgroundColor: backgroundColor:
const Color.fromARGB(255, 233, 229, 229), const Color.fromARGB(255, 233, 229, 229),
@ -740,7 +784,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
setState(() {}); setState(() {});
}, },
width: 120, width: 120,
height: 40, height: 35,
fontsize: 12, fontsize: 12,
textColor: Colors.black, textColor: Colors.black,
title: "Attach file"), title: "Attach file"),
@ -758,6 +802,13 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
), ),
], ],
)), )),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Align( Align(
alignment: Alignment.center, alignment: Alignment.center,
child: Stack( child: Stack(
@ -765,8 +816,85 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
Align( Align(
alignment: Alignment.center, alignment: Alignment.center,
child: SizedBox( child: SizedBox(
height: 45, height: 40,
child: FloatingActionButton.extended( child:
// CustomButton(
// backgroundColor: EventsConstants.btnGreenColor,
// onPressed: () async {
// isLoading = true;
// if (notesController.text.isNotEmpty &&
// sessionsTopicsData != null) {
// print("ADD : ${_selectedFruit}");
// sessionNotesList.add(
// "${_selectedFruit} \n\n ${notesController.text}");
// // });
// print(
// " eventid:${widget.eventid},hcp:${widget.eventid} session: ${sessionsTopicsData}");
// await provider.submitSessionNotes(
// eventsdetail,
// sessionsTopicsData!,
// notesController.text,
// attachedFileName != ''
// ? attachedFilePath
// : "",
// attachedFileName != ''
// ? attachedFileName
// : "",
// );
// //HIVESTORE
// SessionNotesModel notesModel =
// SessionNotesModel(
// notes: notesController.text,
// addedBy: "user",
// addedDate:
// CustomDateFormatter().formatDate(),
// eventid:
// sessionsTopicsData!.kolEventsId,
// hcpid: widget.eventid,
// kolid: sessionsTopicsData!.kolId,
// event_attendees_id: sessionsTopicsData!
// .eventAttendeesId,
// kid: eventsdetail.kId,
// filepath: attachedFileName != ''
// ? attachedFilePath
// : "",
// filename: attachedFileName != ''
// ? attachedFileName
// : "",
// selectedSession: _selectedFruit);
// await provider.addSessionNotes(notesModel);
// _selectedFruit = null;
// isLoading = false;
// sessionsTopicsData = null;
// attachedFileName = "";
// notesController.clear();
// isLoading = false;
// enableCancel = false;
// btnText = "Add Notes";
// setState(() {});
// SnackBarWidget.displaySnackBar(
// "Notes added",
// context,
// );
// } else {
// isLoading = false;
// SnackBarWidget.displaySnackBar(
// "Session/Notes cannot be empty", context,
// error: true);
// }
// },
// width: 100,
// height: 35,
// fontsize: 12,
// textColor: Colors.white,
// title: btnText),
FloatingActionButton.extended(
// backgroundColor: const Color.fromARGB(255, 222, 237, 247), // backgroundColor: const Color.fromARGB(255, 222, 237, 247),
backgroundColor: Colors.green, backgroundColor: Colors.green,
onPressed: () async { onPressed: () async {
@ -818,6 +946,8 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
attachedFileName = ""; attachedFileName = "";
notesController.clear(); notesController.clear();
isLoading = false; isLoading = false;
enableCancel = false;
btnText = "Add Notes";
setState(() {}); setState(() {});
SnackBarWidget.displaySnackBar( SnackBarWidget.displaySnackBar(
"Notes added", "Notes added",
@ -853,6 +983,70 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
], ],
), ),
), ),
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Visibility(
visible: enableCancel,
// child: Padding(
// padding: EdgeInsets.all(4.0),
// child: Text('Cancel',
// style: TextStyle(
// fontSize: 14, color: EventsConstants.blueColor)),
// ),
child: OutlinedButton(
onPressed: () {
enableCancel = false;
notesController.clear();
sessionsTopicsData = null;
_selectedFruit = "";
btnText = "Add Notes";
setState(() {});
},
style: ButtonStyle(
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0))),
),
child: const Text(
"Cancel",
style: TextStyle(color: Colors.black),
),
),
// child: CustomButton(
// backgroundColor: Colors.transparent,
// onPressed: () async {
// enableCancel = false;
// notesController.clear();
// sessionsTopicsData = null;
// _selectedFruit = "";
// btnText = "Add Notes";
// setState(() {});
// },
// width: 100,
// height: 40,
// fontsize: 12,
// textColor: Colors.black,
// title: "Cancel"),
// child: TextButton(
// style: TextButton.styleFrom(
// textStyle: Theme.of(context).textTheme.labelLarge,
// ),
// child: const Text('Cancel',
// style: TextStyle(
// fontSize: 14, color: EventsConstants.blueColor)),
// onPressed: () {
// enableCancel = false;
// notesController.clear();
// sessionsTopicsData = null;
// _selectedFruit = "";
// btnText = "Add Notes";
// setState(() {});
// },
// ),
),
),
],
),
Divider(), Divider(),
Padding( Padding(
padding: const EdgeInsets.only(left: 15.0), padding: const EdgeInsets.only(left: 15.0),
@ -918,7 +1112,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
if (notesController.text.length != 0) { if (notesController.text.length != 0) {
btnText = "Update"; btnText = "Update";
} }
enableCancel = true;
setState(() {}); setState(() {});
}, },
width: 80, width: 80,
@ -1348,21 +1542,21 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
Widget build( Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) { BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container( return Container(
//color: Constants.tabbgColor, color: Colors.white,
decoration: BoxDecoration( // decoration: BoxDecoration(
gradient: LinearGradient( // gradient: LinearGradient(
begin: Alignment.bottomCenter, // begin: Alignment.bottomCenter,
end: Alignment.topCenter, // end: Alignment.topCenter,
colors: [ // colors: [
// Constants.blueColor, // // Constants.blueColor,
EventsConstants.tabbgColor, // EventsConstants.tabbgColor,
EventsConstants.blueColor, // EventsConstants.blueColor,
// Constants.tabbgColor, // // Constants.tabbgColor,
// const Color.fromARGB(255, 222, 237, 247), // // const Color.fromARGB(255, 222, 237, 247),
// const Color.fromARGB(255, 222, 237, 247), // // const Color.fromARGB(255, 222, 237, 247),
// Color(0xff006df1) // // Color(0xff006df1)
]), // ]),
), // ),
// color: Colors.white, // color: Colors.white,
//249, 103, 49 //249, 103, 49
// color: const Color.fromARGB(255, 239, 71, 49), // color: const Color.fromARGB(255, 239, 71, 49),

View File

@ -23,7 +23,9 @@ import 'package:konectar_events/model/sessionnotesmodel.dart';
import 'package:konectar_events/model/specialtymodel.dart'; import 'package:konectar_events/model/specialtymodel.dart';
import 'package:konectar_events/model/topics_cloud_model.dart'; import 'package:konectar_events/model/topics_cloud_model.dart';
import 'package:konectar_events/utils/apicall.dart'; import 'package:konectar_events/utils/apicall.dart';
import 'package:konectar_events/utils/constants.dart';
import 'package:konectar_events/utils/dateformater.dart'; import 'package:konectar_events/utils/dateformater.dart';
import 'package:konectar_events/viewmodel/hive_repository.dart';
import 'package:konectar_events/widgets/word_cloud.dart'; import 'package:konectar_events/widgets/word_cloud.dart';
class EventsProvider extends ChangeNotifier { class EventsProvider extends ChangeNotifier {
@ -62,6 +64,57 @@ class EventsProvider extends ChangeNotifier {
List<AllSessionNotesResponse> allSessionNotes = []; List<AllSessionNotesResponse> allSessionNotes = [];
late StreamSubscription<List<ConnectivityResult>> connectivitySubscription; late StreamSubscription<List<ConnectivityResult>> connectivitySubscription;
bool isLoadingInsights = true; bool isLoadingInsights = true;
//ENABLE/DISABLE KEYS
bool enableFollow = false;
bool enableAttending = false;
bool enableDetails = false;
bool enableSpeakers = false;
bool enableInsights = false;
bool addOffline = false;
bool enableFilters = false;
var tabs = [
Tab(text: "Details"),
Tab(text: "Speakers"),
Tab(text: "Insights"),
// Tab(text: "Medical Insights"),
];
initConfigModules() async {
print("CONFIG_CALLED");
enableFollow = await HiveOperations.checkIfApiExists(
EventsConstants.followUnfollowEvent, EventsConstants.moduleName);
enableAttending = await HiveOperations.checkIfApiExists(
EventsConstants.attendNotAttendEvent, EventsConstants.moduleName);
enableDetails = await HiveOperations.checkIfApiExists(
EventsConstants.eventdetailsapi, EventsConstants.moduleName);
enableSpeakers = await HiveOperations.checkIfApiExists(
EventsConstants.speakerslistapi, EventsConstants.moduleName);
enableInsights = await HiveOperations.checkIfApiExists(
EventsConstants.insightsTopicsCloud, EventsConstants.moduleName);
addOffline = await HiveOperations.checkIfApiExists(
EventsConstants.saveEventOffline, EventsConstants.moduleName);
enableFilters = await HiveOperations.checkIfApiExists(
EventsConstants.filtersApi, EventsConstants.moduleName);
tabs.clear();
if (enableDetails) {
tabs.add(Tab(
text: "Details",
));
}
if (enableSpeakers) {
tabs.add(Tab(
text: "Speakers",
));
}
if (enableInsights) {
tabs.add(Tab(
text: "Insights",
));
}
notifyListeners();
}
Future<void> onSelectAll(int page) async { Future<void> onSelectAll(int page) async {
isFavSeleted = false; isFavSeleted = false;
isAllSelected = !isAllSelected; isAllSelected = !isAllSelected;
@ -78,6 +131,27 @@ class EventsProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
String getLocationDetails(EventsList event) {
List<String> loc = [];
if (event.city != null && event.city != "") {
loc.add(event.city!);
}
if (event.region != null && event.region != "") {
loc.add(event.region!);
}
if (event.country != null && event.country != "") {
loc.add(event.country!);
}
return loc.join(' , ');
// return 'hdgkhjagshjdgashjdgkjhsagdkjgasljkdgsajkgdhjksaghdjkasgdkjgaskjdlsak';
}
String getEventDate(EventsList event) {
String date =
'${CustomDateFormatter().formatYearDate(CustomDateFormatter().convertStringToDate(event.start!))} to ${CustomDateFormatter().formatYearDate(CustomDateFormatter().convertStringToDate(event.end!))}';
return date;
}
bool checkIfUserInterested(String eventid) { bool checkIfUserInterested(String eventid) {
bool user = false; bool user = false;
if (eventList.isNotEmpty) { if (eventList.isNotEmpty) {
@ -407,7 +481,7 @@ class EventsProvider extends ChangeNotifier {
FutureOr saveEventsData(EventsList eventsData) async { FutureOr saveEventsData(EventsList eventsData) async {
box = await Hive.openBox<EventsList>('EventsListBox'); box = await Hive.openBox<EventsList>('EventsListBox');
//check if already exists
box.add(eventsData); box.add(eventsData);
offlineEvents.clear(); offlineEvents.clear();
offlineEvents = await getOfflineMyEvents(); offlineEvents = await getOfflineMyEvents();

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'dart:math'; import 'dart:math';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:konectar_events/model/allsessionnotesmodel.dart'; import 'package:konectar_events/model/allsessionnotesmodel.dart';
import 'package:konectar_events/model/events_speakers_k1.dart'; import 'package:konectar_events/model/events_speakers_k1.dart';
@ -12,6 +13,8 @@ import 'package:konectar_events/model/sessionnotesmodel.dart';
import 'package:konectar_events/model/sessionstopics_model.dart'; import 'package:konectar_events/model/sessionstopics_model.dart';
import 'package:konectar_events/model/topics_cloud_model.dart'; import 'package:konectar_events/model/topics_cloud_model.dart';
import 'package:konectar_events/utils/apicall.dart'; import 'package:konectar_events/utils/apicall.dart';
import 'package:konectar_events/utils/constants.dart';
import 'package:konectar_events/viewmodel/hive_repository.dart';
import 'package:konectar_events/widgets/word_cloud.dart'; import 'package:konectar_events/widgets/word_cloud.dart';
class HcpProfileProvider extends ChangeNotifier { class HcpProfileProvider extends ChangeNotifier {
@ -23,6 +26,60 @@ class HcpProfileProvider extends ChangeNotifier {
List<SessionsTopicsData> sessionTopics = []; List<SessionsTopicsData> sessionTopics = [];
List<AllSessionNotesResponse> allSessionNotes = []; List<AllSessionNotesResponse> allSessionNotes = [];
late Box<SessionNotesModel> box; late Box<SessionNotesModel> box;
bool enableSessions = false;
bool enableNotes = false;
bool enableMedInsights = false;
var tabs = [
Tab(text: "Sessions"),
Tab(text: "Notes"),
Tab(text: "Medical Insights"),
// Tab(text: "Medical Insights"),
];
initConfigModules() async {
enableSessions = await HiveOperations.checkIfApiExists(
EventsConstants.showEventsTopicsAndSession, EventsConstants.moduleName);
enableNotes = await HiveOperations.checkIfApiExists(
EventsConstants.saveEventsTopicNote, EventsConstants.moduleName);
enableMedInsights = await HiveOperations.checkIfApiExists(
EventsConstants.medInsightApi, EventsConstants.moduleName);
tabs.clear();
if (!enableSessions) {
tabs.clear();
} else {
if (enableSessions) {
tabs.add(Tab(
text: "Sessions",
));
}
if (enableNotes) {
tabs.add(Tab(
text: "Notes",
));
}
if (enableMedInsights) {
tabs.add(Tab(
text: "Medical Insights",
));
}
}
notifyListeners();
}
String getUserLoc(EventSpeakersData detail) {
List<String> loc = [];
if (detail.orgName != null && detail.orgName != "") {
loc.add(detail.orgName!);
}
if (detail.city != null && detail.city != "") {
loc.add(detail.city!);
}
if (detail.country != null && detail.country != "") {
loc.add(detail.country!);
}
return loc.join(' , ');
// return 'hdgkhjagshjdgashjdgkjhsagdkjgasljkdgsajkgdhjksaghdjkasgdkjgaskjdlsak';
}
Future<void> getSessionTopics(EventSpeakersData detail) async { Future<void> getSessionTopics(EventSpeakersData detail) async {
sessionTopics = await ApiCall().getSessionsTopics(detail.eid!, sessionTopics = await ApiCall().getSessionsTopics(detail.eid!,

View File

@ -10,16 +10,15 @@ class HiveOperations {
hiveApiConstantsBox.addAll(hiveList); hiveApiConstantsBox.addAll(hiveList);
} }
static Future<bool> checkIfApiExists( static Future<bool> checkIfApiExists(String api, String moduleName) async {
String api,
) async {
late Box<HiveApiConstants> hiveApiConstantsBox; late Box<HiveApiConstants> hiveApiConstantsBox;
hiveApiConstantsBox = hiveApiConstantsBox =
await Hive.openBox<HiveApiConstants>('hiveApiConstants'); await Hive.openBox<HiveApiConstants>('hiveApiConstants');
List<HiveApiConstants> list = hiveApiConstantsBox.values.toList(); List<HiveApiConstants> list = hiveApiConstantsBox.values.toList();
return list.indexWhere( return list.indexWhere(
(element) => element.functionName == api, (element) =>
element.functionName == api && element.module == moduleName,
) == ) ==
-1 -1
? false ? false

View File

@ -6,7 +6,6 @@ import 'package:konectar_events/utils/apicall.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:konectar_events/utils/constants.dart'; import 'package:konectar_events/utils/constants.dart';
import 'package:konectar_events/viewmodel/hive_repository.dart'; import 'package:konectar_events/viewmodel/hive_repository.dart';
import 'package:mobile_device_identifier/mobile_device_identifier.dart';
class LoginProvider extends ChangeNotifier { class LoginProvider extends ChangeNotifier {
late Box<UserData> box; late Box<UserData> box;
@ -18,7 +17,6 @@ class LoginProvider extends ChangeNotifier {
String? email; String? email;
String? code; String? code;
String deviceId = 'Unknown'; String deviceId = 'Unknown';
final _mobileDeviceIdentifierPlugin = MobileDeviceIdentifier();
init() {} init() {}
Future<dynamic> verifyEmail(String email, String deviceid, String platform) { Future<dynamic> verifyEmail(String email, String deviceid, String platform) {
@ -136,19 +134,4 @@ class LoginProvider extends ChangeNotifier {
} }
//GET DEVICE UNIQUE ID //GET DEVICE UNIQUE ID
Future<void> initDeviceId() async {
String deviceId;
try {
deviceId = await _mobileDeviceIdentifierPlugin.getDeviceId() ??
'Unknown platform version';
} on PlatformException {
deviceId = 'Failed to get platform version.';
}
//if (!mounted) return;
deviceId = deviceId;
print("DEVICE ID :$deviceId");
notifyListeners();
}
} }

View File

@ -27,7 +27,7 @@ class _HomeDrawerState extends State<HomeDrawer> {
List<DrawerList>? drawerList; List<DrawerList>? drawerList;
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance(); final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
late Future<String> _useremail; late Future<String> _useremail;
late Future<String> _key; late Future<String> _deviceid;
@override @override
void initState() { void initState() {
setDrawerListArray(); setDrawerListArray();
@ -35,15 +35,15 @@ class _HomeDrawerState extends State<HomeDrawer> {
return prefs.getString('useremail') ?? ""; return prefs.getString('useremail') ?? "";
}); });
_key = _prefs.then((SharedPreferences prefs) { _deviceid = _prefs.then((SharedPreferences prefs) {
return prefs.getString('token') ?? ""; return prefs.getString('verfication_code') ?? "";
}); });
super.initState(); super.initState();
} }
void setDrawerListArray() async { void setDrawerListArray() async {
bool checkContacts = bool checkContacts = await HiveOperations.checkIfApiExists(
await HiveOperations.checkIfApiExists(EventsConstants.contactsListapi); EventsConstants.contactsListapi, EventsConstants.moduleName);
if (!checkContacts) { if (!checkContacts) {
drawerList = <DrawerList>[ drawerList = <DrawerList>[
DrawerList( DrawerList(
@ -257,7 +257,8 @@ class _HomeDrawerState extends State<HomeDrawer> {
} }
void onTapped() async { void onTapped() async {
final resp = ApiCall().logout(await _key); print("device id : ${await _deviceid}");
final resp = await ApiCall().logout(await _useremail, await _deviceid);
print("resp:$resp"); print("resp:$resp");
await SessionManager().logoutSession(false).then((value) { await SessionManager().logoutSession(false).then((value) {
Navigator.of(context).popUntil((route) => route.isFirst); Navigator.of(context).popUntil((route) => route.isFirst);