Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added providers for state management
- Loading branch information
1 parent
ae088b6
commit 9e17cf0
Showing
18 changed files
with
382 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class ApiConfig { | ||
static const String baseUrl = ''; | ||
} |
3 changes: 3 additions & 0 deletions
3
lib/data/api/implementation/medical_consultation_service.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import 'package:medical_consultation/data/api/service/remote_api_service.dart'; | ||
|
||
class MedicalConsultationService implements RemoteApiService {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
abstract class RemoteApiService {} |
20 changes: 20 additions & 0 deletions
20
lib/features/conversations/provider/conversation_provider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:medical_consultation/constants/strings.dart'; | ||
import 'package:medical_consultation/data/mock_data/conversation.dart'; | ||
import 'package:medical_consultation/features/shared/notifiers/base_notifier.dart'; | ||
import 'package:medical_consultation/models/conversation.dart'; | ||
|
||
class ConversationProvider extends BaseNotifier { | ||
List<Conversation> userCurrentConversations = []; | ||
Future<void> featchUserCurrentConversation() async { | ||
try { | ||
sendLoading(); | ||
userCurrentConversations = userConversations; | ||
sendSuccess(); | ||
} on Error catch (error) { | ||
sendError(message: error.toString()); | ||
} catch (_) { | ||
sendError(message: Strings.defaultErrorMessage); | ||
rethrow; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:medical_consultation/constants/strings.dart'; | ||
import 'package:medical_consultation/data/mock_data/appointments_mock.dart'; | ||
import 'package:medical_consultation/data/mock_data/recomended_doctor_mock.dart'; | ||
import 'package:medical_consultation/features/shared/notifiers/base_notifier.dart'; | ||
import 'package:medical_consultation/models/appointment.dart'; | ||
import 'package:medical_consultation/models/doctor_details.dart'; | ||
|
||
class DashboardProvider extends BaseNotifier { | ||
List<DoctorDetail> topRecomendedDoctor = []; | ||
List<UserAppointment> userCurrentAppointment = []; | ||
|
||
Future<void> init() async { | ||
try { | ||
fetchRecomendedDoctor(); | ||
userAppointments(); | ||
} on Error catch (error) { | ||
sendError(message: error.toString()); | ||
} catch (_) { | ||
sendError(message: Strings.defaultErrorMessage); | ||
rethrow; | ||
} | ||
} | ||
|
||
Future fetchRecomendedDoctor() async { | ||
try { | ||
sendLoading(); | ||
topRecomendedDoctor = recomendedDoctor; | ||
sendSuccess(); | ||
} on Error catch (error) { | ||
sendError(message: error.toString()); | ||
} catch (_) { | ||
sendError(message: Strings.defaultErrorMessage); | ||
rethrow; | ||
} | ||
} | ||
|
||
Future userAppointments() async { | ||
try { | ||
sendLoading(); | ||
userCurrentAppointment = userAppointment; | ||
sendSuccess(); | ||
} on Error catch (error) { | ||
sendError(message: error.toString()); | ||
} catch (_) { | ||
sendError(message: Strings.defaultErrorMessage); | ||
rethrow; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
enum BaseNotifierStatus { | ||
init, | ||
error, | ||
success, | ||
loading, | ||
|
||
cancel, | ||
disconnected, | ||
loaded, | ||
} |
Oops, something went wrong.