Merge pull request 'login auth , verfication' (#7) from snehalatha_dev into dev
Reviewed-on: #7
This commit is contained in:
commit
a56c33fdf5
|
@ -5,6 +5,7 @@
|
|||
"method": "POST",
|
||||
"module": "eventapis"
|
||||
},
|
||||
|
||||
{
|
||||
"api": "saveUserInterestedEvent",
|
||||
"interval": 0,
|
||||
|
@ -17,6 +18,12 @@
|
|||
"method": "POST",
|
||||
"module": "eventapis"
|
||||
},
|
||||
{
|
||||
"api": "eventOverview",
|
||||
"interval": 0,
|
||||
"method": "POST",
|
||||
"module": "eventapis"
|
||||
},
|
||||
{
|
||||
"api": "getSpecialitiesDonutChart",
|
||||
"interval": 0,
|
||||
|
|
|
@ -34,7 +34,7 @@ class CustomButton extends StatelessWidget {
|
|||
backgroundColor:
|
||||
MaterialStateColor.resolveWith((states) => backgroundColor),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10), // <-- Radius
|
||||
borderRadius: BorderRadius.circular(20), // <-- Radius
|
||||
),
|
||||
),
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ Future main() async {
|
|||
print("isLoggedIn_is : $isLoggedIn");
|
||||
print("secret : $secretkey");
|
||||
return isLoggedIn
|
||||
? IntroductionAnimationScreen()
|
||||
? NavigationHomeScreen()
|
||||
: IntroductionAnimationScreen();
|
||||
}
|
||||
},
|
||||
|
@ -329,8 +329,7 @@ class _MyAppState extends State<MyApp> {
|
|||
systemNavigationBarDividerColor: Colors.transparent,
|
||||
systemNavigationBarIconBrightness: Brightness.dark,
|
||||
));
|
||||
return OverlaySupport(
|
||||
child: MaterialApp(
|
||||
return MaterialApp(
|
||||
title: 'Flutter UI',
|
||||
debugShowCheckedModeBanner: false,
|
||||
// theme: ThemeData(
|
||||
|
@ -339,7 +338,6 @@ class _MyAppState extends State<MyApp> {
|
|||
// platform: TargetPlatform.iOS,
|
||||
// ),
|
||||
home: NavigationHomeScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class AllSessionNotesResponse {
|
|||
note: json["note"],
|
||||
sessionName: json["session_name"],
|
||||
eventTopics: json["event_topics"],
|
||||
userName: json["user_name"]!,
|
||||
userName: json["user_name"],
|
||||
users: json["users"],
|
||||
notes: json["notes"] == null
|
||||
? []
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
}
|
|
@ -23,11 +23,16 @@ import 'package:konectar_events/model/sessionnotesmodel.dart';
|
|||
import 'package:konectar_events/model/sessionstopics_model.dart';
|
||||
import 'package:konectar_events/model/specialtymodel.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/viewmodel/hive_repository.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class ApiCall {
|
||||
final dio = Dio();
|
||||
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
|
||||
|
||||
late Future<String> _token;
|
||||
|
||||
//K1 API CALLS
|
||||
Future<dynamic> parseInfo() async {
|
||||
|
@ -119,16 +124,21 @@ class ApiCall {
|
|||
};
|
||||
Response response;
|
||||
var formData = FormData.fromMap({
|
||||
"user_email": "vinodh@aissel.com",
|
||||
"start": "2024-12-05",
|
||||
"end": "2024-12-31",
|
||||
"order_by": 8,
|
||||
'type': type ?? 1
|
||||
});
|
||||
// "end": DateTime(2024, 12, 14).toIso8601String(),
|
||||
_token = _prefs.then((SharedPreferences prefs) {
|
||||
return prefs.getString('token') ?? "";
|
||||
});
|
||||
print("SAVED TOKEN :${await _token}");
|
||||
response =
|
||||
await dio.post('${EventsConstants.url}${EventsConstants.eventslistapi}',
|
||||
options: Options(),
|
||||
options: Options(headers: {
|
||||
"Authorization": "Bearer ${await _token}",
|
||||
}),
|
||||
// queryParameters: {
|
||||
// "user_email": "vinodh@aissel.com",
|
||||
// "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 ***********************************************************************************************************************************
|
||||
|
||||
Future<List<EventsList>> getEventsFromK2(int page, String search,
|
||||
|
@ -760,58 +860,6 @@ class ApiCall {
|
|||
|
||||
//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
|
||||
|
||||
Future<List<EventsList>> getSearchedEventsFromK2(
|
||||
|
@ -955,37 +1003,6 @@ class ApiCall {
|
|||
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 {
|
||||
Dio dio = Dio();
|
||||
(dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
|
||||
|
|
|
@ -21,7 +21,8 @@ class EventsConstants {
|
|||
//192.0.0.2:8007 - iphone
|
||||
// 192.168.2.109:8007 - office jkqehjkq
|
||||
//K1 API~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
static const String moduleName = "eventapis";
|
||||
static const String moduleName = "apis/v1/events";
|
||||
static const String loginmodule = "apiauths";
|
||||
|
||||
static const String stagingUrl =
|
||||
"https://cardio-staging.konectar.io/$moduleName/";
|
||||
|
@ -30,6 +31,9 @@ class EventsConstants {
|
|||
static const String devUrl =
|
||||
"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 followUnfollowEvent = "saveUserInterestedEvent";
|
||||
static const String attendNotAttendEvent = "saveUserAttendingEvent";
|
||||
|
@ -42,9 +46,16 @@ class EventsConstants {
|
|||
static const String getTopicNotes = "getTopicNotes";
|
||||
static const String saveEventsTopicNote = "saveEventsTopicNote";
|
||||
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
|
||||
static const String saveEventOffline = "saveEventOffline";
|
||||
static const String contactsListapi = "contactslistapi";
|
||||
static const String filtersApi = "filtersApi";
|
||||
|
||||
//Hive
|
||||
/*
|
||||
|
|
|
@ -55,7 +55,7 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
tabController = TabController(length: 2, vsync: this);
|
||||
tabController = TabController(vsync: this, length: 2);
|
||||
final provider = Provider.of<EventsProvider>(context, listen: false);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
|
@ -67,11 +67,6 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
Future<void> _fetchPage(int pageKey) async {
|
||||
//await initConnectivity();
|
||||
// if (connectionStatus.toString().contains("ConnectivityResult.none")) {
|
||||
|
@ -174,7 +169,7 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
return Consumer<EventsProvider>(
|
||||
builder: (BuildContext context, provider, Widget? child) {
|
||||
return DefaultTabController(
|
||||
length: 3,
|
||||
length: provider.tabs.length,
|
||||
//child: SafeArea(
|
||||
// appBar: CustomAppBar(title: "", backgroundcolor: Constants.bgcolor),
|
||||
//body:
|
||||
|
@ -543,16 +538,22 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
);
|
||||
}
|
||||
showModalBottomSheet<void>(
|
||||
//constraints: BoxConstraints(maxHeight: 200, minHeight: 120),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
return Wrap(children: [
|
||||
// child:
|
||||
|
||||
Container(
|
||||
color: EventsConstants.bgcolor,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 240,
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// constraints: BoxConstraints(minHeight: 120, maxHeight: 130),
|
||||
//height: 240,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// Padding(
|
||||
|
@ -598,19 +599,23 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
provider.addOffline
|
||||
? InkWell(
|
||||
onTap: () async {
|
||||
if (provider.offlineEvents.isEmpty) {
|
||||
await provider.saveEventsData(widget.event);
|
||||
await provider
|
||||
.saveEventsData(widget.event);
|
||||
SnackBarWidget.displaySnackBar(
|
||||
"Event Saved Offline", context);
|
||||
} else {
|
||||
if (!provider.offlineExists) {
|
||||
await provider.saveEventsData(widget.event);
|
||||
await provider
|
||||
.saveEventsData(widget.event);
|
||||
SnackBarWidget.displaySnackBar(
|
||||
"Event Saved Offline", context);
|
||||
} else {
|
||||
await provider.delateOfflineEvent(widget.event);
|
||||
await provider
|
||||
.delateOfflineEvent(widget.event);
|
||||
provider.offlineExists = false;
|
||||
SnackBarWidget.displaySnackBar(
|
||||
"Removed from Offline", context);
|
||||
|
@ -628,8 +633,10 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
)
|
||||
: SizedBox.shrink(),
|
||||
provider.enableAttending
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
if (widget.event.eventUserAttendee!) {
|
||||
widget.event.eventUserAttendee = false;
|
||||
|
@ -654,7 +661,8 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink(),
|
||||
// Container(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||
// 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();
|
||||
}
|
||||
},
|
||||
tabs: _tabs,
|
||||
tabs: provider.tabs,
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
body: TabBarView(
|
||||
//controller: _tabController,
|
||||
children: [
|
||||
expandableDetails(provider),
|
||||
speakersList(context, provider),
|
||||
// controller: tabController,
|
||||
children: returnTabWidget(provider)
|
||||
// [
|
||||
// expandableDetails(provider),
|
||||
// speakersList(context, provider),
|
||||
|
||||
EventsInsights(
|
||||
eid: widget.event.id!,
|
||||
eventsdetail: widget.event,
|
||||
eventid: widget.event.eventId!,
|
||||
kFlutterHashtags: provider.kFlutterHashtags,
|
||||
specialtyList: provider.specialtyList,
|
||||
affiliations: provider.affiliations,
|
||||
allSessionNotes: provider.allSessionNotes,
|
||||
),
|
||||
// EventsInsights(
|
||||
// eid: widget.event.id!,
|
||||
// eventsdetail: widget.event,
|
||||
// eventid: widget.event.eventId!,
|
||||
// kFlutterHashtags: provider.kFlutterHashtags,
|
||||
// specialtyList: provider.specialtyList,
|
||||
// affiliations: provider.affiliations,
|
||||
// allSessionNotes: provider.allSessionNotes,
|
||||
// ),
|
||||
|
||||
// medicalInsights(),
|
||||
//SocialMedia(),
|
||||
],
|
||||
// // medicalInsights(),
|
||||
// //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() {
|
||||
return Padding(
|
||||
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,
|
||||
),
|
||||
RichText(
|
||||
provider.getLocationDetails(event) == ""
|
||||
? SizedBox.shrink()
|
||||
: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
WidgetSpan(
|
||||
|
@ -1176,8 +1214,7 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
),
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
' ${event.city != null && event.city != "" ? "${event.city}, " : ""}${event.region != null && event.region != "" ? "${event.region}, " : ""}${event.country != null && event.country != "" ? "${event.country}" : ""}',
|
||||
text: ' ${provider.getLocationDetails(event)}',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
//fontStyle: FontStyle.italic,
|
||||
|
@ -1187,10 +1224,14 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
event.url1 == null
|
||||
? SizedBox.shrink()
|
||||
: SizedBox(
|
||||
height: 8.0,
|
||||
),
|
||||
InkWell(
|
||||
event.url1 == null
|
||||
? SizedBox.shrink()
|
||||
: InkWell(
|
||||
onTap: () async {
|
||||
print("URL:${event.url1!}");
|
||||
await _launchUrl(event.url1!);
|
||||
|
@ -1250,9 +1291,13 @@ class _EventsListingScreenState extends State<EventsListingScreen>
|
|||
// SizedBox(
|
||||
// width: 15,
|
||||
// ),
|
||||
attendingbtn(widget.event, provider),
|
||||
provider.enableAttending
|
||||
? attendingbtn(widget.event, provider)
|
||||
: SizedBox.shrink(),
|
||||
// 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 {
|
||||
_SliverAppBarDelegate(this._tabBar);
|
||||
|
||||
|
|
|
@ -183,14 +183,21 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||
}
|
||||
|
||||
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)
|
||||
.getAddedSessionNotes();
|
||||
.initConfigModules();
|
||||
// await Provider.of<EventsProvider>(context, listen: false).initFiltersData();
|
||||
// await Provider.of<EventsProvider>(context, listen: false).getMyEvents(0);
|
||||
|
||||
//await ApiCall().dummyapi();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
init();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<EventsProvider>(
|
||||
|
@ -615,7 +622,9 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Material(
|
||||
!provider.enableFilters
|
||||
? SizedBox.shrink()
|
||||
: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
focusColor: Colors.transparent,
|
||||
|
@ -1711,18 +1720,36 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||
SizedBox(
|
||||
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,
|
||||
text: TextSpan(
|
||||
children: [
|
||||
WidgetSpan(
|
||||
child: Icon(Icons.location_on, size: 16),
|
||||
),
|
||||
// WidgetSpan(
|
||||
// child: Flexible(
|
||||
// // width: 200,
|
||||
// child: Text(
|
||||
// provider.getLocationDetails(event),
|
||||
// overflow: TextOverflow.fade,
|
||||
// ),
|
||||
// )),
|
||||
TextSpan(
|
||||
spellOut: true,
|
||||
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(
|
||||
color: Colors.black,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
//fontStyle: FontStyle.italic,
|
||||
|
||||
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,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
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(
|
||||
width: 40,
|
||||
height: 30,
|
||||
child: FloatingActionButton.extended(
|
||||
elevation: 1,
|
||||
shape: CircleBorder(),
|
||||
backgroundColor: EventsConstants.bgcolor,
|
||||
backgroundColor:
|
||||
EventsConstants.bgcolor,
|
||||
//backgroundColor: EventsConstants.homeCardBackgound,
|
||||
onPressed: () async {
|
||||
// event.isfav = !event.isfav;
|
||||
|
@ -1763,12 +1807,15 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||
if (event.eventUserInterest!) {
|
||||
//If event is added to fav then unfollow
|
||||
String msg = await provider
|
||||
.removeEventsToFavs(event.eventId!);
|
||||
.removeEventsToFavs(
|
||||
event.eventId!);
|
||||
SnackBarWidget.displaySnackBar(
|
||||
"Removed from My Events!", context);
|
||||
"Removed from My Events!",
|
||||
context);
|
||||
} else {
|
||||
String msg = await provider
|
||||
.addEventsToFavs(event.eventId!);
|
||||
String msg =
|
||||
await provider.addEventsToFavs(
|
||||
event.eventId!);
|
||||
SnackBarWidget.displaySnackBar(
|
||||
"Added to My Events", context);
|
||||
}
|
||||
|
@ -1783,7 +1830,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||
label: AnimatedSwitcher(
|
||||
duration: Duration(seconds: 1),
|
||||
transitionBuilder: (Widget child,
|
||||
Animation<double> animation) =>
|
||||
Animation<double>
|
||||
animation) =>
|
||||
FadeTransition(
|
||||
opacity: animation,
|
||||
child: SizeTransition(
|
||||
|
@ -1824,7 +1872,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||
text: ' Following',
|
||||
style: TextStyle(
|
||||
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 ',
|
||||
style: TextStyle(
|
||||
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(
|
||||
// alignment: Alignment.bottomRight,
|
||||
// child: SizedBox(
|
||||
|
|
|
@ -2,10 +2,12 @@ import 'dart:convert';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:konectar_events/firebaseexample.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/constants.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:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:mobile_device_identifier/mobile_device_identifier.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
const LoginScreen({super.key});
|
||||
|
@ -40,7 +43,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
late Future<String> _key;
|
||||
late Future<bool> _login;
|
||||
late Future<bool> _logout;
|
||||
late Future<String> _verification_code;
|
||||
String platform = "android";
|
||||
String? deviceId;
|
||||
final _mobileDeviceIdentifierPlugin = MobileDeviceIdentifier();
|
||||
var provider;
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -48,7 +54,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
init();
|
||||
provider = Provider.of<LoginProvider>(context, listen: false);
|
||||
provider.initDeviceId();
|
||||
initDeviceId();
|
||||
if (Platform.isAndroid) {
|
||||
platform = "android";
|
||||
} 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 {
|
||||
await ApiCall().parseInfo();
|
||||
}
|
||||
|
@ -285,68 +306,19 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
Center(
|
||||
child: CustomButton(
|
||||
backgroundColor: EventsConstants.onboardButtonColor,
|
||||
// onPressed: () async {
|
||||
// setState(() {
|
||||
// print("loading");
|
||||
// provider.loading = true;
|
||||
// });
|
||||
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 {
|
||||
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);
|
||||
// emailTextController.text, secretKeyTextConrtroller.text);
|
||||
// if (resp["code"] == "1200") {
|
||||
// provider.loading = false;
|
||||
// provider.showCodeField = false;
|
||||
|
@ -363,42 +335,111 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
// } 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) {
|
||||
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,
|
||||
fontsize: isTablet ? 22 : 18,
|
||||
title: provider.showCodeField ? "Verify" : "Sign In"),
|
||||
|
@ -416,12 +457,14 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
}
|
||||
|
||||
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 String useremail = (prefs.getString('useremail') ?? '');
|
||||
final String username = (prefs.getString('username') ?? '');
|
||||
|
||||
final String secretkey = (prefs.getString('secretkey') ?? '');
|
||||
final String verification_code =
|
||||
(prefs.getString('verfication_code') ?? '');
|
||||
final bool isloggedin = (prefs.getBool('isloggedin') ?? false);
|
||||
final bool isloggedout = (prefs.getBool('isloggedout') ?? false);
|
||||
setState(() {
|
||||
|
@ -435,6 +478,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
_key = prefs.setString('secretkey', key).then((bool success) {
|
||||
return secretkey;
|
||||
});
|
||||
_verification_code =
|
||||
prefs.setString('verfication_code', key).then((bool success) {
|
||||
return verification_code;
|
||||
});
|
||||
_login = prefs.setBool('isloggedin', login).then((bool success) {
|
||||
return isloggedin;
|
||||
});
|
||||
|
|
|
@ -76,12 +76,12 @@ class CareView extends StatelessWidget {
|
|||
child: SlideTransition(
|
||||
position: _secondHalfAnimation,
|
||||
child: Stack(children: [
|
||||
SvgPicture.asset(
|
||||
'assets/images/sc2bg500.svg',
|
||||
fit: BoxFit.fill,
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// height: MediaQuery.of(context).size.height,
|
||||
),
|
||||
// SvgPicture.asset(
|
||||
// 'assets/images/sc2bg500.svg',
|
||||
// fit: BoxFit.fill,
|
||||
// // width: MediaQuery.of(context).size.width,
|
||||
// // height: MediaQuery.of(context).size.height,
|
||||
// ),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 100),
|
||||
child: Column(
|
||||
|
|
|
@ -76,15 +76,15 @@ class MoodDiaryVew extends StatelessWidget {
|
|||
child: SlideTransition(
|
||||
position: _secondHalfAnimation,
|
||||
child: Stack(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 4.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/sc1bg1500.svg',
|
||||
fit: BoxFit.cover,
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// height: MediaQuery.of(context).size.height,
|
||||
),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 4.0),
|
||||
// child: SvgPicture.asset(
|
||||
// 'assets/images/sc1bg1500.svg',
|
||||
// fit: BoxFit.cover,
|
||||
// // width: MediaQuery.of(context).size.width,
|
||||
// // height: MediaQuery.of(context).size.height,
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 100),
|
||||
child: Column(
|
||||
|
|
|
@ -71,12 +71,12 @@ class RelaxView extends StatelessWidget {
|
|||
child: SlideTransition(
|
||||
position: _secondHalfAnimation,
|
||||
child: Stack(children: [
|
||||
SvgPicture.asset(
|
||||
'assets/images/sc1bg1500.svg',
|
||||
fit: BoxFit.cover,
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// height: MediaQuery.of(context).size.height,
|
||||
),
|
||||
// SvgPicture.asset(
|
||||
// 'assets/images/sc1bg1500.svg',
|
||||
// fit: BoxFit.cover,
|
||||
// // width: MediaQuery.of(context).size.width,
|
||||
// // height: MediaQuery.of(context).size.height,
|
||||
// ),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 100),
|
||||
child: Column(
|
||||
|
|
|
@ -47,7 +47,7 @@ class _NavigationHomeScreenState extends State<NavigationHomeScreen> {
|
|||
drawerWidth: MediaQuery.of(context).size.width * 0.75,
|
||||
onDrawerCall: (DrawerIndex drawerIndexdata) async {
|
||||
bool checkContacts = await HiveOperations.checkIfApiExists(
|
||||
EventsConstants.contactsListapi);
|
||||
EventsConstants.contactsListapi, EventsConstants.moduleName);
|
||||
if (!checkContacts && drawerIndexdata.name == "Contacts") {
|
||||
} else {
|
||||
changeIndex(drawerIndexdata);
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:avatar_stack/avatar_stack.dart';
|
|||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
@ -65,6 +66,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
String attachedFileName = '';
|
||||
String attachedFilePath = '';
|
||||
bool isLoading = false;
|
||||
bool enableCancel = false;
|
||||
String btnText = "Add Notes";
|
||||
final List<String> _fruits = ['Events', 'Sessions'];
|
||||
final List<String> topics = [
|
||||
|
@ -75,7 +77,8 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
"Program Committee",
|
||||
"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: "");
|
||||
List<String> sessionNotesList = [];
|
||||
Future<void> dialogBuilder(BuildContext context, Eventsdetail eventsdetail,
|
||||
|
@ -170,7 +173,9 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
notesController.text = newValue.note ?? "";
|
||||
if (newValue.note != "" && notesController.text.length != 0) {
|
||||
btnText = "Update";
|
||||
enableCancel = true;
|
||||
}
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
},
|
||||
|
@ -182,7 +187,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
valueList.value = [0, 0, 0];
|
||||
//valueList.value = [0, 0, 0];
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
init();
|
||||
});
|
||||
|
@ -191,10 +196,23 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
}
|
||||
|
||||
init() async {
|
||||
// await Provider.of<HcpProfileProvider>(context, listen: false)
|
||||
// .initConfigModules();
|
||||
await Provider.of<HcpProfileProvider>(context, listen: false)
|
||||
.getSessionData();
|
||||
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();
|
||||
|
||||
await Provider.of<InteractionProvider>(context, listen: false)
|
||||
|
@ -208,12 +226,6 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
await Provider.of<ViewInteractionProvider>(context, listen: false)
|
||||
.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(() {});
|
||||
}
|
||||
|
||||
|
@ -221,8 +233,9 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
return Consumer<HcpProfileProvider>(
|
||||
builder: (BuildContext context, provider, Widget? child) {
|
||||
return DefaultTabController(
|
||||
length: 3,
|
||||
length: provider.tabs.length,
|
||||
child: Scaffold(
|
||||
backgroundColor: EventsConstants.bgcolor,
|
||||
appBar: AppBar(
|
||||
// title: Text(""),
|
||||
automaticallyImplyLeading: false,
|
||||
|
@ -279,6 +292,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
expandedHeight: 280.0,
|
||||
// expandedHeight: MediaQuery.of(context).size.height * 0.25,
|
||||
backgroundColor: EventsConstants.bgcolor,
|
||||
//backgroundColor: Colors.white,
|
||||
automaticallyImplyLeading: false,
|
||||
floating: false,
|
||||
pinned: false,
|
||||
|
@ -305,32 +319,29 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
pinned: true,
|
||||
floating: true,
|
||||
delegate: _SliverAppBarDelegate(
|
||||
const TabBar(
|
||||
TabBar(
|
||||
isScrollable: false,
|
||||
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
tabAlignment: TabAlignment.fill,
|
||||
labelColor: Colors.white,
|
||||
indicatorColor: Colors.white,
|
||||
labelColor: Colors.black,
|
||||
indicatorColor: EventsConstants.blueColor,
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
labelPadding: EdgeInsets.all(2),
|
||||
indicatorWeight: 4.0,
|
||||
indicatorWeight: 2.0,
|
||||
//Color.fromARGB(255, 5, 36, 62)
|
||||
unselectedLabelColor: Colors.grey,
|
||||
tabs: _tabs,
|
||||
tabs: provider.tabs,
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
body: TabBarView(children: [
|
||||
topicsTab(widget.eventsdetail, provider),
|
||||
sessionNotes(context, widget.eventsdetail, provider),
|
||||
medicalInsights(),
|
||||
// sessionNotes(context)
|
||||
]
|
||||
body: provider.tabs.length == 0
|
||||
? Container()
|
||||
: TabBarView(children: returnTabWidget(provider)
|
||||
// _tabs
|
||||
// .map((e) => Center(
|
||||
// child: FloatingActionButton.extended(
|
||||
|
@ -351,8 +362,25 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
});
|
||||
}
|
||||
|
||||
buildprofile(
|
||||
BuildContext context, EventSpeakersData eventsdetail, String title) {
|
||||
List<Widget> returnTabWidget(HcpProfileProvider provider) {
|
||||
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;
|
||||
print("ORG:${eventsdetail.orgName}");
|
||||
|
||||
|
@ -402,10 +430,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
textAlign: TextAlign.center,
|
||||
text: TextSpan(children: [
|
||||
TextSpan(
|
||||
text: eventsdetail.orgName != null ||
|
||||
eventsdetail.orgName!.trim() != ""
|
||||
? '${eventsdetail.orgName}'
|
||||
: "",
|
||||
text: provider.getUserLoc(eventsdetail),
|
||||
style: TextStyle(
|
||||
// decoration: TextDecoration.underline,
|
||||
// decorationColor: Colors.blue,
|
||||
|
@ -420,34 +445,34 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
// softWrap: true,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
TextSpan(
|
||||
text: eventsdetail.country != null
|
||||
? '${eventsdetail.country},'
|
||||
: "",
|
||||
style: TextStyle(
|
||||
// decoration: TextDecoration.underline,
|
||||
// decorationColor: Colors.blue,
|
||||
color: Colors.white,
|
||||
// TextSpan(
|
||||
// text: eventsdetail.country != null
|
||||
// ? '${eventsdetail.country},'
|
||||
// : "",
|
||||
// style: TextStyle(
|
||||
// // decoration: TextDecoration.underline,
|
||||
// // decorationColor: Colors.blue,
|
||||
// color: Colors.white,
|
||||
|
||||
fontSize: 14,
|
||||
// fontSize: 14,
|
||||
|
||||
// fontFamily: "SourceSerif",
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: eventsdetail.city != null
|
||||
? '${eventsdetail.city}'
|
||||
: "",
|
||||
style: TextStyle(
|
||||
// decoration: TextDecoration.underline,
|
||||
// decorationColor: Colors.blue,
|
||||
color: Colors.white,
|
||||
// // fontFamily: "SourceSerif",
|
||||
// ),
|
||||
// ),
|
||||
// TextSpan(
|
||||
// text: eventsdetail.city != null
|
||||
// ? '${eventsdetail.city}'
|
||||
// : "",
|
||||
// style: TextStyle(
|
||||
// // decoration: TextDecoration.underline,
|
||||
// // decorationColor: Colors.blue,
|
||||
// color: Colors.white,
|
||||
|
||||
fontSize: 14,
|
||||
// fontSize: 14,
|
||||
|
||||
// fontFamily: "SourceSerif",
|
||||
),
|
||||
)
|
||||
// // fontFamily: "SourceSerif",
|
||||
// ),
|
||||
// )
|
||||
])),
|
||||
|
||||
// Text(
|
||||
|
@ -535,7 +560,8 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
// title: eventsdetail.kolFullName!,
|
||||
// eventsdetail: eventsdetail,
|
||||
// ),
|
||||
buildprofile(context, eventsdetail, eventsdetail.kolFullName!),
|
||||
buildprofile(
|
||||
context, eventsdetail, eventsdetail.kolFullName!, provider),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Column(
|
||||
|
@ -722,6 +748,24 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
// SizedBox(
|
||||
// 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(
|
||||
backgroundColor:
|
||||
const Color.fromARGB(255, 233, 229, 229),
|
||||
|
@ -740,7 +784,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
setState(() {});
|
||||
},
|
||||
width: 120,
|
||||
height: 40,
|
||||
height: 35,
|
||||
fontsize: 12,
|
||||
textColor: Colors.black,
|
||||
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(
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
|
@ -765,8 +816,85 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: SizedBox(
|
||||
height: 45,
|
||||
child: FloatingActionButton.extended(
|
||||
height: 40,
|
||||
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: Colors.green,
|
||||
onPressed: () async {
|
||||
|
@ -818,6 +946,8 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
attachedFileName = "";
|
||||
notesController.clear();
|
||||
isLoading = false;
|
||||
enableCancel = false;
|
||||
btnText = "Add Notes";
|
||||
setState(() {});
|
||||
SnackBarWidget.displaySnackBar(
|
||||
"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(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 15.0),
|
||||
|
@ -918,7 +1112,7 @@ class _HCPProfileScreenState extends State<HCPProfileScreen> {
|
|||
if (notesController.text.length != 0) {
|
||||
btnText = "Update";
|
||||
}
|
||||
|
||||
enableCancel = true;
|
||||
setState(() {});
|
||||
},
|
||||
width: 80,
|
||||
|
@ -1348,21 +1542,21 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
|||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return Container(
|
||||
//color: Constants.tabbgColor,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [
|
||||
// Constants.blueColor,
|
||||
EventsConstants.tabbgColor,
|
||||
EventsConstants.blueColor,
|
||||
// Constants.tabbgColor,
|
||||
// const Color.fromARGB(255, 222, 237, 247),
|
||||
// const Color.fromARGB(255, 222, 237, 247),
|
||||
// Color(0xff006df1)
|
||||
]),
|
||||
),
|
||||
color: Colors.white,
|
||||
// decoration: BoxDecoration(
|
||||
// gradient: LinearGradient(
|
||||
// begin: Alignment.bottomCenter,
|
||||
// end: Alignment.topCenter,
|
||||
// colors: [
|
||||
// // Constants.blueColor,
|
||||
// EventsConstants.tabbgColor,
|
||||
// EventsConstants.blueColor,
|
||||
// // Constants.tabbgColor,
|
||||
// // const Color.fromARGB(255, 222, 237, 247),
|
||||
// // const Color.fromARGB(255, 222, 237, 247),
|
||||
// // Color(0xff006df1)
|
||||
// ]),
|
||||
// ),
|
||||
// color: Colors.white,
|
||||
//249, 103, 49
|
||||
// color: const Color.fromARGB(255, 239, 71, 49),
|
||||
|
|
|
@ -23,7 +23,9 @@ import 'package:konectar_events/model/sessionnotesmodel.dart';
|
|||
import 'package:konectar_events/model/specialtymodel.dart';
|
||||
import 'package:konectar_events/model/topics_cloud_model.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/viewmodel/hive_repository.dart';
|
||||
import 'package:konectar_events/widgets/word_cloud.dart';
|
||||
|
||||
class EventsProvider extends ChangeNotifier {
|
||||
|
@ -62,6 +64,57 @@ class EventsProvider extends ChangeNotifier {
|
|||
List<AllSessionNotesResponse> allSessionNotes = [];
|
||||
late StreamSubscription<List<ConnectivityResult>> connectivitySubscription;
|
||||
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 {
|
||||
isFavSeleted = false;
|
||||
isAllSelected = !isAllSelected;
|
||||
|
@ -78,6 +131,27 @@ class EventsProvider extends ChangeNotifier {
|
|||
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 user = false;
|
||||
if (eventList.isNotEmpty) {
|
||||
|
@ -407,7 +481,7 @@ class EventsProvider extends ChangeNotifier {
|
|||
|
||||
FutureOr saveEventsData(EventsList eventsData) async {
|
||||
box = await Hive.openBox<EventsList>('EventsListBox');
|
||||
|
||||
//check if already exists
|
||||
box.add(eventsData);
|
||||
offlineEvents.clear();
|
||||
offlineEvents = await getOfflineMyEvents();
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:konectar_events/model/allsessionnotesmodel.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/topics_cloud_model.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';
|
||||
|
||||
class HcpProfileProvider extends ChangeNotifier {
|
||||
|
@ -23,6 +26,60 @@ class HcpProfileProvider extends ChangeNotifier {
|
|||
List<SessionsTopicsData> sessionTopics = [];
|
||||
List<AllSessionNotesResponse> allSessionNotes = [];
|
||||
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 {
|
||||
sessionTopics = await ApiCall().getSessionsTopics(detail.eid!,
|
||||
|
|
|
@ -10,16 +10,15 @@ class HiveOperations {
|
|||
hiveApiConstantsBox.addAll(hiveList);
|
||||
}
|
||||
|
||||
static Future<bool> checkIfApiExists(
|
||||
String api,
|
||||
) async {
|
||||
static Future<bool> checkIfApiExists(String api, String moduleName) async {
|
||||
late Box<HiveApiConstants> hiveApiConstantsBox;
|
||||
hiveApiConstantsBox =
|
||||
await Hive.openBox<HiveApiConstants>('hiveApiConstants');
|
||||
|
||||
List<HiveApiConstants> list = hiveApiConstantsBox.values.toList();
|
||||
return list.indexWhere(
|
||||
(element) => element.functionName == api,
|
||||
(element) =>
|
||||
element.functionName == api && element.module == moduleName,
|
||||
) ==
|
||||
-1
|
||||
? false
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:konectar_events/utils/apicall.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:konectar_events/utils/constants.dart';
|
||||
import 'package:konectar_events/viewmodel/hive_repository.dart';
|
||||
import 'package:mobile_device_identifier/mobile_device_identifier.dart';
|
||||
|
||||
class LoginProvider extends ChangeNotifier {
|
||||
late Box<UserData> box;
|
||||
|
@ -18,7 +17,6 @@ class LoginProvider extends ChangeNotifier {
|
|||
String? email;
|
||||
String? code;
|
||||
String deviceId = 'Unknown';
|
||||
final _mobileDeviceIdentifierPlugin = MobileDeviceIdentifier();
|
||||
|
||||
init() {}
|
||||
Future<dynamic> verifyEmail(String email, String deviceid, String platform) {
|
||||
|
@ -136,19 +134,4 @@ class LoginProvider extends ChangeNotifier {
|
|||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class _HomeDrawerState extends State<HomeDrawer> {
|
|||
List<DrawerList>? drawerList;
|
||||
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
|
||||
late Future<String> _useremail;
|
||||
late Future<String> _key;
|
||||
late Future<String> _deviceid;
|
||||
@override
|
||||
void initState() {
|
||||
setDrawerListArray();
|
||||
|
@ -35,15 +35,15 @@ class _HomeDrawerState extends State<HomeDrawer> {
|
|||
return prefs.getString('useremail') ?? "";
|
||||
});
|
||||
|
||||
_key = _prefs.then((SharedPreferences prefs) {
|
||||
return prefs.getString('token') ?? "";
|
||||
_deviceid = _prefs.then((SharedPreferences prefs) {
|
||||
return prefs.getString('verfication_code') ?? "";
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void setDrawerListArray() async {
|
||||
bool checkContacts =
|
||||
await HiveOperations.checkIfApiExists(EventsConstants.contactsListapi);
|
||||
bool checkContacts = await HiveOperations.checkIfApiExists(
|
||||
EventsConstants.contactsListapi, EventsConstants.moduleName);
|
||||
if (!checkContacts) {
|
||||
drawerList = <DrawerList>[
|
||||
DrawerList(
|
||||
|
@ -257,7 +257,8 @@ class _HomeDrawerState extends State<HomeDrawer> {
|
|||
}
|
||||
|
||||
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");
|
||||
await SessionManager().logoutSession(false).then((value) {
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
|
|
Loading…
Reference in New Issue