Merge pull request 'login auth , verfication' (#7) from snehalatha_dev into dev

Reviewed-on: #7
This commit is contained in:
snehalathad 2024-12-16 11:38:45 +00:00
commit a56c33fdf5
20 changed files with 1378 additions and 838 deletions

View File

@ -5,18 +5,25 @@
"method": "POST", "method": "POST",
"module": "eventapis" "module": "eventapis"
}, },
{ {
"api": "saveUserInterestedEvent", "api": "saveUserInterestedEvent",
"interval": 0, "interval": 0,
"method": "POST", "method": "POST",
"module": "eventapis" "module": "eventapis"
}, },
{ {
"api": "saveUserAttendingEvent", "api": "saveUserAttendingEvent",
"interval": 0, "interval": 0,
"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,17 +329,15 @@ 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( // primarySwatch: Colors.blue,
// primarySwatch: Colors.blue, // textTheme: AppTheme.textTheme,
// textTheme: AppTheme.textTheme, // 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,153 +538,167 @@ 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: [
color: EventsConstants.bgcolor, // child:
width: MediaQuery.of(context).size.width,
height: 240,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Align(
// alignment: Alignment.topLeft,
// child: const Text(
// 'Actions',
// style: TextStyle(fontSize: 18),
// )),
// ),IntroductionAnimationScreen
// InkWell(
// onTap: () {
// Navigator.push<dynamic>(
// context,
// MaterialPageRoute<dynamic>(
// builder: (BuildContext context) =>
// IntroductionAnimationScreen(),
// ),
// );
// // Navigator.pop(context);
// },
// child: ListTile(
// title: Text("GOTO"),
// leading: Icon(
// Icons.calendar_month,
// color: Colors.green,
// ),
// ),
// ),
InkWell(
onTap: () {
Add2Calendar.addEvent2Cal(
buildEvent(),
);
Navigator.pop(context);
},
child: ListTile(
title: Text("Add to my calendar"),
leading: Icon(
Icons.calendar_month,
color: Colors.green,
),
),
),
InkWell(
onTap: () async {
if (provider.offlineEvents.isEmpty) {
await provider.saveEventsData(widget.event);
SnackBarWidget.displaySnackBar(
"Event Saved Offline", context);
} else {
if (!provider.offlineExists) {
await provider.saveEventsData(widget.event);
SnackBarWidget.displaySnackBar(
"Event Saved Offline", context);
} else {
await provider.delateOfflineEvent(widget.event);
provider.offlineExists = false;
SnackBarWidget.displaySnackBar(
"Removed from Offline", context);
}
}
Navigator.pop(context); Container(
}, color: EventsConstants.bgcolor,
child: ListTile( // width: MediaQuery.of(context).size.width,
title: Text(provider.offlineExists // constraints: BoxConstraints(minHeight: 120, maxHeight: 130),
? "Remove the event from offline" //height: 240,
: "Save the event offline"), child: Center(
leading: Icon( child: Column(
Icons.download, mainAxisAlignment: MainAxisAlignment.start,
color: Colors.blue, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Align(
// alignment: Alignment.topLeft,
// child: const Text(
// 'Actions',
// style: TextStyle(fontSize: 18),
// )),
// ),IntroductionAnimationScreen
// InkWell(
// onTap: () {
// Navigator.push<dynamic>(
// context,
// MaterialPageRoute<dynamic>(
// builder: (BuildContext context) =>
// IntroductionAnimationScreen(),
// ),
// );
// // Navigator.pop(context);
// },
// child: ListTile(
// title: Text("GOTO"),
// leading: Icon(
// Icons.calendar_month,
// color: Colors.green,
// ),
// ),
// ),
InkWell(
onTap: () {
Add2Calendar.addEvent2Cal(
buildEvent(),
);
Navigator.pop(context);
},
child: ListTile(
title: Text("Add to my calendar"),
leading: Icon(
Icons.calendar_month,
color: Colors.green,
),
), ),
), ),
), provider.addOffline
InkWell( ? InkWell(
onTap: () { onTap: () async {
if (widget.event.eventUserAttendee!) { if (provider.offlineEvents.isEmpty) {
widget.event.eventUserAttendee = false; await provider
.saveEventsData(widget.event);
SnackBarWidget.displaySnackBar(
"Event Saved Offline", context);
} else {
if (!provider.offlineExists) {
await provider
.saveEventsData(widget.event);
SnackBarWidget.displaySnackBar(
"Event Saved Offline", context);
} else {
await provider
.delateOfflineEvent(widget.event);
provider.offlineExists = false;
SnackBarWidget.displaySnackBar(
"Removed from Offline", context);
}
}
// if (event.isAttending) { Navigator.pop(context);
// SnackBarWidget.displaySnackBar( },
// "Attending", context); child: ListTile(
// } else { title: Text(provider.offlineExists
SnackBarWidget.displaySnackBar( ? "Remove the event from offline"
"Marked as not attending", context); : "Save the event offline"),
// } leading: Icon(
setState(() {}); Icons.download,
Navigator.pop(context); color: Colors.blue,
} else { ),
Navigator.pop(context); ),
} )
}, : SizedBox.shrink(),
child: ListTile( provider.enableAttending
title: Text("Mark as not attending"), ? InkWell(
leading: Icon( onTap: () {
Icons.remove_circle, if (widget.event.eventUserAttendee!) {
color: Colors.red, widget.event.eventUserAttendee = false;
),
), // if (event.isAttending) {
), // SnackBarWidget.displaySnackBar(
// Container( // "Attending", context);
// padding: EdgeInsets.symmetric(horizontal: 8.0), // } else {
// width: MediaQuery.of(context).size.width, SnackBarWidget.displaySnackBar(
// child: ElevatedButton( "Marked as not attending", context);
// child: const Text( // }
// 'Add to My Calendar', setState(() {});
// style: TextStyle(color: Colors.black), Navigator.pop(context);
// ), } else {
// onPressed: () { Navigator.pop(context);
// Add2Calendar.addEvent2Cal( }
// buildEvent(), },
// ); child: ListTile(
// Navigator.pop(context); title: Text("Mark as not attending"),
// }), leading: Icon(
// ), Icons.remove_circle,
// Container( color: Colors.red,
// padding: EdgeInsets.symmetric(horizontal: 8.0), ),
// width: MediaQuery.of(context).size.width, ),
// Container( )
// padding: EdgeInsets.symmetric(horizontal: 8.0), : SizedBox.shrink(),
// width: MediaQuery.of(context).size.width, // Container(
// child: ElevatedButton( // padding: EdgeInsets.symmetric(horizontal: 8.0),
// child: const Text('Remove from my events', // width: MediaQuery.of(context).size.width,
// style: TextStyle(color: Colors.black)), // child: ElevatedButton(
// onPressed: () => Navigator.pop(context), // child: const Text(
// ), // 'Add to My Calendar',
// ), // style: TextStyle(color: Colors.black),
// ElevatedButton( // ),
// child: const Text('Close'), // onPressed: () {
// onPressed: () => Navigator.pop(context), // Add2Calendar.addEvent2Cal(
// ), // buildEvent(),
], // );
// Navigator.pop(context);
// }),
// ),
// Container(
// padding: EdgeInsets.symmetric(horizontal: 8.0),
// width: MediaQuery.of(context).size.width,
// Container(
// padding: EdgeInsets.symmetric(horizontal: 8.0),
// width: MediaQuery.of(context).size.width,
// child: ElevatedButton(
// child: const Text('Remove from my events',
// style: TextStyle(color: Colors.black)),
// onPressed: () => Navigator.pop(context),
// ),
// ),
// ElevatedButton(
// child: const Text('Close'),
// onPressed: () => Navigator.pop(context),
// ),
],
),
), ),
), ),
); ]);
}, },
); );
}, },
@ -772,32 +781,33 @@ 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(),
// //SocialMedia(),
// ],
), ),
// medicalInsights(),
//SocialMedia(),
],
),
), ),
), ),
Visibility( Visibility(
@ -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,62 +1196,69 @@ class _EventsListingScreenState extends State<EventsListingScreen>
], ],
), ),
), ),
SizedBox( provider.getLocationDetails(event) == ""
height: 8.0, ? SizedBox.shrink()
), : SizedBox(
RichText( height: 8.0,
text: TextSpan( ),
children: [ provider.getLocationDetails(event) == ""
WidgetSpan( ? SizedBox.shrink()
child: Icon( : RichText(
Icons.location_on, text: TextSpan(
size: 18, children: [
color: Colors.white, WidgetSpan(
child: Icon(
Icons.location_on,
size: 18,
color: Colors.white,
),
),
TextSpan(
text: ' ${provider.getLocationDetails(event)}',
style: TextStyle(
color: Colors.white,
//fontStyle: FontStyle.italic,
letterSpacing: 0.3,
fontSize: isTablet ? 20 : 14),
),
],
), ),
), ),
TextSpan( event.url1 == null
text: ? SizedBox.shrink()
' ${event.city != null && event.city != "" ? "${event.city}, " : ""}${event.region != null && event.region != "" ? "${event.region}, " : ""}${event.country != null && event.country != "" ? "${event.country}" : ""}', : SizedBox(
style: TextStyle( height: 8.0,
color: Colors.white,
//fontStyle: FontStyle.italic,
letterSpacing: 0.3,
fontSize: isTablet ? 20 : 14),
), ),
], event.url1 == null
), ? SizedBox.shrink()
), : InkWell(
SizedBox( onTap: () async {
height: 8.0, print("URL:${event.url1!}");
), await _launchUrl(event.url1!);
InkWell( },
onTap: () async { child: RichText(
print("URL:${event.url1!}"); text: TextSpan(
await _launchUrl(event.url1!); children: [
}, WidgetSpan(
child: RichText( child: Icon(
text: TextSpan( Icons.link,
children: [ size: 18,
WidgetSpan( color: Colors.white,
child: Icon( ),
Icons.link, ),
size: 18, TextSpan(
color: Colors.white, text: ' Visit Website',
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.white,
// fontStyle: FontStyle.italic,
letterSpacing: 0.6,
fontSize: isTablet ? 20 : 14),
),
],
), ),
), ),
TextSpan( ),
text: ' Visit Website',
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.white,
// fontStyle: FontStyle.italic,
letterSpacing: 0.6,
fontSize: isTablet ? 20 : 14),
),
],
),
),
),
Padding( Padding(
padding: const EdgeInsets.only(top: 8.0, right: 8.0, left: 1), padding: const EdgeInsets.only(top: 8.0, right: 8.0, left: 1),
@ -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,50 +622,52 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
// ), // ),
// ), // ),
// ), // ),
Material( !provider.enableFilters
color: Colors.transparent, ? SizedBox.shrink()
child: InkWell( : Material(
focusColor: Colors.transparent, color: Colors.transparent,
highlightColor: Colors.transparent, child: InkWell(
hoverColor: Colors.transparent, focusColor: Colors.transparent,
splashColor: Colors.grey.withOpacity(0.2), highlightColor: Colors.transparent,
borderRadius: const BorderRadius.all( hoverColor: Colors.transparent,
Radius.circular(4.0), splashColor: Colors.grey.withOpacity(0.2),
), borderRadius: const BorderRadius.all(
onTap: () { Radius.circular(4.0),
FocusScope.of(context).requestFocus(FocusNode()); ),
// Navigator.push<dynamic>( onTap: () {
// context, FocusScope.of(context).requestFocus(FocusNode());
// MaterialPageRoute<dynamic>( // Navigator.push<dynamic>(
// builder: (BuildContext context) => // context,
// populateDrawer(provider), // MaterialPageRoute<dynamic>(
// fullscreenDialog: false), // builder: (BuildContext context) =>
// ); // populateDrawer(provider),
_scaffoldKey.currentState?.openEndDrawer(); // fullscreenDialog: false),
}, // );
child: Padding( _scaffoldKey.currentState?.openEndDrawer();
padding: const EdgeInsets.only(left: 8), },
child: Row( child: Padding(
children: <Widget>[ padding: const EdgeInsets.only(left: 8),
Text( child: Row(
'Filters', children: <Widget>[
style: TextStyle( Text(
fontWeight: FontWeight.w100, 'Filters',
fontSize: 16, style: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 16,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.sort,
color: Color.fromARGB(255, 0, 71, 132),
),
),
],
), ),
), ),
Padding( ),
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.sort,
color: Color.fromARGB(255, 0, 71, 132),
),
),
],
), ),
),
),
),
], ],
), ),
), ),
@ -1711,143 +1720,185 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),
RichText( provider.getLocationDetails(event).length == 0
textAlign: TextAlign.justify, ? SizedBox.shrink()
text: TextSpan( : Container(
children: [ constraints: BoxConstraints(
WidgetSpan( minWidth: 100, maxWidth: double.maxFinite),
child: Icon(Icons.location_on, size: 16), //width: MediaQuery.of(context).size.width / 2,
), // padding: EdgeInsets.only(right: 13),
TextSpan( child: RichText(
text: textAlign: TextAlign.justify,
' ${event.city != null && event.city != "" ? "${event.city}, " : ""}${event.region != null && event.region != "" ? "${event.region}, " : ""}${event.country != null && event.country != "" ? "${event.country}" : ""}', text: TextSpan(
style: TextStyle( children: [
color: Colors.black, WidgetSpan(
//fontStyle: FontStyle.italic, child: Icon(Icons.location_on, size: 16),
),
// WidgetSpan(
// child: Flexible(
// // width: 200,
// child: Text(
// provider.getLocationDetails(event),
// overflow: TextOverflow.fade,
// ),
// )),
TextSpan(
spellOut: true,
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(
color: Colors.black,
overflow: TextOverflow.ellipsis,
//fontStyle: FontStyle.italic,
fontSize: isTablet ? 16 : 12), fontSize: isTablet ? 16 : 12),
),
],
),
),
), ),
], 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
alignment: FractionalOffset.bottomRight, ? Align(
child: Row( alignment: FractionalOffset.bottomRight,
children: [ child: Row(
Column( children: [
crossAxisAlignment: CrossAxisAlignment.end, Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end,
children: [ mainAxisAlignment:
provider.ifOfflineExists(event.eventId ?? "") MainAxisAlignment.spaceBetween,
? Padding( children: [
padding: EdgeInsets.only(right: 10), SizedBox(
child: Icon(Icons.bookmark, width: 40,
color: EventsConstants.blueColor, height: 30,
size: isTablet ? 14 : 18), child: FloatingActionButton.extended(
) elevation: 1,
: SizedBox.shrink(), shape: CircleBorder(),
SizedBox( backgroundColor:
width: 40, EventsConstants.bgcolor,
height: 30, //backgroundColor: EventsConstants.homeCardBackgound,
child: FloatingActionButton.extended( onPressed: () async {
elevation: 1, // event.isfav = !event.isfav;
shape: CircleBorder(),
backgroundColor: EventsConstants.bgcolor,
//backgroundColor: EventsConstants.homeCardBackgound,
onPressed: () async {
// event.isfav = !event.isfav;
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(
SnackBarWidget.displaySnackBar( event.eventId!);
"Removed from My Events!", context); SnackBarWidget.displaySnackBar(
} else { "Removed from My Events!",
String msg = await provider context);
.addEventsToFavs(event.eventId!); } else {
SnackBarWidget.displaySnackBar( String msg =
"Added to My Events", context); await provider.addEventsToFavs(
} event.eventId!);
pagingController.refresh(); SnackBarWidget.displaySnackBar(
setState(() {}); "Added to My Events", context);
// if (event.isfav) { }
// // await provider.favsEventsData(event); pagingController.refresh();
// } else { setState(() {});
// // await provider.delateEventsData(event); // if (event.isfav) {
// } // // await provider.favsEventsData(event);
}, // } else {
label: AnimatedSwitcher( // // await provider.delateEventsData(event);
duration: Duration(seconds: 1), // }
transitionBuilder: (Widget child, },
Animation<double> animation) => label: AnimatedSwitcher(
FadeTransition( duration: Duration(seconds: 1),
opacity: animation, transitionBuilder: (Widget child,
child: SizeTransition( Animation<double>
child: child, animation) =>
sizeFactor: animation, FadeTransition(
axis: Axis.horizontal, opacity: animation,
), child: SizeTransition(
child: child,
sizeFactor: animation,
axis: Axis.horizontal,
),
),
child: event.eventUserInterest!
? Column(
children: [
Icon(
Icons.favorite,
color: Colors.red,
size: 14,
),
],
)
: Icon(
Icons.favorite,
color: Colors.grey,
size: 14,
))),
),
SizedBox(
height: 2,
),
event.eventUserInterest!
? RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Icon(Icons.check,
color: Colors.grey[600],
size: isTablet ? 14 : 10),
),
TextSpan(
text: ' Following',
style: TextStyle(
color: Colors.grey[600],
fontSize:
isTablet ? 14 : 10),
),
],
), ),
child: event.eventUserInterest! )
? Column( : Center(
child: RichText(
text: TextSpan(
children: [ children: [
Icon( TextSpan(
Icons.favorite, text: 'Follow ',
color: Colors.red, style: TextStyle(
size: 14, color: Colors.grey[600],
fontSize:
isTablet ? 14 : 10),
), ),
], ],
) ),
: Icon(
Icons.favorite,
color: Colors.grey,
size: 14,
))),
),
SizedBox(
height: 2,
),
event.eventUserInterest!
? RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Icon(Icons.check,
color: Colors.grey[600],
size: isTablet ? 14 : 10),
),
TextSpan(
text: ' Following',
style: TextStyle(
color: Colors.grey[600],
fontSize: isTablet ? 14 : 10),
),
],
),
)
: Center(
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: 'Follow ',
style: TextStyle(
color: Colors.grey[600],
fontSize: isTablet ? 14 : 10),
), ),
], ),
), ],
), ),
), ],
], ),
), )
], : 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,120 +306,140 @@ class _LoginScreenState extends State<LoginScreen> {
Center( Center(
child: CustomButton( child: CustomButton(
backgroundColor: EventsConstants.onboardButtonColor, backgroundColor: EventsConstants.onboardButtonColor,
// onPressed: () async {
// setState(() {
// print("loading");
// provider.loading = true;
// });
// if (textFieldsValidation(provider).isEmpty) {
// print("email:${emailTextController.text}");
// // if (await _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;
// 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"];
// }
// 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 { onPressed: () async {
await ApiCall().fetchApiConstants().then( setState(() {
(value) { print("loading");
Navigator.of(context).pushReplacement( provider.loading = true;
MaterialPageRoute( });
builder: (context) => NavigationHomeScreen()),
); if (textFieldsValidation(provider).isEmpty) {
}, print("email:${emailTextController.text}");
); // if (await _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(deviceId));
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(
MaterialPageRoute(
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,54 +319,68 @@ 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(), // _tabs
// sessionNotes(context) // .map((e) => Center(
] // child: FloatingActionButton.extended(
// _tabs // backgroundColor:
// .map((e) => Center( // const Color.fromARGB(255, 222, 237, 247),
// child: FloatingActionButton.extended( // onPressed: () {},
// backgroundColor: // heroTag: 'follow',
// const Color.fromARGB(255, 222, 237, 247), // elevation: 0,
// onPressed: () {}, // label: const Text("Add Notes"),
// heroTag: 'follow', // icon: const Icon(Icons.add),
// elevation: 0, // ),
// label: const Text("Add Notes"), // // Text("${e.text}", textAlign: TextAlign.center),
// icon: const Icon(Icons.add), // ))
// ), // .toList()),
// // Text("${e.text}", textAlign: TextAlign.center), ),
// ))
// .toList()),
),
), ),
)); ));
}); });
} }
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,100 +802,250 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
), ),
], ],
)), )),
Align( const SizedBox(
alignment: Alignment.center, height: 10,
child: Stack( ),
children: [ Row(
Align( mainAxisAlignment: MainAxisAlignment.center,
alignment: Alignment.center, crossAxisAlignment: CrossAxisAlignment.center,
child: SizedBox( children: [
height: 45, Align(
child: FloatingActionButton.extended( alignment: Alignment.center,
// backgroundColor: const Color.fromARGB(255, 222, 237, 247), child: Stack(
backgroundColor: Colors.green, children: [
onPressed: () async { Align(
//"Program Committee Admin. & Management" alignment: Alignment.center,
//setState(() { child: SizedBox(
isLoading = true; height: 40,
child:
// CustomButton(
// backgroundColor: EventsConstants.btnGreenColor,
// onPressed: () async {
// isLoading = true;
if (notesController.text.isNotEmpty && // if (notesController.text.isNotEmpty &&
sessionsTopicsData != null) { // sessionsTopicsData != null) {
print("ADD : ${_selectedFruit}"); // print("ADD : ${_selectedFruit}");
sessionNotesList.add( // sessionNotesList.add(
"${_selectedFruit} \n\n ${notesController.text}"); // "${_selectedFruit} \n\n ${notesController.text}");
// }); // // });
print( // print(
" eventid:${widget.eventid},hcp:${widget.eventid} session: ${sessionsTopicsData}"); // " eventid:${widget.eventid},hcp:${widget.eventid} session: ${sessionsTopicsData}");
await provider.submitSessionNotes( // await provider.submitSessionNotes(
eventsdetail, // eventsdetail,
sessionsTopicsData!, // sessionsTopicsData!,
notesController.text, // notesController.text,
attachedFileName != '' ? attachedFilePath : "", // attachedFileName != ''
attachedFileName != '' ? attachedFileName : "", // ? attachedFilePath
); // : "",
//HIVESTORE // attachedFileName != ''
// ? attachedFileName
// : "",
// );
// //HIVESTORE
SessionNotesModel notesModel = SessionNotesModel( // SessionNotesModel notesModel =
notes: notesController.text, // SessionNotesModel(
addedBy: "user", // notes: notesController.text,
addedDate: CustomDateFormatter().formatDate(), // addedBy: "user",
eventid: sessionsTopicsData!.kolEventsId, // addedDate:
hcpid: widget.eventid, // CustomDateFormatter().formatDate(),
kolid: sessionsTopicsData!.kolId, // eventid:
event_attendees_id: // sessionsTopicsData!.kolEventsId,
sessionsTopicsData!.eventAttendeesId, // hcpid: widget.eventid,
kid: eventsdetail.kId, // kolid: sessionsTopicsData!.kolId,
filepath: attachedFileName != '' // event_attendees_id: sessionsTopicsData!
? attachedFilePath // .eventAttendeesId,
: "", // kid: eventsdetail.kId,
filename: attachedFileName != '' // filepath: attachedFileName != ''
? attachedFileName // ? attachedFilePath
: "", // : "",
selectedSession: _selectedFruit); // filename: attachedFileName != ''
// ? attachedFileName
// : "",
// selectedSession: _selectedFruit);
await provider.addSessionNotes(notesModel); // await provider.addSessionNotes(notesModel);
_selectedFruit = null; // _selectedFruit = null;
isLoading = false; // isLoading = false;
sessionsTopicsData = null; // sessionsTopicsData = null;
attachedFileName = ""; // attachedFileName = "";
notesController.clear(); // notesController.clear();
isLoading = false; // isLoading = false;
setState(() {}); // enableCancel = false;
SnackBarWidget.displaySnackBar( // btnText = "Add Notes";
"Notes added", // setState(() {});
context, // SnackBarWidget.displaySnackBar(
); // "Notes added",
} else { // context,
isLoading = false; // );
SnackBarWidget.displaySnackBar( // } else {
"Session/Notes cannot be empty", context, // isLoading = false;
error: true); // SnackBarWidget.displaySnackBar(
} // "Session/Notes cannot be empty", context,
}, // error: true);
heroTag: 'addnotes', // }
elevation: 0, // },
label: Text( // width: 100,
btnText, // height: 35,
style: TextStyle(color: Colors.white), // fontsize: 12,
// textColor: Colors.white,
// title: btnText),
FloatingActionButton.extended(
// backgroundColor: const Color.fromARGB(255, 222, 237, 247),
backgroundColor: Colors.green,
onPressed: () async {
//"Program Committee Admin. & Management"
//setState(() {
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);
}
},
heroTag: 'addnotes',
elevation: 0,
label: Text(
btnText,
style: TextStyle(color: Colors.white),
),
// icon: const Icon(
// Icons.add,
// color: Colors.black,
// ),
),
), ),
// icon: const Icon( ),
// Icons.add, Visibility(
// color: Colors.black, visible: isLoading,
// ), child: Center(
child: CircularProgressIndicator(
color: EventsConstants.blueColor,
)),
),
],
),
),
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(() {});
// },
// ),
), ),
Visibility( ),
visible: isLoading, ],
child: Center(
child: CircularProgressIndicator(
color: EventsConstants.blueColor,
)),
),
],
),
), ),
Divider(), Divider(),
Padding( Padding(
@ -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);