Compare commits
No commits in common. "2050bd332c3359258a05ae85dde3a12cbdd5b62e" and "f8973c8752eda7d11e5ff89c8a3a0dd8d91d3347" have entirely different histories.
2050bd332c
...
f8973c8752
|
|
@ -1,49 +1,46 @@
|
||||||
{
|
{
|
||||||
"project_info": {
|
"project_info": {
|
||||||
"project_number": "900714037062",
|
"project_number": "574860813475",
|
||||||
"project_id": "yimaru-academy-5e7e2",
|
"project_id": "yimaru-lms-e834e",
|
||||||
"storage_bucket": "yimaru-academy-5e7e2.firebasestorage.app"
|
"storage_bucket": "yimaru-lms-e834e.firebasestorage.app"
|
||||||
},
|
},
|
||||||
"client": [
|
"client": [
|
||||||
{
|
{
|
||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:900714037062:android:f11e3b69315b05304e6f47",
|
"mobilesdk_app_id": "1:574860813475:android:cd7fa6cf3a0527d97acb16",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "com.yimaru.lms.app"
|
"package_name": "com.yimaru.lms.app"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [
|
"oauth_client": [
|
||||||
{
|
{
|
||||||
"client_id": "900714037062-ngc0gc426sfnnjjr494g4vni46ne5uqv.apps.googleusercontent.com",
|
"client_id": "574860813475-3p3k63lkrfd113sn6jscgvdj0aigsg5s.apps.googleusercontent.com",
|
||||||
"client_type": 1,
|
"client_type": 1,
|
||||||
"android_info": {
|
"android_info": {
|
||||||
"package_name": "com.yimaru.lms.app",
|
"package_name": "com.yimaru.lms.app",
|
||||||
"certificate_hash": "139ee56ac9763191d1eee882efc440c10530e6e9"
|
"certificate_hash": "928ead08b5e39d6a861a55ae7cceb8c402d1ee7a"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"client_id": "900714037062-mtm9rps15br603nnn3a451rr2vllopro.apps.googleusercontent.com",
|
"client_id": "574860813475-m90u87plqaac4tb8oug32k41usossiod.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "com.yimaru.lms.app",
|
||||||
|
"certificate_hash": "29797902ad6a24212b9d9fad71562907956f6a6c"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"api_key": [
|
"api_key": [
|
||||||
{
|
{
|
||||||
"current_key": "AIzaSyAi8e4PMFH8QQU11DWftHdNEu8WUP7i2ww"
|
"current_key": "AIzaSyC7QlhcuSNte49CERnRKPrQbyLbwErIRmk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"services": {
|
"services": {
|
||||||
"appinvite_service": {
|
"appinvite_service": {
|
||||||
"other_platform_oauth_client": [
|
"other_platform_oauth_client": [
|
||||||
{
|
{
|
||||||
"client_id": "900714037062-24ria5fcfet71o3vde8f6gsvsj1n68ec.apps.googleusercontent.com",
|
"client_id": "574860813475-n5o17gpprdqmhcml99tiqhafb17rob0r.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
"client_type": 3
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "900714037062-35bg0hsou56hg37mbcbpiar9uti7tcku.apps.googleusercontent.com",
|
|
||||||
"client_type": 2,
|
|
||||||
"ios_info": {
|
|
||||||
"bundle_id": "com.yimaru.lms.app"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"flutter":{"platforms":{"android":{"default":{"projectId":"yimaru-academy-5e7e2","appId":"1:900714037062:android:f11e3b69315b05304e6f47","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"yimaru-academy-5e7e2","configurations":{"android":"1:900714037062:android:f11e3b69315b05304e6f47","ios":"1:900714037062:ios:1caf8f24a4333b8e4e6f47"}}}}}}
|
{"flutter":{"platforms":{"android":{"default":{"projectId":"yimaru-lms-e834e","appId":"1:574860813475:android:cd7fa6cf3a0527d97acb16","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"yimaru-lms-e834e","configurations":{"android":"1:574860813475:android:cd7fa6cf3a0527d97acb16","ios":"1:574860813475:ios:3ac9f7c4ae1771287acb16"}}}}}}
|
||||||
|
|
@ -51,7 +51,6 @@ import 'package:yimaru_app/ui/views/course/course_view.dart';
|
||||||
import 'package:yimaru_app/services/audio_player_service.dart';
|
import 'package:yimaru_app/services/audio_player_service.dart';
|
||||||
import 'package:yimaru_app/services/voice_recorder_service.dart';
|
import 'package:yimaru_app/services/voice_recorder_service.dart';
|
||||||
import 'package:yimaru_app/ui/views/course_practice_question/course_practice_question_view.dart';
|
import 'package:yimaru_app/ui/views/course_practice_question/course_practice_question_view.dart';
|
||||||
import 'package:yimaru_app/ui/views/learn_subcategory/learn_subcategory_view.dart';
|
|
||||||
// @stacked-import
|
// @stacked-import
|
||||||
|
|
||||||
@StackedApp(
|
@StackedApp(
|
||||||
|
|
@ -91,7 +90,6 @@ import 'package:yimaru_app/ui/views/learn_subcategory/learn_subcategory_view.dar
|
||||||
MaterialRoute(page: CourseSubcategoryView),
|
MaterialRoute(page: CourseSubcategoryView),
|
||||||
MaterialRoute(page: CourseView),
|
MaterialRoute(page: CourseView),
|
||||||
MaterialRoute(page: CoursePracticeQuestionView),
|
MaterialRoute(page: CoursePracticeQuestionView),
|
||||||
MaterialRoute(page: LearnSubcategoryView),
|
|
||||||
// @stacked-route
|
// @stacked-route
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,14 @@
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'package:flutter/material.dart' as _i38;
|
import 'package:flutter/material.dart' as _i37;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart' as _i1;
|
import 'package:stacked/stacked.dart' as _i1;
|
||||||
import 'package:stacked_services/stacked_services.dart' as _i44;
|
import 'package:stacked_services/stacked_services.dart' as _i42;
|
||||||
import 'package:yimaru_app/models/category.dart' as _i42;
|
import 'package:yimaru_app/models/course.dart' as _i38;
|
||||||
import 'package:yimaru_app/models/course.dart' as _i40;
|
import 'package:yimaru_app/models/course_category.dart' as _i40;
|
||||||
import 'package:yimaru_app/models/course_lesson.dart' as _i41;
|
import 'package:yimaru_app/models/course_lesson.dart' as _i39;
|
||||||
import 'package:yimaru_app/models/level.dart' as _i39;
|
import 'package:yimaru_app/models/course_subcategory.dart' as _i41;
|
||||||
import 'package:yimaru_app/models/subcategory.dart' as _i43;
|
|
||||||
import 'package:yimaru_app/ui/views/account_privacy/account_privacy_view.dart'
|
import 'package:yimaru_app/ui/views/account_privacy/account_privacy_view.dart'
|
||||||
as _i9;
|
as _i9;
|
||||||
import 'package:yimaru_app/ui/views/assessment/assessment_view.dart' as _i22;
|
import 'package:yimaru_app/ui/views/assessment/assessment_view.dart' as _i22;
|
||||||
|
|
@ -51,8 +50,6 @@ import 'package:yimaru_app/ui/views/learn_module/learn_module_view.dart'
|
||||||
as _i20;
|
as _i20;
|
||||||
import 'package:yimaru_app/ui/views/learn_practice/learn_practice_view.dart'
|
import 'package:yimaru_app/ui/views/learn_practice/learn_practice_view.dart'
|
||||||
as _i26;
|
as _i26;
|
||||||
import 'package:yimaru_app/ui/views/learn_subcategory/learn_subcategory_view.dart'
|
|
||||||
as _i37;
|
|
||||||
import 'package:yimaru_app/ui/views/login/login_view.dart' as _i17;
|
import 'package:yimaru_app/ui/views/login/login_view.dart' as _i17;
|
||||||
import 'package:yimaru_app/ui/views/onboarding/onboarding_view.dart' as _i3;
|
import 'package:yimaru_app/ui/views/onboarding/onboarding_view.dart' as _i3;
|
||||||
import 'package:yimaru_app/ui/views/privacy_policy/privacy_policy_view.dart'
|
import 'package:yimaru_app/ui/views/privacy_policy/privacy_policy_view.dart'
|
||||||
|
|
@ -141,8 +138,6 @@ class Routes {
|
||||||
|
|
||||||
static const coursePracticeQuestionView = '/course-practice-question-view';
|
static const coursePracticeQuestionView = '/course-practice-question-view';
|
||||||
|
|
||||||
static const learnSubcategoryView = '/learn-subcategory-view';
|
|
||||||
|
|
||||||
static const all = <String>{
|
static const all = <String>{
|
||||||
homeView,
|
homeView,
|
||||||
onboardingView,
|
onboardingView,
|
||||||
|
|
@ -179,7 +174,6 @@ class Routes {
|
||||||
courseSubcategoryView,
|
courseSubcategoryView,
|
||||||
courseView,
|
courseView,
|
||||||
coursePracticeQuestionView,
|
coursePracticeQuestionView,
|
||||||
learnSubcategoryView,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -325,21 +319,17 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
Routes.coursePracticeQuestionView,
|
Routes.coursePracticeQuestionView,
|
||||||
page: _i36.CoursePracticeQuestionView,
|
page: _i36.CoursePracticeQuestionView,
|
||||||
),
|
),
|
||||||
_i1.RouteDef(
|
|
||||||
Routes.learnSubcategoryView,
|
|
||||||
page: _i37.LearnSubcategoryView,
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||||
_i2.HomeView: (data) {
|
_i2.HomeView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i2.HomeView(),
|
builder: (context) => const _i2.HomeView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i3.OnboardingView: (data) {
|
_i3.OnboardingView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i3.OnboardingView(),
|
builder: (context) => const _i3.OnboardingView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
|
|
@ -348,120 +338,116 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
final args = data.getArgs<StartupViewArguments>(
|
final args = data.getArgs<StartupViewArguments>(
|
||||||
orElse: () => const StartupViewArguments(),
|
orElse: () => const StartupViewArguments(),
|
||||||
);
|
);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => _i4.StartupView(key: args.key, label: args.label),
|
builder: (context) => _i4.StartupView(key: args.key, label: args.label),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i5.ProfileView: (data) {
|
_i5.ProfileView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i5.ProfileView(),
|
builder: (context) => const _i5.ProfileView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i6.ProfileDetailView: (data) {
|
_i6.ProfileDetailView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i6.ProfileDetailView(),
|
builder: (context) => const _i6.ProfileDetailView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i7.DownloadsView: (data) {
|
_i7.DownloadsView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i7.DownloadsView(),
|
builder: (context) => const _i7.DownloadsView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i8.ProgressView: (data) {
|
_i8.ProgressView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i8.ProgressView(),
|
builder: (context) => const _i8.ProgressView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i9.AccountPrivacyView: (data) {
|
_i9.AccountPrivacyView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i9.AccountPrivacyView(),
|
builder: (context) => const _i9.AccountPrivacyView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i10.SupportView: (data) {
|
_i10.SupportView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i10.SupportView(),
|
builder: (context) => const _i10.SupportView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i11.TelegramSupportView: (data) {
|
_i11.TelegramSupportView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i11.TelegramSupportView(),
|
builder: (context) => const _i11.TelegramSupportView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i12.CallSupportView: (data) {
|
_i12.CallSupportView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i12.CallSupportView(),
|
builder: (context) => const _i12.CallSupportView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i13.LanguageView: (data) {
|
_i13.LanguageView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i13.LanguageView(),
|
builder: (context) => const _i13.LanguageView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i14.PrivacyPolicyView: (data) {
|
_i14.PrivacyPolicyView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i14.PrivacyPolicyView(),
|
builder: (context) => const _i14.PrivacyPolicyView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i15.TermsAndConditionsView: (data) {
|
_i15.TermsAndConditionsView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i15.TermsAndConditionsView(),
|
builder: (context) => const _i15.TermsAndConditionsView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i16.RegisterView: (data) {
|
_i16.RegisterView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i16.RegisterView(),
|
builder: (context) => const _i16.RegisterView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i17.LoginView: (data) {
|
_i17.LoginView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i17.LoginView(),
|
builder: (context) => const _i17.LoginView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i18.LearnView: (data) {
|
_i18.LearnView: (data) {
|
||||||
final args = data.getArgs<LearnViewArguments>(nullOk: false);
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
builder: (context) => const _i18.LearnView(),
|
||||||
builder: (context) => _i18.LearnView(key: args.key, id: args.id),
|
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i19.LearnLevelView: (data) {
|
_i19.LearnLevelView: (data) {
|
||||||
final args = data.getArgs<LearnLevelViewArguments>(nullOk: false);
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
builder: (context) => const _i19.LearnLevelView(),
|
||||||
builder: (context) => _i19.LearnLevelView(key: args.key, id: args.id),
|
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i20.LearnModuleView: (data) {
|
_i20.LearnModuleView: (data) {
|
||||||
final args = data.getArgs<LearnModuleViewArguments>(nullOk: false);
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
builder: (context) => const _i20.LearnModuleView(),
|
||||||
builder: (context) =>
|
|
||||||
_i20.LearnModuleView(key: args.key, level: args.level),
|
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i21.WelcomeView: (data) {
|
_i21.WelcomeView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i21.WelcomeView(),
|
builder: (context) => const _i21.WelcomeView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i22.AssessmentView: (data) {
|
_i22.AssessmentView: (data) {
|
||||||
final args = data.getArgs<AssessmentViewArguments>(nullOk: false);
|
final args = data.getArgs<AssessmentViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i22.AssessmentView(key: args.key, data: args.data),
|
_i22.AssessmentView(key: args.key, data: args.data),
|
||||||
settings: data,
|
settings: data,
|
||||||
|
|
@ -469,7 +455,7 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
},
|
},
|
||||||
_i23.LearnLessonView: (data) {
|
_i23.LearnLessonView: (data) {
|
||||||
final args = data.getArgs<LearnLessonViewArguments>(nullOk: false);
|
final args = data.getArgs<LearnLessonViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => _i23.LearnLessonView(
|
builder: (context) => _i23.LearnLessonView(
|
||||||
key: args.key,
|
key: args.key,
|
||||||
title: args.title,
|
title: args.title,
|
||||||
|
|
@ -481,14 +467,14 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i24.ForgetPasswordView: (data) {
|
_i24.ForgetPasswordView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i24.ForgetPasswordView(),
|
builder: (context) => const _i24.ForgetPasswordView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i25.LearnLessonDetailView: (data) {
|
_i25.LearnLessonDetailView: (data) {
|
||||||
final args = data.getArgs<LearnLessonDetailViewArguments>(nullOk: false);
|
final args = data.getArgs<LearnLessonDetailViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => _i25.LearnLessonDetailView(
|
builder: (context) => _i25.LearnLessonDetailView(
|
||||||
key: args.key,
|
key: args.key,
|
||||||
title: args.title,
|
title: args.title,
|
||||||
|
|
@ -499,7 +485,7 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
},
|
},
|
||||||
_i26.LearnPracticeView: (data) {
|
_i26.LearnPracticeView: (data) {
|
||||||
final args = data.getArgs<LearnPracticeViewArguments>(nullOk: false);
|
final args = data.getArgs<LearnPracticeViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => _i26.LearnPracticeView(
|
builder: (context) => _i26.LearnPracticeView(
|
||||||
key: args.key,
|
key: args.key,
|
||||||
title: args.title,
|
title: args.title,
|
||||||
|
|
@ -511,7 +497,7 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
},
|
},
|
||||||
_i27.CoursePracticeView: (data) {
|
_i27.CoursePracticeView: (data) {
|
||||||
final args = data.getArgs<CoursePracticeViewArguments>(nullOk: false);
|
final args = data.getArgs<CoursePracticeViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i27.CoursePracticeView(key: args.key, id: args.id),
|
_i27.CoursePracticeView(key: args.key, id: args.id),
|
||||||
settings: data,
|
settings: data,
|
||||||
|
|
@ -519,21 +505,21 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
},
|
},
|
||||||
_i28.CoursePaymentView: (data) {
|
_i28.CoursePaymentView: (data) {
|
||||||
final args = data.getArgs<CoursePaymentViewArguments>(nullOk: false);
|
final args = data.getArgs<CoursePaymentViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i28.CoursePaymentView(key: args.key, course: args.course),
|
_i28.CoursePaymentView(key: args.key, course: args.course),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i29.CourseCategoryView: (data) {
|
_i29.CourseCategoryView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i29.CourseCategoryView(),
|
builder: (context) => const _i29.CourseCategoryView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i30.FailureView: (data) {
|
_i30.FailureView: (data) {
|
||||||
final args = data.getArgs<FailureViewArguments>(nullOk: false);
|
final args = data.getArgs<FailureViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i30.FailureView(key: args.key, label: args.label),
|
_i30.FailureView(key: args.key, label: args.label),
|
||||||
settings: data,
|
settings: data,
|
||||||
|
|
@ -541,7 +527,7 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
},
|
},
|
||||||
_i31.CourseLessonView: (data) {
|
_i31.CourseLessonView: (data) {
|
||||||
final args = data.getArgs<CourseLessonViewArguments>(nullOk: false);
|
final args = data.getArgs<CourseLessonViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i31.CourseLessonView(key: args.key, course: args.course),
|
_i31.CourseLessonView(key: args.key, course: args.course),
|
||||||
settings: data,
|
settings: data,
|
||||||
|
|
@ -549,21 +535,21 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
},
|
},
|
||||||
_i32.CourseLessonDetailView: (data) {
|
_i32.CourseLessonDetailView: (data) {
|
||||||
final args = data.getArgs<CourseLessonDetailViewArguments>(nullOk: false);
|
final args = data.getArgs<CourseLessonDetailViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i32.CourseLessonDetailView(key: args.key, lesson: args.lesson),
|
_i32.CourseLessonDetailView(key: args.key, lesson: args.lesson),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i33.DuolingoView: (data) {
|
_i33.DuolingoView: (data) {
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i33.DuolingoView(),
|
builder: (context) => const _i33.DuolingoView(),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i34.CourseSubcategoryView: (data) {
|
_i34.CourseSubcategoryView: (data) {
|
||||||
final args = data.getArgs<CourseSubcategoryViewArguments>(nullOk: false);
|
final args = data.getArgs<CourseSubcategoryViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i34.CourseSubcategoryView(key: args.key, category: args.category),
|
_i34.CourseSubcategoryView(key: args.key, category: args.category),
|
||||||
settings: data,
|
settings: data,
|
||||||
|
|
@ -571,7 +557,7 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
},
|
},
|
||||||
_i35.CourseView: (data) {
|
_i35.CourseView: (data) {
|
||||||
final args = data.getArgs<CourseViewArguments>(nullOk: false);
|
final args = data.getArgs<CourseViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i35.CourseView(key: args.key, subcategory: args.subcategory),
|
_i35.CourseView(key: args.key, subcategory: args.subcategory),
|
||||||
settings: data,
|
settings: data,
|
||||||
|
|
@ -580,18 +566,12 @@ class StackedRouter extends _i1.RouterBase {
|
||||||
_i36.CoursePracticeQuestionView: (data) {
|
_i36.CoursePracticeQuestionView: (data) {
|
||||||
final args =
|
final args =
|
||||||
data.getArgs<CoursePracticeQuestionViewArguments>(nullOk: false);
|
data.getArgs<CoursePracticeQuestionViewArguments>(nullOk: false);
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
return _i37.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
_i36.CoursePracticeQuestionView(key: args.key, id: args.id),
|
_i36.CoursePracticeQuestionView(key: args.key, id: args.id),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i37.LearnSubcategoryView: (data) {
|
|
||||||
return _i38.MaterialPageRoute<dynamic>(
|
|
||||||
builder: (context) => const _i37.LearnSubcategoryView(),
|
|
||||||
settings: data,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -607,7 +587,7 @@ class StartupViewArguments {
|
||||||
this.label = 'Loading',
|
this.label = 'Loading',
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final String label;
|
final String label;
|
||||||
|
|
||||||
|
|
@ -628,94 +608,13 @@ class StartupViewArguments {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LearnViewArguments {
|
|
||||||
const LearnViewArguments({
|
|
||||||
this.key,
|
|
||||||
required this.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
final _i38.Key? key;
|
|
||||||
|
|
||||||
final int id;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return '{"key": "$key", "id": "$id"}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(covariant LearnViewArguments other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
return other.key == key && other.id == id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
return key.hashCode ^ id.hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LearnLevelViewArguments {
|
|
||||||
const LearnLevelViewArguments({
|
|
||||||
this.key,
|
|
||||||
required this.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
final _i38.Key? key;
|
|
||||||
|
|
||||||
final int id;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return '{"key": "$key", "id": "$id"}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(covariant LearnLevelViewArguments other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
return other.key == key && other.id == id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
return key.hashCode ^ id.hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LearnModuleViewArguments {
|
|
||||||
const LearnModuleViewArguments({
|
|
||||||
this.key,
|
|
||||||
required this.level,
|
|
||||||
});
|
|
||||||
|
|
||||||
final _i38.Key? key;
|
|
||||||
|
|
||||||
final _i39.Level level;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return '{"key": "$key", "level": "$level"}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(covariant LearnModuleViewArguments other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
return other.key == key && other.level == level;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
return key.hashCode ^ level.hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AssessmentViewArguments {
|
class AssessmentViewArguments {
|
||||||
const AssessmentViewArguments({
|
const AssessmentViewArguments({
|
||||||
this.key,
|
this.key,
|
||||||
required this.data,
|
required this.data,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final Map<String, dynamic> data;
|
final Map<String, dynamic> data;
|
||||||
|
|
||||||
|
|
@ -746,7 +645,7 @@ class LearnLessonViewArguments {
|
||||||
required this.description,
|
required this.description,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
|
|
@ -793,7 +692,7 @@ class LearnLessonDetailViewArguments {
|
||||||
required this.description,
|
required this.description,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
|
|
@ -833,7 +732,7 @@ class LearnPracticeViewArguments {
|
||||||
required this.buttonLabel,
|
required this.buttonLabel,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
|
|
@ -874,7 +773,7 @@ class CoursePracticeViewArguments {
|
||||||
required this.id,
|
required this.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final int id;
|
final int id;
|
||||||
|
|
||||||
|
|
@ -901,9 +800,9 @@ class CoursePaymentViewArguments {
|
||||||
required this.course,
|
required this.course,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final _i40.Course course;
|
final _i38.Course course;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|
@ -928,7 +827,7 @@ class FailureViewArguments {
|
||||||
required this.label,
|
required this.label,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final String label;
|
final String label;
|
||||||
|
|
||||||
|
|
@ -955,9 +854,9 @@ class CourseLessonViewArguments {
|
||||||
required this.course,
|
required this.course,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final _i40.Course course;
|
final _i38.Course course;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|
@ -982,9 +881,9 @@ class CourseLessonDetailViewArguments {
|
||||||
required this.lesson,
|
required this.lesson,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final _i41.CourseLesson lesson;
|
final _i39.CourseLesson lesson;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|
@ -1009,9 +908,9 @@ class CourseSubcategoryViewArguments {
|
||||||
required this.category,
|
required this.category,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final _i42.Category category;
|
final _i40.CourseCategory category;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|
@ -1036,9 +935,9 @@ class CourseViewArguments {
|
||||||
required this.subcategory,
|
required this.subcategory,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final _i43.Subcategory subcategory;
|
final _i41.CourseSubcategory subcategory;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|
@ -1063,7 +962,7 @@ class CoursePracticeQuestionViewArguments {
|
||||||
required this.id,
|
required this.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i38.Key? key;
|
final _i37.Key? key;
|
||||||
|
|
||||||
final int id;
|
final int id;
|
||||||
|
|
||||||
|
|
@ -1084,7 +983,7 @@ class CoursePracticeQuestionViewArguments {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NavigatorStateExtension on _i44.NavigationService {
|
extension NavigatorStateExtension on _i42.NavigationService {
|
||||||
Future<dynamic> navigateToHomeView([
|
Future<dynamic> navigateToHomeView([
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1114,7 +1013,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToStartupView({
|
Future<dynamic> navigateToStartupView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
String label = 'Loading',
|
String label = 'Loading',
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1312,51 +1211,42 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToLearnView({
|
Future<dynamic> navigateToLearnView([
|
||||||
_i38.Key? key,
|
|
||||||
required int id,
|
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
}) async {
|
]) async {
|
||||||
return navigateTo<dynamic>(Routes.learnView,
|
return navigateTo<dynamic>(Routes.learnView,
|
||||||
arguments: LearnViewArguments(key: key, id: id),
|
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToLearnLevelView({
|
Future<dynamic> navigateToLearnLevelView([
|
||||||
_i38.Key? key,
|
|
||||||
required int id,
|
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
}) async {
|
]) async {
|
||||||
return navigateTo<dynamic>(Routes.learnLevelView,
|
return navigateTo<dynamic>(Routes.learnLevelView,
|
||||||
arguments: LearnLevelViewArguments(key: key, id: id),
|
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToLearnModuleView({
|
Future<dynamic> navigateToLearnModuleView([
|
||||||
_i38.Key? key,
|
|
||||||
required _i39.Level level,
|
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
}) async {
|
]) async {
|
||||||
return navigateTo<dynamic>(Routes.learnModuleView,
|
return navigateTo<dynamic>(Routes.learnModuleView,
|
||||||
arguments: LearnModuleViewArguments(key: key, level: level),
|
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
|
|
@ -1378,7 +1268,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToAssessmentView({
|
Future<dynamic> navigateToAssessmentView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required Map<String, dynamic> data,
|
required Map<String, dynamic> data,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1395,7 +1285,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToLearnLessonView({
|
Future<dynamic> navigateToLearnLessonView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String title,
|
required String title,
|
||||||
required String topics,
|
required String topics,
|
||||||
required String subtitle,
|
required String subtitle,
|
||||||
|
|
@ -1436,7 +1326,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToLearnLessonDetailView({
|
Future<dynamic> navigateToLearnLessonDetailView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String title,
|
required String title,
|
||||||
required List<Map<String, dynamic>> practices,
|
required List<Map<String, dynamic>> practices,
|
||||||
required String description,
|
required String description,
|
||||||
|
|
@ -1459,7 +1349,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToLearnPracticeView({
|
Future<dynamic> navigateToLearnPracticeView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String title,
|
required String title,
|
||||||
required String subtitle,
|
required String subtitle,
|
||||||
required List<Map<String, dynamic>> practices,
|
required List<Map<String, dynamic>> practices,
|
||||||
|
|
@ -1484,7 +1374,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToCoursePracticeView({
|
Future<dynamic> navigateToCoursePracticeView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required int id,
|
required int id,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1501,8 +1391,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToCoursePaymentView({
|
Future<dynamic> navigateToCoursePaymentView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i40.Course course,
|
required _i38.Course course,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -1532,7 +1422,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToFailureView({
|
Future<dynamic> navigateToFailureView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String label,
|
required String label,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1549,8 +1439,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToCourseLessonView({
|
Future<dynamic> navigateToCourseLessonView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i40.Course course,
|
required _i38.Course course,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -1566,8 +1456,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToCourseLessonDetailView({
|
Future<dynamic> navigateToCourseLessonDetailView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i41.CourseLesson lesson,
|
required _i39.CourseLesson lesson,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -1597,8 +1487,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToCourseSubcategoryView({
|
Future<dynamic> navigateToCourseSubcategoryView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i42.Category category,
|
required _i40.CourseCategory category,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -1614,8 +1504,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToCourseView({
|
Future<dynamic> navigateToCourseView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i43.Subcategory subcategory,
|
required _i41.CourseSubcategory subcategory,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -1631,7 +1521,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToCoursePracticeQuestionView({
|
Future<dynamic> navigateToCoursePracticeQuestionView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required int id,
|
required int id,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1647,20 +1537,6 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToLearnSubcategoryView([
|
|
||||||
int? routerId,
|
|
||||||
bool preventDuplicates = true,
|
|
||||||
Map<String, String>? parameters,
|
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
|
||||||
transition,
|
|
||||||
]) async {
|
|
||||||
return navigateTo<dynamic>(Routes.learnSubcategoryView,
|
|
||||||
id: routerId,
|
|
||||||
preventDuplicates: preventDuplicates,
|
|
||||||
parameters: parameters,
|
|
||||||
transition: transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<dynamic> replaceWithHomeView([
|
Future<dynamic> replaceWithHomeView([
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1690,7 +1566,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithStartupView({
|
Future<dynamic> replaceWithStartupView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
String label = 'Loading',
|
String label = 'Loading',
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1888,51 +1764,42 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithLearnView({
|
Future<dynamic> replaceWithLearnView([
|
||||||
_i38.Key? key,
|
|
||||||
required int id,
|
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
}) async {
|
]) async {
|
||||||
return replaceWith<dynamic>(Routes.learnView,
|
return replaceWith<dynamic>(Routes.learnView,
|
||||||
arguments: LearnViewArguments(key: key, id: id),
|
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithLearnLevelView({
|
Future<dynamic> replaceWithLearnLevelView([
|
||||||
_i38.Key? key,
|
|
||||||
required int id,
|
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
}) async {
|
]) async {
|
||||||
return replaceWith<dynamic>(Routes.learnLevelView,
|
return replaceWith<dynamic>(Routes.learnLevelView,
|
||||||
arguments: LearnLevelViewArguments(key: key, id: id),
|
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithLearnModuleView({
|
Future<dynamic> replaceWithLearnModuleView([
|
||||||
_i38.Key? key,
|
|
||||||
required _i39.Level level,
|
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
}) async {
|
]) async {
|
||||||
return replaceWith<dynamic>(Routes.learnModuleView,
|
return replaceWith<dynamic>(Routes.learnModuleView,
|
||||||
arguments: LearnModuleViewArguments(key: key, level: level),
|
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
|
|
@ -1954,7 +1821,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithAssessmentView({
|
Future<dynamic> replaceWithAssessmentView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required Map<String, dynamic> data,
|
required Map<String, dynamic> data,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -1971,7 +1838,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithLearnLessonView({
|
Future<dynamic> replaceWithLearnLessonView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String title,
|
required String title,
|
||||||
required String topics,
|
required String topics,
|
||||||
required String subtitle,
|
required String subtitle,
|
||||||
|
|
@ -2012,7 +1879,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithLearnLessonDetailView({
|
Future<dynamic> replaceWithLearnLessonDetailView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String title,
|
required String title,
|
||||||
required List<Map<String, dynamic>> practices,
|
required List<Map<String, dynamic>> practices,
|
||||||
required String description,
|
required String description,
|
||||||
|
|
@ -2035,7 +1902,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithLearnPracticeView({
|
Future<dynamic> replaceWithLearnPracticeView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String title,
|
required String title,
|
||||||
required String subtitle,
|
required String subtitle,
|
||||||
required List<Map<String, dynamic>> practices,
|
required List<Map<String, dynamic>> practices,
|
||||||
|
|
@ -2060,7 +1927,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithCoursePracticeView({
|
Future<dynamic> replaceWithCoursePracticeView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required int id,
|
required int id,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -2077,8 +1944,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithCoursePaymentView({
|
Future<dynamic> replaceWithCoursePaymentView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i40.Course course,
|
required _i38.Course course,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -2108,7 +1975,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithFailureView({
|
Future<dynamic> replaceWithFailureView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required String label,
|
required String label,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -2125,8 +1992,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithCourseLessonView({
|
Future<dynamic> replaceWithCourseLessonView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i40.Course course,
|
required _i38.Course course,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -2142,8 +2009,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithCourseLessonDetailView({
|
Future<dynamic> replaceWithCourseLessonDetailView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i41.CourseLesson lesson,
|
required _i39.CourseLesson lesson,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -2173,8 +2040,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithCourseSubcategoryView({
|
Future<dynamic> replaceWithCourseSubcategoryView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i42.Category category,
|
required _i40.CourseCategory category,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -2190,8 +2057,8 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithCourseView({
|
Future<dynamic> replaceWithCourseView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required _i43.Subcategory subcategory,
|
required _i41.CourseSubcategory subcategory,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
|
|
@ -2207,7 +2074,7 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithCoursePracticeQuestionView({
|
Future<dynamic> replaceWithCoursePracticeQuestionView({
|
||||||
_i38.Key? key,
|
_i37.Key? key,
|
||||||
required int id,
|
required int id,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
|
|
@ -2222,18 +2089,4 @@ extension NavigatorStateExtension on _i44.NavigationService {
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithLearnSubcategoryView([
|
|
||||||
int? routerId,
|
|
||||||
bool preventDuplicates = true,
|
|
||||||
Map<String, String>? parameters,
|
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
|
||||||
transition,
|
|
||||||
]) async {
|
|
||||||
return replaceWith<dynamic>(Routes.learnSubcategoryView,
|
|
||||||
id: routerId,
|
|
||||||
preventDuplicates: preventDuplicates,
|
|
||||||
parameters: parameters,
|
|
||||||
transition: transition);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,23 +50,21 @@ class DefaultFirebaseOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const FirebaseOptions android = FirebaseOptions(
|
static const FirebaseOptions android = FirebaseOptions(
|
||||||
apiKey: 'AIzaSyAi8e4PMFH8QQU11DWftHdNEu8WUP7i2ww',
|
apiKey: 'AIzaSyC7QlhcuSNte49CERnRKPrQbyLbwErIRmk',
|
||||||
appId: '1:900714037062:android:f11e3b69315b05304e6f47',
|
appId: '1:574860813475:android:cd7fa6cf3a0527d97acb16',
|
||||||
messagingSenderId: '900714037062',
|
messagingSenderId: '574860813475',
|
||||||
projectId: 'yimaru-academy-5e7e2',
|
projectId: 'yimaru-lms-e834e',
|
||||||
storageBucket: 'yimaru-academy-5e7e2.firebasestorage.app',
|
storageBucket: 'yimaru-lms-e834e.firebasestorage.app',
|
||||||
);
|
);
|
||||||
|
|
||||||
static const FirebaseOptions ios = FirebaseOptions(
|
static const FirebaseOptions ios = FirebaseOptions(
|
||||||
apiKey: 'AIzaSyDbaGD47oUJOyn9n3b0pbH6ozmbGyIlOKk',
|
apiKey: 'AIzaSyBBcQ17JB6RBTjD7G7mh6Xf_FMUGxP5cC8',
|
||||||
appId: '1:900714037062:ios:1caf8f24a4333b8e4e6f47',
|
appId: '1:574860813475:ios:3ac9f7c4ae1771287acb16',
|
||||||
messagingSenderId: '900714037062',
|
messagingSenderId: '574860813475',
|
||||||
projectId: 'yimaru-academy-5e7e2',
|
projectId: 'yimaru-lms-e834e',
|
||||||
storageBucket: 'yimaru-academy-5e7e2.firebasestorage.app',
|
storageBucket: 'yimaru-lms-e834e.firebasestorage.app',
|
||||||
androidClientId:
|
androidClientId:
|
||||||
'900714037062-ngc0gc426sfnnjjr494g4vni46ne5uqv.apps.googleusercontent.com',
|
'574860813475-3p3k63lkrfd113sn6jscgvdj0aigsg5s.apps.googleusercontent.com',
|
||||||
iosClientId:
|
|
||||||
'900714037062-35bg0hsou56hg37mbcbpiar9uti7tcku.apps.googleusercontent.com',
|
|
||||||
iosBundleId: 'com.yimaru.lms.app',
|
iosBundleId: 'com.yimaru.lms.app',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
|
|
||||||
part 'category.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class Category {
|
|
||||||
final int? id;
|
|
||||||
|
|
||||||
final String? name;
|
|
||||||
|
|
||||||
@JsonKey(name: 'is_active')
|
|
||||||
final bool? isActive;
|
|
||||||
|
|
||||||
@JsonKey(name: 'total_count')
|
|
||||||
final int? totalCount;
|
|
||||||
|
|
||||||
const Category({this.id, this.name, this.isActive, this.totalCount});
|
|
||||||
|
|
||||||
factory Category.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$CategoryFromJson(json);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$CategoryToJson(this);
|
|
||||||
}
|
|
||||||
|
|
@ -6,38 +6,32 @@ part 'course.g.dart';
|
||||||
class Course {
|
class Course {
|
||||||
final int? id;
|
final int? id;
|
||||||
|
|
||||||
|
final String? level;
|
||||||
|
|
||||||
final String? title;
|
final String? title;
|
||||||
|
|
||||||
final String? thumbnail;
|
final String? thumbnail;
|
||||||
|
|
||||||
final String? description;
|
final String? description;
|
||||||
|
|
||||||
|
@JsonKey(name: 'course_id')
|
||||||
|
final int? courseId;
|
||||||
|
|
||||||
@JsonKey(name: 'is_active')
|
@JsonKey(name: 'is_active')
|
||||||
final bool? isActive;
|
final bool? isActive;
|
||||||
|
|
||||||
@JsonKey(name: 'category_id')
|
@JsonKey(name: 'display_order')
|
||||||
final int? categoryId;
|
final int? displayOrder;
|
||||||
|
|
||||||
@JsonKey(name: 'total_count')
|
const Course(
|
||||||
final int? totalCount;
|
{this.id,
|
||||||
|
this.level,
|
||||||
@JsonKey(name: 'intro_video_url')
|
|
||||||
final String? introVideoUrl;
|
|
||||||
|
|
||||||
@JsonKey(name: 'sub_category_id')
|
|
||||||
final int? subCategoryId;
|
|
||||||
|
|
||||||
const Course({
|
|
||||||
this.id,
|
|
||||||
this.title,
|
this.title,
|
||||||
this.isActive,
|
this.isActive,
|
||||||
|
this.courseId,
|
||||||
this.thumbnail,
|
this.thumbnail,
|
||||||
this.totalCount,
|
|
||||||
this.categoryId,
|
|
||||||
this.description,
|
this.description,
|
||||||
this.introVideoUrl,
|
this.displayOrder});
|
||||||
this.subCategoryId,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Course.fromJson(Map<String, dynamic> json) => _$CourseFromJson(json);
|
factory Course.fromJson(Map<String, dynamic> json) => _$CourseFromJson(json);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,24 +8,22 @@ part of 'course.dart';
|
||||||
|
|
||||||
Course _$CourseFromJson(Map<String, dynamic> json) => Course(
|
Course _$CourseFromJson(Map<String, dynamic> json) => Course(
|
||||||
id: (json['id'] as num?)?.toInt(),
|
id: (json['id'] as num?)?.toInt(),
|
||||||
|
level: json['level'] as String?,
|
||||||
title: json['title'] as String?,
|
title: json['title'] as String?,
|
||||||
isActive: json['is_active'] as bool?,
|
isActive: json['is_active'] as bool?,
|
||||||
|
courseId: (json['course_id'] as num?)?.toInt(),
|
||||||
thumbnail: json['thumbnail'] as String?,
|
thumbnail: json['thumbnail'] as String?,
|
||||||
totalCount: (json['total_count'] as num?)?.toInt(),
|
|
||||||
categoryId: (json['category_id'] as num?)?.toInt(),
|
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
introVideoUrl: json['intro_video_url'] as String?,
|
displayOrder: (json['display_order'] as num?)?.toInt(),
|
||||||
subCategoryId: (json['sub_category_id'] as num?)?.toInt(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$CourseToJson(Course instance) => <String, dynamic>{
|
Map<String, dynamic> _$CourseToJson(Course instance) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
|
'level': instance.level,
|
||||||
'title': instance.title,
|
'title': instance.title,
|
||||||
'thumbnail': instance.thumbnail,
|
'thumbnail': instance.thumbnail,
|
||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
|
'course_id': instance.courseId,
|
||||||
'is_active': instance.isActive,
|
'is_active': instance.isActive,
|
||||||
'category_id': instance.categoryId,
|
'display_order': instance.displayOrder,
|
||||||
'total_count': instance.totalCount,
|
|
||||||
'intro_video_url': instance.introVideoUrl,
|
|
||||||
'sub_category_id': instance.subCategoryId,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
20
lib/models/course_category.dart
Normal file
20
lib/models/course_category.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'course_category.g.dart';
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
|
class CourseCategory {
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
final String? name;
|
||||||
|
|
||||||
|
@JsonKey(name: 'is_active')
|
||||||
|
final bool? isActive;
|
||||||
|
|
||||||
|
const CourseCategory({this.id, this.name, this.isActive});
|
||||||
|
|
||||||
|
factory CourseCategory.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$CourseCategoryFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$CourseCategoryToJson(this);
|
||||||
|
}
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
part of 'category.dart';
|
part of 'course_category.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
Category _$CategoryFromJson(Map<String, dynamic> json) => Category(
|
CourseCategory _$CourseCategoryFromJson(Map<String, dynamic> json) =>
|
||||||
|
CourseCategory(
|
||||||
id: (json['id'] as num?)?.toInt(),
|
id: (json['id'] as num?)?.toInt(),
|
||||||
name: json['name'] as String?,
|
name: json['name'] as String?,
|
||||||
isActive: json['is_active'] as bool?,
|
isActive: json['is_active'] as bool?,
|
||||||
totalCount: (json['total_count'] as num?)?.toInt(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$CategoryToJson(Category instance) => <String, dynamic>{
|
Map<String, dynamic> _$CourseCategoryToJson(CourseCategory instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
'is_active': instance.isActive,
|
'is_active': instance.isActive,
|
||||||
'total_count': instance.totalCount,
|
|
||||||
};
|
};
|
||||||
|
|
@ -33,8 +33,8 @@ Map<String, dynamic> _$CourseLessonToJson(CourseLesson instance) =>
|
||||||
'visibility': instance.visibility,
|
'visibility': instance.visibility,
|
||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'video_url': instance.videoUrl,
|
'video_url': instance.videoUrl,
|
||||||
'vimeo_status': instance.vimeoStatus,
|
|
||||||
'instructor_id': instance.instructorId,
|
'instructor_id': instance.instructorId,
|
||||||
'sub_course_id': instance.courseId,
|
'sub_course_id': instance.courseId,
|
||||||
|
'vimeo_status': instance.vimeoStatus,
|
||||||
'display_order': instance.displayOrder,
|
'display_order': instance.displayOrder,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
33
lib/models/course_subcategory.dart
Normal file
33
lib/models/course_subcategory.dart
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'course_subcategory.g.dart';
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
|
class CourseSubcategory {
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
final String? title;
|
||||||
|
|
||||||
|
final String? thumbnail;
|
||||||
|
|
||||||
|
final String? description;
|
||||||
|
|
||||||
|
@JsonKey(name: 'is_active')
|
||||||
|
final bool? isActive;
|
||||||
|
|
||||||
|
@JsonKey(name: 'category_id')
|
||||||
|
final int? categoryId;
|
||||||
|
|
||||||
|
const CourseSubcategory(
|
||||||
|
{this.id,
|
||||||
|
this.title,
|
||||||
|
this.isActive,
|
||||||
|
this.thumbnail,
|
||||||
|
this.categoryId,
|
||||||
|
this.description});
|
||||||
|
|
||||||
|
factory CourseSubcategory.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$CourseSubcategoryFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$CourseSubcategoryToJson(this);
|
||||||
|
}
|
||||||
|
|
@ -1,29 +1,27 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
part of 'level.dart';
|
part of 'course_subcategory.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
Level _$LevelFromJson(Map<String, dynamic> json) => Level(
|
CourseSubcategory _$CourseSubcategoryFromJson(Map<String, dynamic> json) =>
|
||||||
|
CourseSubcategory(
|
||||||
id: (json['id'] as num?)?.toInt(),
|
id: (json['id'] as num?)?.toInt(),
|
||||||
title: json['title'] as String?,
|
title: json['title'] as String?,
|
||||||
isActive: json['is_active'] as bool?,
|
isActive: json['is_active'] as bool?,
|
||||||
cerfLevel: json['cefr_level'] as String?,
|
|
||||||
thumbnail: json['thumbnail'] as String?,
|
thumbnail: json['thumbnail'] as String?,
|
||||||
totalCount: (json['total_count'] as num?)?.toInt(),
|
categoryId: (json['category_id'] as num?)?.toInt(),
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
displayOrder: (json['display_order'] as num?)?.toInt(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$LevelToJson(Level instance) => <String, dynamic>{
|
Map<String, dynamic> _$CourseSubcategoryToJson(CourseSubcategory instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'title': instance.title,
|
'title': instance.title,
|
||||||
'thumbnail': instance.thumbnail,
|
'thumbnail': instance.thumbnail,
|
||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'is_active': instance.isActive,
|
'is_active': instance.isActive,
|
||||||
'cefr_level': instance.cerfLevel,
|
'category_id': instance.categoryId,
|
||||||
'total_count': instance.totalCount,
|
|
||||||
'display_order': instance.displayOrder,
|
|
||||||
};
|
};
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
|
|
||||||
part 'level.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class Level {
|
|
||||||
final int? id;
|
|
||||||
|
|
||||||
final String? title;
|
|
||||||
|
|
||||||
final String? thumbnail;
|
|
||||||
|
|
||||||
final String? description;
|
|
||||||
|
|
||||||
@JsonKey(name: 'is_active')
|
|
||||||
final bool? isActive;
|
|
||||||
|
|
||||||
@JsonKey(name: 'cefr_level')
|
|
||||||
final String? cerfLevel;
|
|
||||||
|
|
||||||
@JsonKey(name: 'total_count')
|
|
||||||
final int? totalCount;
|
|
||||||
|
|
||||||
@JsonKey(name: 'display_order')
|
|
||||||
final int? displayOrder;
|
|
||||||
|
|
||||||
const Level({
|
|
||||||
this.id,
|
|
||||||
this.title,
|
|
||||||
this.isActive,
|
|
||||||
this.cerfLevel,
|
|
||||||
this.thumbnail,
|
|
||||||
this.totalCount,
|
|
||||||
this.description,
|
|
||||||
this.displayOrder,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Level.fromJson(Map<String, dynamic> json) => _$LevelFromJson(json);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$LevelToJson(this);
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
|
|
||||||
part 'module.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class Module {
|
|
||||||
final int? id;
|
|
||||||
|
|
||||||
final String? title;
|
|
||||||
|
|
||||||
final String? description;
|
|
||||||
|
|
||||||
@JsonKey(name: 'icon_url')
|
|
||||||
final String? iconUrl;
|
|
||||||
|
|
||||||
@JsonKey(name: 'level_id')
|
|
||||||
final int? levelId;
|
|
||||||
|
|
||||||
@JsonKey(name: 'is_active')
|
|
||||||
final bool? isActive;
|
|
||||||
|
|
||||||
@JsonKey(name: 'display_order')
|
|
||||||
final int? displayOrder;
|
|
||||||
|
|
||||||
const Module({
|
|
||||||
this.id,
|
|
||||||
this.title,
|
|
||||||
this.iconUrl,
|
|
||||||
this.levelId,
|
|
||||||
this.isActive,
|
|
||||||
this.description,
|
|
||||||
this.displayOrder,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Module.fromJson(Map<String, dynamic> json) => _$ModuleFromJson(json);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$ModuleToJson(this);
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'module.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
Module _$ModuleFromJson(Map<String, dynamic> json) => Module(
|
|
||||||
id: (json['id'] as num?)?.toInt(),
|
|
||||||
title: json['title'] as String?,
|
|
||||||
iconUrl: json['icon_url'] as String?,
|
|
||||||
levelId: (json['level_id'] as num?)?.toInt(),
|
|
||||||
isActive: json['is_active'] as bool?,
|
|
||||||
description: json['description'] as String?,
|
|
||||||
displayOrder: (json['display_order'] as num?)?.toInt(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$ModuleToJson(Module instance) => <String, dynamic>{
|
|
||||||
'id': instance.id,
|
|
||||||
'title': instance.title,
|
|
||||||
'description': instance.description,
|
|
||||||
'icon_url': instance.iconUrl,
|
|
||||||
'level_id': instance.levelId,
|
|
||||||
'is_active': instance.isActive,
|
|
||||||
'display_order': instance.displayOrder,
|
|
||||||
};
|
|
||||||
|
|
@ -14,6 +14,6 @@ Option _$OptionFromJson(Map<String, dynamic> json) => Option(
|
||||||
|
|
||||||
Map<String, dynamic> _$OptionToJson(Option instance) => <String, dynamic>{
|
Map<String, dynamic> _$OptionToJson(Option instance) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'is_correct': instance.isCorrect,
|
|
||||||
'option_text': instance.optionText,
|
'option_text': instance.optionText,
|
||||||
|
'is_correct': instance.isCorrect,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
|
|
||||||
part 'subcategory.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class Subcategory {
|
|
||||||
final int? id;
|
|
||||||
|
|
||||||
final String? name;
|
|
||||||
|
|
||||||
final String? description;
|
|
||||||
|
|
||||||
@JsonKey(name: 'is_active')
|
|
||||||
final bool? isActive;
|
|
||||||
|
|
||||||
@JsonKey(name: 'total_count')
|
|
||||||
final int? totalCount;
|
|
||||||
|
|
||||||
@JsonKey(name: 'category_id')
|
|
||||||
final int? categoryId;
|
|
||||||
|
|
||||||
@JsonKey(name: 'category_name')
|
|
||||||
final String? categoryName;
|
|
||||||
|
|
||||||
@JsonKey(name: 'display_order')
|
|
||||||
final int? displayOrder;
|
|
||||||
|
|
||||||
const Subcategory(
|
|
||||||
{this.id,
|
|
||||||
this.name,
|
|
||||||
this.isActive,
|
|
||||||
this.totalCount,
|
|
||||||
this.categoryId,
|
|
||||||
this.description,
|
|
||||||
this.categoryName,
|
|
||||||
this.displayOrder});
|
|
||||||
|
|
||||||
factory Subcategory.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$SubcategoryFromJson(json);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$SubcategoryToJson(this);
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'subcategory.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
Subcategory _$SubcategoryFromJson(Map<String, dynamic> json) => Subcategory(
|
|
||||||
id: (json['id'] as num?)?.toInt(),
|
|
||||||
name: json['name'] as String?,
|
|
||||||
isActive: json['is_active'] as bool?,
|
|
||||||
totalCount: (json['total_count'] as num?)?.toInt(),
|
|
||||||
categoryId: (json['category_id'] as num?)?.toInt(),
|
|
||||||
description: json['description'] as String?,
|
|
||||||
categoryName: json['category_name'] as String?,
|
|
||||||
displayOrder: (json['display_order'] as num?)?.toInt(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$SubcategoryToJson(Subcategory instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'id': instance.id,
|
|
||||||
'name': instance.name,
|
|
||||||
'description': instance.description,
|
|
||||||
'is_active': instance.isActive,
|
|
||||||
'total_count': instance.totalCount,
|
|
||||||
'category_id': instance.categoryId,
|
|
||||||
'category_name': instance.categoryName,
|
|
||||||
'display_order': instance.displayOrder,
|
|
||||||
};
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
part 'user.g.dart';
|
part 'user_model.g.dart';
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class User {
|
class UserModel {
|
||||||
final String? email;
|
final String? email;
|
||||||
|
|
||||||
final String? gender;
|
final String? gender;
|
||||||
|
|
@ -40,7 +40,7 @@ class User {
|
||||||
@JsonKey(name: 'profile_picture_url')
|
@JsonKey(name: 'profile_picture_url')
|
||||||
final String? profilePicture;
|
final String? profilePicture;
|
||||||
|
|
||||||
const User({
|
const UserModel({
|
||||||
this.email,
|
this.email,
|
||||||
this.region,
|
this.region,
|
||||||
this.gender,
|
this.gender,
|
||||||
|
|
@ -57,7 +57,7 @@ class User {
|
||||||
this.profileCompleted,
|
this.profileCompleted,
|
||||||
});
|
});
|
||||||
|
|
||||||
User copyWith(
|
UserModel copyWith(
|
||||||
{int? userId,
|
{int? userId,
|
||||||
String? email,
|
String? email,
|
||||||
String? gender,
|
String? gender,
|
||||||
|
|
@ -72,7 +72,7 @@ class User {
|
||||||
bool? userInfoLoaded,
|
bool? userInfoLoaded,
|
||||||
bool? profileCompleted,
|
bool? profileCompleted,
|
||||||
String? profilePicture}) =>
|
String? profilePicture}) =>
|
||||||
User(
|
UserModel(
|
||||||
email: email ?? this.email,
|
email: email ?? this.email,
|
||||||
userId: userId ?? this.userId,
|
userId: userId ?? this.userId,
|
||||||
gender: gender ?? this.gender,
|
gender: gender ?? this.gender,
|
||||||
|
|
@ -88,7 +88,8 @@ class User {
|
||||||
profilePicture: profilePicture ?? this.profilePicture,
|
profilePicture: profilePicture ?? this.profilePicture,
|
||||||
profileCompleted: profileCompleted ?? this.profileCompleted);
|
profileCompleted: profileCompleted ?? this.profileCompleted);
|
||||||
|
|
||||||
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
|
factory UserModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$UserModelFromJson(json);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$UserToJson(this);
|
Map<String, dynamic> toJson() => _$UserModelToJson(this);
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
part of 'user.dart';
|
part of 'user_model.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
User _$UserFromJson(Map<String, dynamic> json) => User(
|
UserModel _$UserModelFromJson(Map<String, dynamic> json) => UserModel(
|
||||||
email: json['email'] as String?,
|
email: json['email'] as String?,
|
||||||
region: json['region'] as String?,
|
region: json['region'] as String?,
|
||||||
gender: json['gender'] as String?,
|
gender: json['gender'] as String?,
|
||||||
|
|
@ -23,7 +23,7 @@ User _$UserFromJson(Map<String, dynamic> json) => User(
|
||||||
profileCompleted: json['profile_completed'] as bool?,
|
profileCompleted: json['profile_completed'] as bool?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
|
Map<String, dynamic> _$UserModelToJson(UserModel instance) => <String, dynamic>{
|
||||||
'email': instance.email,
|
'email': instance.email,
|
||||||
'gender': instance.gender,
|
'gender': instance.gender,
|
||||||
'region': instance.region,
|
'region': instance.region,
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:yimaru_app/models/level.dart';
|
|
||||||
import 'package:yimaru_app/models/question.dart';
|
import 'package:yimaru_app/models/question.dart';
|
||||||
import 'package:yimaru_app/models/subcategory.dart';
|
import 'package:yimaru_app/models/course_subcategory.dart';
|
||||||
import 'package:yimaru_app/models/category.dart';
|
import 'package:yimaru_app/models/course_category.dart';
|
||||||
import 'package:yimaru_app/models/course_lesson.dart';
|
import 'package:yimaru_app/models/course_lesson.dart';
|
||||||
import 'package:yimaru_app/models/course_progress.dart';
|
import 'package:yimaru_app/models/course_progress.dart';
|
||||||
import 'package:yimaru_app/models/course.dart';
|
import 'package:yimaru_app/models/course.dart';
|
||||||
import 'package:yimaru_app/models/practice.dart';
|
import 'package:yimaru_app/models/practice.dart';
|
||||||
import 'package:yimaru_app/models/practice_question.dart';
|
import 'package:yimaru_app/models/practice_question.dart';
|
||||||
import 'package:yimaru_app/models/user.dart';
|
import 'package:yimaru_app/models/user_model.dart';
|
||||||
import 'package:yimaru_app/services/dio_service.dart';
|
import 'package:yimaru_app/services/dio_service.dart';
|
||||||
import 'package:yimaru_app/ui/common/app_constants.dart';
|
import 'package:yimaru_app/ui/common/app_constants.dart';
|
||||||
|
|
||||||
import '../app/app.locator.dart';
|
import '../app/app.locator.dart';
|
||||||
import '../models/module.dart';
|
|
||||||
import '../ui/common/enmus.dart';
|
import '../ui/common/enmus.dart';
|
||||||
|
|
||||||
class ApiService {
|
class ApiService {
|
||||||
|
|
@ -60,7 +58,7 @@ class ApiService {
|
||||||
return {
|
return {
|
||||||
'status': ResponseStatus.success,
|
'status': ResponseStatus.success,
|
||||||
'message': 'Logged in successfully',
|
'message': 'Logged in successfully',
|
||||||
'data': User.fromJson(response.data['data']),
|
'data': UserModel.fromJson(response.data['data']),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
|
@ -88,7 +86,7 @@ class ApiService {
|
||||||
return {
|
return {
|
||||||
'status': ResponseStatus.success,
|
'status': ResponseStatus.success,
|
||||||
'message': 'Logged in successfully',
|
'message': 'Logged in successfully',
|
||||||
'data': User.fromJson(response.data['data']),
|
'data': UserModel.fromJson(response.data['data']),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
|
@ -115,7 +113,7 @@ class ApiService {
|
||||||
return {
|
return {
|
||||||
'status': ResponseStatus.success,
|
'status': ResponseStatus.success,
|
||||||
'message': 'Otp verified successfully',
|
'message': 'Otp verified successfully',
|
||||||
'data': User.fromJson(response.data['data']),
|
'data': UserModel.fromJson(response.data['data']),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
|
@ -214,7 +212,7 @@ class ApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GEt profile completion status
|
// GEt profile completion status
|
||||||
Future<Map<String, dynamic>> getProfileStatus(User? user) async {
|
Future<Map<String, dynamic>> getProfileStatus(UserModel? user) async {
|
||||||
try {
|
try {
|
||||||
Response response = await _service.dio.get(
|
Response response = await _service.dio.get(
|
||||||
'$kBaseUrl/$kUserBaseUrl/${user?.userId}/$kProfileStatusUrl',
|
'$kBaseUrl/$kUserBaseUrl/${user?.userId}/$kProfileStatusUrl',
|
||||||
|
|
@ -251,7 +249,7 @@ class ApiService {
|
||||||
return {
|
return {
|
||||||
'status': ResponseStatus.success,
|
'status': ResponseStatus.success,
|
||||||
'message': 'Profile fetched successfully',
|
'message': 'Profile fetched successfully',
|
||||||
'data': User.fromJson(response.data['data']),
|
'data': UserModel.fromJson(response.data['data']),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
|
@ -371,20 +369,20 @@ class ApiService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get categories
|
// Get course categories
|
||||||
Future<List<Category>> getCategories() async {
|
Future<List<CourseCategory>> getCourseCategories() async {
|
||||||
try {
|
try {
|
||||||
List<Category> categories = [];
|
List<CourseCategory> categories = [];
|
||||||
|
|
||||||
final Response response = await _service.dio.get(
|
final Response response = await _service.dio
|
||||||
'$kBaseUrl/api/$kApiVersionUrl/$kCourseManagementUrl/$kCategoryUrl');
|
.get('$kBaseUrl/$kCourseBaseUrl/$kCourseCategoryUrl');
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
var data = response.data;
|
var data = response.data;
|
||||||
var decodedData = data['data']['categories'] as List;
|
var decodedData = data['data']['categories'] as List;
|
||||||
categories = decodedData.map(
|
categories = decodedData.map(
|
||||||
(e) {
|
(e) {
|
||||||
return Category.fromJson(e);
|
return CourseCategory.fromJson(e);
|
||||||
},
|
},
|
||||||
).toList();
|
).toList();
|
||||||
return categories;
|
return categories;
|
||||||
|
|
@ -396,19 +394,19 @@ class ApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get course subcategory
|
// Get course subcategory
|
||||||
Future<List<Subcategory>> getSubcategories(int id) async {
|
Future<List<CourseSubcategory>> getCourseSubcategories(int id) async {
|
||||||
try {
|
try {
|
||||||
List<Subcategory> subcategories = [];
|
List<CourseSubcategory> subcategories = [];
|
||||||
|
|
||||||
final Response response = await _service.dio
|
final Response response = await _service.dio.get(
|
||||||
.get('$kBaseUrl/$kCourseBaseUrl/$kCategoryUrl/$id/$kCoursesUrl');
|
'$kBaseUrl/$kCourseBaseUrl/$kCourseCategoryUrl/$id/$kCoursesUrl');
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
var data = response.data;
|
var data = response.data;
|
||||||
var decodedData = data['data']['courses'] as List;
|
var decodedData = data['data']['courses'] as List;
|
||||||
subcategories = decodedData.map(
|
subcategories = decodedData.map(
|
||||||
(e) {
|
(e) {
|
||||||
return Subcategory.fromJson(e);
|
return CourseSubcategory.fromJson(e);
|
||||||
},
|
},
|
||||||
).toList();
|
).toList();
|
||||||
return subcategories;
|
return subcategories;
|
||||||
|
|
@ -420,28 +418,28 @@ class ApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get courses
|
// Get courses
|
||||||
// Future<List<Course>> getCourses(int id) async {
|
Future<List<Course>> getCourses(int id) async {
|
||||||
// try {
|
try {
|
||||||
// List<Course> courses = [];
|
List<Course> courses = [];
|
||||||
//
|
|
||||||
// final Response response = await _service.dio
|
final Response response = await _service.dio
|
||||||
// .get('$kBaseUrl/$kCourseBaseUrl/$kCoursesUrl/$id/$kSubcoursesUrl');
|
.get('$kBaseUrl/$kCourseBaseUrl/$kCoursesUrl/$id/$kSubcoursesUrl');
|
||||||
//
|
|
||||||
// if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
// var data = response.data;
|
var data = response.data;
|
||||||
// var decodedData = data['data']['sub_courses'] as List;
|
var decodedData = data['data']['sub_courses'] as List;
|
||||||
// courses = decodedData.map(
|
courses = decodedData.map(
|
||||||
// (e) {
|
(e) {
|
||||||
// return Course.fromJson(e);
|
return Course.fromJson(e);
|
||||||
// },
|
},
|
||||||
// ).toList();
|
).toList();
|
||||||
// return courses;
|
return courses;
|
||||||
// }
|
}
|
||||||
// return [];
|
return [];
|
||||||
// } catch (e) {
|
} catch (e) {
|
||||||
// return [];
|
return [];
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Get course progress
|
// Get course progress
|
||||||
Future<List<CourseProgress>> getCourseProgress(int id) async {
|
Future<List<CourseProgress>> getCourseProgress(int id) async {
|
||||||
|
|
@ -578,100 +576,4 @@ class ApiService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get learn subcategories
|
|
||||||
Future<List<Subcategory>> getLearnSubcategories() async {
|
|
||||||
try {
|
|
||||||
List<Subcategory> learnSubcategories = [];
|
|
||||||
|
|
||||||
final Response response = await _service.dio.get(
|
|
||||||
'$kBaseUrl/api/$kApiVersionUrl/$kCourseManagementUrl/$kLearnSubcategoriesUrl');
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
var data = response.data;
|
|
||||||
var decodedData = data['data']['sub_categories'] as List;
|
|
||||||
learnSubcategories = decodedData.map(
|
|
||||||
(e) {
|
|
||||||
return Subcategory.fromJson(e);
|
|
||||||
},
|
|
||||||
).toList();
|
|
||||||
return learnSubcategories;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
} catch (e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get courses
|
|
||||||
Future<List<Course>> getCourses(int id) async {
|
|
||||||
try {
|
|
||||||
List<Course> courses = [];
|
|
||||||
|
|
||||||
final Response response = await _service.dio.get(
|
|
||||||
'$kBaseUrl/api/$kApiVersionUrl/$kCourseManagementUrl/$kSubcategoriesUrl/$id/$kCoursesUrl');
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
var data = response.data;
|
|
||||||
var decodedData = data['data']['courses'] as List;
|
|
||||||
courses = decodedData.map(
|
|
||||||
(e) {
|
|
||||||
return Course.fromJson(e);
|
|
||||||
},
|
|
||||||
).toList();
|
|
||||||
return courses;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
} catch (e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get levels
|
|
||||||
Future<List<Level>> getLevels(int id) async {
|
|
||||||
try {
|
|
||||||
List<Level> levels = [];
|
|
||||||
|
|
||||||
final Response response = await _service.dio.get(
|
|
||||||
'$kBaseUrl/api/$kApiVersionUrl/$kCourseManagementUrl/$kCoursesUrl/$id/$kLevelsUrl');
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
var data = response.data;
|
|
||||||
var decodedData = data['data']['levels'] as List;
|
|
||||||
levels = decodedData.map(
|
|
||||||
(e) {
|
|
||||||
return Level.fromJson(e);
|
|
||||||
},
|
|
||||||
).toList();
|
|
||||||
return levels;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
} catch (e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get modules
|
|
||||||
Future<List<Module>> getModules(int id) async {
|
|
||||||
try {
|
|
||||||
List<Module> modules = [];
|
|
||||||
|
|
||||||
final Response response = await _service.dio.get(
|
|
||||||
'$kBaseUrl/api/$kApiVersionUrl/$kCourseManagementUrl/$kLevelsUrl/$id/$kModulesUrl');
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
var data = response.data;
|
|
||||||
var decodedData = data['data']['modules'] as List;
|
|
||||||
modules = decodedData.map(
|
|
||||||
(e) {
|
|
||||||
return Module.fromJson(e);
|
|
||||||
},
|
|
||||||
).toList();
|
|
||||||
return modules;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
} catch (e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:yimaru_app/app/app.locator.dart';
|
import 'package:yimaru_app/app/app.locator.dart';
|
||||||
import 'package:yimaru_app/models/user.dart';
|
import 'package:yimaru_app/models/user_model.dart';
|
||||||
import 'package:yimaru_app/services/secure_storage_service.dart';
|
import 'package:yimaru_app/services/secure_storage_service.dart';
|
||||||
|
|
||||||
class AuthenticationService with ListenableServiceMixin {
|
class AuthenticationService with ListenableServiceMixin {
|
||||||
|
|
@ -8,9 +8,9 @@ class AuthenticationService with ListenableServiceMixin {
|
||||||
final _secureService = locator<SecureStorageService>();
|
final _secureService = locator<SecureStorageService>();
|
||||||
|
|
||||||
// User data
|
// User data
|
||||||
User? _user;
|
UserModel? _user;
|
||||||
|
|
||||||
User? get user => _user;
|
UserModel? get user => _user;
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
AuthenticationService() {
|
AuthenticationService() {
|
||||||
|
|
@ -51,7 +51,7 @@ class AuthenticationService with ListenableServiceMixin {
|
||||||
await _secureService.setString('accessToken', data['accessToken']);
|
await _secureService.setString('accessToken', data['accessToken']);
|
||||||
await _secureService.setString('refreshToken', data['refreshToken']);
|
await _secureService.setString('refreshToken', data['refreshToken']);
|
||||||
|
|
||||||
_user = User(
|
_user = UserModel(
|
||||||
userId: await _secureService.getInt('userId'),
|
userId: await _secureService.getInt('userId'),
|
||||||
accessToken: await _secureService.getString('accessToken'),
|
accessToken: await _secureService.getString('accessToken'),
|
||||||
refreshToken: await _secureService.getString('refreshToken'),
|
refreshToken: await _secureService.getString('refreshToken'),
|
||||||
|
|
@ -67,6 +67,7 @@ class AuthenticationService with ListenableServiceMixin {
|
||||||
profileCompleted: await _secureService.getBool('profileCompleted'),
|
profileCompleted: await _secureService.getBool('profileCompleted'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +83,7 @@ class AuthenticationService with ListenableServiceMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save user data
|
// Save user data
|
||||||
Future<void> saveUserData(User data) async {
|
Future<void> saveUserData(UserModel data) async {
|
||||||
await _secureService.setBool('userInfoLoaded', true);
|
await _secureService.setBool('userInfoLoaded', true);
|
||||||
await _secureService.setBool(
|
await _secureService.setBool(
|
||||||
'profileCompleted', data.profileCompleted ?? false);
|
'profileCompleted', data.profileCompleted ?? false);
|
||||||
|
|
@ -95,7 +96,7 @@ class AuthenticationService with ListenableServiceMixin {
|
||||||
await _secureService.setString('firstName', data.firstName ?? '');
|
await _secureService.setString('firstName', data.firstName ?? '');
|
||||||
await _secureService.setString('occupation', data.occupation ?? '');
|
await _secureService.setString('occupation', data.occupation ?? '');
|
||||||
|
|
||||||
_user = User(
|
_user = UserModel(
|
||||||
email: data.email,
|
email: data.email,
|
||||||
gender: data.gender,
|
gender: data.gender,
|
||||||
region: data.region,
|
region: data.region,
|
||||||
|
|
@ -147,8 +148,8 @@ class AuthenticationService with ListenableServiceMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user data
|
// Get user data
|
||||||
Future<User?> getUser() async {
|
Future<UserModel?> getUser() async {
|
||||||
_user = User(
|
_user = UserModel(
|
||||||
userId: await _secureService.getInt('userId'),
|
userId: await _secureService.getInt('userId'),
|
||||||
email: await _secureService.getString('email'),
|
email: await _secureService.getString('email'),
|
||||||
region: await _secureService.getString('region'),
|
region: await _secureService.getString('region'),
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:yimaru_app/app/app.router.dart';
|
import 'package:yimaru_app/app/app.router.dart';
|
||||||
import 'package:yimaru_app/models/user.dart';
|
import 'package:yimaru_app/models/user_model.dart';
|
||||||
import 'package:yimaru_app/services/authentication_service.dart';
|
import 'package:yimaru_app/services/authentication_service.dart';
|
||||||
|
|
||||||
import '../app/app.locator.dart';
|
import '../app/app.locator.dart';
|
||||||
|
|
@ -135,7 +135,7 @@ class DioService {
|
||||||
|
|
||||||
// Refresh token
|
// Refresh token
|
||||||
Future<bool> _refreshToken() async {
|
Future<bool> _refreshToken() async {
|
||||||
final User? user = await _authenticationService.getUser();
|
final UserModel? user = await _authenticationService.getUser();
|
||||||
|
|
||||||
if (user?.refreshToken == null) return false;
|
if (user?.refreshToken == null) return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,9 @@
|
||||||
String kBaseUrl = 'https://api.yimaruacademy.com';
|
String kBaseUrl = 'https://api.yimaruacademy.com';
|
||||||
|
|
||||||
String kApiUrl = 'api';
|
|
||||||
|
|
||||||
String kApiVersionUrl = 'v1';
|
|
||||||
|
|
||||||
String kLevelsUrl = 'levels';
|
|
||||||
|
|
||||||
String kCoursesUrl = 'courses';
|
String kCoursesUrl = 'courses';
|
||||||
|
|
||||||
String kModulesUrl = 'modules';
|
|
||||||
|
|
||||||
String kRegisterUrl = 'register';
|
String kRegisterUrl = 'register';
|
||||||
|
|
||||||
String kCategoryUrl = 'categories';
|
|
||||||
|
|
||||||
String kCoursePractice = 'by-owner';
|
String kCoursePractice = 'by-owner';
|
||||||
|
|
||||||
String kUserBaseUrl = 'api/v1/user';
|
String kUserBaseUrl = 'api/v1/user';
|
||||||
|
|
@ -30,9 +20,9 @@ String kCompleteLessonUrl = 'complete';
|
||||||
|
|
||||||
String kResetPassword = 'resetPassword';
|
String kResetPassword = 'resetPassword';
|
||||||
|
|
||||||
String kRequestResetCode = 'sendResetCode';
|
String kCourseCategoryUrl = 'categories';
|
||||||
|
|
||||||
String kSubcategoriesUrl = 'sub-categories';
|
String kRequestResetCode = 'sendResetCode';
|
||||||
|
|
||||||
String kPublishedVideos = 'videos/published';
|
String kPublishedVideos = 'videos/published';
|
||||||
|
|
||||||
|
|
@ -46,8 +36,6 @@ String kLoginUrl = 'api/v1/auth/customer-login';
|
||||||
|
|
||||||
String kPracticeBaseUrl = 'api/v1/question-sets';
|
String kPracticeBaseUrl = 'api/v1/question-sets';
|
||||||
|
|
||||||
String kCourseManagementUrl = 'course-management';
|
|
||||||
|
|
||||||
String kProfileStatusUrl = 'is-profile-completed';
|
String kProfileStatusUrl = 'is-profile-completed';
|
||||||
|
|
||||||
String kCourseBaseUrl = 'api/v1/course-management';
|
String kCourseBaseUrl = 'api/v1/course-management';
|
||||||
|
|
@ -62,12 +50,10 @@ String kCourseProgressUrl = 'api/v1/progress/courses';
|
||||||
|
|
||||||
String kAssessmentsUrl = 'api/v1/assessment/questions';
|
String kAssessmentsUrl = 'api/v1/assessment/questions';
|
||||||
|
|
||||||
String kLearnSubcategoriesUrl = 'human-language/sub-categories';
|
|
||||||
|
|
||||||
String kEmptyImagePath = '/data/user/0/com.yimaru.lms.app/app_flutter';
|
String kEmptyImagePath = '/data/user/0/com.yimaru.lms.app/app_flutter';
|
||||||
|
|
||||||
String kSampleVideoUrl =
|
String kSampleVideoUrl =
|
||||||
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4';
|
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4';
|
||||||
|
|
||||||
String kServerClientId =
|
String kServerClientId =
|
||||||
'900714037062-24ria5fcfet71o3vde8f6gsvsj1n68ec.apps.googleusercontent.com';
|
'574860813475-n5o17gpprdqmhcml99tiqhafb17rob0r.apps.googleusercontent.com';
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ const String ksHomeBottomSheetDescription =
|
||||||
const String ksPrivacyPolicy =
|
const String ksPrivacyPolicy =
|
||||||
'A brief, simple overview of Yimaru’s commitment to user privacy. Our goal is to be transparent about the data we collect and how we use it to enhance your learning experience.';
|
'A brief, simple overview of Yimaru’s commitment to user privacy. Our goal is to be transparent about the data we collect and how we use it to enhance your learning experience.';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const String ksTerms = """
|
const String ksTerms = """
|
||||||
<p style="color:#9C2C91;font-size:13px;">
|
<p style="color:#9C2C91;font-size:13px;">
|
||||||
Last updated: October 26, 2025
|
Last updated: October 26, 2025
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@ enum StateObjects {
|
||||||
register,
|
register,
|
||||||
verifyOtp,
|
verifyOtp,
|
||||||
resendOtp,
|
resendOtp,
|
||||||
learnLevels,
|
|
||||||
learnModules,
|
|
||||||
learnCourses,
|
|
||||||
profileImage,
|
profileImage,
|
||||||
courseLessons,
|
courseLessons,
|
||||||
profileUpdate,
|
profileUpdate,
|
||||||
|
|
@ -44,7 +41,6 @@ enum StateObjects {
|
||||||
courseCategories,
|
courseCategories,
|
||||||
profileCompletion,
|
profileCompletion,
|
||||||
registerWithGoogle,
|
registerWithGoogle,
|
||||||
learnSubcategories,
|
|
||||||
learnPracticeSample,
|
learnPracticeSample,
|
||||||
learnPracticeAnswer,
|
learnPracticeAnswer,
|
||||||
loginWithPhoneNumber,
|
loginWithPhoneNumber,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import 'dart:math';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'app_colors.dart';
|
import 'app_colors.dart';
|
||||||
|
|
||||||
// Split full name
|
// Split full name
|
||||||
Map<String, String> splitFullName(String fullName) {
|
Map<String, String> splitFullName(String fullName) {
|
||||||
final parts = fullName.trim().split(RegExp(r'\s+'));
|
final parts = fullName.trim().split(RegExp(r'\s+'));
|
||||||
|
|
|
||||||
|
|
@ -127,8 +127,8 @@ class AccountPrivacyView extends StackedView<AccountPrivacyViewModel> {
|
||||||
|
|
||||||
Widget _buildPrivacyPolicy(AccountPrivacyViewModel viewModel) =>
|
Widget _buildPrivacyPolicy(AccountPrivacyViewModel viewModel) =>
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
title: 'Privacy Policy',
|
|
||||||
icon: Icons.shield_moon_outlined,
|
icon: Icons.shield_moon_outlined,
|
||||||
|
title: 'Privacy Policy',
|
||||||
onTap: () async => await viewModel.navigateToPrivacyPolicy(),
|
onTap: () async => await viewModel.navigateToPrivacyPolicy(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ class AccountPrivacyViewModel extends BaseViewModel {
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
Future<void> navigateToTerms() async =>
|
|
||||||
await _navigationService.navigateToTermsAndConditionsView();
|
|
||||||
|
|
||||||
Future<void> navigateToLanguage() async =>
|
Future<void> navigateToLanguage() async =>
|
||||||
await _navigationService.navigateToLanguageView();
|
await _navigationService.navigateToLanguageView();
|
||||||
|
|
||||||
Future<void> navigateToPrivacyPolicy() async =>
|
Future<void> navigateToPrivacyPolicy() async =>
|
||||||
await _navigationService.navigateToPrivacyPolicyView();
|
await _navigationService.navigateToPrivacyPolicyView();
|
||||||
|
|
||||||
|
Future<void> navigateToTerms() async =>
|
||||||
|
await _navigationService.navigateToTermsAndConditionsView();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:yimaru_app/ui/views/assessment/screens/assessment_questions_screen.dart';
|
import 'package:yimaru_app/ui/views/assessment/screens/Assessment_form_screen.dart';
|
||||||
import 'package:yimaru_app/ui/views/assessment/screens/assessment_intro_screen.dart';
|
import 'package:yimaru_app/ui/views/assessment/screens/assessment_intro_screen.dart';
|
||||||
import 'package:yimaru_app/ui/views/assessment/screens/assessment_result_screen.dart';
|
import 'package:yimaru_app/ui/views/assessment/screens/assessment_result_screen.dart';
|
||||||
import 'package:yimaru_app/ui/views/assessment/screens/start_lesson_screen.dart';
|
import 'package:yimaru_app/ui/views/assessment/screens/start_lesson_screen.dart';
|
||||||
|
|
@ -51,7 +51,7 @@ class AssessmentView extends StackedView<AssessmentViewModel> {
|
||||||
|
|
||||||
Widget _buildAssessmentIntro() => const AssessmentIntroScreen();
|
Widget _buildAssessmentIntro() => const AssessmentIntroScreen();
|
||||||
|
|
||||||
Widget _buildAssessment() => const AssessmentQuestionsScreen();
|
Widget _buildAssessment() => const AssessmentFormScreen();
|
||||||
|
|
||||||
Widget _buildAssessmentResult() => const AssessmentResultScreen();
|
Widget _buildAssessmentResult() => const AssessmentResultScreen();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,14 @@ class AssessmentViewModel extends BaseViewModel {
|
||||||
|
|
||||||
int get currentQuestion => _currentQuestion;
|
int get currentQuestion => _currentQuestion;
|
||||||
|
|
||||||
List<Question> _assessments = [];
|
|
||||||
|
|
||||||
List<Question> get assessments => _assessments;
|
|
||||||
|
|
||||||
ProficiencyLevels _proficiencyLevel = ProficiencyLevels.none;
|
ProficiencyLevels _proficiencyLevel = ProficiencyLevels.none;
|
||||||
|
|
||||||
ProficiencyLevels get proficiencyLevel => _proficiencyLevel;
|
ProficiencyLevels get proficiencyLevel => _proficiencyLevel;
|
||||||
|
|
||||||
|
List<Question> _assessments = [];
|
||||||
|
|
||||||
|
List<Question> get assessments => _assessments;
|
||||||
|
|
||||||
final Map<String, dynamic> _selectedAnswers = {};
|
final Map<String, dynamic> _selectedAnswers = {};
|
||||||
|
|
||||||
Map<String, dynamic> get selectedAnswers => _selectedAnswers;
|
Map<String, dynamic> get selectedAnswers => _selectedAnswers;
|
||||||
|
|
@ -55,6 +55,20 @@ class AssessmentViewModel extends BaseViewModel {
|
||||||
Map<String, dynamic> get userData => _userData;
|
Map<String, dynamic> get userData => _userData;
|
||||||
|
|
||||||
// Assessment
|
// Assessment
|
||||||
|
int countCorrectAnswersUntil(int untilQuestion) {
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for (int i = 1; i <= untilQuestion; i++) {
|
||||||
|
final answer = _selectedAnswers[i.toString()];
|
||||||
|
|
||||||
|
if (answer is Map<String, dynamic> && answer['correct'] == true) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> evaluateAssessment() {
|
Map<String, dynamic> evaluateAssessment() {
|
||||||
if (_currentQuestion == 5) {
|
if (_currentQuestion == 5) {
|
||||||
// A1
|
// A1
|
||||||
|
|
@ -97,24 +111,6 @@ class AssessmentViewModel extends BaseViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int countCorrectAnswersUntil(int untilQuestion) {
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
for (int i = 1; i <= untilQuestion; i++) {
|
|
||||||
final answer = _selectedAnswers[i.toString()];
|
|
||||||
|
|
||||||
if (answer is Map<String, dynamic> && answer['correct'] == true) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSelectedAnswer({required int question, required String answer}) {
|
|
||||||
return _selectedAnswers[question.toString()]?['option'] == answer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSelectedAnswer({required int question, required Option? option}) {
|
void setSelectedAnswer({required int question, required Option? option}) {
|
||||||
bool correct = false;
|
bool correct = false;
|
||||||
if (option?.isCorrect ?? false) {
|
if (option?.isCorrect ?? false) {
|
||||||
|
|
@ -137,18 +133,43 @@ class AssessmentViewModel extends BaseViewModel {
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
// User data
|
bool isSelectedAnswer({required int question, required String answer}) {
|
||||||
void clearUserData() {
|
return _selectedAnswers[question.toString()]?['option'] == answer;
|
||||||
_userData.clear();
|
}
|
||||||
|
|
||||||
|
// Add user data
|
||||||
|
void initUserData(Map<String, dynamic> data) {
|
||||||
|
clearUserData();
|
||||||
|
_userData.addAll(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addUserData(Map<String, dynamic> data) {
|
void addUserData(Map<String, dynamic> data) {
|
||||||
_userData.addAll(data);
|
_userData.addAll(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initUserData(Map<String, dynamic> data) {
|
void clearUserData() {
|
||||||
clearUserData();
|
_userData.clear();
|
||||||
_userData.addAll(data);
|
}
|
||||||
|
|
||||||
|
// Dialog
|
||||||
|
Future<bool?> showAbortDialog() async {
|
||||||
|
DialogResponse? response = await _dialogService.showDialog(
|
||||||
|
cancelTitle: 'No',
|
||||||
|
buttonTitle: 'Yes',
|
||||||
|
barrierDismissible: true,
|
||||||
|
title: 'Abort Assessment',
|
||||||
|
cancelTitleColor: kcDarkGrey,
|
||||||
|
buttonTitleColor: kcPrimaryColor,
|
||||||
|
description: 'Are you sure to abort the assessment ?',
|
||||||
|
);
|
||||||
|
return response?.confirmed;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> abort() async {
|
||||||
|
bool? response = await showAbortDialog();
|
||||||
|
if (response != null && response) {
|
||||||
|
next(page: 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Question navigation
|
// Question navigation
|
||||||
|
|
@ -185,6 +206,19 @@ class AssessmentViewModel extends BaseViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// In-app navigation
|
// In-app navigation
|
||||||
|
void next({int? page}) async {
|
||||||
|
if (page == null) {
|
||||||
|
if (_previousPage != 0) {
|
||||||
|
_currentPage = _previousPage;
|
||||||
|
} else {
|
||||||
|
_currentPage++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_previousPage = _currentPage;
|
||||||
|
_currentPage = page;
|
||||||
|
}
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
void goBack() {
|
void goBack() {
|
||||||
if (_currentPage == 0) {
|
if (_currentPage == 0) {
|
||||||
|
|
@ -202,51 +236,23 @@ class AssessmentViewModel extends BaseViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void next({int? page}) async {
|
|
||||||
if (page == null) {
|
|
||||||
if (_previousPage != 0) {
|
|
||||||
_currentPage = _previousPage;
|
|
||||||
} else {
|
|
||||||
_currentPage++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_previousPage = _currentPage;
|
|
||||||
_currentPage = page;
|
|
||||||
}
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dialog
|
|
||||||
Future<void> abort() async {
|
|
||||||
bool? response = await showAbortDialog();
|
|
||||||
if (response != null && response) {
|
|
||||||
next(page: 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool?> showAbortDialog() async {
|
|
||||||
DialogResponse? response = await _dialogService.showDialog(
|
|
||||||
cancelTitle: 'No',
|
|
||||||
buttonTitle: 'Yes',
|
|
||||||
barrierDismissible: true,
|
|
||||||
title: 'Abort Assessment',
|
|
||||||
cancelTitleColor: kcDarkGrey,
|
|
||||||
buttonTitleColor: kcPrimaryColor,
|
|
||||||
description: 'Are you sure to abort the assessment ?',
|
|
||||||
);
|
|
||||||
return response?.confirmed;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
Future<void> replaceWithHome() async =>
|
|
||||||
await _navigationService.clearStackAndShow(Routes.homeView);
|
|
||||||
|
|
||||||
Future<void> navigateToLanguage() async =>
|
Future<void> navigateToLanguage() async =>
|
||||||
await _navigationService.navigateToLanguageView();
|
await _navigationService.navigateToLanguageView();
|
||||||
|
|
||||||
|
Future<void> replaceWithHome() async =>
|
||||||
|
await _navigationService.clearStackAndShow(Routes.homeView);
|
||||||
|
|
||||||
// Remote api call
|
// Remote api call
|
||||||
|
Future<void> getAssessments() async => await runBusyFuture(_getAssessments());
|
||||||
|
|
||||||
|
Future<void> _getAssessments() async {
|
||||||
|
if (await _statusChecker.checkConnection()) {
|
||||||
|
_assessments = await _apiService.getAssessments();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Complete profile
|
// Complete profile
|
||||||
Future<void> completeProfile() async =>
|
Future<void> completeProfile() async =>
|
||||||
|
|
@ -266,13 +272,4 @@ class AssessmentViewModel extends BaseViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assessments
|
|
||||||
Future<void> _getAssessments() async {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
_assessments = await _apiService.getAssessments();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getAssessments() async => await runBusyFuture(_getAssessments());
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import 'package:yimaru_app/ui/widgets/large_app_bar.dart';
|
||||||
import '../assessment_viewmodel.dart';
|
import '../assessment_viewmodel.dart';
|
||||||
import 'assessment_loading_screen.dart';
|
import 'assessment_loading_screen.dart';
|
||||||
|
|
||||||
class AssessmentQuestionsScreen extends ViewModelWidget<AssessmentViewModel> {
|
class AssessmentFormScreen extends ViewModelWidget<AssessmentViewModel> {
|
||||||
const AssessmentQuestionsScreen({super.key});
|
const AssessmentFormScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, AssessmentViewModel viewModel) =>
|
Widget build(BuildContext context, AssessmentViewModel viewModel) =>
|
||||||
|
|
@ -109,14 +109,14 @@ class AssessmentQuestionsScreen extends ViewModelWidget<AssessmentViewModel> {
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: viewModel.assessments[index].options?.length,
|
itemCount: viewModel.assessments[index].options?.length,
|
||||||
itemBuilder: (context, inner) => _buildAnswer(
|
itemBuilder: (context, inner) => _buildAnswer(
|
||||||
onTap: () => viewModel.setSelectedAnswer(
|
|
||||||
question: index + 1,
|
|
||||||
option: viewModel.assessments[index].options?[inner]),
|
|
||||||
title: viewModel.assessments[index].options?[inner].optionText ?? '',
|
title: viewModel.assessments[index].options?[inner].optionText ?? '',
|
||||||
selected: viewModel.isSelectedAnswer(
|
selected: viewModel.isSelectedAnswer(
|
||||||
question: index + 1,
|
question: index + 1,
|
||||||
answer: viewModel.assessments[index].options?[inner].optionText ??
|
answer: viewModel.assessments[index].options?[inner].optionText ??
|
||||||
''),
|
''),
|
||||||
|
onTap: () => viewModel.setSelectedAnswer(
|
||||||
|
question: index + 1,
|
||||||
|
option: viewModel.assessments[index].options?[inner]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
import '../../../models/course_detail.dart';
|
import '../../../models/course_detail.dart';
|
||||||
import '../../../models/subcategory.dart';
|
import '../../../models/course_subcategory.dart';
|
||||||
import '../../common/app_colors.dart';
|
import '../../common/app_colors.dart';
|
||||||
import '../../common/enmus.dart';
|
import '../../common/enmus.dart';
|
||||||
import '../../common/ui_helpers.dart';
|
import '../../common/ui_helpers.dart';
|
||||||
|
|
@ -12,7 +12,7 @@ import '../../widgets/small_app_bar.dart';
|
||||||
import 'course_viewmodel.dart';
|
import 'course_viewmodel.dart';
|
||||||
|
|
||||||
class CourseView extends StackedView<CourseViewModel> {
|
class CourseView extends StackedView<CourseViewModel> {
|
||||||
final Subcategory subcategory;
|
final CourseSubcategory subcategory;
|
||||||
|
|
||||||
const CourseView({Key? key, required this.subcategory}) : super(key: key);
|
const CourseView({Key? key, required this.subcategory}) : super(key: key);
|
||||||
|
|
||||||
|
|
@ -83,12 +83,12 @@ class CourseView extends StackedView<CourseViewModel> {
|
||||||
];
|
];
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
Widget _buildTitle() => Text(
|
||||||
'${subcategory.name ?? ''} courses',
|
'${subcategory.title ?? ''} courses',
|
||||||
style: style18DG700,
|
style: style18DG700,
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildSubtitle() => Text(
|
Widget _buildSubtitle() => Text(
|
||||||
'Explore variety of courses on ${subcategory.name ?? ''}.',
|
'Explore variety of courses on ${subcategory.title ?? ''}.',
|
||||||
style: style14DG400,
|
style: style14DG400,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -105,7 +105,6 @@ class CourseView extends StackedView<CourseViewModel> {
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: viewModel.courseDetail.length,
|
itemCount: viewModel.courseDetail.length,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
separatorBuilder: (context, index) => verticalSpaceSmall,
|
|
||||||
itemBuilder: (context, index) => _buildTile(
|
itemBuilder: (context, index) => _buildTile(
|
||||||
courseDetail: viewModel.courseDetail[index],
|
courseDetail: viewModel.courseDetail[index],
|
||||||
onCourseTap: () async => await viewModel
|
onCourseTap: () async => await viewModel
|
||||||
|
|
@ -113,6 +112,7 @@ class CourseView extends StackedView<CourseViewModel> {
|
||||||
onPracticeTap: () async => await viewModel.navigateToCoursePractice(
|
onPracticeTap: () async => await viewModel.navigateToCoursePractice(
|
||||||
viewModel.courseDetail[index].course?.id ?? 0),
|
viewModel.courseDetail[index].course?.id ?? 0),
|
||||||
),
|
),
|
||||||
|
separatorBuilder: (context, index) => verticalSpaceSmall,
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildTile({
|
Widget _buildTile({
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import '../../common/enmus.dart';
|
||||||
|
|
||||||
class CourseViewModel extends BaseViewModel {
|
class CourseViewModel extends BaseViewModel {
|
||||||
// Dependency injection
|
// Dependency injection
|
||||||
|
|
||||||
final _courseService = locator<CourseService>();
|
final _courseService = locator<CourseService>();
|
||||||
|
|
||||||
final _statusChecker = locator<StatusCheckerService>();
|
final _statusChecker = locator<StatusCheckerService>();
|
||||||
|
|
@ -25,15 +26,15 @@ class CourseViewModel extends BaseViewModel {
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
Future<void> navigateToCoursePractice(int id) =>
|
|
||||||
_navigationService.navigateToCoursePracticeView(id: id);
|
|
||||||
|
|
||||||
Future<void> navigateToCoursePayment(Course course) async =>
|
Future<void> navigateToCoursePayment(Course course) async =>
|
||||||
_navigationService.navigateToCoursePaymentView(course: course);
|
_navigationService.navigateToCoursePaymentView(course: course);
|
||||||
|
|
||||||
|
Future<void> navigateToCoursePractice(int id) =>
|
||||||
|
_navigationService.navigateToCoursePracticeView(id: id);
|
||||||
|
|
||||||
// Remote api call
|
// Remote api call
|
||||||
|
|
||||||
// Course detail
|
// Sub course
|
||||||
Future<void> getCourseDetails(int id) async =>
|
Future<void> getCourseDetails(int id) async =>
|
||||||
await runBusyFuture(_getCourseDetails(id),
|
await runBusyFuture(_getCourseDetails(id),
|
||||||
busyObject: StateObjects.courses);
|
busyObject: StateObjects.courses);
|
||||||
|
|
@ -41,8 +42,8 @@ class CourseViewModel extends BaseViewModel {
|
||||||
Future<void> _getCourseDetails(int id) async {
|
Future<void> _getCourseDetails(int id) async {
|
||||||
if (await _statusChecker.checkConnection()) {
|
if (await _statusChecker.checkConnection()) {
|
||||||
_courseDetail = await _courseService.getCoursesDetail(id);
|
_courseDetail = await _courseService.getCoursesDetail(id);
|
||||||
// _courseDetail.sort((a, b) =>
|
_courseDetail.sort((a, b) =>
|
||||||
// (a.course?.displayOrder ?? 0).compareTo(b.course?.displayOrder ?? 0));
|
(a.course?.displayOrder ?? 0).compareTo(b.course?.displayOrder ?? 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
import '../../../models/category.dart';
|
import '../../../models/course_category.dart';
|
||||||
import '../../common/app_colors.dart';
|
import '../../common/app_colors.dart';
|
||||||
import '../../common/enmus.dart';
|
import '../../common/enmus.dart';
|
||||||
import '../../common/ui_helpers.dart';
|
import '../../common/ui_helpers.dart';
|
||||||
|
|
@ -15,7 +15,7 @@ class CourseCategoryView extends StackedView<CourseCategoryViewModel> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onViewModelReady(CourseCategoryViewModel viewModel) async {
|
void onViewModelReady(CourseCategoryViewModel viewModel) async {
|
||||||
await viewModel.getCategories();
|
await viewModel.getCourseCategories();
|
||||||
super.onViewModelReady(viewModel);
|
super.onViewModelReady(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ class CourseCategoryView extends StackedView<CourseCategoryViewModel> {
|
||||||
|
|
||||||
//
|
//
|
||||||
Widget _buildTile({
|
Widget _buildTile({
|
||||||
required Category category,
|
required CourseCategory category,
|
||||||
required GestureTapCallback onTap,
|
required GestureTapCallback onTap,
|
||||||
}) =>
|
}) =>
|
||||||
CourseCategoryCard(
|
CourseCategoryCard(
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import 'package:stacked_services/stacked_services.dart';
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../app/app.router.dart';
|
import '../../../app/app.router.dart';
|
||||||
import '../../../models/category.dart';
|
import '../../../models/course_category.dart';
|
||||||
import '../../../models/user.dart';
|
import '../../../models/user_model.dart';
|
||||||
import '../../../services/api_service.dart';
|
import '../../../services/api_service.dart';
|
||||||
import '../../../services/authentication_service.dart';
|
import '../../../services/authentication_service.dart';
|
||||||
import '../../../services/status_checker_service.dart';
|
import '../../../services/status_checker_service.dart';
|
||||||
|
|
@ -25,30 +25,31 @@ class CourseCategoryViewModel extends ReactiveViewModel {
|
||||||
[_authenticationService];
|
[_authenticationService];
|
||||||
|
|
||||||
// Current user
|
// Current user
|
||||||
User? get _user => _authenticationService.user;
|
UserModel? get _user => _authenticationService.user;
|
||||||
|
|
||||||
User? get user => _user;
|
UserModel? get user => _user;
|
||||||
|
|
||||||
// Course categories
|
// Course categories
|
||||||
List<Category> _categories = [];
|
List<CourseCategory> _categories = [];
|
||||||
|
|
||||||
List<Category> get categories => _categories;
|
List<CourseCategory> get categories => _categories;
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
Future<void> navigateToCourseCategory(Category category) async =>
|
Future<void> navigateToCourseCategory(CourseCategory category) async =>
|
||||||
_navigationService.navigateToCourseSubcategoryView(category: category);
|
_navigationService.navigateToCourseSubcategoryView(category: category);
|
||||||
|
|
||||||
// Remote api call
|
// Remote api call
|
||||||
|
|
||||||
// Course categories
|
// Course categories
|
||||||
Future<void> getCategories() async =>
|
Future<void> getCourseCategories() async =>
|
||||||
await runBusyFuture(_getCategories(),
|
await runBusyFuture(_getCourseCategories(),
|
||||||
busyObject: StateObjects.courseCategories);
|
busyObject: StateObjects.courseCategories);
|
||||||
|
|
||||||
Future<void> _getCategories() async {
|
Future<void> _getCourseCategories() async {
|
||||||
if (categories.isEmpty) {
|
if (categories.isEmpty) {
|
||||||
if (await _statusChecker.checkConnection()) {
|
if (await _statusChecker.checkConnection()) {
|
||||||
_categories = await _apiService.getCategories();
|
_categories = await _apiService.getCourseCategories();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,12 @@ class CourseLessonView extends StackedView<CourseLessonViewModel> {
|
||||||
children: _buildLessonColumnChildren(viewModel),
|
children: _buildLessonColumnChildren(viewModel),
|
||||||
);
|
);
|
||||||
|
|
||||||
List<Widget> _buildLessonColumnChildren(CourseLessonViewModel viewModel) =>
|
List<Widget> _buildLessonColumnChildren(CourseLessonViewModel viewModel) => [
|
||||||
[_buildTitle(), verticalSpaceMedium, _buildListViewBuilder(viewModel)];
|
// verticalSpaceLarge,
|
||||||
|
_buildTitle(),
|
||||||
|
verticalSpaceMedium,
|
||||||
|
_buildListViewBuilder(viewModel)
|
||||||
|
];
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
Widget _buildTitle() => Text(
|
||||||
'${course.title} course lessons',
|
'${course.title} course lessons',
|
||||||
|
|
|
||||||
|
|
@ -29,38 +29,6 @@ class CourseLessonDetailViewModel extends BaseViewModel {
|
||||||
VideoPlayerController? get videoPlayerController => _videoPlayerController;
|
VideoPlayerController? get videoPlayerController => _videoPlayerController;
|
||||||
|
|
||||||
// Video player
|
// Video player
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_videoPlayerController?.dispose();
|
|
||||||
_chewieController?.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> pause() async {
|
|
||||||
await _chewieController?.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _videoListener(CourseLesson lesson) async {
|
|
||||||
final controller = _videoPlayerController;
|
|
||||||
|
|
||||||
if (controller == null || !controller.value.isInitialized) return;
|
|
||||||
|
|
||||||
final position = controller.value.position;
|
|
||||||
final duration = controller.value.duration;
|
|
||||||
|
|
||||||
if (duration.inSeconds == 0) return;
|
|
||||||
|
|
||||||
double progress = position.inSeconds / duration.inSeconds;
|
|
||||||
|
|
||||||
print("Video progress: ${(progress * 100).toStringAsFixed(2)}%");
|
|
||||||
|
|
||||||
// Example: mark completion at 95%
|
|
||||||
if (progress >= 0.95) {
|
|
||||||
await _onVideoCompleted(lesson);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initializePlayer(CourseLesson lesson) async =>
|
Future<void> initializePlayer(CourseLesson lesson) async =>
|
||||||
await runBusyFuture(_initializePlayer(lesson),
|
await runBusyFuture(_initializePlayer(lesson),
|
||||||
busyObject: StateObjects.loadCourseVideo);
|
busyObject: StateObjects.loadCourseVideo);
|
||||||
|
|
@ -91,6 +59,26 @@ class CourseLessonDetailViewModel extends BaseViewModel {
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _videoListener(CourseLesson lesson) async {
|
||||||
|
final controller = _videoPlayerController;
|
||||||
|
|
||||||
|
if (controller == null || !controller.value.isInitialized) return;
|
||||||
|
|
||||||
|
final position = controller.value.position;
|
||||||
|
final duration = controller.value.duration;
|
||||||
|
|
||||||
|
if (duration.inSeconds == 0) return;
|
||||||
|
|
||||||
|
double progress = position.inSeconds / duration.inSeconds;
|
||||||
|
|
||||||
|
print("Video progress: ${(progress * 100).toStringAsFixed(2)}%");
|
||||||
|
|
||||||
|
// Example: mark completion at 95%
|
||||||
|
if (progress >= 0.95) {
|
||||||
|
await _onVideoCompleted(lesson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _onVideoCompleted(CourseLesson lesson) async {
|
Future<void> _onVideoCompleted(CourseLesson lesson) async {
|
||||||
if (_isCompleted) return;
|
if (_isCompleted) return;
|
||||||
|
|
||||||
|
|
@ -101,6 +89,17 @@ class CourseLessonDetailViewModel extends BaseViewModel {
|
||||||
await _apiService.completeLesson(lesson.id ?? 0);
|
await _apiService.completeLesson(lesson.id ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> pause() async {
|
||||||
|
await _chewieController?.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_videoPlayerController?.dispose();
|
||||||
|
_chewieController?.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,17 +95,17 @@ class CoursePracticeView extends StackedView<CoursePracticeViewModel> {
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: viewModel.coursePractices.length,
|
itemCount: viewModel.coursePractices.length,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemBuilder: (context, index) => _buildCard(
|
||||||
|
title: viewModel.coursePractices[index].title ?? '',
|
||||||
|
onTap: () async =>
|
||||||
|
await viewModel.navigateToCoursePracticeQuestion(viewModel.coursePractices[index].id ?? 0),
|
||||||
|
),
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
mainAxisSpacing: 15,
|
mainAxisSpacing: 15,
|
||||||
crossAxisSpacing: 15,
|
crossAxisSpacing: 15,
|
||||||
childAspectRatio: 1.2,
|
childAspectRatio: 1.2,
|
||||||
),
|
),
|
||||||
itemBuilder: (context, index) => _buildCard(
|
|
||||||
title: viewModel.coursePractices[index].title ?? '',
|
|
||||||
onTap: () async => await viewModel.navigateToCoursePracticeQuestion(
|
|
||||||
viewModel.coursePractices[index].id ?? 0),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildCard({
|
Widget _buildCard({
|
||||||
|
|
|
||||||
|
|
@ -56,80 +56,13 @@ class CoursePracticeQuestionViewModel extends FormViewModel {
|
||||||
|
|
||||||
Map<String, dynamic> get selectedAnswers => _selectedAnswers;
|
Map<String, dynamic> get selectedAnswers => _selectedAnswers;
|
||||||
|
|
||||||
// Question navigation
|
// Question
|
||||||
void previousQuestion() {
|
|
||||||
if (_currentQuestionIndex != 0) {
|
|
||||||
_currentQuestionIndex--;
|
|
||||||
_pageController.previousPage(
|
|
||||||
duration: const Duration(microseconds: 100), curve: Curves.linear);
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// In-app navigation
|
|
||||||
void goBack() {
|
|
||||||
if (_currentPage == 0) {
|
|
||||||
pop();
|
|
||||||
} else {
|
|
||||||
_currentPage = 0;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void goTo(int page) {
|
|
||||||
_currentPage = page;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
void next({int? page}) async {
|
|
||||||
if (page == null) {
|
|
||||||
if (_previousPage != 0) {
|
|
||||||
_currentPage = _previousPage;
|
|
||||||
} else {
|
|
||||||
_currentPage++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_previousPage = _currentPage;
|
|
||||||
_currentPage = page;
|
|
||||||
}
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Answer
|
|
||||||
void reset() {
|
|
||||||
_selectedAnswers.clear();
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAnswerFocus() {
|
void setAnswerFocus() {
|
||||||
_focusAnswer = true;
|
_focusAnswer = true;
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> abort() async {
|
|
||||||
bool? response = await showAbortDialog();
|
|
||||||
if (response != null && response) {
|
|
||||||
next(page: 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool?> showAbortDialog() async {
|
|
||||||
DialogResponse? response = await _dialogService.showDialog(
|
|
||||||
cancelTitle: 'No',
|
|
||||||
buttonTitle: 'Yes',
|
|
||||||
title: 'Abort Practice',
|
|
||||||
barrierDismissible: true,
|
|
||||||
cancelTitleColor: kcDarkGrey,
|
|
||||||
buttonTitleColor: kcPrimaryColor,
|
|
||||||
description: 'Are you sure to abort the practice ?',
|
|
||||||
);
|
|
||||||
return response?.confirmed;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSelectedAnswer({required int question, required String answer}) {
|
|
||||||
return _selectedAnswers[question.toString()]?['option'] == answer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSelectedAnswer({required int question, required Option? option}) {
|
void setSelectedAnswer({required int question, required Option? option}) {
|
||||||
bool correct = false;
|
bool correct = false;
|
||||||
if (option?.isCorrect ?? false) {
|
if (option?.isCorrect ?? false) {
|
||||||
|
|
@ -151,29 +84,81 @@ class CoursePracticeQuestionViewModel extends FormViewModel {
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isSelectedAnswer({required int question, required String answer}) {
|
||||||
|
return _selectedAnswers[question.toString()]?['option'] == answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dialog
|
||||||
|
Future<bool?> showAbortDialog() async {
|
||||||
|
DialogResponse? response = await _dialogService.showDialog(
|
||||||
|
cancelTitle: 'No',
|
||||||
|
buttonTitle: 'Yes',
|
||||||
|
title: 'Abort Practice',
|
||||||
|
barrierDismissible: true,
|
||||||
|
cancelTitleColor: kcDarkGrey,
|
||||||
|
buttonTitleColor: kcPrimaryColor,
|
||||||
|
description: 'Are you sure to abort the practice ?',
|
||||||
|
);
|
||||||
|
return response?.confirmed;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> abort() async {
|
||||||
|
bool? response = await showAbortDialog();
|
||||||
|
if (response != null && response) {
|
||||||
|
next(page: 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset practice
|
||||||
|
void reset() {
|
||||||
|
_selectedAnswers.clear();
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Question navigation
|
||||||
|
void previousQuestion() {
|
||||||
|
if (_currentQuestionIndex != 0) {
|
||||||
|
_currentQuestionIndex--;
|
||||||
|
_pageController.previousPage(
|
||||||
|
duration: const Duration(microseconds: 100), curve: Curves.linear);
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// In-app navigation
|
||||||
|
void goTo(int page) {
|
||||||
|
_currentPage = page;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void next({int? page}) async {
|
||||||
|
if (page == null) {
|
||||||
|
if (_previousPage != 0) {
|
||||||
|
_currentPage = _previousPage;
|
||||||
|
} else {
|
||||||
|
_currentPage++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_previousPage = _currentPage;
|
||||||
|
_currentPage = page;
|
||||||
|
}
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void goBack() {
|
||||||
|
if (_currentPage == 0) {
|
||||||
|
pop();
|
||||||
|
} else {
|
||||||
|
_currentPage = 0;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
// Remote api call
|
// Remote api call
|
||||||
|
|
||||||
// Question navigation
|
|
||||||
Future<void> _nextQuestion(int id) async {
|
|
||||||
_currentQuestionIndex++;
|
|
||||||
|
|
||||||
if (_currentQuestionIndex == _coursePracticeQuestions.length) {
|
|
||||||
next();
|
|
||||||
} else {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
_currentQuestion = await _apiService.getCoursePracticeQuestion(id);
|
|
||||||
_pageController.jumpToPage(_currentQuestionIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> nextQuestion(int id) async =>
|
|
||||||
await runBusyFuture(_nextQuestion(id),
|
|
||||||
busyObject: StateObjects.coursePractice);
|
|
||||||
|
|
||||||
// Course practice questions
|
// Course practice questions
|
||||||
Future<void> getCoursePracticeQuestions(int id) async =>
|
Future<void> getCoursePracticeQuestions(int id) async =>
|
||||||
await runBusyFuture(_getCoursePracticeQuestions(id),
|
await runBusyFuture(_getCoursePracticeQuestions(id),
|
||||||
|
|
@ -200,4 +185,25 @@ class CoursePracticeQuestionViewModel extends FormViewModel {
|
||||||
_currentQuestion = await _apiService.getCoursePracticeQuestion(id);
|
_currentQuestion = await _apiService.getCoursePracticeQuestion(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Question navigation
|
||||||
|
Future<void> nextQuestion(int id) async =>
|
||||||
|
await runBusyFuture(_nextQuestion(id),
|
||||||
|
busyObject: StateObjects.coursePractice);
|
||||||
|
|
||||||
|
Future<void> _nextQuestion(int id)async{
|
||||||
|
_currentQuestionIndex++;
|
||||||
|
|
||||||
|
if (_currentQuestionIndex == _coursePracticeQuestions.length) {
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
if (await _statusChecker.checkConnection()) {
|
||||||
|
_currentQuestion = await _apiService.getCoursePracticeQuestion(id);
|
||||||
|
_pageController.jumpToPage(_currentQuestionIndex);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
import '../../../models/category.dart';
|
import '../../../models/course_category.dart';
|
||||||
import '../../../models/subcategory.dart';
|
import '../../../models/course_subcategory.dart';
|
||||||
import '../../common/app_colors.dart';
|
import '../../common/app_colors.dart';
|
||||||
import '../../common/enmus.dart';
|
import '../../common/enmus.dart';
|
||||||
import '../../common/ui_helpers.dart';
|
import '../../common/ui_helpers.dart';
|
||||||
|
|
@ -12,14 +12,14 @@ import '../../widgets/small_app_bar.dart';
|
||||||
import 'course_subcategory_viewmodel.dart';
|
import 'course_subcategory_viewmodel.dart';
|
||||||
|
|
||||||
class CourseSubcategoryView extends StackedView<CourseSubcategoryViewModel> {
|
class CourseSubcategoryView extends StackedView<CourseSubcategoryViewModel> {
|
||||||
final Category category;
|
final CourseCategory category;
|
||||||
|
|
||||||
const CourseSubcategoryView({Key? key, required this.category})
|
const CourseSubcategoryView({Key? key, required this.category})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onViewModelReady(CourseSubcategoryViewModel viewModel) async {
|
void onViewModelReady(CourseSubcategoryViewModel viewModel) async {
|
||||||
await viewModel.getSubcategories(category.id ?? 0);
|
await viewModel.getCourseSubcategories(category.id ?? 0);
|
||||||
super.onViewModelReady(viewModel);
|
super.onViewModelReady(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ class CourseSubcategoryView extends StackedView<CourseSubcategoryViewModel> {
|
||||||
Widget _buildTile({
|
Widget _buildTile({
|
||||||
GestureTapCallback? onCourseTap,
|
GestureTapCallback? onCourseTap,
|
||||||
GestureTapCallback? onPracticeTap,
|
GestureTapCallback? onPracticeTap,
|
||||||
required Subcategory subcategory,
|
required CourseSubcategory subcategory,
|
||||||
}) =>
|
}) =>
|
||||||
CourseSubcategoryTile(
|
CourseSubcategoryTile(
|
||||||
subcategory: subcategory,
|
subcategory: subcategory,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import 'package:stacked_services/stacked_services.dart';
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../app/app.router.dart';
|
import '../../../app/app.router.dart';
|
||||||
import '../../../models/subcategory.dart';
|
import '../../../models/course_subcategory.dart';
|
||||||
import '../../../services/api_service.dart';
|
import '../../../services/api_service.dart';
|
||||||
import '../../../services/status_checker_service.dart';
|
import '../../../services/status_checker_service.dart';
|
||||||
import '../../common/enmus.dart';
|
import '../../common/enmus.dart';
|
||||||
|
|
@ -16,10 +16,10 @@ class CourseSubcategoryViewModel extends BaseViewModel {
|
||||||
|
|
||||||
final _navigationService = locator<NavigationService>();
|
final _navigationService = locator<NavigationService>();
|
||||||
|
|
||||||
// Course subcategories
|
// Courses
|
||||||
List<Subcategory> _subcategories = [];
|
List<CourseSubcategory> _subcategories = [];
|
||||||
|
|
||||||
List<Subcategory> get subcategories => _subcategories;
|
List<CourseSubcategory> get subcategories => _subcategories;
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
@ -27,19 +27,20 @@ class CourseSubcategoryViewModel extends BaseViewModel {
|
||||||
Future<void> navigateToCoursePractice(int id) async =>
|
Future<void> navigateToCoursePractice(int id) async =>
|
||||||
_navigationService.navigateToCoursePracticeView(id: id);
|
_navigationService.navigateToCoursePracticeView(id: id);
|
||||||
|
|
||||||
Future<void> navigateToSubcourse(Subcategory subcategory) async =>
|
Future<void> navigateToSubcourse(CourseSubcategory subcategory) async =>
|
||||||
_navigationService.navigateToCourseView(subcategory: subcategory);
|
_navigationService.navigateToCourseView(subcategory: subcategory);
|
||||||
|
|
||||||
// Remote api call
|
// Remote api call
|
||||||
|
|
||||||
// Course subcategories
|
// Courses
|
||||||
Future<void> getSubcategories(int id) async =>
|
Future<void> getCourseSubcategories(int id) async =>
|
||||||
await runBusyFuture(_getSubcategories(id),
|
await runBusyFuture(_getCourseSubcategories(id),
|
||||||
busyObject: StateObjects.subcategories);
|
busyObject: StateObjects.subcategories);
|
||||||
|
|
||||||
Future<void> _getSubcategories(int id) async {
|
Future<void> _getCourseSubcategories(int id) async {
|
||||||
if (await _statusChecker.checkConnection()) {
|
if (await _statusChecker.checkConnection()) {
|
||||||
_subcategories = await _apiService.getSubcategories(id);
|
_subcategories = await _apiService.getCourseSubcategories(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,32 +169,41 @@ class DuolingoViewModel extends FormViewModel {
|
||||||
|
|
||||||
List<String> get listeningAssessments => _listeningAssessments;
|
List<String> get listeningAssessments => _listeningAssessments;
|
||||||
|
|
||||||
// Assessment
|
// Topics
|
||||||
void setSpeakingState() {
|
|
||||||
_isSpeaking = !_isSpeaking;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAssessmentFocus() {
|
void setAssessmentFocus() {
|
||||||
_assessmentFocus = true;
|
_assessmentFocus = true;
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Speaking state
|
||||||
|
void setSpeakingState() {
|
||||||
|
_isSpeaking = !_isSpeaking;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set assessment
|
||||||
void setSelectedAssessment(
|
void setSelectedAssessment(
|
||||||
{required int page, required Map<String, dynamic> assessment}) {
|
{required int page, required Map<String, dynamic> assessment}) {
|
||||||
_selectedAssessment = assessment;
|
_selectedAssessment = assessment;
|
||||||
goTo(page);
|
goTo(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSelectedListeningAssessment(String value) =>
|
// Listening assessment
|
||||||
_selectedListeningAssessment == value;
|
|
||||||
|
|
||||||
void setSelectedListeningAssessment(String value) {
|
void setSelectedListeningAssessment(String value) {
|
||||||
_selectedListeningAssessment = value;
|
_selectedListeningAssessment = value;
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isSelectedListeningAssessment(String value) =>
|
||||||
|
_selectedListeningAssessment == value;
|
||||||
|
|
||||||
// In-app navigation
|
// In-app navigation
|
||||||
|
void goTo(int page) {
|
||||||
|
_currentPage = page;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
void goBack() {
|
void goBack() {
|
||||||
if (_currentPage == 0) {
|
if (_currentPage == 0) {
|
||||||
pop();
|
pop();
|
||||||
|
|
@ -204,11 +213,6 @@ class DuolingoViewModel extends FormViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void goTo(int page) {
|
|
||||||
_currentPage = page;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ class DuolingoRetakeScreen extends ViewModelWidget<DuolingoViewModel> {
|
||||||
height: 55,
|
height: 55,
|
||||||
safe: false,
|
safe: false,
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
text: 'Practice Again',
|
|
||||||
foregroundColor: kcWhite,
|
foregroundColor: kcWhite,
|
||||||
|
text: 'Practice Again',
|
||||||
onTap: () => viewModel.goTo(0),
|
onTap: () => viewModel.goTo(0),
|
||||||
backgroundColor: kcPrimaryColor,
|
backgroundColor: kcPrimaryColor,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,14 @@ class DuolingoSpeakingAssessment1Question
|
||||||
[_buildTimer(), _buildCountdownTime()];
|
[_buildTimer(), _buildCountdownTime()];
|
||||||
|
|
||||||
Widget _buildTimer() => const CircularProgressIndicator(
|
Widget _buildTimer() => const CircularProgressIndicator(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minWidth: 50,
|
||||||
|
minHeight: 50,
|
||||||
|
),
|
||||||
value: 1.0,
|
value: 1.0,
|
||||||
strokeWidth: 5,
|
strokeWidth: 5,
|
||||||
color: kcPrimaryColor,
|
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
constraints: BoxConstraints(minWidth: 50, minHeight: 50),
|
color: kcPrimaryColor,
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildCountdownTime() => Text(
|
Widget _buildCountdownTime() => Text(
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ import '../../common/validators/form_validator.dart';
|
||||||
import 'forget_password_viewmodel.dart';
|
import 'forget_password_viewmodel.dart';
|
||||||
|
|
||||||
@FormView(fields: [
|
@FormView(fields: [
|
||||||
FormTextField(name: 'password', validator: FormValidator.validateForm),
|
|
||||||
FormTextField(name: 'resetCode', validator: FormValidator.validateForm),
|
|
||||||
FormTextField(name: 'email', validator: FormValidator.validateEmailForm),
|
FormTextField(name: 'email', validator: FormValidator.validateEmailForm),
|
||||||
|
FormTextField(name: 'resetCode', validator: FormValidator.validateForm),
|
||||||
|
FormTextField(name: 'password', validator: FormValidator.validateForm),
|
||||||
FormTextField(name: 'confirmPassword', validator: FormValidator.validateForm)
|
FormTextField(name: 'confirmPassword', validator: FormValidator.validateForm)
|
||||||
])
|
])
|
||||||
class ForgetPasswordView extends StackedView<ForgetPasswordViewModel>
|
class ForgetPasswordView extends StackedView<ForgetPasswordViewModel>
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ import 'package:yimaru_app/ui/common/validators/form_validator.dart';
|
||||||
|
|
||||||
const bool _autoTextFieldValidation = true;
|
const bool _autoTextFieldValidation = true;
|
||||||
|
|
||||||
const String PasswordValueKey = 'password';
|
|
||||||
const String ResetCodeValueKey = 'resetCode';
|
|
||||||
const String EmailValueKey = 'email';
|
const String EmailValueKey = 'email';
|
||||||
|
const String ResetCodeValueKey = 'resetCode';
|
||||||
|
const String PasswordValueKey = 'password';
|
||||||
const String ConfirmPasswordValueKey = 'confirmPassword';
|
const String ConfirmPasswordValueKey = 'confirmPassword';
|
||||||
|
|
||||||
final Map<String, TextEditingController>
|
final Map<String, TextEditingController>
|
||||||
|
|
@ -24,25 +24,25 @@ final Map<String, FocusNode> _ForgetPasswordViewFocusNodes = {};
|
||||||
|
|
||||||
final Map<String, String? Function(String?)?>
|
final Map<String, String? Function(String?)?>
|
||||||
_ForgetPasswordViewTextValidations = {
|
_ForgetPasswordViewTextValidations = {
|
||||||
PasswordValueKey: FormValidator.validateForm,
|
|
||||||
ResetCodeValueKey: FormValidator.validateForm,
|
|
||||||
EmailValueKey: FormValidator.validateEmailForm,
|
EmailValueKey: FormValidator.validateEmailForm,
|
||||||
|
ResetCodeValueKey: FormValidator.validateForm,
|
||||||
|
PasswordValueKey: FormValidator.validateForm,
|
||||||
ConfirmPasswordValueKey: FormValidator.validateForm,
|
ConfirmPasswordValueKey: FormValidator.validateForm,
|
||||||
};
|
};
|
||||||
|
|
||||||
mixin $ForgetPasswordView {
|
mixin $ForgetPasswordView {
|
||||||
TextEditingController get passwordController =>
|
|
||||||
_getFormTextEditingController(PasswordValueKey);
|
|
||||||
TextEditingController get resetCodeController =>
|
|
||||||
_getFormTextEditingController(ResetCodeValueKey);
|
|
||||||
TextEditingController get emailController =>
|
TextEditingController get emailController =>
|
||||||
_getFormTextEditingController(EmailValueKey);
|
_getFormTextEditingController(EmailValueKey);
|
||||||
|
TextEditingController get resetCodeController =>
|
||||||
|
_getFormTextEditingController(ResetCodeValueKey);
|
||||||
|
TextEditingController get passwordController =>
|
||||||
|
_getFormTextEditingController(PasswordValueKey);
|
||||||
TextEditingController get confirmPasswordController =>
|
TextEditingController get confirmPasswordController =>
|
||||||
_getFormTextEditingController(ConfirmPasswordValueKey);
|
_getFormTextEditingController(ConfirmPasswordValueKey);
|
||||||
|
|
||||||
FocusNode get passwordFocusNode => _getFormFocusNode(PasswordValueKey);
|
|
||||||
FocusNode get resetCodeFocusNode => _getFormFocusNode(ResetCodeValueKey);
|
|
||||||
FocusNode get emailFocusNode => _getFormFocusNode(EmailValueKey);
|
FocusNode get emailFocusNode => _getFormFocusNode(EmailValueKey);
|
||||||
|
FocusNode get resetCodeFocusNode => _getFormFocusNode(ResetCodeValueKey);
|
||||||
|
FocusNode get passwordFocusNode => _getFormFocusNode(PasswordValueKey);
|
||||||
FocusNode get confirmPasswordFocusNode =>
|
FocusNode get confirmPasswordFocusNode =>
|
||||||
_getFormFocusNode(ConfirmPasswordValueKey);
|
_getFormFocusNode(ConfirmPasswordValueKey);
|
||||||
|
|
||||||
|
|
@ -70,9 +70,9 @@ mixin $ForgetPasswordView {
|
||||||
/// Registers a listener on every generated controller that calls [model.setData()]
|
/// Registers a listener on every generated controller that calls [model.setData()]
|
||||||
/// with the latest textController values
|
/// with the latest textController values
|
||||||
void syncFormWithViewModel(FormStateHelper model) {
|
void syncFormWithViewModel(FormStateHelper model) {
|
||||||
passwordController.addListener(() => _updateFormData(model));
|
|
||||||
resetCodeController.addListener(() => _updateFormData(model));
|
|
||||||
emailController.addListener(() => _updateFormData(model));
|
emailController.addListener(() => _updateFormData(model));
|
||||||
|
resetCodeController.addListener(() => _updateFormData(model));
|
||||||
|
passwordController.addListener(() => _updateFormData(model));
|
||||||
confirmPasswordController.addListener(() => _updateFormData(model));
|
confirmPasswordController.addListener(() => _updateFormData(model));
|
||||||
|
|
||||||
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
||||||
|
|
@ -85,9 +85,9 @@ mixin $ForgetPasswordView {
|
||||||
'This feature was deprecated after 3.1.0.',
|
'This feature was deprecated after 3.1.0.',
|
||||||
)
|
)
|
||||||
void listenToFormUpdated(FormViewModel model) {
|
void listenToFormUpdated(FormViewModel model) {
|
||||||
passwordController.addListener(() => _updateFormData(model));
|
|
||||||
resetCodeController.addListener(() => _updateFormData(model));
|
|
||||||
emailController.addListener(() => _updateFormData(model));
|
emailController.addListener(() => _updateFormData(model));
|
||||||
|
resetCodeController.addListener(() => _updateFormData(model));
|
||||||
|
passwordController.addListener(() => _updateFormData(model));
|
||||||
confirmPasswordController.addListener(() => _updateFormData(model));
|
confirmPasswordController.addListener(() => _updateFormData(model));
|
||||||
|
|
||||||
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
||||||
|
|
@ -98,9 +98,9 @@ mixin $ForgetPasswordView {
|
||||||
model.setData(
|
model.setData(
|
||||||
model.formValueMap
|
model.formValueMap
|
||||||
..addAll({
|
..addAll({
|
||||||
PasswordValueKey: passwordController.text,
|
|
||||||
ResetCodeValueKey: resetCodeController.text,
|
|
||||||
EmailValueKey: emailController.text,
|
EmailValueKey: emailController.text,
|
||||||
|
ResetCodeValueKey: resetCodeController.text,
|
||||||
|
PasswordValueKey: passwordController.text,
|
||||||
ConfirmPasswordValueKey: confirmPasswordController.text,
|
ConfirmPasswordValueKey: confirmPasswordController.text,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
@ -143,20 +143,19 @@ extension ValueProperties on FormStateHelper {
|
||||||
return !hasAnyValidationMessage;
|
return !hasAnyValidationMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? get passwordValue => this.formValueMap[PasswordValueKey] as String?;
|
|
||||||
String? get resetCodeValue => this.formValueMap[ResetCodeValueKey] as String?;
|
|
||||||
String? get emailValue => this.formValueMap[EmailValueKey] as String?;
|
String? get emailValue => this.formValueMap[EmailValueKey] as String?;
|
||||||
|
String? get resetCodeValue => this.formValueMap[ResetCodeValueKey] as String?;
|
||||||
|
String? get passwordValue => this.formValueMap[PasswordValueKey] as String?;
|
||||||
String? get confirmPasswordValue =>
|
String? get confirmPasswordValue =>
|
||||||
this.formValueMap[ConfirmPasswordValueKey] as String?;
|
this.formValueMap[ConfirmPasswordValueKey] as String?;
|
||||||
|
|
||||||
set passwordValue(String? value) {
|
set emailValue(String? value) {
|
||||||
this.setData(
|
this.setData(
|
||||||
this.formValueMap..addAll({PasswordValueKey: value}),
|
this.formValueMap..addAll({EmailValueKey: value}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_ForgetPasswordViewTextEditingControllers.containsKey(
|
if (_ForgetPasswordViewTextEditingControllers.containsKey(EmailValueKey)) {
|
||||||
PasswordValueKey)) {
|
_ForgetPasswordViewTextEditingControllers[EmailValueKey]?.text =
|
||||||
_ForgetPasswordViewTextEditingControllers[PasswordValueKey]?.text =
|
|
||||||
value ?? '';
|
value ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -173,13 +172,14 @@ extension ValueProperties on FormStateHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set emailValue(String? value) {
|
set passwordValue(String? value) {
|
||||||
this.setData(
|
this.setData(
|
||||||
this.formValueMap..addAll({EmailValueKey: value}),
|
this.formValueMap..addAll({PasswordValueKey: value}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_ForgetPasswordViewTextEditingControllers.containsKey(EmailValueKey)) {
|
if (_ForgetPasswordViewTextEditingControllers.containsKey(
|
||||||
_ForgetPasswordViewTextEditingControllers[EmailValueKey]?.text =
|
PasswordValueKey)) {
|
||||||
|
_ForgetPasswordViewTextEditingControllers[PasswordValueKey]?.text =
|
||||||
value ?? '';
|
value ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,64 +196,64 @@ extension ValueProperties on FormStateHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get hasPassword =>
|
|
||||||
this.formValueMap.containsKey(PasswordValueKey) &&
|
|
||||||
(passwordValue?.isNotEmpty ?? false);
|
|
||||||
bool get hasResetCode =>
|
|
||||||
this.formValueMap.containsKey(ResetCodeValueKey) &&
|
|
||||||
(resetCodeValue?.isNotEmpty ?? false);
|
|
||||||
bool get hasEmail =>
|
bool get hasEmail =>
|
||||||
this.formValueMap.containsKey(EmailValueKey) &&
|
this.formValueMap.containsKey(EmailValueKey) &&
|
||||||
(emailValue?.isNotEmpty ?? false);
|
(emailValue?.isNotEmpty ?? false);
|
||||||
|
bool get hasResetCode =>
|
||||||
|
this.formValueMap.containsKey(ResetCodeValueKey) &&
|
||||||
|
(resetCodeValue?.isNotEmpty ?? false);
|
||||||
|
bool get hasPassword =>
|
||||||
|
this.formValueMap.containsKey(PasswordValueKey) &&
|
||||||
|
(passwordValue?.isNotEmpty ?? false);
|
||||||
bool get hasConfirmPassword =>
|
bool get hasConfirmPassword =>
|
||||||
this.formValueMap.containsKey(ConfirmPasswordValueKey) &&
|
this.formValueMap.containsKey(ConfirmPasswordValueKey) &&
|
||||||
(confirmPasswordValue?.isNotEmpty ?? false);
|
(confirmPasswordValue?.isNotEmpty ?? false);
|
||||||
|
|
||||||
bool get hasPasswordValidationMessage =>
|
|
||||||
this.fieldsValidationMessages[PasswordValueKey]?.isNotEmpty ?? false;
|
|
||||||
bool get hasResetCodeValidationMessage =>
|
|
||||||
this.fieldsValidationMessages[ResetCodeValueKey]?.isNotEmpty ?? false;
|
|
||||||
bool get hasEmailValidationMessage =>
|
bool get hasEmailValidationMessage =>
|
||||||
this.fieldsValidationMessages[EmailValueKey]?.isNotEmpty ?? false;
|
this.fieldsValidationMessages[EmailValueKey]?.isNotEmpty ?? false;
|
||||||
|
bool get hasResetCodeValidationMessage =>
|
||||||
|
this.fieldsValidationMessages[ResetCodeValueKey]?.isNotEmpty ?? false;
|
||||||
|
bool get hasPasswordValidationMessage =>
|
||||||
|
this.fieldsValidationMessages[PasswordValueKey]?.isNotEmpty ?? false;
|
||||||
bool get hasConfirmPasswordValidationMessage =>
|
bool get hasConfirmPasswordValidationMessage =>
|
||||||
this.fieldsValidationMessages[ConfirmPasswordValueKey]?.isNotEmpty ??
|
this.fieldsValidationMessages[ConfirmPasswordValueKey]?.isNotEmpty ??
|
||||||
false;
|
false;
|
||||||
|
|
||||||
String? get passwordValidationMessage =>
|
|
||||||
this.fieldsValidationMessages[PasswordValueKey];
|
|
||||||
String? get resetCodeValidationMessage =>
|
|
||||||
this.fieldsValidationMessages[ResetCodeValueKey];
|
|
||||||
String? get emailValidationMessage =>
|
String? get emailValidationMessage =>
|
||||||
this.fieldsValidationMessages[EmailValueKey];
|
this.fieldsValidationMessages[EmailValueKey];
|
||||||
|
String? get resetCodeValidationMessage =>
|
||||||
|
this.fieldsValidationMessages[ResetCodeValueKey];
|
||||||
|
String? get passwordValidationMessage =>
|
||||||
|
this.fieldsValidationMessages[PasswordValueKey];
|
||||||
String? get confirmPasswordValidationMessage =>
|
String? get confirmPasswordValidationMessage =>
|
||||||
this.fieldsValidationMessages[ConfirmPasswordValueKey];
|
this.fieldsValidationMessages[ConfirmPasswordValueKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Methods on FormStateHelper {
|
extension Methods on FormStateHelper {
|
||||||
setPasswordValidationMessage(String? validationMessage) =>
|
|
||||||
this.fieldsValidationMessages[PasswordValueKey] = validationMessage;
|
|
||||||
setResetCodeValidationMessage(String? validationMessage) =>
|
|
||||||
this.fieldsValidationMessages[ResetCodeValueKey] = validationMessage;
|
|
||||||
setEmailValidationMessage(String? validationMessage) =>
|
setEmailValidationMessage(String? validationMessage) =>
|
||||||
this.fieldsValidationMessages[EmailValueKey] = validationMessage;
|
this.fieldsValidationMessages[EmailValueKey] = validationMessage;
|
||||||
|
setResetCodeValidationMessage(String? validationMessage) =>
|
||||||
|
this.fieldsValidationMessages[ResetCodeValueKey] = validationMessage;
|
||||||
|
setPasswordValidationMessage(String? validationMessage) =>
|
||||||
|
this.fieldsValidationMessages[PasswordValueKey] = validationMessage;
|
||||||
setConfirmPasswordValidationMessage(String? validationMessage) =>
|
setConfirmPasswordValidationMessage(String? validationMessage) =>
|
||||||
this.fieldsValidationMessages[ConfirmPasswordValueKey] =
|
this.fieldsValidationMessages[ConfirmPasswordValueKey] =
|
||||||
validationMessage;
|
validationMessage;
|
||||||
|
|
||||||
/// Clears text input fields on the Form
|
/// Clears text input fields on the Form
|
||||||
void clearForm() {
|
void clearForm() {
|
||||||
passwordValue = '';
|
|
||||||
resetCodeValue = '';
|
|
||||||
emailValue = '';
|
emailValue = '';
|
||||||
|
resetCodeValue = '';
|
||||||
|
passwordValue = '';
|
||||||
confirmPasswordValue = '';
|
confirmPasswordValue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Validates text input fields on the Form
|
/// Validates text input fields on the Form
|
||||||
void validateForm() {
|
void validateForm() {
|
||||||
this.setValidationMessages({
|
this.setValidationMessages({
|
||||||
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
|
||||||
ResetCodeValueKey: getValidationMessage(ResetCodeValueKey),
|
|
||||||
EmailValueKey: getValidationMessage(EmailValueKey),
|
EmailValueKey: getValidationMessage(EmailValueKey),
|
||||||
|
ResetCodeValueKey: getValidationMessage(ResetCodeValueKey),
|
||||||
|
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
||||||
ConfirmPasswordValueKey: getValidationMessage(ConfirmPasswordValueKey),
|
ConfirmPasswordValueKey: getValidationMessage(ConfirmPasswordValueKey),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -274,8 +274,8 @@ String? getValidationMessage(String key) {
|
||||||
/// Updates the fieldsValidationMessages on the FormViewModel
|
/// Updates the fieldsValidationMessages on the FormViewModel
|
||||||
void updateValidationData(FormStateHelper model) =>
|
void updateValidationData(FormStateHelper model) =>
|
||||||
model.setValidationMessages({
|
model.setValidationMessages({
|
||||||
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
|
||||||
ResetCodeValueKey: getValidationMessage(ResetCodeValueKey),
|
|
||||||
EmailValueKey: getValidationMessage(EmailValueKey),
|
EmailValueKey: getValidationMessage(EmailValueKey),
|
||||||
|
ResetCodeValueKey: getValidationMessage(ResetCodeValueKey),
|
||||||
|
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
||||||
ConfirmPasswordValueKey: getValidationMessage(ConfirmPasswordValueKey),
|
ConfirmPasswordValueKey: getValidationMessage(ConfirmPasswordValueKey),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
|
|
||||||
Map<String, dynamic> get userData => _userData;
|
Map<String, dynamic> get userData => _userData;
|
||||||
|
|
||||||
// In-app navigation
|
// Navigation
|
||||||
int _currentPage = 0;
|
int _currentPage = 0;
|
||||||
|
|
||||||
int get currentPage => _currentPage;
|
int get currentPage => _currentPage;
|
||||||
|
|
@ -69,6 +69,15 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
|
|
||||||
bool get obscureConfirmPassword => _obscureConfirmPassword;
|
bool get obscureConfirmPassword => _obscureConfirmPassword;
|
||||||
|
|
||||||
|
// Add user data
|
||||||
|
void addUserData(Map<String, dynamic> data) {
|
||||||
|
_userData.addAll(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearUserData() {
|
||||||
|
_userData.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Email
|
// Email
|
||||||
void setEmailFocus() {
|
void setEmailFocus() {
|
||||||
_focusEmail = true;
|
_focusEmail = true;
|
||||||
|
|
@ -81,37 +90,12 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
// User data
|
|
||||||
void clearUserData() {
|
|
||||||
_userData.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void addUserData(Map<String, dynamic> data) {
|
|
||||||
_userData.addAll(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
void setPasswordFocus() {
|
void setPasswordFocus() {
|
||||||
_focusPassword = true;
|
_focusPassword = true;
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setObscurePassword() {
|
|
||||||
_obscurePassword = !_obscurePassword;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
double validationProgress() {
|
|
||||||
int completed = 0;
|
|
||||||
|
|
||||||
if (_length) completed++;
|
|
||||||
if (_number) completed++;
|
|
||||||
if (_specialChar) completed++;
|
|
||||||
if (_passwordMatch) completed++;
|
|
||||||
|
|
||||||
return completed / 4; // returns 0.0 → 1.0
|
|
||||||
}
|
|
||||||
|
|
||||||
void validatePassword(
|
void validatePassword(
|
||||||
{required String password, required String confirmPassword}) {
|
{required String password, required String confirmPassword}) {
|
||||||
if (password.length > 8) {
|
if (password.length > 8) {
|
||||||
|
|
@ -140,6 +124,22 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double validationProgress() {
|
||||||
|
int completed = 0;
|
||||||
|
|
||||||
|
if (_length) completed++;
|
||||||
|
if (_number) completed++;
|
||||||
|
if (_specialChar) completed++;
|
||||||
|
if (_passwordMatch) completed++;
|
||||||
|
|
||||||
|
return completed / 4; // returns 0.0 → 1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
void setObscurePassword() {
|
||||||
|
_obscurePassword = !_obscurePassword;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
// Confirm password
|
// Confirm password
|
||||||
void setConfirmPasswordFocus() {
|
void setConfirmPasswordFocus() {
|
||||||
_focusConfirmPassword = true;
|
_focusConfirmPassword = true;
|
||||||
|
|
@ -172,6 +172,11 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// In-app navigation
|
// In-app navigation
|
||||||
|
void goTo(int page) {
|
||||||
|
_currentPage = page;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
void goBack() {
|
void goBack() {
|
||||||
if (_currentPage == 1) {
|
if (_currentPage == 1) {
|
||||||
_currentPage = 0;
|
_currentPage = 0;
|
||||||
|
|
@ -181,11 +186,6 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void goTo(int page) {
|
|
||||||
_currentPage = page;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
|
|
@ -194,23 +194,6 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
|
|
||||||
// Remote api calls
|
// Remote api calls
|
||||||
|
|
||||||
// Request reset code
|
|
||||||
Future<void> resetPassword() async => await runBusyFuture(_resetPassword(),
|
|
||||||
busyObject: StateObjects.resetPassword);
|
|
||||||
|
|
||||||
Future<void> _resetPassword() async {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
Map<String, dynamic> response =
|
|
||||||
await _apiService.resetPassword(_userData);
|
|
||||||
if (response['status'] == ResponseStatus.success) {
|
|
||||||
showSuccessToast(response['message']);
|
|
||||||
await replaceWithLogin();
|
|
||||||
} else {
|
|
||||||
showErrorToast(response['message']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Request reset code
|
// Request reset code
|
||||||
Future<void> requestResetCode() async =>
|
Future<void> requestResetCode() async =>
|
||||||
await runBusyFuture(_requestResetCode(),
|
await runBusyFuture(_requestResetCode(),
|
||||||
|
|
@ -228,4 +211,21 @@ class ForgetPasswordViewModel extends FormViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Request reset code
|
||||||
|
Future<void> resetPassword() async => await runBusyFuture(_resetPassword(),
|
||||||
|
busyObject: StateObjects.resetPassword);
|
||||||
|
|
||||||
|
Future<void> _resetPassword() async {
|
||||||
|
if (await _statusChecker.checkConnection()) {
|
||||||
|
Map<String, dynamic> response =
|
||||||
|
await _apiService.resetPassword(_userData);
|
||||||
|
if (response['status'] == ResponseStatus.success) {
|
||||||
|
showSuccessToast(response['message']);
|
||||||
|
await replaceWithLogin();
|
||||||
|
} else {
|
||||||
|
showErrorToast(response['message']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,9 @@ class RequestCodeScreen extends ViewModelWidget<ForgetPasswordViewModel> {
|
||||||
|
|
||||||
Widget getPadding(context) {
|
Widget getPadding(context) {
|
||||||
double half = screenHeight(context) / 2;
|
double half = screenHeight(context) / 2;
|
||||||
return SizedBox(height: half + 375 - half);
|
return SizedBox(
|
||||||
|
height: half + 375 - half,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _inAppPop(ForgetPasswordViewModel viewModel) {
|
void _inAppPop(ForgetPasswordViewModel viewModel) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import 'package:stacked/stacked.dart';
|
||||||
import 'package:yimaru_app/ui/common/app_colors.dart';
|
import 'package:yimaru_app/ui/common/app_colors.dart';
|
||||||
import 'package:yimaru_app/ui/common/enmus.dart';
|
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||||
import 'package:yimaru_app/ui/views/course_category/course_category_view.dart';
|
import 'package:yimaru_app/ui/views/course_category/course_category_view.dart';
|
||||||
import 'package:yimaru_app/ui/views/learn_subcategory/learn_subcategory_view.dart';
|
import 'package:yimaru_app/ui/views/learn/learn_view.dart';
|
||||||
import 'package:yimaru_app/ui/views/profile/profile_view.dart';
|
import 'package:yimaru_app/ui/views/profile/profile_view.dart';
|
||||||
import 'package:yimaru_app/ui/views/startup/startup_view.dart';
|
import 'package:yimaru_app/ui/views/startup/startup_view.dart';
|
||||||
|
|
||||||
|
|
@ -18,7 +18,6 @@ class HomeView extends StackedView<HomeViewModel> {
|
||||||
@override
|
@override
|
||||||
void onViewModelReady(HomeViewModel viewModel) async {
|
void onViewModelReady(HomeViewModel viewModel) async {
|
||||||
// Removable
|
// Removable
|
||||||
print('HERE');
|
|
||||||
await _init(viewModel);
|
await _init(viewModel);
|
||||||
super.onViewModelReady(viewModel);
|
super.onViewModelReady(viewModel);
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +82,7 @@ Widget _buildProfileIcon() => const Icon(Icons.person);
|
||||||
Widget getViewForIndex(int index) {
|
Widget getViewForIndex(int index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
return const LearnSubcategoryView();
|
return const LearnView();
|
||||||
case 1:
|
case 1:
|
||||||
return const CourseCategoryView();
|
return const CourseCategoryView();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import 'package:yimaru_app/app/app.bottomsheets.dart';
|
import 'package:yimaru_app/app/app.bottomsheets.dart';
|
||||||
|
import 'package:yimaru_app/app/app.dialogs.dart';
|
||||||
import 'package:yimaru_app/app/app.locator.dart';
|
import 'package:yimaru_app/app/app.locator.dart';
|
||||||
import 'package:yimaru_app/app/app.router.dart';
|
import 'package:yimaru_app/app/app.router.dart';
|
||||||
import 'package:yimaru_app/models/user.dart';
|
import 'package:yimaru_app/models/user_model.dart';
|
||||||
import 'package:yimaru_app/services/status_checker_service.dart';
|
import 'package:yimaru_app/services/status_checker_service.dart';
|
||||||
import 'package:yimaru_app/ui/common/app_strings.dart';
|
import 'package:yimaru_app/ui/common/app_strings.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
@ -15,6 +16,7 @@ import '../../common/ui_helpers.dart';
|
||||||
|
|
||||||
class HomeViewModel extends ReactiveViewModel {
|
class HomeViewModel extends ReactiveViewModel {
|
||||||
final _apiService = locator<ApiService>();
|
final _apiService = locator<ApiService>();
|
||||||
|
final _dialogService = locator<DialogService>();
|
||||||
final _statusChecker = locator<StatusCheckerService>();
|
final _statusChecker = locator<StatusCheckerService>();
|
||||||
final _navigationService = locator<NavigationService>();
|
final _navigationService = locator<NavigationService>();
|
||||||
final _bottomSheetService = locator<BottomSheetService>();
|
final _bottomSheetService = locator<BottomSheetService>();
|
||||||
|
|
@ -26,9 +28,9 @@ class HomeViewModel extends ReactiveViewModel {
|
||||||
[_authenticationService];
|
[_authenticationService];
|
||||||
|
|
||||||
// Current user
|
// Current user
|
||||||
User? get _user => _authenticationService.user;
|
UserModel? get _user => _authenticationService.user;
|
||||||
|
|
||||||
User? get user => _user;
|
UserModel? get user => _user;
|
||||||
|
|
||||||
// Bottom navigation
|
// Bottom navigation
|
||||||
int _currentPage = 0;
|
int _currentPage = 0;
|
||||||
|
|
@ -36,6 +38,19 @@ class HomeViewModel extends ReactiveViewModel {
|
||||||
int get currentPage => _currentPage;
|
int get currentPage => _currentPage;
|
||||||
|
|
||||||
// Bottom navigation
|
// Bottom navigation
|
||||||
|
void setCurrentIndex(int index) {
|
||||||
|
_currentPage = index;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void showDialog() {
|
||||||
|
_dialogService.showCustomDialog(
|
||||||
|
title: 'Stacked Rocks!',
|
||||||
|
variant: DialogType.infoAlert,
|
||||||
|
description: 'Give stacked stars on Github',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void showBottomSheet() {
|
void showBottomSheet() {
|
||||||
_bottomSheetService.showCustomSheet(
|
_bottomSheetService.showCustomSheet(
|
||||||
title: ksHomeBottomSheetTitle,
|
title: ksHomeBottomSheetTitle,
|
||||||
|
|
@ -44,12 +59,6 @@ class HomeViewModel extends ReactiveViewModel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCurrentIndex(int index) {
|
|
||||||
_currentPage = index;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save profile status
|
|
||||||
Future<void> saveProfileStatus(bool value) async =>
|
Future<void> saveProfileStatus(bool value) async =>
|
||||||
await _authenticationService.saveProfileStatus(value);
|
await _authenticationService.saveProfileStatus(value);
|
||||||
|
|
||||||
|
|
@ -71,34 +80,7 @@ class HomeViewModel extends ReactiveViewModel {
|
||||||
await _getProfileData();
|
await _getProfileData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get profile data
|
// Profile status
|
||||||
Future<void> _getProfileData() async {
|
|
||||||
if (!(_user?.userInfoLoaded ?? false)) {
|
|
||||||
Map<String, dynamic> response = {};
|
|
||||||
|
|
||||||
if (_user?.profileCompleted != null &&
|
|
||||||
(_user?.profileCompleted ?? false)) {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
response = await _apiService.getProfileData(_user?.userId);
|
|
||||||
|
|
||||||
if (response['status'] == ResponseStatus.success) {
|
|
||||||
User user = response['data'] as User;
|
|
||||||
|
|
||||||
await _authenticationService.saveUserData(user);
|
|
||||||
|
|
||||||
String image =
|
|
||||||
await _imageDownloaderService.downloader(user.profilePicture);
|
|
||||||
|
|
||||||
await _authenticationService.saveProfilePicture(image);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await replaceWithFailure();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get profile status
|
|
||||||
Future<void> _getProfileStatus() async {
|
Future<void> _getProfileStatus() async {
|
||||||
Map<String, dynamic> response = {};
|
Map<String, dynamic> response = {};
|
||||||
if (_user?.profileCompleted == null) {
|
if (_user?.profileCompleted == null) {
|
||||||
|
|
@ -120,4 +102,32 @@ class HomeViewModel extends ReactiveViewModel {
|
||||||
await saveProfileStatus(response['data']);
|
await saveProfileStatus(response['data']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Profile data
|
||||||
|
|
||||||
|
Future<void> _getProfileData() async {
|
||||||
|
if (!(_user?.userInfoLoaded ?? false)) {
|
||||||
|
Map<String, dynamic> response = {};
|
||||||
|
|
||||||
|
if (_user?.profileCompleted != null &&
|
||||||
|
(_user?.profileCompleted ?? false)) {
|
||||||
|
if (await _statusChecker.checkConnection()) {
|
||||||
|
response = await _apiService.getProfileData(_user?.userId);
|
||||||
|
|
||||||
|
if (response['status'] == ResponseStatus.success) {
|
||||||
|
UserModel user = response['data'] as UserModel;
|
||||||
|
|
||||||
|
await _authenticationService.saveUserData(user);
|
||||||
|
|
||||||
|
String image =
|
||||||
|
await _imageDownloaderService.downloader(user.profilePicture);
|
||||||
|
|
||||||
|
await _authenticationService.saveProfilePicture(image);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await replaceWithFailure();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ class LanguageViewModel extends BaseViewModel {
|
||||||
final _navigationService = locator<NavigationService>();
|
final _navigationService = locator<NavigationService>();
|
||||||
|
|
||||||
// Languages
|
// Languages
|
||||||
|
|
||||||
Map<String, dynamic> _selectedLanguage = {
|
Map<String, dynamic> _selectedLanguage = {
|
||||||
'code': 'EN',
|
'code': 'EN',
|
||||||
'language': 'English'
|
'language': 'English'
|
||||||
|
|
@ -22,14 +23,13 @@ class LanguageViewModel extends BaseViewModel {
|
||||||
List<Map<String, dynamic>> get languages => _languages;
|
List<Map<String, dynamic>> get languages => _languages;
|
||||||
|
|
||||||
// Languages
|
// Languages
|
||||||
bool isSelectedLanguage(String title) =>
|
|
||||||
_selectedLanguage['language'] == title;
|
|
||||||
|
|
||||||
void setSelectedLanguage(Map<String, dynamic> title) {
|
void setSelectedLanguage(Map<String, dynamic> title) {
|
||||||
_selectedLanguage = title;
|
_selectedLanguage = title;
|
||||||
rebuildUi();
|
rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isSelectedLanguage(String title) =>
|
||||||
|
_selectedLanguage['language'] == title;
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,15 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/learn_tile.dart';
|
import 'package:yimaru_app/ui/widgets/profile_app_bar.dart';
|
||||||
|
import 'package:yimaru_app/ui/widgets/learn_level_tile.dart';
|
||||||
|
|
||||||
import '../../../models/course.dart';
|
|
||||||
import '../../common/app_colors.dart';
|
import '../../common/app_colors.dart';
|
||||||
import '../../common/enmus.dart';
|
import '../../common/enmus.dart';
|
||||||
import '../../common/ui_helpers.dart';
|
import '../../common/ui_helpers.dart';
|
||||||
import '../../widgets/custom_circular_progress_indicator.dart';
|
|
||||||
import '../../widgets/small_app_bar.dart';
|
|
||||||
import 'learn_viewmodel.dart';
|
import 'learn_viewmodel.dart';
|
||||||
|
|
||||||
class LearnView extends StackedView<LearnViewModel> {
|
class LearnView extends StackedView<LearnViewModel> {
|
||||||
final int id;
|
const LearnView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
const LearnView({Key? key, required this.id}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onViewModelReady(LearnViewModel viewModel) async {
|
|
||||||
await viewModel.getCourses(id);
|
|
||||||
super.onViewModelReady(viewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LearnViewModel viewModelBuilder(BuildContext context) => LearnViewModel();
|
LearnViewModel viewModelBuilder(BuildContext context) => LearnViewModel();
|
||||||
|
|
@ -50,50 +40,49 @@ class LearnView extends StackedView<LearnViewModel> {
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
_buildAppBar(viewModel),
|
_buildAppBar(viewModel),
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
_buildLearnColumnWrapper(viewModel)
|
_buildLevelsColumnWrapper(viewModel)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildAppBar(LearnViewModel viewModel) => SmallAppBar(
|
Widget _buildAppBar(LearnViewModel viewModel) => ProfileAppBar(
|
||||||
onTap: viewModel.pop,
|
name: viewModel.user?.firstName,
|
||||||
showBackButton: true,
|
profileImage: viewModel.user?.profilePicture,
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildLearnColumnWrapper(LearnViewModel viewModel) =>
|
Widget _buildLevelsColumnWrapper(LearnViewModel viewModel) =>
|
||||||
Expanded(child: _buildLearnColumnScrollView(viewModel));
|
Expanded(child: _buildLevelsColumnScrollView(viewModel));
|
||||||
|
|
||||||
Widget _buildLearnColumnScrollView(LearnViewModel viewModel) =>
|
Widget _buildLevelsColumnScrollView(LearnViewModel viewModel) =>
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
child: _buildListViewBuilder(viewModel),
|
child: _buildLevelsColumn(viewModel),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildListViewBuilder(LearnViewModel viewModel) =>
|
Widget _buildLevelsColumn(LearnViewModel viewModel) => Column(
|
||||||
viewModel.busy(StateObjects.learnCourses)
|
mainAxisSize: MainAxisSize.min,
|
||||||
? _buildProgressIndicator()
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
: _buildListView(viewModel);
|
children: _buildLevelsColumnChildren(viewModel),
|
||||||
|
|
||||||
Widget _buildProgressIndicator() => const Center(
|
|
||||||
child: CustomCircularProgressIndicator(color: kcPrimaryColor),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildListView(LearnViewModel viewModel) => ListView.separated(
|
List<Widget> _buildLevelsColumnChildren(LearnViewModel viewModel) =>
|
||||||
|
[verticalSpaceLarge, _buildListView(viewModel)];
|
||||||
|
|
||||||
|
Widget _buildListView(LearnViewModel viewModel) => ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: viewModel.courses.length,
|
itemCount: viewModel.learnLevels.length,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
separatorBuilder: (context, index) => verticalSpaceSmall,
|
|
||||||
itemBuilder: (context, index) => _buildTile(
|
itemBuilder: (context, index) => _buildTile(
|
||||||
course: viewModel.courses[index],
|
title: viewModel.learnLevels[index]['title'],
|
||||||
onTap: () async => await viewModel
|
status: viewModel.learnLevels[index]['status'],
|
||||||
.navigateToLearnLevel(viewModel.courses[index].id ?? 0),
|
subtitle: viewModel.learnLevels[index]['subtitle']),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildTile({
|
Widget _buildTile(
|
||||||
required Course course,
|
{required String title,
|
||||||
required GestureTapCallback onTap,
|
required String subtitle,
|
||||||
}) =>
|
required ProgressStatuses status}) =>
|
||||||
LearnTile(
|
LearnLevelTile(
|
||||||
onTap: onTap,
|
title: title,
|
||||||
course: course,
|
status: status,
|
||||||
|
subtitle: subtitle,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,45 @@
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:yimaru_app/app/app.router.dart';
|
import 'package:yimaru_app/app/app.router.dart';
|
||||||
import 'package:yimaru_app/models/course.dart';
|
import 'package:yimaru_app/models/user_model.dart';
|
||||||
|
import 'package:yimaru_app/services/authentication_service.dart';
|
||||||
import 'package:yimaru_app/ui/common/enmus.dart';
|
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../services/api_service.dart';
|
|
||||||
import '../../../services/status_checker_service.dart';
|
|
||||||
|
|
||||||
class LearnViewModel extends BaseViewModel {
|
|
||||||
// Dependency injection
|
|
||||||
final _apiService = locator<ApiService>();
|
|
||||||
|
|
||||||
final _statusChecker = locator<StatusCheckerService>();
|
|
||||||
|
|
||||||
|
class LearnViewModel extends ReactiveViewModel {
|
||||||
final _navigationService = locator<NavigationService>();
|
final _navigationService = locator<NavigationService>();
|
||||||
|
final _authenticationService = locator<AuthenticationService>();
|
||||||
|
|
||||||
// Learn courses
|
@override
|
||||||
List<Course> _courses = [];
|
List<ListenableServiceMixin> get listenableServices =>
|
||||||
|
[_authenticationService];
|
||||||
|
|
||||||
List<Course> get courses => _courses;
|
// Current user
|
||||||
|
UserModel? get _user => _authenticationService.user;
|
||||||
|
|
||||||
// Navigation
|
UserModel? get user => _user;
|
||||||
void pop() => _navigationService.back();
|
|
||||||
|
|
||||||
Future<void> navigateToLearnLevel(int id) async =>
|
final List<Map<String, dynamic>> _learnLevels = [
|
||||||
_navigationService.navigateToLearnLevelView(id: id);
|
{
|
||||||
|
'title': 'Beginner',
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'subtitle': 'Start your journey with the basics of English.',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// 'title': 'Intermediate',
|
||||||
|
// 'status': ProgressStatuses.started,
|
||||||
|
// 'subtitle': 'Practice real conversations and expand vocabulary.',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'title': 'Advanced',
|
||||||
|
// 'status': ProgressStatuses.pending,
|
||||||
|
// 'subtitle': 'Achieve fluency and master complex topics.',
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
// Remote api call
|
List<Map<String, dynamic>> get learnLevels => _learnLevels;
|
||||||
|
|
||||||
// Learn courses
|
Future<void> navigateToLearnLevel() async =>
|
||||||
Future<void> getCourses(int id) async => await runBusyFuture(_getCourses(id),
|
_navigationService.navigateToLearnLevelView();
|
||||||
busyObject: StateObjects.learnCourses);
|
|
||||||
|
|
||||||
Future<void> _getCourses(int id) async {
|
|
||||||
if (_courses.isEmpty) {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
_courses = await _apiService.getCourses(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,6 @@ class LearnLessonDetailViewModel extends BaseViewModel {
|
||||||
VideoPlayerController? get videoPlayerController => _videoPlayerController;
|
VideoPlayerController? get videoPlayerController => _videoPlayerController;
|
||||||
|
|
||||||
// Video player
|
// Video player
|
||||||
void close() {
|
|
||||||
_videoPlayerController?.dispose();
|
|
||||||
_chewieController?.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> pause() async {
|
|
||||||
await _chewieController?.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initializePlayer() async =>
|
Future<void> initializePlayer() async =>
|
||||||
await runBusyFuture(_initializePlayer(),
|
await runBusyFuture(_initializePlayer(),
|
||||||
busyObject: StateObjects.loadLessonVideo);
|
busyObject: StateObjects.loadLessonVideo);
|
||||||
|
|
@ -60,6 +51,15 @@ class LearnLessonDetailViewModel extends BaseViewModel {
|
||||||
// rebuildUi();
|
// rebuildUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> pause() async {
|
||||||
|
await _chewieController?.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
void close() {
|
||||||
|
_videoPlayerController?.dispose();
|
||||||
|
_chewieController?.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,14 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/learn_level_tile.dart';
|
import 'package:yimaru_app/ui/widgets/learn_sub_level_tile.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/small_app_bar.dart';
|
import 'package:yimaru_app/ui/widgets/small_app_bar.dart';
|
||||||
|
|
||||||
import '../../../models/level.dart';
|
|
||||||
import '../../common/app_colors.dart';
|
import '../../common/app_colors.dart';
|
||||||
import '../../common/enmus.dart';
|
|
||||||
import '../../common/ui_helpers.dart';
|
import '../../common/ui_helpers.dart';
|
||||||
import '../../widgets/custom_circular_progress_indicator.dart';
|
|
||||||
import 'learn_level_viewmodel.dart';
|
import 'learn_level_viewmodel.dart';
|
||||||
|
|
||||||
class LearnLevelView extends StackedView<LearnLevelViewModel> {
|
class LearnLevelView extends StackedView<LearnLevelViewModel> {
|
||||||
final int id;
|
const LearnLevelView({Key? key}) : super(key: key);
|
||||||
const LearnLevelView({Key? key, required this.id}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onViewModelReady(LearnLevelViewModel viewModel) async {
|
|
||||||
await viewModel.getLevels(id);
|
|
||||||
super.onViewModelReady(viewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LearnLevelViewModel viewModelBuilder(BuildContext context) =>
|
LearnLevelViewModel viewModelBuilder(BuildContext context) =>
|
||||||
|
|
@ -64,35 +54,36 @@ class LearnLevelView extends StackedView<LearnLevelViewModel> {
|
||||||
|
|
||||||
Widget _buildLevelsColumnScrollView(LearnLevelViewModel viewModel) =>
|
Widget _buildLevelsColumnScrollView(LearnLevelViewModel viewModel) =>
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
child: _buildListViewBuilder(viewModel),
|
child: _buildLevelsColumn(viewModel),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildListViewBuilder(LearnLevelViewModel viewModel) =>
|
Widget _buildLevelsColumn(LearnLevelViewModel viewModel) => Column(
|
||||||
viewModel.busy(StateObjects.learnLevels)
|
mainAxisSize: MainAxisSize.min,
|
||||||
? _buildProgressIndicator()
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
: _buildListView(viewModel);
|
children: _buildLevelsColumnChildren(viewModel),
|
||||||
|
|
||||||
Widget _buildProgressIndicator() => const Center(
|
|
||||||
child: CustomCircularProgressIndicator(color: kcPrimaryColor),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildListView(LearnLevelViewModel viewModel) => ListView.separated(
|
List<Widget> _buildLevelsColumnChildren(LearnLevelViewModel viewModel) =>
|
||||||
|
[verticalSpaceLarge, _buildListView(viewModel)];
|
||||||
|
|
||||||
|
Widget _buildListView(LearnLevelViewModel viewModel) => ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: viewModel.levels.length,
|
itemCount: viewModel.learnSubLevels.length,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (context, index) => _buildTile(
|
itemBuilder: (context, index) => _buildTile(
|
||||||
level: viewModel.levels[index],
|
title: viewModel.learnSubLevels[index]['title'],
|
||||||
onTap: () async => await viewModel.navigateToModule( viewModel.levels[index]),
|
current: viewModel.learnSubLevels[index]['current'],
|
||||||
),
|
subtitle: viewModel.learnSubLevels[index]['subtitle']),
|
||||||
separatorBuilder: (context, index) => verticalSpaceSmall,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildTile({
|
Widget _buildTile({
|
||||||
required Level level,
|
required String title,
|
||||||
required GestureTapCallback onTap,
|
required bool current,
|
||||||
|
required String subtitle,
|
||||||
}) =>
|
}) =>
|
||||||
LearnLevelTile(
|
LearnSubLevelTile(
|
||||||
onTap: onTap,
|
title: title,
|
||||||
level: level,
|
current: current,
|
||||||
|
subtitle: subtitle,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,43 +3,28 @@ import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:yimaru_app/app/app.router.dart';
|
import 'package:yimaru_app/app/app.router.dart';
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../models/level.dart';
|
|
||||||
import '../../../services/api_service.dart';
|
|
||||||
import '../../../services/status_checker_service.dart';
|
|
||||||
import '../../common/enmus.dart';
|
|
||||||
|
|
||||||
class LearnLevelViewModel extends BaseViewModel {
|
class LearnLevelViewModel extends BaseViewModel {
|
||||||
// Dependency injection
|
|
||||||
final _apiService = locator<ApiService>();
|
|
||||||
|
|
||||||
final _statusChecker = locator<StatusCheckerService>();
|
|
||||||
|
|
||||||
final _navigationService = locator<NavigationService>();
|
final _navigationService = locator<NavigationService>();
|
||||||
|
|
||||||
// Learn levels
|
final List<Map<String, dynamic>> _learnSubLevels = [
|
||||||
List<Level> _levels = [];
|
{
|
||||||
|
'title': 'A1',
|
||||||
|
'current': true,
|
||||||
|
'subtitle': 'Start your journey with the basics of English.',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// 'title': 'A2',
|
||||||
|
// 'current': false,
|
||||||
|
// 'subtitle': 'Build upon your foundational knowledge.',
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
List<Level> get levels => _levels;
|
List<Map<String, dynamic>> get learnSubLevels => _learnSubLevels;
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
||||||
Future<void> navigateToModule(Level level) async =>
|
Future<void> navigateToLearnModule() async =>
|
||||||
_navigationService.navigateToLearnModuleView(level: level);
|
_navigationService.navigateToLearnModuleView();
|
||||||
|
|
||||||
// Remote api call
|
|
||||||
|
|
||||||
// Learn levels
|
|
||||||
Future<void> getLevels(int id) async =>
|
|
||||||
await runBusyFuture(_getLevels(id), busyObject: StateObjects.learnLevels);
|
|
||||||
|
|
||||||
Future<void> _getLevels(int id) async {
|
|
||||||
if (_levels.isEmpty) {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
_levels = await _apiService.getLevels(id);
|
|
||||||
_levels.sort(
|
|
||||||
(a, b) => (a.displayOrder ?? 0).compareTo(b.displayOrder ?? 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,16 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:yimaru_app/models/level.dart';
|
|
||||||
import 'package:yimaru_app/ui/common/enmus.dart';
|
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/learn_module_tile.dart';
|
import 'package:yimaru_app/ui/widgets/learn_module_tile.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/overall_learn_progress.dart';
|
import 'package:yimaru_app/ui/widgets/overall_learn_progress.dart';
|
||||||
|
|
||||||
import '../../../models/module.dart';
|
|
||||||
import '../../common/app_colors.dart';
|
import '../../common/app_colors.dart';
|
||||||
import '../../common/ui_helpers.dart';
|
import '../../common/ui_helpers.dart';
|
||||||
import '../../widgets/small_app_bar.dart';
|
import '../../widgets/small_app_bar.dart';
|
||||||
import 'learn_module_viewmodel.dart';
|
import 'learn_module_viewmodel.dart';
|
||||||
|
|
||||||
class LearnModuleView extends StackedView<LearnModuleViewModel> {
|
class LearnModuleView extends StackedView<LearnModuleViewModel> {
|
||||||
final Level level;
|
const LearnModuleView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
const LearnModuleView({Key? key, required this.level}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onViewModelReady(LearnModuleViewModel viewModel) async {
|
|
||||||
await viewModel.getModules(level.id ?? 0);
|
|
||||||
super.onViewModelReady(viewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LearnModuleViewModel viewModelBuilder(BuildContext context) =>
|
LearnModuleViewModel viewModelBuilder(BuildContext context) =>
|
||||||
|
|
@ -52,7 +42,7 @@ class LearnModuleView extends StackedView<LearnModuleViewModel> {
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
_buildAppBar(viewModel),
|
_buildAppBar(viewModel),
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
_buildModulesColumnWrapper(viewModel),
|
_buildLevelsColumnWrapper(viewModel),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -61,7 +51,7 @@ class LearnModuleView extends StackedView<LearnModuleViewModel> {
|
||||||
showBackButton: true,
|
showBackButton: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildModulesColumnWrapper(LearnModuleViewModel viewModel) =>
|
Widget _buildLevelsColumnWrapper(LearnModuleViewModel viewModel) =>
|
||||||
Expanded(child: _buildLevelsColumnScrollView(viewModel));
|
Expanded(child: _buildLevelsColumnScrollView(viewModel));
|
||||||
|
|
||||||
Widget _buildLevelsColumnScrollView(LearnModuleViewModel viewModel) =>
|
Widget _buildLevelsColumnScrollView(LearnModuleViewModel viewModel) =>
|
||||||
|
|
@ -71,7 +61,7 @@ class LearnModuleView extends StackedView<LearnModuleViewModel> {
|
||||||
|
|
||||||
Widget _buildLevelsColumn(LearnModuleViewModel viewModel) => Column(
|
Widget _buildLevelsColumn(LearnModuleViewModel viewModel) => Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _buildLevelsColumnChildren(viewModel),
|
children: _buildLevelsColumnChildren(viewModel),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -86,7 +76,7 @@ class LearnModuleView extends StackedView<LearnModuleViewModel> {
|
||||||
];
|
];
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
Widget _buildTitle() => Text(
|
||||||
level.title ?? '',
|
'A1 - Beginner',
|
||||||
style: style18P600,
|
style: style18P600,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -102,19 +92,27 @@ class LearnModuleView extends StackedView<LearnModuleViewModel> {
|
||||||
itemCount: viewModel.modules.length,
|
itemCount: viewModel.modules.length,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (context, index) => _buildTile(
|
itemBuilder: (context, index) => _buildTile(
|
||||||
module: viewModel.modules[index],
|
title: viewModel.modules[index]['title'],
|
||||||
onLessonTap: () {},
|
status: viewModel.modules[index]['status'],
|
||||||
onPracticeTap: () {}),
|
topics: viewModel.modules[index]['topics'],
|
||||||
|
subtitle: viewModel.modules[index]['subtitle'],
|
||||||
|
practices: viewModel.modules[index]['practices'],
|
||||||
|
description: viewModel.modules[index]['description']),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildTile({
|
Widget _buildTile(
|
||||||
required Module module,
|
{required String title,
|
||||||
required GestureTapCallback onLessonTap,
|
required String topics,
|
||||||
required GestureTapCallback onPracticeTap,
|
required String subtitle,
|
||||||
}) =>
|
required String description,
|
||||||
|
required ProgressStatuses status,
|
||||||
|
required List<Map<String, dynamic>> practices}) =>
|
||||||
LearnModuleTile(
|
LearnModuleTile(
|
||||||
module: module,
|
title: title,
|
||||||
onLessonTap: onLessonTap,
|
status: status,
|
||||||
onPracticeTap: onPracticeTap,
|
topics: topics,
|
||||||
|
subtitle: subtitle,
|
||||||
|
practices: practices,
|
||||||
|
description: description,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,351 @@
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:yimaru_app/app/app.router.dart';
|
import 'package:yimaru_app/app/app.router.dart';
|
||||||
import 'package:yimaru_app/models/module.dart';
|
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../services/api_service.dart';
|
|
||||||
import '../../../services/status_checker_service.dart';
|
|
||||||
import '../../common/enmus.dart';
|
import '../../common/enmus.dart';
|
||||||
|
|
||||||
class LearnModuleViewModel extends BaseViewModel {
|
class LearnModuleViewModel extends BaseViewModel {
|
||||||
// Dependency injection
|
|
||||||
final _apiService = locator<ApiService>();
|
|
||||||
|
|
||||||
final _statusChecker = locator<StatusCheckerService>();
|
|
||||||
|
|
||||||
final _navigationService = locator<NavigationService>();
|
final _navigationService = locator<NavigationService>();
|
||||||
|
|
||||||
// Learn module
|
// Modules
|
||||||
List<Module> _modules = [];
|
final List<Map<String, dynamic>> _modules = [
|
||||||
|
{
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'title': 'Lesson 1.1',
|
||||||
|
'subtitle': 'Start Speaking English Today! Greetings & Introductions',
|
||||||
|
'topics':
|
||||||
|
"""👉 How to use "Good Morning," "Afternoon," and "Evening" at the right time.
|
||||||
|
👉 Why saying "I'm" is often better than "I am" in spoken English.
|
||||||
|
👉 Master "My," "Your," and the verb "To Be" without the headache.
|
||||||
|
👉 How to perfectly say the "Long I" sound in "Hi" and "My."
|
||||||
|
""",
|
||||||
|
'practices': [
|
||||||
|
{
|
||||||
|
'question_text': 'Good morning! How are you?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1El9hhmZvLnrTYtVreHR0EDXNrZyGphT9/view?usp=sharing',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1dUSahuj_VdunV293gEZr0XL9d4WV7_8G/view?usp=sharing'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'What\'s your name?',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/14oAqcMRltXeQhQ-RTGizO2DZ4CkHmKdu/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1iAsOIXD4NcsctKuubnvWlnwXodTMlou5/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'Nice to meet you!',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/10bOaNCcpNFzxpJ4d2-5KYahMCCcWt668/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1h8V6lFuOiOf0zRRN-NvYjtLrmMdx0SeX/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'You are doing great! Tell me, are you happy to be here?',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1sjNFofDRr9KB8fQptdM12LDJ5DIaHujs/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1kcNIL5NCt_lfTzAbmCkM3yojD_UzjSx7/view?usp=drive_link',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'description':
|
||||||
|
"""Stop feeling nervous when you meet someone new! In this lesson, we break down the most common English greetings and show you exactly how to introduce yourself with confidence.
|
||||||
|
Whether you are at the market, in a classroom, or meeting someone online, the first 10 seconds of a conversation are the most important. Our teacher will guide you through the exact phrases you need to sound natural and friendly from the very first moment.
|
||||||
|
""",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'title': 'Lesson 1.2',
|
||||||
|
'subtitle': 'Talk About Your Home! "Where Are You From?" & Locations',
|
||||||
|
'topics':
|
||||||
|
"""👉 The difference between "Where are you from?" and "Where do you live?"
|
||||||
|
👉 How to use "Am," "Is," and "Are" to talk about your home.
|
||||||
|
👉 Learn to say "Where-are-you" as one smooth sound (word linking).
|
||||||
|
👉 Practice a full conversation with Miss Alem.
|
||||||
|
👉 A fast-paced game to test your speed and memory.
|
||||||
|
""",
|
||||||
|
'practices': [
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'Hey, It is a pleasure to meet you. Where are you from?',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1F98PdPqeDhkF5KMzFjgmUoy4HanIDHVs/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1vipFTk-DYgOCYhyDyWVaORec7g0JeidD/view?usp=drive_link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'Ethiopia is beautiful! What city are you from?',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1nZJLV9lOgFGqYr-W3vlpt8rbay_bwARJ/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1T8JIYQ6T9Mq_7TazGr85ag4PCyQgHhzi/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'I see. And where does your family live now?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/19XAbHL3HqTpPcolvOQUVPSGef-Ythusu/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1O8o11DNKYZBcm1-f8pjMFJjNIvGmawvg/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'description':
|
||||||
|
"""Are you ready to talk about your city, town, or country with pride? In Lesson 1.2, we move past basic greetings and learn how to share where you come from and where you live now.
|
||||||
|
Whether you are meeting a tourist, a new classmate, or a colleague, being able to say "I’m from Ethiopia" or "I live in Addis Ababa" is the best way to build a connection. Miss Alem will show you how to link your words together so you sound like a natural English speaker!
|
||||||
|
""",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'Lesson 1.3',
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'subtitle': 'Talk About Your Family! Master "Have" vs. "Has"',
|
||||||
|
'topics':
|
||||||
|
"""👉 Master the names for parents, grandparents, and the secret word for brothers and sisters (Siblings).
|
||||||
|
👉 Never mix up "I have" and "She has" ever again.
|
||||||
|
👉 Why the letter "S" is the most important sound when talking about your brothers.
|
||||||
|
👉 A close-up look at how to pronounce "Mother" and "Father" like a native speaker.
|
||||||
|
👉 Test your eyes and ears by finding the hidden mistakes in our family game.
|
||||||
|
""",
|
||||||
|
'practices': [
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'Hello! I want to know about your family. Do you have a brother or sister?',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1fred7Y5ocdD4codZuK7Pr349O38UkB0Z/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1tMoTA4D6joz0bkWS5Nfn-neUvbej6XDI/view?usp=drive_link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'That is nice! How many people are in your family?',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1dhYhiycWwdtW0ndJUMdMXxxVyrXLXPCM/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1FwRxWvrxzKbhEIYImy2ONzd410pabkJa/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'Do you have grandparents?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1UBaQYiJINgOmZWDLFKeXZQ8Zfb7cOKNZ/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/14cnEJTO7GtGZcO8ag50JdupV2EkvDHes/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'description':
|
||||||
|
"""Do you have brothers and sisters? In Lesson 1.3, we dive into the most personal and important topic for building friendships: Your Family. Many beginners make mistakes with the words "have" and "has," but today, we will fix that! Our teacher will teach you the exact formulas to describe your parents, siblings, and grandparents with perfect grammar. By the end of this video, you will be able to introduce your entire family in English with confidence.""",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'title': 'Lesson 1.4',
|
||||||
|
'subtitle': '"What Do You Do?" Talk About Your Job & Studies',
|
||||||
|
'topics':
|
||||||
|
"""👉 The clear difference between talking about work and academic life.
|
||||||
|
👉 Simple rules to decide between "I’m a teacher" and "I’m an accountant."
|
||||||
|
👉 How to use the "-ing" form if you are still training for your dream job.
|
||||||
|
👉 Perfecting the final "T" in "Student" and the "SH" sound in "Cashier."
|
||||||
|
👉 A high-energy game to test your grammar reflexes!""",
|
||||||
|
'practices': [
|
||||||
|
{
|
||||||
|
'question_text': 'It is good to see you again! What do you do?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/171fh_iN0aXS0t95_5RzcxFiVmLCB7caP/view?usp=sharing',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1wDkbp23F2PsLZM9mWlRd-JjnwZa97T-8/view?usp=drive_link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'That is great. Are you studying to be a professional? What are you studying?',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1egHUMIqGt9VAw5HMVMdjWR3zmamdSB6F/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1T_qrH_-KHgQFw5kX4Ti-UwXvnBFyJsWT/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'Your sister works in a restaurant. Is she a waitress?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1Okd-W2zRZCukQfnbLEp9A4r_5rt99U_6/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1t-_JHXel9dtSHRwYU_CO1Mc8-Pa1pOa0/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'My friend works in a bank. Is he an accountant?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1K4ahmIzuBdrsUoO-gVRp525ZFyP7b1Cq/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1ecpWSQTvU9pu8BYq3qRkYUjblX5wG4RZ/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'description':
|
||||||
|
"""You’ve shared your name and your home—now it’s time to talk about your daily life! In Lesson 1.4, we master the most common question in English: "What do you do?" Whether you are working a full-time job, searching for a new career, or currently studying, this lesson gives you the exact phrases to describe your profession with perfect grammar.
|
||||||
|
Miss [Name] breaks down the tricky "A vs. An" rule so you never have to second-guess yourself again. Plus, learn how to sound more natural by "linking" your words like a native speaker!
|
||||||
|
"""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'Lesson 1.5',
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'subtitle': 'Talk About Your Day! Daily Routines & Time Words',
|
||||||
|
'topics':
|
||||||
|
"""👉 Master the 6 most common actions, from "Wake up" to "Go to bed."
|
||||||
|
👉 Learn why we say "I eat" but "She eats" (and how to never forget it!).
|
||||||
|
👉 Use "First," "Then," and "Finally" to tell a complete story about your day.
|
||||||
|
👉 How to perfectly say the tricky "TH" sound in the word "Teeth."
|
||||||
|
👉 A fast-paced game to test if your brain can handle the "S" rule under pressure!""",
|
||||||
|
'practices': [
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'I want to hear about your day! What is the first thing you do in the morning?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1B_g45crvD0X2xfJJuCBdBhe7LNRJtKpa/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/13nV3uQ6Vftc0DznBJ8GQMi26dHxmMUwH/view?usp=drive_link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'That is a great start. What do you do for your hygiene? I brush...',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1ijbKHO9A3PEOUb712ycCw-P3ZvWX-NTp/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1r92ixsWSD58TrV9LIArPRaKk1bVE5m44/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'Perfect. And then, what do you do before you leave the house?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1xEHuliUwyqFV35o_C2varAHcoI3QrOsS/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1RJgS3tp0ZKQ1YIt9fLRch-IqFialZR6Q/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'And finally, what is the last thing you do at night?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1njWyQExmgAPWgDTrcpqitEoNjiPfCbEw/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/140O0xAkYpVo5FLZQmbc1BaY_6agYWeki/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'description':
|
||||||
|
"""What do you do from the moment you wake up until you go to bed? In Lesson 1.5, we master the art of describing your Daily Routine at Home. This is the best way to practice the "Simple Present Tense" so you can talk about your habits, chores, and schedules like a pro.
|
||||||
|
Our teacher will show you the "S" secret—the most important grammar rule for talking about other people—and teach you the "Time Order Words" that make your English flow naturally from one activity to the next.
|
||||||
|
"""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'Lesson 1.6',
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'subtitle': 'Express Your Feelings! Likes, Dislikes & Hobbies',
|
||||||
|
'topics':
|
||||||
|
"""👉 How to build perfect positive and negative sentences (I like vs. I don't like).
|
||||||
|
👉 Master the "Do you like...?" structure and the correct short answers.
|
||||||
|
👉 Learn why we switch from "Don't" to "Doesn't" for He and She.
|
||||||
|
👉 How to master the "L" sound and make your "Don't" sound natural and fast.
|
||||||
|
👉 A high-speed game to test if you can handle the grammar of likes and dislikes!""",
|
||||||
|
'practices': [
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'I want to know about your hobbies. Do you like football?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1ombhL58UTSSMlVr4OkjEN2m1TXeIs3Jw/view?usp=sharing',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1E-NilYZkazwTyAFwwNunDQmWIxBHH_GL/view?usp=drive_link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'That’s fun! Some people prefer quiet things. What do you like to do at home',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1HJqwHQId9MUhaQvjoyhuhk-ZQNCz5-RP/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1HJqwHQId9MUhaQvjoyhuhk-ZQNCz5-RP/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text':
|
||||||
|
'Interesting. Many people like music. Do you like slow music?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/13edPllK_dZYmmFIsue_A-sGmDe9fh89K/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1lA18zdiFbKKXaGwUvJv4JwBMW_Vxxkip/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'Do you like running?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1MSVceVXL-mAELGvv0_SN68t1-pCM-V6R/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1XkwoWINsoXDSe63kjJXQFczjtPKbBTY4/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'description':
|
||||||
|
"""What makes you happy? What do you avoid? In Lesson 1.6, we learn how to make your English conversations personal and fun by sharing your Likes and Dislikes. This is the final topic of Module 1, and it is the key to building real friendships by finding common interests!
|
||||||
|
We will see how to use the power of "Do" and "Don't," and show you how the "S" rule changes when we talk about what our friends like. Get ready to talk about football, coffee, music, and more!
|
||||||
|
"""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'Lesson 1.7',
|
||||||
|
'status': ProgressStatuses.started,
|
||||||
|
'subtitle': 'Module 1 Final Test! Speaking Review & Graduation',
|
||||||
|
'topics': """👉 Fast-paced practice for names, origins, and jobs.
|
||||||
|
Mastering "Have," "Has," and the plural "S" under pressure.
|
||||||
|
👉 Using the Simple Present Tense to describe your day and your likes.
|
||||||
|
👉 A bonus challenge to find and correct common beginner mistakes.
|
||||||
|
👉 Two speaking scripts to help you link your words and sound like a native speaker.""",
|
||||||
|
'practices': [
|
||||||
|
{
|
||||||
|
'question_text': 'Hello! What\'s your name?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/11xsnZpqOXQREc2nku77u_qOXucUdncDq/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1OgvhumoPNdw33WfxEZfS1xtYZHshAM-k/view?usp=drive_link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'It was a pleasure meeting you. Nice to meet you!',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1NmKeyx0mKmbFyZdmQ4sWGM6UMpwAIrHN/view?usp=drive_link',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1nu1fiK4dLCjW9jjENvThshU48vFj-T3h/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'Where are you from?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1uM2L6-u0H-LHyDQL_Y0txjoO64n5lHkp/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1VXhHRG2CJR3lx07cAuiZrfCxzxdOcCIz/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'And where do you live now?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1sGJpaRQ1wArA2iDq7BZM-56abMZwiISO/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/10Cj8r2KeYUttBJ7W2wETP8XSdK2ZItom/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'Do you have a brother or sister?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1cA4wD7zY7WRgorWladvf1f8QRu54oBBw/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1IeiGyN1S5XaREfXgmzfl-zESap8A_k3H/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'I am a teacher. Are you a student?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1n5w3skHBvQ2hE_OA2HdeUnr0YeN4zL2_/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1j86TVmeNzZvL8RueZeIueCQO_40i9aMh/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'question_text': 'What is the first thing you do in the morning?',
|
||||||
|
'question_audio_url':
|
||||||
|
'https://drive.google.com/file/d/1oCrDDtYF4-1S2UYu6shilqmQSqyRG3v_/view?usp=drive_link',
|
||||||
|
'sample_answer':
|
||||||
|
'https://drive.google.com/file/d/1shpCr2XvV12cXaxuJ-AjW-0XWvBdtT8Q/view?usp=drive_link'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'description':
|
||||||
|
"""Congratulations! You have reached the end of Module 1. You started with simple greetings, and now you are ready to hold a full conversation in English! This is our Final Speaking Review, where we test everything you’ve learned so far.
|
||||||
|
From your name and family to your daily habits and hobbies, this lesson is designed to push your speed, accuracy, and confidence. We will lead you through three high-intensity speaking drills and a bonus Grammar Check to make sure you are 100% ready for Module 2!
|
||||||
|
"""
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
List<Module> get modules => _modules;
|
List<Map<String, dynamic>> get modules => _modules;
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
void pop() => _navigationService.back();
|
void pop() => _navigationService.back();
|
||||||
|
|
@ -45,20 +371,4 @@ class LearnModuleViewModel extends BaseViewModel {
|
||||||
buttonLabel: 'Begin Lesson Practice',
|
buttonLabel: 'Begin Lesson Practice',
|
||||||
subtitle: 'Let’s quickly review what you’ve learned in this lesson!',
|
subtitle: 'Let’s quickly review what you’ve learned in this lesson!',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remote api call
|
|
||||||
|
|
||||||
// Learn modules
|
|
||||||
Future<void> getModules(int id) async => await runBusyFuture(_getModules(id),
|
|
||||||
busyObject: StateObjects.learnModules);
|
|
||||||
|
|
||||||
Future<void> _getModules(int id) async {
|
|
||||||
if (_modules.isEmpty) {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
_modules = await _apiService.getModules(id);
|
|
||||||
_modules.sort(
|
|
||||||
(a, b) => (a.displayOrder ?? 0).compareTo(b.displayOrder ?? 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'package:audioplayers/audioplayers.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:waveform_recorder/waveform_recorder.dart';
|
import 'package:waveform_recorder/waveform_recorder.dart';
|
||||||
import 'package:yimaru_app/models/user.dart';
|
import 'package:yimaru_app/models/user_model.dart';
|
||||||
import 'package:yimaru_app/services/authentication_service.dart';
|
import 'package:yimaru_app/services/authentication_service.dart';
|
||||||
import 'package:yimaru_app/services/voice_recorder_service.dart';
|
import 'package:yimaru_app/services/voice_recorder_service.dart';
|
||||||
import 'package:yimaru_app/ui/common/enmus.dart';
|
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||||
|
|
@ -32,9 +32,9 @@ class LearnPracticeViewModel extends ReactiveViewModel {
|
||||||
[_audioPlayerService, _voiceRecorderService, _authenticationService];
|
[_audioPlayerService, _voiceRecorderService, _authenticationService];
|
||||||
|
|
||||||
// User
|
// User
|
||||||
User? get _user => _authenticationService.user;
|
UserModel? get _user => _authenticationService.user;
|
||||||
|
|
||||||
User? get user => _user;
|
UserModel? get user => _user;
|
||||||
|
|
||||||
// AudioPlayer
|
// AudioPlayer
|
||||||
AudioPlayer get _player => _audioPlayerService.player;
|
AudioPlayer get _player => _audioPlayerService.player;
|
||||||
|
|
@ -55,6 +55,7 @@ class LearnPracticeViewModel extends ReactiveViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Voice recorder
|
// Voice recorder
|
||||||
|
|
||||||
WaveformRecorderController get _waveController =>
|
WaveformRecorderController get _waveController =>
|
||||||
_voiceRecorderService.waveController;
|
_voiceRecorderService.waveController;
|
||||||
|
|
||||||
|
|
@ -81,36 +82,22 @@ class LearnPracticeViewModel extends ReactiveViewModel {
|
||||||
|
|
||||||
Map<String, dynamic> get selectedPractice => _selectedPractice;
|
Map<String, dynamic> get selectedPractice => _selectedPractice;
|
||||||
|
|
||||||
// Voice recorder
|
// Practice
|
||||||
Future<void> stopRecording() async =>
|
void setPractice(Map<String, dynamic> practice) {
|
||||||
await _voiceRecorderService.stopRecording();
|
_selectedPractice = practice;
|
||||||
|
goTo(1);
|
||||||
Future<void> startRecording() async => await runBusyFuture(_startRecording(),
|
|
||||||
busyObject: StateObjects.recordLearnPracticeAnswer);
|
|
||||||
|
|
||||||
Future<void> _startRecording() async =>
|
|
||||||
await _voiceRecorderService.startRecording();
|
|
||||||
|
|
||||||
// Sample audio
|
|
||||||
Future<void> playSampleAudio() async =>
|
|
||||||
await runBusyFuture(_playSampleAudio(),
|
|
||||||
busyObject: StateObjects.learnPracticeSample);
|
|
||||||
|
|
||||||
Future<void> _playSampleAudio() async {
|
|
||||||
setBusyObject(StateObjects.learnPracticeSample);
|
|
||||||
await _audioPlayerService.playUrl(_selectedPractice['sample_answer']);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> pauseSampleAudio() async =>
|
|
||||||
await runBusyFuture(_pauseSampleAudio(),
|
|
||||||
busyObject: StateObjects.learnPracticeSample);
|
|
||||||
|
|
||||||
Future<void> _pauseSampleAudio() async {
|
|
||||||
setBusyObject(StateObjects.learnPracticeSample);
|
|
||||||
await _audioPlayerService.pause();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play practice audio
|
// Play practice audio
|
||||||
|
Future<void> playQuestionAudio() async =>
|
||||||
|
await runBusyFuture(_playQuestionAudio(),
|
||||||
|
busyObject: StateObjects.learnPracticeQuestion);
|
||||||
|
|
||||||
|
Future<void> _playQuestionAudio() async {
|
||||||
|
goTo(3);
|
||||||
|
await _audioPlayerService.playUrl(_selectedPractice['question_audio_url']);
|
||||||
|
}
|
||||||
|
|
||||||
void _listenToAudio() {
|
void _listenToAudio() {
|
||||||
_audioPlayerService.durationStream.listen((dur) {
|
_audioPlayerService.durationStream.listen((dur) {
|
||||||
_duration = dur;
|
_duration = dur;
|
||||||
|
|
@ -125,13 +112,29 @@ class LearnPracticeViewModel extends ReactiveViewModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> playQuestionAudio() async =>
|
// Set busy object
|
||||||
await runBusyFuture(_playQuestionAudio(),
|
|
||||||
busyObject: StateObjects.learnPracticeQuestion);
|
|
||||||
|
|
||||||
Future<void> _playQuestionAudio() async {
|
void setBusyObject(StateObjects object) {
|
||||||
goTo(3);
|
_busyObject = object;
|
||||||
await _audioPlayerService.playUrl(_selectedPractice['question_audio_url']);
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sample audio
|
||||||
|
Future<void> playSampleAudio() async =>
|
||||||
|
await runBusyFuture(_playSampleAudio(),
|
||||||
|
busyObject: StateObjects.learnPracticeSample);
|
||||||
|
Future<void> _playSampleAudio() async {
|
||||||
|
setBusyObject(StateObjects.learnPracticeSample);
|
||||||
|
await _audioPlayerService.playUrl(_selectedPractice['sample_answer']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pauseSampleAudio() async =>
|
||||||
|
await runBusyFuture(_pauseSampleAudio(),
|
||||||
|
busyObject: StateObjects.learnPracticeSample);
|
||||||
|
|
||||||
|
Future<void> _pauseSampleAudio() async {
|
||||||
|
setBusyObject(StateObjects.learnPracticeSample);
|
||||||
|
await _audioPlayerService.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recorded audio
|
// Recorded audio
|
||||||
|
|
@ -154,17 +157,15 @@ class LearnPracticeViewModel extends ReactiveViewModel {
|
||||||
await _audioPlayerService.pause();
|
await _audioPlayerService.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set busy object
|
// Voice recorder
|
||||||
void setBusyObject(StateObjects object) {
|
Future<void> startRecording() async => await runBusyFuture(_startRecording(),
|
||||||
_busyObject = object;
|
busyObject: StateObjects.recordLearnPracticeAnswer);
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Practice
|
Future<void> _startRecording() async =>
|
||||||
void setPractice(Map<String, dynamic> practice) {
|
await _voiceRecorderService.startRecording();
|
||||||
_selectedPractice = practice;
|
|
||||||
goTo(1);
|
Future<void> stopRecording() async =>
|
||||||
}
|
await _voiceRecorderService.stopRecording();
|
||||||
|
|
||||||
// Dialogue
|
// Dialogue
|
||||||
Future<bool?> showAbortDialog() async {
|
Future<bool?> showAbortDialog() async {
|
||||||
|
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:stacked/stacked.dart';
|
|
||||||
import 'package:yimaru_app/ui/widgets/learn_subcategory_card.dart';
|
|
||||||
|
|
||||||
import '../../../models/subcategory.dart';
|
|
||||||
import '../../common/app_colors.dart';
|
|
||||||
import '../../common/enmus.dart';
|
|
||||||
import '../../common/ui_helpers.dart';
|
|
||||||
import '../../widgets/custom_circular_progress_indicator.dart';
|
|
||||||
import '../../widgets/profile_app_bar.dart';
|
|
||||||
import 'learn_subcategory_viewmodel.dart';
|
|
||||||
|
|
||||||
class LearnSubcategoryView extends StackedView<LearnSubcategoryViewModel> {
|
|
||||||
const LearnSubcategoryView({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onViewModelReady(LearnSubcategoryViewModel viewModel) async {
|
|
||||||
await viewModel.getLearnSubcategories();
|
|
||||||
super.onViewModelReady(viewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
LearnSubcategoryViewModel viewModelBuilder(BuildContext context) =>
|
|
||||||
LearnSubcategoryViewModel();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget builder(
|
|
||||||
BuildContext context,
|
|
||||||
LearnSubcategoryViewModel viewModel,
|
|
||||||
Widget? child,
|
|
||||||
) =>
|
|
||||||
_buildScaffoldWrapper(viewModel);
|
|
||||||
|
|
||||||
Widget _buildScaffoldWrapper(LearnSubcategoryViewModel viewModel) => Scaffold(
|
|
||||||
backgroundColor: kcBackgroundColor,
|
|
||||||
body: _buildScaffold(viewModel),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildScaffold(LearnSubcategoryViewModel viewModel) =>
|
|
||||||
SafeArea(child: _buildBody(viewModel));
|
|
||||||
|
|
||||||
Widget _buildBody(LearnSubcategoryViewModel viewModel) => Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
||||||
child: _buildColumn(viewModel),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildColumn(LearnSubcategoryViewModel viewModel) => Column(
|
|
||||||
children: [
|
|
||||||
verticalSpaceMedium,
|
|
||||||
_buildAppBar(viewModel),
|
|
||||||
verticalSpaceMedium,
|
|
||||||
_buildSubcategoryColumnWrapper(viewModel)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildAppBar(LearnSubcategoryViewModel viewModel) => ProfileAppBar(
|
|
||||||
name: viewModel.user?.firstName,
|
|
||||||
profileImage: viewModel.user?.profilePicture,
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildSubcategoryColumnWrapper(LearnSubcategoryViewModel viewModel) =>
|
|
||||||
Expanded(child: _buildSubcategoryColumnScrollView(viewModel));
|
|
||||||
|
|
||||||
Widget _buildSubcategoryColumnScrollView(
|
|
||||||
LearnSubcategoryViewModel viewModel) =>
|
|
||||||
SingleChildScrollView(
|
|
||||||
child: _buildListViewBuilder(viewModel),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildListViewBuilder(LearnSubcategoryViewModel viewModel) =>
|
|
||||||
viewModel.busy(StateObjects.learnSubcategories)
|
|
||||||
? _buildProgressIndicator()
|
|
||||||
: _buildListView(viewModel);
|
|
||||||
|
|
||||||
Widget _buildProgressIndicator() => const Center(
|
|
||||||
child: CustomCircularProgressIndicator(color: kcPrimaryColor),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildListView(LearnSubcategoryViewModel viewModel) =>
|
|
||||||
ListView.separated(
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: viewModel.subcategories.length,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
separatorBuilder: (context, index) => verticalSpaceSmall,
|
|
||||||
itemBuilder: (context, index) => _buildTile(
|
|
||||||
subcategory: viewModel.subcategories[index],
|
|
||||||
onTap: () async => await viewModel
|
|
||||||
.navigateToLearn(viewModel.subcategories[index].id ?? 0),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildTile({
|
|
||||||
required Subcategory subcategory,
|
|
||||||
required GestureTapCallback onTap,
|
|
||||||
}) =>
|
|
||||||
LearnSubcategoryCard(
|
|
||||||
onTap: onTap,
|
|
||||||
subcategory: subcategory,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
import 'package:stacked/stacked.dart';
|
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
|
||||||
import '../../../app/app.router.dart';
|
|
||||||
import '../../../models/subcategory.dart';
|
|
||||||
import '../../../models/user.dart';
|
|
||||||
import '../../../services/api_service.dart';
|
|
||||||
import '../../../services/authentication_service.dart';
|
|
||||||
import '../../../services/status_checker_service.dart';
|
|
||||||
import '../../common/enmus.dart';
|
|
||||||
|
|
||||||
class LearnSubcategoryViewModel extends ReactiveViewModel {
|
|
||||||
// Dependency injection
|
|
||||||
final _apiService = locator<ApiService>();
|
|
||||||
|
|
||||||
final _statusChecker = locator<StatusCheckerService>();
|
|
||||||
|
|
||||||
final _navigationService = locator<NavigationService>();
|
|
||||||
|
|
||||||
final _authenticationService = locator<AuthenticationService>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<ListenableServiceMixin> get listenableServices =>
|
|
||||||
[_authenticationService];
|
|
||||||
|
|
||||||
// Current user
|
|
||||||
User? get _user => _authenticationService.user;
|
|
||||||
|
|
||||||
User? get user => _user;
|
|
||||||
|
|
||||||
// Learn subcategories
|
|
||||||
List<Subcategory> _subcategories = [];
|
|
||||||
|
|
||||||
List<Subcategory> get subcategories => _subcategories;
|
|
||||||
|
|
||||||
// Navigation
|
|
||||||
Future<void> navigateToLearn(int id) async =>
|
|
||||||
_navigationService.navigateToLearnView(id: id);
|
|
||||||
|
|
||||||
// Remote api call
|
|
||||||
|
|
||||||
// Learn subcategories
|
|
||||||
Future<void> getLearnSubcategories() async =>
|
|
||||||
await runBusyFuture(_getLearnSubcategories(),
|
|
||||||
busyObject: StateObjects.learnSubcategories);
|
|
||||||
|
|
||||||
Future<void> _getLearnSubcategories() async {
|
|
||||||
if (_subcategories.isEmpty) {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
_subcategories = await _apiService.getLearnSubcategories();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -11,8 +11,8 @@ import 'login_viewmodel.dart';
|
||||||
|
|
||||||
@FormView(fields: [
|
@FormView(fields: [
|
||||||
FormTextField(name: 'otp', validator: FormValidator.validateForm),
|
FormTextField(name: 'otp', validator: FormValidator.validateForm),
|
||||||
FormTextField(name: 'password', validator: FormValidator.validateForm),
|
|
||||||
FormTextField(name: 'email', validator: FormValidator.validateEmailForm),
|
FormTextField(name: 'email', validator: FormValidator.validateEmailForm),
|
||||||
|
FormTextField(name: 'password', validator: FormValidator.validateForm),
|
||||||
FormTextField(name: 'phoneNumber', validator: FormValidator.validateForm)
|
FormTextField(name: 'phoneNumber', validator: FormValidator.validateForm)
|
||||||
])
|
])
|
||||||
class LoginView extends StackedView<LoginViewModel> with $LoginView {
|
class LoginView extends StackedView<LoginViewModel> with $LoginView {
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import 'package:yimaru_app/ui/common/validators/form_validator.dart';
|
||||||
const bool _autoTextFieldValidation = true;
|
const bool _autoTextFieldValidation = true;
|
||||||
|
|
||||||
const String OtpValueKey = 'otp';
|
const String OtpValueKey = 'otp';
|
||||||
const String PasswordValueKey = 'password';
|
|
||||||
const String EmailValueKey = 'email';
|
const String EmailValueKey = 'email';
|
||||||
|
const String PasswordValueKey = 'password';
|
||||||
const String PhoneNumberValueKey = 'phoneNumber';
|
const String PhoneNumberValueKey = 'phoneNumber';
|
||||||
|
|
||||||
final Map<String, TextEditingController> _LoginViewTextEditingControllers = {};
|
final Map<String, TextEditingController> _LoginViewTextEditingControllers = {};
|
||||||
|
|
@ -23,24 +23,24 @@ final Map<String, FocusNode> _LoginViewFocusNodes = {};
|
||||||
|
|
||||||
final Map<String, String? Function(String?)?> _LoginViewTextValidations = {
|
final Map<String, String? Function(String?)?> _LoginViewTextValidations = {
|
||||||
OtpValueKey: FormValidator.validateForm,
|
OtpValueKey: FormValidator.validateForm,
|
||||||
PasswordValueKey: FormValidator.validateForm,
|
|
||||||
EmailValueKey: FormValidator.validateEmailForm,
|
EmailValueKey: FormValidator.validateEmailForm,
|
||||||
|
PasswordValueKey: FormValidator.validateForm,
|
||||||
PhoneNumberValueKey: FormValidator.validateForm,
|
PhoneNumberValueKey: FormValidator.validateForm,
|
||||||
};
|
};
|
||||||
|
|
||||||
mixin $LoginView {
|
mixin $LoginView {
|
||||||
TextEditingController get otpController =>
|
TextEditingController get otpController =>
|
||||||
_getFormTextEditingController(OtpValueKey);
|
_getFormTextEditingController(OtpValueKey);
|
||||||
TextEditingController get passwordController =>
|
|
||||||
_getFormTextEditingController(PasswordValueKey);
|
|
||||||
TextEditingController get emailController =>
|
TextEditingController get emailController =>
|
||||||
_getFormTextEditingController(EmailValueKey);
|
_getFormTextEditingController(EmailValueKey);
|
||||||
|
TextEditingController get passwordController =>
|
||||||
|
_getFormTextEditingController(PasswordValueKey);
|
||||||
TextEditingController get phoneNumberController =>
|
TextEditingController get phoneNumberController =>
|
||||||
_getFormTextEditingController(PhoneNumberValueKey);
|
_getFormTextEditingController(PhoneNumberValueKey);
|
||||||
|
|
||||||
FocusNode get otpFocusNode => _getFormFocusNode(OtpValueKey);
|
FocusNode get otpFocusNode => _getFormFocusNode(OtpValueKey);
|
||||||
FocusNode get passwordFocusNode => _getFormFocusNode(PasswordValueKey);
|
|
||||||
FocusNode get emailFocusNode => _getFormFocusNode(EmailValueKey);
|
FocusNode get emailFocusNode => _getFormFocusNode(EmailValueKey);
|
||||||
|
FocusNode get passwordFocusNode => _getFormFocusNode(PasswordValueKey);
|
||||||
FocusNode get phoneNumberFocusNode => _getFormFocusNode(PhoneNumberValueKey);
|
FocusNode get phoneNumberFocusNode => _getFormFocusNode(PhoneNumberValueKey);
|
||||||
|
|
||||||
TextEditingController _getFormTextEditingController(
|
TextEditingController _getFormTextEditingController(
|
||||||
|
|
@ -68,8 +68,8 @@ mixin $LoginView {
|
||||||
/// with the latest textController values
|
/// with the latest textController values
|
||||||
void syncFormWithViewModel(FormStateHelper model) {
|
void syncFormWithViewModel(FormStateHelper model) {
|
||||||
otpController.addListener(() => _updateFormData(model));
|
otpController.addListener(() => _updateFormData(model));
|
||||||
passwordController.addListener(() => _updateFormData(model));
|
|
||||||
emailController.addListener(() => _updateFormData(model));
|
emailController.addListener(() => _updateFormData(model));
|
||||||
|
passwordController.addListener(() => _updateFormData(model));
|
||||||
phoneNumberController.addListener(() => _updateFormData(model));
|
phoneNumberController.addListener(() => _updateFormData(model));
|
||||||
|
|
||||||
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
||||||
|
|
@ -83,8 +83,8 @@ mixin $LoginView {
|
||||||
)
|
)
|
||||||
void listenToFormUpdated(FormViewModel model) {
|
void listenToFormUpdated(FormViewModel model) {
|
||||||
otpController.addListener(() => _updateFormData(model));
|
otpController.addListener(() => _updateFormData(model));
|
||||||
passwordController.addListener(() => _updateFormData(model));
|
|
||||||
emailController.addListener(() => _updateFormData(model));
|
emailController.addListener(() => _updateFormData(model));
|
||||||
|
passwordController.addListener(() => _updateFormData(model));
|
||||||
phoneNumberController.addListener(() => _updateFormData(model));
|
phoneNumberController.addListener(() => _updateFormData(model));
|
||||||
|
|
||||||
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
_updateFormData(model, forceValidate: _autoTextFieldValidation);
|
||||||
|
|
@ -96,8 +96,8 @@ mixin $LoginView {
|
||||||
model.formValueMap
|
model.formValueMap
|
||||||
..addAll({
|
..addAll({
|
||||||
OtpValueKey: otpController.text,
|
OtpValueKey: otpController.text,
|
||||||
PasswordValueKey: passwordController.text,
|
|
||||||
EmailValueKey: emailController.text,
|
EmailValueKey: emailController.text,
|
||||||
|
PasswordValueKey: passwordController.text,
|
||||||
PhoneNumberValueKey: phoneNumberController.text,
|
PhoneNumberValueKey: phoneNumberController.text,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
@ -141,8 +141,8 @@ extension ValueProperties on FormStateHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
String? get otpValue => this.formValueMap[OtpValueKey] as String?;
|
String? get otpValue => this.formValueMap[OtpValueKey] as String?;
|
||||||
String? get passwordValue => this.formValueMap[PasswordValueKey] as String?;
|
|
||||||
String? get emailValue => this.formValueMap[EmailValueKey] as String?;
|
String? get emailValue => this.formValueMap[EmailValueKey] as String?;
|
||||||
|
String? get passwordValue => this.formValueMap[PasswordValueKey] as String?;
|
||||||
String? get phoneNumberValue =>
|
String? get phoneNumberValue =>
|
||||||
this.formValueMap[PhoneNumberValueKey] as String?;
|
this.formValueMap[PhoneNumberValueKey] as String?;
|
||||||
|
|
||||||
|
|
@ -156,16 +156,6 @@ extension ValueProperties on FormStateHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set passwordValue(String? value) {
|
|
||||||
this.setData(
|
|
||||||
this.formValueMap..addAll({PasswordValueKey: value}),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (_LoginViewTextEditingControllers.containsKey(PasswordValueKey)) {
|
|
||||||
_LoginViewTextEditingControllers[PasswordValueKey]?.text = value ?? '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set emailValue(String? value) {
|
set emailValue(String? value) {
|
||||||
this.setData(
|
this.setData(
|
||||||
this.formValueMap..addAll({EmailValueKey: value}),
|
this.formValueMap..addAll({EmailValueKey: value}),
|
||||||
|
|
@ -176,6 +166,16 @@ extension ValueProperties on FormStateHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set passwordValue(String? value) {
|
||||||
|
this.setData(
|
||||||
|
this.formValueMap..addAll({PasswordValueKey: value}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (_LoginViewTextEditingControllers.containsKey(PasswordValueKey)) {
|
||||||
|
_LoginViewTextEditingControllers[PasswordValueKey]?.text = value ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
set phoneNumberValue(String? value) {
|
set phoneNumberValue(String? value) {
|
||||||
this.setData(
|
this.setData(
|
||||||
this.formValueMap..addAll({PhoneNumberValueKey: value}),
|
this.formValueMap..addAll({PhoneNumberValueKey: value}),
|
||||||
|
|
@ -189,31 +189,31 @@ extension ValueProperties on FormStateHelper {
|
||||||
bool get hasOtp =>
|
bool get hasOtp =>
|
||||||
this.formValueMap.containsKey(OtpValueKey) &&
|
this.formValueMap.containsKey(OtpValueKey) &&
|
||||||
(otpValue?.isNotEmpty ?? false);
|
(otpValue?.isNotEmpty ?? false);
|
||||||
bool get hasPassword =>
|
|
||||||
this.formValueMap.containsKey(PasswordValueKey) &&
|
|
||||||
(passwordValue?.isNotEmpty ?? false);
|
|
||||||
bool get hasEmail =>
|
bool get hasEmail =>
|
||||||
this.formValueMap.containsKey(EmailValueKey) &&
|
this.formValueMap.containsKey(EmailValueKey) &&
|
||||||
(emailValue?.isNotEmpty ?? false);
|
(emailValue?.isNotEmpty ?? false);
|
||||||
|
bool get hasPassword =>
|
||||||
|
this.formValueMap.containsKey(PasswordValueKey) &&
|
||||||
|
(passwordValue?.isNotEmpty ?? false);
|
||||||
bool get hasPhoneNumber =>
|
bool get hasPhoneNumber =>
|
||||||
this.formValueMap.containsKey(PhoneNumberValueKey) &&
|
this.formValueMap.containsKey(PhoneNumberValueKey) &&
|
||||||
(phoneNumberValue?.isNotEmpty ?? false);
|
(phoneNumberValue?.isNotEmpty ?? false);
|
||||||
|
|
||||||
bool get hasOtpValidationMessage =>
|
bool get hasOtpValidationMessage =>
|
||||||
this.fieldsValidationMessages[OtpValueKey]?.isNotEmpty ?? false;
|
this.fieldsValidationMessages[OtpValueKey]?.isNotEmpty ?? false;
|
||||||
bool get hasPasswordValidationMessage =>
|
|
||||||
this.fieldsValidationMessages[PasswordValueKey]?.isNotEmpty ?? false;
|
|
||||||
bool get hasEmailValidationMessage =>
|
bool get hasEmailValidationMessage =>
|
||||||
this.fieldsValidationMessages[EmailValueKey]?.isNotEmpty ?? false;
|
this.fieldsValidationMessages[EmailValueKey]?.isNotEmpty ?? false;
|
||||||
|
bool get hasPasswordValidationMessage =>
|
||||||
|
this.fieldsValidationMessages[PasswordValueKey]?.isNotEmpty ?? false;
|
||||||
bool get hasPhoneNumberValidationMessage =>
|
bool get hasPhoneNumberValidationMessage =>
|
||||||
this.fieldsValidationMessages[PhoneNumberValueKey]?.isNotEmpty ?? false;
|
this.fieldsValidationMessages[PhoneNumberValueKey]?.isNotEmpty ?? false;
|
||||||
|
|
||||||
String? get otpValidationMessage =>
|
String? get otpValidationMessage =>
|
||||||
this.fieldsValidationMessages[OtpValueKey];
|
this.fieldsValidationMessages[OtpValueKey];
|
||||||
String? get passwordValidationMessage =>
|
|
||||||
this.fieldsValidationMessages[PasswordValueKey];
|
|
||||||
String? get emailValidationMessage =>
|
String? get emailValidationMessage =>
|
||||||
this.fieldsValidationMessages[EmailValueKey];
|
this.fieldsValidationMessages[EmailValueKey];
|
||||||
|
String? get passwordValidationMessage =>
|
||||||
|
this.fieldsValidationMessages[PasswordValueKey];
|
||||||
String? get phoneNumberValidationMessage =>
|
String? get phoneNumberValidationMessage =>
|
||||||
this.fieldsValidationMessages[PhoneNumberValueKey];
|
this.fieldsValidationMessages[PhoneNumberValueKey];
|
||||||
}
|
}
|
||||||
|
|
@ -221,18 +221,18 @@ extension ValueProperties on FormStateHelper {
|
||||||
extension Methods on FormStateHelper {
|
extension Methods on FormStateHelper {
|
||||||
setOtpValidationMessage(String? validationMessage) =>
|
setOtpValidationMessage(String? validationMessage) =>
|
||||||
this.fieldsValidationMessages[OtpValueKey] = validationMessage;
|
this.fieldsValidationMessages[OtpValueKey] = validationMessage;
|
||||||
setPasswordValidationMessage(String? validationMessage) =>
|
|
||||||
this.fieldsValidationMessages[PasswordValueKey] = validationMessage;
|
|
||||||
setEmailValidationMessage(String? validationMessage) =>
|
setEmailValidationMessage(String? validationMessage) =>
|
||||||
this.fieldsValidationMessages[EmailValueKey] = validationMessage;
|
this.fieldsValidationMessages[EmailValueKey] = validationMessage;
|
||||||
|
setPasswordValidationMessage(String? validationMessage) =>
|
||||||
|
this.fieldsValidationMessages[PasswordValueKey] = validationMessage;
|
||||||
setPhoneNumberValidationMessage(String? validationMessage) =>
|
setPhoneNumberValidationMessage(String? validationMessage) =>
|
||||||
this.fieldsValidationMessages[PhoneNumberValueKey] = validationMessage;
|
this.fieldsValidationMessages[PhoneNumberValueKey] = validationMessage;
|
||||||
|
|
||||||
/// Clears text input fields on the Form
|
/// Clears text input fields on the Form
|
||||||
void clearForm() {
|
void clearForm() {
|
||||||
otpValue = '';
|
otpValue = '';
|
||||||
passwordValue = '';
|
|
||||||
emailValue = '';
|
emailValue = '';
|
||||||
|
passwordValue = '';
|
||||||
phoneNumberValue = '';
|
phoneNumberValue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,8 +240,8 @@ extension Methods on FormStateHelper {
|
||||||
void validateForm() {
|
void validateForm() {
|
||||||
this.setValidationMessages({
|
this.setValidationMessages({
|
||||||
OtpValueKey: getValidationMessage(OtpValueKey),
|
OtpValueKey: getValidationMessage(OtpValueKey),
|
||||||
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
|
||||||
EmailValueKey: getValidationMessage(EmailValueKey),
|
EmailValueKey: getValidationMessage(EmailValueKey),
|
||||||
|
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
||||||
PhoneNumberValueKey: getValidationMessage(PhoneNumberValueKey),
|
PhoneNumberValueKey: getValidationMessage(PhoneNumberValueKey),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -263,7 +263,7 @@ String? getValidationMessage(String key) {
|
||||||
void updateValidationData(FormStateHelper model) =>
|
void updateValidationData(FormStateHelper model) =>
|
||||||
model.setValidationMessages({
|
model.setValidationMessages({
|
||||||
OtpValueKey: getValidationMessage(OtpValueKey),
|
OtpValueKey: getValidationMessage(OtpValueKey),
|
||||||
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
|
||||||
EmailValueKey: getValidationMessage(EmailValueKey),
|
EmailValueKey: getValidationMessage(EmailValueKey),
|
||||||
|
PasswordValueKey: getValidationMessage(PasswordValueKey),
|
||||||
PhoneNumberValueKey: getValidationMessage(PhoneNumberValueKey),
|
PhoneNumberValueKey: getValidationMessage(PhoneNumberValueKey),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:yimaru_app/app/app.locator.dart';
|
import 'package:yimaru_app/app/app.locator.dart';
|
||||||
import 'package:yimaru_app/app/app.router.dart';
|
import 'package:yimaru_app/app/app.router.dart';
|
||||||
import 'package:yimaru_app/models/user.dart';
|
import 'package:yimaru_app/models/user_model.dart';
|
||||||
|
|
||||||
import '../../../services/api_service.dart';
|
import '../../../services/api_service.dart';
|
||||||
import '../../../services/authentication_service.dart';
|
import '../../../services/authentication_service.dart';
|
||||||
|
|
@ -29,6 +29,8 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
@override
|
@override
|
||||||
List<ListenableServiceMixin> get listenableServices => [_googleAuthService];
|
List<ListenableServiceMixin> get listenableServices => [_googleAuthService];
|
||||||
|
|
||||||
|
// Sms
|
||||||
|
|
||||||
// Google user
|
// Google user
|
||||||
GoogleSignInAccount? get _googleUser => _googleAuthService.googleUser;
|
GoogleSignInAccount? get _googleUser => _googleAuthService.googleUser;
|
||||||
|
|
||||||
|
|
@ -126,16 +128,21 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
_resendTime = DateTime.now().add(const Duration(minutes: 3, seconds: 0));
|
_resendTime = DateTime.now().add(const Duration(minutes: 3, seconds: 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// User data
|
// Add user data
|
||||||
void clearUserData() {
|
|
||||||
_userData.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void addUserData(Map<String, dynamic> data) {
|
void addUserData(Map<String, dynamic> data) {
|
||||||
_userData.addAll(data);
|
_userData.addAll(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearUserData() {
|
||||||
|
_userData.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// In app navigation
|
// In app navigation
|
||||||
|
void goTo(int page) {
|
||||||
|
_currentPage = page;
|
||||||
|
rebuildUi();
|
||||||
|
}
|
||||||
|
|
||||||
void goBack() {
|
void goBack() {
|
||||||
if (_currentPage == 1) {
|
if (_currentPage == 1) {
|
||||||
_currentPage = 0;
|
_currentPage = 0;
|
||||||
|
|
@ -148,21 +155,16 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void goTo(int page) {
|
|
||||||
_currentPage = page;
|
|
||||||
rebuildUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
Future<void> replaceWithHome() async =>
|
|
||||||
await _navigationService.clearStackAndShow(Routes.homeView);
|
|
||||||
|
|
||||||
Future<void> navigateToRegister() async =>
|
Future<void> navigateToRegister() async =>
|
||||||
await _navigationService.navigateToRegisterView();
|
await _navigationService.navigateToRegisterView();
|
||||||
|
|
||||||
Future<void> navigateToForgetPassword() async =>
|
Future<void> navigateToForgetPassword() async =>
|
||||||
await _navigationService.navigateToForgetPasswordView();
|
await _navigationService.navigateToForgetPasswordView();
|
||||||
|
|
||||||
|
Future<void> replaceWithHome() async =>
|
||||||
|
await _navigationService.clearStackAndShow(Routes.homeView);
|
||||||
|
|
||||||
// Remote api calls
|
// Remote api calls
|
||||||
|
|
||||||
// Login with email
|
// Login with email
|
||||||
|
|
@ -173,7 +175,7 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
if (await _statusChecker.checkConnection()) {
|
if (await _statusChecker.checkConnection()) {
|
||||||
Map<String, dynamic> response = await _apiService.login(_userData);
|
Map<String, dynamic> response = await _apiService.login(_userData);
|
||||||
if (response['status'] == ResponseStatus.success) {
|
if (response['status'] == ResponseStatus.success) {
|
||||||
User user = response['data'] as User;
|
UserModel user = response['data'] as UserModel;
|
||||||
Map<String, dynamic> data = {
|
Map<String, dynamic> data = {
|
||||||
'userId': user.userId,
|
'userId': user.userId,
|
||||||
'accessToken': user.accessToken,
|
'accessToken': user.accessToken,
|
||||||
|
|
@ -190,37 +192,6 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sign-in with google
|
|
||||||
Future<void> _googleAuth() async {
|
|
||||||
if (await _statusChecker.checkConnection()) {
|
|
||||||
await _googleAuthService.googleAuth();
|
|
||||||
|
|
||||||
Map<String, dynamic> data = {
|
|
||||||
'id_token': _googleUser?.authentication.idToken ?? '',
|
|
||||||
};
|
|
||||||
|
|
||||||
Map<String, dynamic> response = await _apiService.googleAuth(data);
|
|
||||||
|
|
||||||
if (response['status'] == ResponseStatus.success) {
|
|
||||||
User user = response['data'] as User;
|
|
||||||
Map<String, dynamic> data = {
|
|
||||||
'userId': user.userId,
|
|
||||||
'accessToken': user.accessToken,
|
|
||||||
'refreshToken': user.refreshToken
|
|
||||||
};
|
|
||||||
await _authenticationService.saveUserCredential(data);
|
|
||||||
clearUserData();
|
|
||||||
await replaceWithHome();
|
|
||||||
showSuccessToast(response['message']);
|
|
||||||
} else {
|
|
||||||
showErrorToast(response['message']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> signInWithGoogle() async => await runBusyFuture(_googleAuth(),
|
|
||||||
busyObject: StateObjects.loginWithGoogle);
|
|
||||||
|
|
||||||
// Login with phone
|
// Login with phone
|
||||||
Future<void> loginWithPhoneNumber() async =>
|
Future<void> loginWithPhoneNumber() async =>
|
||||||
await runBusyFuture(_loginWithPhoneNumber(),
|
await runBusyFuture(_loginWithPhoneNumber(),
|
||||||
|
|
@ -238,12 +209,46 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sign-in with google
|
||||||
|
Future<void> signInWithGoogle() async => await runBusyFuture(_googleAuth(),
|
||||||
|
busyObject: StateObjects.loginWithGoogle);
|
||||||
|
|
||||||
|
Future<void> _googleAuth() async {
|
||||||
|
if (await _statusChecker.checkConnection()) {
|
||||||
|
await _googleAuthService.googleAuth();
|
||||||
|
|
||||||
|
Map<String, dynamic> data = {
|
||||||
|
'id_token': _googleUser?.authentication.idToken ?? '',
|
||||||
|
};
|
||||||
|
|
||||||
|
Map<String, dynamic> response = await _apiService.googleAuth(data);
|
||||||
|
|
||||||
|
if (response['status'] == ResponseStatus.success) {
|
||||||
|
UserModel user = response['data'] as UserModel;
|
||||||
|
Map<String, dynamic> data = {
|
||||||
|
'userId': user.userId,
|
||||||
|
'accessToken': user.accessToken,
|
||||||
|
'refreshToken': user.refreshToken
|
||||||
|
};
|
||||||
|
await _authenticationService.saveUserCredential(data);
|
||||||
|
clearUserData();
|
||||||
|
await replaceWithHome();
|
||||||
|
showSuccessToast(response['message']);
|
||||||
|
} else {
|
||||||
|
showErrorToast(response['message']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Verify otp
|
// Verify otp
|
||||||
|
Future<void> verifyOtp() async =>
|
||||||
|
await runBusyFuture(_verifyOtp(), busyObject: StateObjects.verifyOtp);
|
||||||
|
|
||||||
Future<void> _verifyOtp() async {
|
Future<void> _verifyOtp() async {
|
||||||
if (await _statusChecker.checkConnection()) {
|
if (await _statusChecker.checkConnection()) {
|
||||||
Map<String, dynamic> response = await _apiService.verifyOtp(_userData);
|
Map<String, dynamic> response = await _apiService.verifyOtp(_userData);
|
||||||
if (response['status'] == ResponseStatus.success) {
|
if (response['status'] == ResponseStatus.success) {
|
||||||
User user = response['data'] as User;
|
UserModel user = response['data'] as UserModel;
|
||||||
Map<String, dynamic> data = {
|
Map<String, dynamic> data = {
|
||||||
'userId': user.userId,
|
'userId': user.userId,
|
||||||
'accessToken': user.accessToken,
|
'accessToken': user.accessToken,
|
||||||
|
|
@ -259,10 +264,10 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> verifyOtp() async =>
|
|
||||||
await runBusyFuture(_verifyOtp(), busyObject: StateObjects.verifyOtp);
|
|
||||||
|
|
||||||
// Resend otp
|
// Resend otp
|
||||||
|
Future<void> resendOtp() async =>
|
||||||
|
await runBusyFuture(_resendOtp(), busyObject: StateObjects.resendOtp);
|
||||||
|
|
||||||
Future<void> _resendOtp() async {
|
Future<void> _resendOtp() async {
|
||||||
if (await _statusChecker.checkConnection()) {
|
if (await _statusChecker.checkConnection()) {
|
||||||
resetButton();
|
resetButton();
|
||||||
|
|
@ -276,7 +281,4 @@ class LoginViewModel extends ReactiveViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> resendOtp() async =>
|
|
||||||
await runBusyFuture(_resendOtp(), busyObject: StateObjects.resendOtp);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import 'package:yimaru_app/services/image_picker_service.dart';
|
||||||
import 'package:yimaru_app/ui/common/enmus.dart';
|
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../models/user.dart';
|
import '../../../models/user_model.dart';
|
||||||
import '../../../services/api_service.dart';
|
import '../../../services/api_service.dart';
|
||||||
import '../../../services/authentication_service.dart';
|
import '../../../services/authentication_service.dart';
|
||||||
import '../../../services/google_auth_service.dart';
|
import '../../../services/google_auth_service.dart';
|
||||||
|
|
@ -32,9 +32,9 @@ class ProfileViewModel extends ReactiveViewModel {
|
||||||
[_authenticationService];
|
[_authenticationService];
|
||||||
|
|
||||||
// Current user
|
// Current user
|
||||||
User? get _user => _authenticationService.user;
|
UserModel? get _user => _authenticationService.user;
|
||||||
|
|
||||||
User? get user => _user;
|
UserModel? get user => _user;
|
||||||
|
|
||||||
// Image picker
|
// Image picker
|
||||||
Future<void> openCamera() async =>
|
Future<void> openCamera() async =>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../models/user.dart';
|
import '../../../models/user_model.dart';
|
||||||
import '../../../services/api_service.dart';
|
import '../../../services/api_service.dart';
|
||||||
import '../../../services/authentication_service.dart';
|
import '../../../services/authentication_service.dart';
|
||||||
import '../../../services/image_picker_service.dart';
|
import '../../../services/image_picker_service.dart';
|
||||||
|
|
@ -28,9 +28,9 @@ class ProfileDetailViewModel extends ReactiveViewModel
|
||||||
[_authenticationService];
|
[_authenticationService];
|
||||||
|
|
||||||
// Current user
|
// Current user
|
||||||
User? get _user => _authenticationService.user;
|
UserModel? get _user => _authenticationService.user;
|
||||||
|
|
||||||
User? get user => _user;
|
UserModel? get user => _user;
|
||||||
|
|
||||||
// First name
|
// First name
|
||||||
bool _focusFirstName = false;
|
bool _focusFirstName = false;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import 'package:yimaru_app/ui/common/enmus.dart';
|
||||||
import 'package:yimaru_app/ui/common/ui_helpers.dart';
|
import 'package:yimaru_app/ui/common/ui_helpers.dart';
|
||||||
|
|
||||||
import '../../../app/app.locator.dart';
|
import '../../../app/app.locator.dart';
|
||||||
import '../../../models/user.dart';
|
import '../../../models/user_model.dart';
|
||||||
import '../../../services/google_auth_service.dart';
|
import '../../../services/google_auth_service.dart';
|
||||||
import '../../../services/smart_auth_service.dart';
|
import '../../../services/smart_auth_service.dart';
|
||||||
import '../../../services/status_checker_service.dart';
|
import '../../../services/status_checker_service.dart';
|
||||||
|
|
@ -336,7 +336,7 @@ class RegisterViewModel extends ReactiveViewModel
|
||||||
Map<String, dynamic> response = await _apiService.googleAuth(data);
|
Map<String, dynamic> response = await _apiService.googleAuth(data);
|
||||||
|
|
||||||
if (response['status'] == ResponseStatus.success) {
|
if (response['status'] == ResponseStatus.success) {
|
||||||
User user = response['data'] as User;
|
UserModel user = response['data'] as UserModel;
|
||||||
Map<String, dynamic> data = {
|
Map<String, dynamic> data = {
|
||||||
'userId': user.userId,
|
'userId': user.userId,
|
||||||
'accessToken': user.accessToken,
|
'accessToken': user.accessToken,
|
||||||
|
|
@ -359,7 +359,7 @@ class RegisterViewModel extends ReactiveViewModel
|
||||||
if (await _statusChecker.checkConnection()) {
|
if (await _statusChecker.checkConnection()) {
|
||||||
Map<String, dynamic> response = await _apiService.verifyOtp(_userData);
|
Map<String, dynamic> response = await _apiService.verifyOtp(_userData);
|
||||||
if (response['status'] == ResponseStatus.success) {
|
if (response['status'] == ResponseStatus.success) {
|
||||||
User user = response['data'] as User;
|
UserModel user = response['data'] as UserModel;
|
||||||
Map<String, dynamic> data = {
|
Map<String, dynamic> data = {
|
||||||
'userId': user.userId,
|
'userId': user.userId,
|
||||||
'accessToken': user.accessToken,
|
'accessToken': user.accessToken,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:yimaru_app/models/category.dart';
|
import 'package:yimaru_app/models/course_category.dart';
|
||||||
import 'package:yimaru_app/ui/common/helper_functions.dart';
|
import 'package:yimaru_app/ui/common/helper_functions.dart';
|
||||||
|
|
||||||
import '../common/app_colors.dart';
|
import '../common/app_colors.dart';
|
||||||
|
|
@ -8,7 +8,7 @@ import '../common/ui_helpers.dart';
|
||||||
import 'custom_elevated_button.dart';
|
import 'custom_elevated_button.dart';
|
||||||
|
|
||||||
class CourseCategoryCard extends StatelessWidget {
|
class CourseCategoryCard extends StatelessWidget {
|
||||||
final Category category;
|
final CourseCategory category;
|
||||||
final GestureTapCallback? onTap;
|
final GestureTapCallback? onTap;
|
||||||
|
|
||||||
const CourseCategoryCard({super.key, this.onTap, required this.category});
|
const CourseCategoryCard({super.key, this.onTap, required this.category});
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/custom_linear_progress_indicator.dart';
|
import 'package:yimaru_app/ui/widgets/custom_linear_progress_indicator.dart';
|
||||||
|
|
||||||
import '../../models/subcategory.dart';
|
import '../../models/course_subcategory.dart';
|
||||||
import '../common/app_colors.dart';
|
import '../common/app_colors.dart';
|
||||||
import '../common/ui_helpers.dart';
|
import '../common/ui_helpers.dart';
|
||||||
import 'custom_elevated_button.dart';
|
import 'custom_elevated_button.dart';
|
||||||
|
|
||||||
class CourseSubcategoryTile extends StatelessWidget {
|
class CourseSubcategoryTile extends StatelessWidget {
|
||||||
final Subcategory subcategory;
|
final CourseSubcategory subcategory;
|
||||||
final GestureTapCallback? onCourseTap;
|
final GestureTapCallback? onCourseTap;
|
||||||
final GestureTapCallback? onPracticeTap;
|
final GestureTapCallback? onPracticeTap;
|
||||||
|
|
||||||
|
|
@ -57,9 +57,9 @@ class CourseSubcategoryTile extends StatelessWidget {
|
||||||
];
|
];
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
Widget _buildTitle() => Text(
|
||||||
(subcategory.name == null || subcategory.name!.isEmpty)
|
(subcategory.title == null || subcategory.title!.isEmpty)
|
||||||
? 'Course ${subcategory.id}'
|
? 'Course ${subcategory.id}'
|
||||||
: subcategory.name!,
|
: subcategory.title!,
|
||||||
style: style16P600,
|
style: style16P600,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,69 +1,67 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:yimaru_app/ui/views/learn_level/learn_level_viewmodel.dart';
|
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||||
|
import 'package:yimaru_app/ui/common/ui_helpers.dart';
|
||||||
|
import 'package:yimaru_app/ui/views/learn/learn_viewmodel.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/progress_status.dart';
|
import 'package:yimaru_app/ui/widgets/progress_status.dart';
|
||||||
|
|
||||||
import '../../models/level.dart';
|
|
||||||
import '../common/app_colors.dart';
|
import '../common/app_colors.dart';
|
||||||
import '../common/ui_helpers.dart';
|
|
||||||
import 'custom_elevated_button.dart';
|
import 'custom_elevated_button.dart';
|
||||||
|
|
||||||
class LearnLevelTile extends ViewModelWidget<LearnLevelViewModel> {
|
class LearnLevelTile extends ViewModelWidget<LearnViewModel> {
|
||||||
final Level level;
|
final String title;
|
||||||
final GestureTapCallback? onTap;
|
final String subtitle;
|
||||||
|
final ProgressStatuses status;
|
||||||
|
|
||||||
const LearnLevelTile({
|
const LearnLevelTile({
|
||||||
super.key,
|
super.key,
|
||||||
this.onTap,
|
required this.title,
|
||||||
required this.level,
|
required this.status,
|
||||||
|
required this.subtitle,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, LearnLevelViewModel viewModel) =>
|
Widget build(BuildContext context, LearnViewModel viewModel) =>
|
||||||
_buildExpansionTileCard(viewModel);
|
_buildExpansionTileCard(viewModel);
|
||||||
|
|
||||||
Widget _buildExpansionTileCard(LearnLevelViewModel viewModel) => Container(
|
Widget _buildExpansionTileCard(LearnViewModel viewModel) => Container(
|
||||||
margin: const EdgeInsets.only(bottom: 15),
|
margin: const EdgeInsets.only(bottom: 15),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: kcPrimaryColor.withOpacity(0.2),
|
color: status == ProgressStatuses.started
|
||||||
// color:
|
? kcPrimaryColor.withOpacity(0.2)
|
||||||
// current ? kcPrimaryColor.withOpacity(0.2) : kcVeryLightGrey,
|
: kcVeryLightGrey),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: _buildExpansionTile(viewModel),
|
child: _buildExpansionTile(viewModel),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildExpansionTile(LearnLevelViewModel viewModel) => ExpansionTile(
|
Widget _buildExpansionTile(LearnViewModel viewModel) => ExpansionTile(
|
||||||
enabled: true,
|
|
||||||
textColor: kcDarkGrey,
|
textColor: kcDarkGrey,
|
||||||
showTrailingIcon: true,
|
|
||||||
title: _buildTitleRow(),
|
title: _buildTitleRow(),
|
||||||
initiallyExpanded: false,
|
subtitle: _buildContent(),
|
||||||
collapsedIconColor: kcDarkGrey,
|
collapsedIconColor: kcDarkGrey,
|
||||||
collapsedTextColor: kcDarkGrey,
|
collapsedTextColor: kcDarkGrey,
|
||||||
shape: Border.all(color: kcTransparent),
|
shape: Border.all(color: kcTransparent),
|
||||||
expandedAlignment: Alignment.centerLeft,
|
expandedAlignment: Alignment.centerLeft,
|
||||||
backgroundColor: kcPrimaryColor.withOpacity(0.1),
|
childrenPadding: const EdgeInsets.all(15),
|
||||||
controlAffinity: ListTileControlAffinity.trailing,
|
controlAffinity: ListTileControlAffinity.trailing,
|
||||||
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
backgroundColor: status != ProgressStatuses.pending
|
||||||
|
? kcPrimaryColor.withOpacity(0.1)
|
||||||
|
: kcBackgroundColor,
|
||||||
tilePadding: const EdgeInsets.symmetric(horizontal: 15),
|
tilePadding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
collapsedBackgroundColor: kcPrimaryColor.withOpacity(0.1),
|
enabled: status != ProgressStatuses.pending ? true : false,
|
||||||
childrenPadding: const EdgeInsets.only(left: 15, right: 15, bottom: 15),
|
collapsedBackgroundColor: status != ProgressStatuses.pending
|
||||||
|
? kcPrimaryColor.withOpacity(0.1)
|
||||||
//enabled: current,
|
: kcBackgroundColor,
|
||||||
// showTrailingIcon: current,
|
showTrailingIcon: status != ProgressStatuses.pending ? true : false,
|
||||||
//initiallyExpanded: current,
|
initiallyExpanded: status == ProgressStatuses.started ? true : false,
|
||||||
// collapsedBackgroundColor:
|
|
||||||
// current ? kcPrimaryColor.withOpacity(0.1) : kcBackgroundColor,
|
|
||||||
// backgroundColor:
|
|
||||||
// current ? kcPrimaryColor.withOpacity(0.1) : kcBackgroundColor,
|
|
||||||
children: _buildExpansionTileChildren(viewModel),
|
children: _buildExpansionTileChildren(viewModel),
|
||||||
);
|
);
|
||||||
|
|
||||||
List<Widget> _buildExpansionTileChildren(LearnLevelViewModel viewModel) =>
|
List<Widget> _buildExpansionTileChildren(LearnViewModel viewModel) =>
|
||||||
[_buildViewButton(viewModel)];
|
[_buildActionButton(viewModel)];
|
||||||
|
|
||||||
Widget _buildTitleRow() => Row(
|
Widget _buildTitleRow() => Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
|
@ -72,27 +70,42 @@ class LearnLevelTile extends ViewModelWidget<LearnLevelViewModel> {
|
||||||
|
|
||||||
List<Widget> _buildTitleChildren() => [
|
List<Widget> _buildTitleChildren() => [
|
||||||
_buildTitle(),
|
_buildTitle(),
|
||||||
// if (current) horizontalSpaceSmall,
|
if (status != ProgressStatuses.pending) horizontalSpaceSmall,
|
||||||
// if (current) _buildProgressStatus()
|
if (status != ProgressStatuses.pending) _buildProgressStatus()
|
||||||
];
|
];
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
Widget _buildTitle() => Text(
|
||||||
level.title ?? '',
|
title,
|
||||||
style: style16P600,
|
style: const TextStyle(
|
||||||
);
|
fontSize: 16,
|
||||||
|
|
||||||
Widget _buildProgressStatus() => const ProgressStatus(
|
|
||||||
color: kcPrimaryColor,
|
color: kcPrimaryColor,
|
||||||
status: 'Current Level',
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildViewButton(LearnLevelViewModel viewModel) =>
|
Widget _buildProgressStatus() => ProgressStatus(
|
||||||
CustomElevatedButton(
|
status: status.name.substring(0, 1).toUpperCase() +
|
||||||
|
status.name.substring(1, status.name.length),
|
||||||
|
color: kcPrimaryColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildContent() => Text(
|
||||||
|
subtitle,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: kcDarkGrey,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildActionButton(LearnViewModel viewModel) => CustomElevatedButton(
|
||||||
height: 15,
|
height: 15,
|
||||||
onTap: onTap,
|
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
text: 'View Level',
|
|
||||||
foregroundColor: kcWhite,
|
foregroundColor: kcWhite,
|
||||||
backgroundColor: kcPrimaryColor,
|
backgroundColor: kcPrimaryColor,
|
||||||
|
text: status == ProgressStatuses.completed
|
||||||
|
? 'Review Course'
|
||||||
|
: status == ProgressStatuses.pending
|
||||||
|
? 'Start Learning'
|
||||||
|
: 'Continue Learning',
|
||||||
|
onTap: () async => await viewModel.navigateToLearnLevel(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,27 @@ import 'package:yimaru_app/ui/views/learn_module/learn_module_viewmodel.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/custom_linear_progress_indicator.dart';
|
import 'package:yimaru_app/ui/widgets/custom_linear_progress_indicator.dart';
|
||||||
import 'package:yimaru_app/ui/widgets/finish_practice_sheet.dart';
|
import 'package:yimaru_app/ui/widgets/finish_practice_sheet.dart';
|
||||||
|
|
||||||
import '../../models/module.dart';
|
|
||||||
import '../common/app_colors.dart';
|
import '../common/app_colors.dart';
|
||||||
import '../common/enmus.dart';
|
import '../common/enmus.dart';
|
||||||
import '../common/ui_helpers.dart';
|
import '../common/ui_helpers.dart';
|
||||||
import 'custom_elevated_button.dart';
|
import 'custom_elevated_button.dart';
|
||||||
|
|
||||||
class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
||||||
final Module module;
|
final String title;
|
||||||
final GestureTapCallback? onLessonTap;
|
final String topics;
|
||||||
final GestureTapCallback? onPracticeTap;
|
final String subtitle;
|
||||||
|
final String description;
|
||||||
|
final ProgressStatuses status;
|
||||||
|
final List<Map<String, dynamic>> practices;
|
||||||
|
|
||||||
const LearnModuleTile(
|
const LearnModuleTile(
|
||||||
{super.key, this.onLessonTap, this.onPracticeTap, required this.module});
|
{super.key,
|
||||||
|
required this.title,
|
||||||
|
required this.topics,
|
||||||
|
required this.status,
|
||||||
|
required this.subtitle,
|
||||||
|
required this.practices,
|
||||||
|
required this.description});
|
||||||
|
|
||||||
Future<void> _showSheet(
|
Future<void> _showSheet(
|
||||||
{required BuildContext context,
|
{required BuildContext context,
|
||||||
|
|
@ -49,7 +57,7 @@ class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
||||||
Stack(
|
Stack(
|
||||||
children: [
|
children: [
|
||||||
_buildExpansionTile(context: context, viewModel: viewModel),
|
_buildExpansionTile(context: context, viewModel: viewModel),
|
||||||
// _buildContainerShaderState()
|
_buildContainerShaderState()
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -57,11 +65,8 @@ class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
||||||
{required BuildContext context,
|
{required BuildContext context,
|
||||||
required LearnModuleViewModel viewModel}) =>
|
required LearnModuleViewModel viewModel}) =>
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
enabled: true,
|
|
||||||
title: _buildTitle(),
|
|
||||||
textColor: kcDarkGrey,
|
textColor: kcDarkGrey,
|
||||||
showTrailingIcon: true,
|
title: _buildTitle(),
|
||||||
initiallyExpanded: true,
|
|
||||||
subtitle: _buildContent(),
|
subtitle: _buildContent(),
|
||||||
leading: _buildIconWrapper(),
|
leading: _buildIconWrapper(),
|
||||||
collapsedIconColor: kcDarkGrey,
|
collapsedIconColor: kcDarkGrey,
|
||||||
|
|
@ -70,13 +75,13 @@ class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
||||||
shape: Border.all(color: kcTransparent),
|
shape: Border.all(color: kcTransparent),
|
||||||
expandedAlignment: Alignment.centerLeft,
|
expandedAlignment: Alignment.centerLeft,
|
||||||
collapsedBackgroundColor: kcBackgroundColor,
|
collapsedBackgroundColor: kcBackgroundColor,
|
||||||
|
enabled: status != ProgressStatuses.pending,
|
||||||
controlAffinity: ListTileControlAffinity.trailing,
|
controlAffinity: ListTileControlAffinity.trailing,
|
||||||
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
||||||
tilePadding: const EdgeInsets.symmetric(horizontal: 15),
|
tilePadding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
childrenPadding: const EdgeInsets.fromLTRB(70, 15, 15, 15),
|
childrenPadding: const EdgeInsets.fromLTRB(70, 15, 15, 15),
|
||||||
// enabled: status != ProgressStatuses.pending,
|
showTrailingIcon: status != ProgressStatuses.pending ? true : false,
|
||||||
// showTrailingIcon: status != ProgressStatuses.pending ? true : false,
|
initiallyExpanded: status == ProgressStatuses.started ? true : false,
|
||||||
//initiallyExpanded: status == ProgressStatuses.started ? true : false,
|
|
||||||
children:
|
children:
|
||||||
_buildExpansionTileChildren(context: context, viewModel: viewModel),
|
_buildExpansionTileChildren(context: context, viewModel: viewModel),
|
||||||
);
|
);
|
||||||
|
|
@ -92,19 +97,13 @@ class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
Widget _buildTitle() => Text(
|
||||||
module.title ?? '',
|
title,
|
||||||
maxLines: 1,
|
|
||||||
softWrap: false,
|
|
||||||
style: style16P600,
|
style: style16P600,
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildContent() => Text(
|
Widget _buildContent() => Text(
|
||||||
module.description ?? '',
|
subtitle,
|
||||||
maxLines: 1,
|
|
||||||
softWrap: false,
|
|
||||||
style: style14DG400,
|
style: style14DG400,
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
List<Widget> _buildExpansionTileChildren(
|
List<Widget> _buildExpansionTileChildren(
|
||||||
|
|
@ -180,16 +179,15 @@ class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
||||||
CustomElevatedButton(
|
CustomElevatedButton(
|
||||||
height: 15,
|
height: 15,
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
onTap: onLessonTap,
|
text: 'View Lessons',
|
||||||
text: 'View Module',
|
|
||||||
foregroundColor: kcWhite,
|
foregroundColor: kcWhite,
|
||||||
backgroundColor: kcPrimaryColor,
|
backgroundColor: kcPrimaryColor,
|
||||||
// onTap: () async => await viewModel.navigateToLearnLesson(
|
onTap: () async => await viewModel.navigateToLearnLesson(
|
||||||
// title: title,
|
title: title,
|
||||||
// topics: topics,
|
topics: topics,
|
||||||
// subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
// practices: practices,
|
practices: practices,
|
||||||
// description: description),
|
description: description),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildPracticeButtonWrapper(
|
Widget _buildPracticeButtonWrapper(
|
||||||
|
|
@ -205,21 +203,20 @@ class LearnModuleTile extends ViewModelWidget<LearnModuleViewModel> {
|
||||||
CustomElevatedButton(
|
CustomElevatedButton(
|
||||||
height: 15,
|
height: 15,
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
onTap: onPracticeTap,
|
|
||||||
text: 'View Practices',
|
text: 'View Practices',
|
||||||
backgroundColor: kcWhite,
|
backgroundColor: kcWhite,
|
||||||
borderColor: kcPrimaryColor,
|
borderColor: kcPrimaryColor,
|
||||||
foregroundColor: kcPrimaryColor,
|
foregroundColor: kcPrimaryColor,
|
||||||
// onTap: () async => await viewModel.navigateToLearnPractice(practices),
|
onTap: () async => await viewModel.navigateToLearnPractice(practices),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildSheet(LearnModuleViewModel viewModel) => FinishPracticeSheet(
|
Widget _buildSheet(LearnModuleViewModel viewModel) => FinishPracticeSheet(
|
||||||
onTap: viewModel.pop,
|
onTap: viewModel.pop,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Widget _buildContainerShaderState() => status == ProgressStatuses.pending
|
Widget _buildContainerShaderState() => status == ProgressStatuses.pending
|
||||||
// ? _buildContainerShaderWrapper()
|
? _buildContainerShaderWrapper()
|
||||||
// : Container();
|
: Container();
|
||||||
|
|
||||||
Widget _buildContainerShaderWrapper() => Positioned.fill(
|
Widget _buildContainerShaderWrapper() => Positioned.fill(
|
||||||
child: _buildContainerShader(),
|
child: _buildContainerShader(),
|
||||||
|
|
|
||||||
129
lib/ui/widgets/learn_sub_level_tile.dart
Normal file
129
lib/ui/widgets/learn_sub_level_tile.dart
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:stacked/stacked.dart';
|
||||||
|
import 'package:yimaru_app/ui/views/learn_level/learn_level_viewmodel.dart';
|
||||||
|
import 'package:yimaru_app/ui/widgets/progress_status.dart';
|
||||||
|
|
||||||
|
import '../common/app_colors.dart';
|
||||||
|
import '../common/ui_helpers.dart';
|
||||||
|
import 'custom_elevated_button.dart';
|
||||||
|
|
||||||
|
class LearnSubLevelTile extends ViewModelWidget<LearnLevelViewModel> {
|
||||||
|
final bool current;
|
||||||
|
final String title;
|
||||||
|
final String subtitle;
|
||||||
|
|
||||||
|
const LearnSubLevelTile({
|
||||||
|
super.key,
|
||||||
|
required this.title,
|
||||||
|
required this.current,
|
||||||
|
required this.subtitle,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, LearnLevelViewModel viewModel) =>
|
||||||
|
_buildExpansionTileCard(viewModel);
|
||||||
|
|
||||||
|
Widget _buildExpansionTileCard(LearnLevelViewModel viewModel) => Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 15),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
border: Border.all(
|
||||||
|
color:
|
||||||
|
current ? kcPrimaryColor.withOpacity(0.2) : kcVeryLightGrey),
|
||||||
|
),
|
||||||
|
child: _buildExpansionTile(viewModel),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildExpansionTile(LearnLevelViewModel viewModel) => ExpansionTile(
|
||||||
|
enabled: current,
|
||||||
|
textColor: kcDarkGrey,
|
||||||
|
title: _buildTitleRow(),
|
||||||
|
showTrailingIcon: current,
|
||||||
|
subtitle: _buildContent(),
|
||||||
|
initiallyExpanded: current,
|
||||||
|
collapsedIconColor: kcDarkGrey,
|
||||||
|
collapsedTextColor: kcDarkGrey,
|
||||||
|
shape: Border.all(color: kcTransparent),
|
||||||
|
expandedAlignment: Alignment.centerLeft,
|
||||||
|
childrenPadding: const EdgeInsets.all(15),
|
||||||
|
controlAffinity: ListTileControlAffinity.trailing,
|
||||||
|
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
backgroundColor:
|
||||||
|
current ? kcPrimaryColor.withOpacity(0.1) : kcBackgroundColor,
|
||||||
|
tilePadding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
collapsedBackgroundColor:
|
||||||
|
current ? kcPrimaryColor.withOpacity(0.1) : kcBackgroundColor,
|
||||||
|
children: _buildExpansionTileChildren(viewModel),
|
||||||
|
);
|
||||||
|
|
||||||
|
List<Widget> _buildExpansionTileChildren(LearnLevelViewModel viewModel) =>
|
||||||
|
[_buildActionButtonWrapper(viewModel)];
|
||||||
|
|
||||||
|
Widget _buildTitleRow() => Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: _buildTitleChildren(),
|
||||||
|
);
|
||||||
|
|
||||||
|
List<Widget> _buildTitleChildren() => [
|
||||||
|
_buildTitle(),
|
||||||
|
if (current) horizontalSpaceSmall,
|
||||||
|
if (current) _buildProgressStatus()
|
||||||
|
];
|
||||||
|
|
||||||
|
Widget _buildTitle() => Text(
|
||||||
|
title,
|
||||||
|
style: style16P600,
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildProgressStatus() => const ProgressStatus(
|
||||||
|
color: kcPrimaryColor,
|
||||||
|
status: 'Current Level',
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildContent() => Text(
|
||||||
|
subtitle,
|
||||||
|
style: style14DG400,
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildActionButtonWrapper(LearnLevelViewModel viewModel) => SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: _buildActionButtons(viewModel),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildActionButtons(LearnLevelViewModel viewModel) => Row(
|
||||||
|
children: [
|
||||||
|
_buildViewButtonWrapper(viewModel),
|
||||||
|
horizontalSpaceSmall,
|
||||||
|
_buildPracticeButtonWrapper(viewModel)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildViewButtonWrapper(LearnLevelViewModel viewModel) => Expanded(
|
||||||
|
child: _buildViewButton(viewModel),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildViewButton(LearnLevelViewModel viewModel) =>
|
||||||
|
CustomElevatedButton(
|
||||||
|
height: 15,
|
||||||
|
borderRadius: 12,
|
||||||
|
text: 'View Course',
|
||||||
|
foregroundColor: kcWhite,
|
||||||
|
backgroundColor: kcPrimaryColor,
|
||||||
|
onTap: () async => await viewModel.navigateToLearnModule(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildPracticeButtonWrapper(LearnLevelViewModel viewModel) => Expanded(
|
||||||
|
child: Container(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildPracticeButton(LearnLevelViewModel viewModel) =>
|
||||||
|
const CustomElevatedButton(
|
||||||
|
height: 15,
|
||||||
|
text: 'Practice',
|
||||||
|
borderRadius: 12,
|
||||||
|
backgroundColor: kcWhite,
|
||||||
|
borderColor: kcPrimaryColor,
|
||||||
|
foregroundColor: kcPrimaryColor
|
||||||
|
// onTap: () async => await viewModel.navigateToLearnPractice()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:yimaru_app/models/subcategory.dart';
|
|
||||||
|
|
||||||
import '../common/app_colors.dart';
|
|
||||||
import '../common/app_strings.dart';
|
|
||||||
import '../common/helper_functions.dart';
|
|
||||||
import '../common/ui_helpers.dart';
|
|
||||||
import 'custom_elevated_button.dart';
|
|
||||||
|
|
||||||
class LearnSubcategoryCard extends StatelessWidget {
|
|
||||||
final Subcategory subcategory;
|
|
||||||
final GestureTapCallback? onTap;
|
|
||||||
|
|
||||||
const LearnSubcategoryCard(
|
|
||||||
{super.key, this.onTap, required this.subcategory});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) => _buildContainer();
|
|
||||||
|
|
||||||
Widget _buildContainer() => Container(
|
|
||||||
height: 200,
|
|
||||||
padding: const EdgeInsets.all(15),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: getColor(),
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
|
||||||
),
|
|
||||||
child: _buildColumn(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildColumn() => Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: _buildColumnChildren(),
|
|
||||||
);
|
|
||||||
|
|
||||||
List<Widget> _buildColumnChildren() => [
|
|
||||||
_buildTitle(),
|
|
||||||
verticalSpaceTiny,
|
|
||||||
_buildSubtitle(),
|
|
||||||
verticalSpaceMedium,
|
|
||||||
__buildStartButtonWrapper(),
|
|
||||||
];
|
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
|
||||||
subcategory.name ?? '',
|
|
||||||
style: style18DG700,
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildSubtitle() => Text(
|
|
||||||
subcategory.description ?? ksCategorySubtitle,
|
|
||||||
maxLines: 3,
|
|
||||||
style: style16DG400,
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget __buildStartButtonWrapper() => SizedBox(
|
|
||||||
height: 40,
|
|
||||||
child: _buildStartButton(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildStartButton() => CustomElevatedButton(
|
|
||||||
height: 50,
|
|
||||||
width: 200,
|
|
||||||
onTap: onTap,
|
|
||||||
borderRadius: 12,
|
|
||||||
text: 'Select Course',
|
|
||||||
foregroundColor: kcWhite,
|
|
||||||
backgroundColor: kcPrimaryColor,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,123 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:stacked/stacked.dart';
|
|
||||||
import 'package:yimaru_app/models/course.dart';
|
|
||||||
import 'package:yimaru_app/ui/common/ui_helpers.dart';
|
|
||||||
import 'package:yimaru_app/ui/views/learn/learn_viewmodel.dart';
|
|
||||||
|
|
||||||
import '../common/app_colors.dart';
|
|
||||||
import 'custom_elevated_button.dart';
|
|
||||||
|
|
||||||
class LearnTile extends ViewModelWidget<LearnViewModel> {
|
|
||||||
final Course course;
|
|
||||||
final GestureTapCallback? onTap;
|
|
||||||
|
|
||||||
const LearnTile({
|
|
||||||
super.key,
|
|
||||||
this.onTap,
|
|
||||||
required this.course,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, LearnViewModel viewModel) =>
|
|
||||||
_buildExpansionTileCard(viewModel);
|
|
||||||
|
|
||||||
Widget _buildExpansionTileCard(LearnViewModel viewModel) => Container(
|
|
||||||
margin: const EdgeInsets.only(bottom: 15),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
|
||||||
border: Border.all(color: kcPrimaryColor.withOpacity(0.2)
|
|
||||||
// color: status == ProgressStatuses.started
|
|
||||||
// ? kcPrimaryColor.withOpacity(0.2)
|
|
||||||
// : kcVeryLightGrey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: _buildExpansionTile(viewModel),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildExpansionTile(LearnViewModel viewModel) => ExpansionTile(
|
|
||||||
enabled: true,
|
|
||||||
textColor: kcDarkGrey,
|
|
||||||
showTrailingIcon: true,
|
|
||||||
title: _buildTitleRow(),
|
|
||||||
initiallyExpanded: false,
|
|
||||||
subtitle: _buildContent(),
|
|
||||||
collapsedIconColor: kcDarkGrey,
|
|
||||||
collapsedTextColor: kcDarkGrey,
|
|
||||||
shape: Border.all(color: kcTransparent),
|
|
||||||
expandedAlignment: Alignment.centerLeft,
|
|
||||||
backgroundColor: kcPrimaryColor.withOpacity(0.1),
|
|
||||||
controlAffinity: ListTileControlAffinity.trailing,
|
|
||||||
childrenPadding: const EdgeInsets.only(bottom: 15),
|
|
||||||
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
tilePadding: const EdgeInsets.symmetric(horizontal: 15),
|
|
||||||
collapsedBackgroundColor: kcPrimaryColor.withOpacity(0.1),
|
|
||||||
// enabled: status != ProgressStatuses.pending ? true : false,
|
|
||||||
// status != ProgressStatuses.pending
|
|
||||||
// ? kcPrimaryColor.withOpacity(0.1)
|
|
||||||
// : kcBackgroundColor,
|
|
||||||
// collapsedBackgroundColor: status != ProgressStatuses.pending
|
|
||||||
// ? kcPrimaryColor.withOpacity(0.1)
|
|
||||||
// : kcBackgroundColor,
|
|
||||||
// showTrailingIcon: status != ProgressStatuses.pending ? true : false,
|
|
||||||
// initiallyExpanded: status == ProgressStatuses.started ? true : false,
|
|
||||||
children: _buildExpansionTileChildren(viewModel),
|
|
||||||
);
|
|
||||||
|
|
||||||
List<Widget> _buildExpansionTileChildren(LearnViewModel viewModel) => [
|
|
||||||
_buildDivider(),
|
|
||||||
verticalSpaceTiny,
|
|
||||||
_buildActionButtonWrapper(viewModel)
|
|
||||||
];
|
|
||||||
|
|
||||||
Widget _buildTitleRow() => Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: _buildTitleChildren(),
|
|
||||||
);
|
|
||||||
|
|
||||||
List<Widget> _buildTitleChildren() => [
|
|
||||||
_buildTitle(),
|
|
||||||
// if (status != ProgressStatuses.pending) horizontalSpaceSmall,
|
|
||||||
// if (status != ProgressStatuses.pending) _buildProgressStatus()
|
|
||||||
];
|
|
||||||
|
|
||||||
Widget _buildTitle() => Text(
|
|
||||||
course.title ?? '',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: kcPrimaryColor,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Widget _buildProgressStatus() => ProgressStatus(
|
|
||||||
// status: status.name.substring(0, 1).toUpperCase() +
|
|
||||||
// status.name.substring(1, status.name.length),
|
|
||||||
// color: kcPrimaryColor,
|
|
||||||
// );
|
|
||||||
|
|
||||||
Widget _buildContent() => Text(
|
|
||||||
course.description ?? '',
|
|
||||||
style: style14DG400,
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildDivider() => const Divider(color: kcVeryLightGrey);
|
|
||||||
|
|
||||||
Widget _buildActionButtonWrapper(LearnViewModel viewModel) => Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
||||||
child: _buildActionButton(viewModel),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _buildActionButton(LearnViewModel viewModel) => CustomElevatedButton(
|
|
||||||
height: 15,
|
|
||||||
onTap: onTap,
|
|
||||||
borderRadius: 12,
|
|
||||||
text: 'Start Course',
|
|
||||||
foregroundColor: kcWhite,
|
|
||||||
backgroundColor: kcPrimaryColor,
|
|
||||||
// text: status == ProgressStatuses.completed
|
|
||||||
// ? 'Review Course'
|
|
||||||
// : status == ProgressStatuses.pending
|
|
||||||
// ? 'Start Learning'
|
|
||||||
// : 'Continue Learning',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -84,8 +84,7 @@ class SelectableCoursePracticeQuestion
|
||||||
? _buildProgressIndicator()
|
? _buildProgressIndicator()
|
||||||
: _buildContinueButton(viewModel);
|
: _buildContinueButton(viewModel);
|
||||||
|
|
||||||
Widget _buildProgressIndicator() =>
|
Widget _buildProgressIndicator()=>const CustomCircularProgressIndicator(color: kcPrimaryColor);
|
||||||
const CustomCircularProgressIndicator(color: kcPrimaryColor);
|
|
||||||
|
|
||||||
Widget _buildContinueButton(CoursePracticeQuestionViewModel viewModel) =>
|
Widget _buildContinueButton(CoursePracticeQuestionViewModel viewModel) =>
|
||||||
CustomElevatedButton(
|
CustomElevatedButton(
|
||||||
|
|
@ -101,7 +100,7 @@ class SelectableCoursePracticeQuestion
|
||||||
? kcPrimaryColor
|
? kcPrimaryColor
|
||||||
: kcPrimaryColor.withOpacity(0.1),
|
: kcPrimaryColor.withOpacity(0.1),
|
||||||
onTap: viewModel.selectedAnswers.containsKey((index + 1).toString())
|
onTap: viewModel.selectedAnswers.containsKey((index + 1).toString())
|
||||||
? () async => await viewModel.nextQuestion(viewModel
|
? ()async =>await viewModel.nextQuestion(viewModel
|
||||||
.coursePracticeQuestions[
|
.coursePracticeQuestions[
|
||||||
index + 1 < viewModel.coursePracticeQuestions.length
|
index + 1 < viewModel.coursePracticeQuestions.length
|
||||||
? index + 1
|
? index + 1
|
||||||
|
|
@ -109,5 +108,6 @@ class SelectableCoursePracticeQuestion
|
||||||
.questionId ??
|
.questionId ??
|
||||||
0)
|
0)
|
||||||
: null,
|
: null,
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,7 @@ class WritingCoursePracticeQuestion
|
||||||
? _buildProgressIndicator()
|
? _buildProgressIndicator()
|
||||||
: _buildContinueButton(viewModel);
|
: _buildContinueButton(viewModel);
|
||||||
|
|
||||||
Widget _buildProgressIndicator() =>
|
Widget _buildProgressIndicator()=>const CustomCircularProgressIndicator(color: kcPrimaryColor);
|
||||||
const CustomCircularProgressIndicator(color: kcPrimaryColor);
|
|
||||||
|
|
||||||
Widget _buildContinueButton(CoursePracticeQuestionViewModel viewModel) =>
|
Widget _buildContinueButton(CoursePracticeQuestionViewModel viewModel) =>
|
||||||
CustomElevatedButton(
|
CustomElevatedButton(
|
||||||
|
|
@ -111,7 +110,7 @@ class WritingCoursePracticeQuestion
|
||||||
? kcPrimaryColor
|
? kcPrimaryColor
|
||||||
: kcPrimaryColor.withOpacity(0.1),
|
: kcPrimaryColor.withOpacity(0.1),
|
||||||
onTap: answerController.text.isNotEmpty
|
onTap: answerController.text.isNotEmpty
|
||||||
? () async => await viewModel.nextQuestion(
|
? ()async =>await viewModel.nextQuestion(
|
||||||
index + 1 < viewModel.coursePracticeQuestions.length
|
index + 1 < viewModel.coursePracticeQuestions.length
|
||||||
? index + 1
|
? index + 1
|
||||||
: index)
|
: index)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
name: yimaru_app
|
name: yimaru_app
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.1.3+4
|
version: 0.1.2+3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.3 <4.0.0'
|
sdk: '>=3.0.3 <4.0.0'
|
||||||
|
|
|
||||||
|
|
@ -8,40 +8,38 @@ import 'dart:ui' as _i10;
|
||||||
|
|
||||||
import 'package:audioplayers/audioplayers.dart' as _i4;
|
import 'package:audioplayers/audioplayers.dart' as _i4;
|
||||||
import 'package:dio/dio.dart' as _i2;
|
import 'package:dio/dio.dart' as _i2;
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart' as _i32;
|
import 'package:firebase_messaging/firebase_messaging.dart' as _i30;
|
||||||
import 'package:flutter/material.dart' as _i8;
|
import 'package:flutter/material.dart' as _i8;
|
||||||
import 'package:mockito/mockito.dart' as _i1;
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
import 'package:mockito/src/dummies.dart' as _i7;
|
import 'package:mockito/src/dummies.dart' as _i7;
|
||||||
import 'package:permission_handler/permission_handler.dart' as _i27;
|
import 'package:permission_handler/permission_handler.dart' as _i25;
|
||||||
import 'package:stacked_services/stacked_services.dart' as _i6;
|
import 'package:stacked_services/stacked_services.dart' as _i6;
|
||||||
import 'package:waveform_recorder/waveform_recorder.dart' as _i5;
|
import 'package:waveform_recorder/waveform_recorder.dart' as _i5;
|
||||||
import 'package:yimaru_app/models/category.dart' as _i15;
|
import 'package:yimaru_app/models/course.dart' as _i17;
|
||||||
import 'package:yimaru_app/models/course.dart' as _i21;
|
import 'package:yimaru_app/models/course_category.dart' as _i15;
|
||||||
import 'package:yimaru_app/models/course_detail.dart' as _i35;
|
import 'package:yimaru_app/models/course_detail.dart' as _i33;
|
||||||
import 'package:yimaru_app/models/course_lesson.dart' as _i18;
|
import 'package:yimaru_app/models/course_lesson.dart' as _i19;
|
||||||
import 'package:yimaru_app/models/course_progress.dart' as _i17;
|
import 'package:yimaru_app/models/course_progress.dart' as _i18;
|
||||||
import 'package:yimaru_app/models/level.dart' as _i22;
|
import 'package:yimaru_app/models/course_subcategory.dart' as _i16;
|
||||||
import 'package:yimaru_app/models/module.dart' as _i23;
|
import 'package:yimaru_app/models/practice.dart' as _i20;
|
||||||
import 'package:yimaru_app/models/practice.dart' as _i19;
|
import 'package:yimaru_app/models/practice_question.dart' as _i21;
|
||||||
import 'package:yimaru_app/models/practice_question.dart' as _i20;
|
|
||||||
import 'package:yimaru_app/models/question.dart' as _i14;
|
import 'package:yimaru_app/models/question.dart' as _i14;
|
||||||
import 'package:yimaru_app/models/subcategory.dart' as _i16;
|
import 'package:yimaru_app/models/user_model.dart' as _i12;
|
||||||
import 'package:yimaru_app/models/user.dart' as _i12;
|
|
||||||
import 'package:yimaru_app/services/api_service.dart' as _i13;
|
import 'package:yimaru_app/services/api_service.dart' as _i13;
|
||||||
import 'package:yimaru_app/services/audio_player_service.dart' as _i36;
|
import 'package:yimaru_app/services/audio_player_service.dart' as _i34;
|
||||||
import 'package:yimaru_app/services/authentication_service.dart' as _i11;
|
import 'package:yimaru_app/services/authentication_service.dart' as _i11;
|
||||||
import 'package:yimaru_app/services/course_service.dart' as _i34;
|
import 'package:yimaru_app/services/course_service.dart' as _i32;
|
||||||
import 'package:yimaru_app/services/dio_service.dart' as _i24;
|
import 'package:yimaru_app/services/dio_service.dart' as _i22;
|
||||||
import 'package:yimaru_app/services/google_auth_service.dart' as _i29;
|
import 'package:yimaru_app/services/google_auth_service.dart' as _i27;
|
||||||
import 'package:yimaru_app/services/image_downloader_service.dart' as _i30;
|
import 'package:yimaru_app/services/image_downloader_service.dart' as _i28;
|
||||||
import 'package:yimaru_app/services/image_picker_service.dart' as _i28;
|
import 'package:yimaru_app/services/image_picker_service.dart' as _i26;
|
||||||
import 'package:yimaru_app/services/notification_service.dart' as _i31;
|
import 'package:yimaru_app/services/notification_service.dart' as _i29;
|
||||||
import 'package:yimaru_app/services/permission_handler_service.dart' as _i26;
|
import 'package:yimaru_app/services/permission_handler_service.dart' as _i24;
|
||||||
import 'package:yimaru_app/services/secure_storage_service.dart' as _i3;
|
import 'package:yimaru_app/services/secure_storage_service.dart' as _i3;
|
||||||
import 'package:yimaru_app/services/smart_auth_service.dart' as _i33;
|
import 'package:yimaru_app/services/smart_auth_service.dart' as _i31;
|
||||||
import 'package:yimaru_app/services/status_checker_service.dart' as _i25;
|
import 'package:yimaru_app/services/status_checker_service.dart' as _i23;
|
||||||
import 'package:yimaru_app/services/voice_recorder_service.dart' as _i37;
|
import 'package:yimaru_app/services/voice_recorder_service.dart' as _i35;
|
||||||
import 'package:yimaru_app/ui/common/enmus.dart' as _i38;
|
import 'package:yimaru_app/ui/common/enmus.dart' as _i36;
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
// ignore_for_file: avoid_redundant_argument_values
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
|
@ -859,7 +857,7 @@ class MockAuthenticationService extends _i1.Mock
|
||||||
) as _i9.Future<void>);
|
) as _i9.Future<void>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<void> saveUserData(_i12.User? data) => (super.noSuchMethod(
|
_i9.Future<void> saveUserData(_i12.UserModel? data) => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#saveUserData,
|
#saveUserData,
|
||||||
[data],
|
[data],
|
||||||
|
|
@ -900,14 +898,14 @@ class MockAuthenticationService extends _i1.Mock
|
||||||
) as _i9.Future<void>);
|
) as _i9.Future<void>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<_i12.User?> getUser() => (super.noSuchMethod(
|
_i9.Future<_i12.UserModel?> getUser() => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getUser,
|
#getUser,
|
||||||
[],
|
[],
|
||||||
),
|
),
|
||||||
returnValue: _i9.Future<_i12.User?>.value(),
|
returnValue: _i9.Future<_i12.UserModel?>.value(),
|
||||||
returnValueForMissingStub: _i9.Future<_i12.User?>.value(),
|
returnValueForMissingStub: _i9.Future<_i12.UserModel?>.value(),
|
||||||
) as _i9.Future<_i12.User?>);
|
) as _i9.Future<_i12.UserModel?>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<void> logout() => (super.noSuchMethod(
|
_i9.Future<void> logout() => (super.noSuchMethod(
|
||||||
|
|
@ -1055,7 +1053,7 @@ class MockApiService extends _i1.Mock implements _i13.ApiService {
|
||||||
) as _i9.Future<Map<String, dynamic>>);
|
) as _i9.Future<Map<String, dynamic>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<Map<String, dynamic>> getProfileStatus(_i12.User? user) =>
|
_i9.Future<Map<String, dynamic>> getProfileStatus(_i12.UserModel? user) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getProfileStatus,
|
#getProfileStatus,
|
||||||
|
|
@ -1126,54 +1124,68 @@ class MockApiService extends _i1.Mock implements _i13.ApiService {
|
||||||
) as _i9.Future<List<_i14.Question>>);
|
) as _i9.Future<List<_i14.Question>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<List<_i15.Category>> getCategories() => (super.noSuchMethod(
|
_i9.Future<List<_i15.CourseCategory>> getCourseCategories() =>
|
||||||
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getCourseCategories,
|
#getCourseCategories,
|
||||||
[],
|
[],
|
||||||
),
|
),
|
||||||
returnValue: _i9.Future<List<_i15.Category>>.value(<_i15.Category>[]),
|
returnValue: _i9.Future<List<_i15.CourseCategory>>.value(
|
||||||
returnValueForMissingStub:
|
<_i15.CourseCategory>[]),
|
||||||
_i9.Future<List<_i15.Category>>.value(<_i15.Category>[]),
|
returnValueForMissingStub: _i9.Future<List<_i15.CourseCategory>>.value(
|
||||||
) as _i9.Future<List<_i15.Category>>);
|
<_i15.CourseCategory>[]),
|
||||||
|
) as _i9.Future<List<_i15.CourseCategory>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<List<_i16.Subcategory>> getSubcategories(int? id) =>
|
_i9.Future<List<_i16.CourseSubcategory>> getCourseSubcategories(int? id) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getCourseSubcategories,
|
#getCourseSubcategories,
|
||||||
[id],
|
[id],
|
||||||
),
|
),
|
||||||
returnValue:
|
returnValue: _i9.Future<List<_i16.CourseSubcategory>>.value(
|
||||||
_i9.Future<List<_i16.Subcategory>>.value(<_i16.Subcategory>[]),
|
<_i16.CourseSubcategory>[]),
|
||||||
returnValueForMissingStub:
|
returnValueForMissingStub:
|
||||||
_i9.Future<List<_i16.Subcategory>>.value(<_i16.Subcategory>[]),
|
_i9.Future<List<_i16.CourseSubcategory>>.value(
|
||||||
) as _i9.Future<List<_i16.Subcategory>>);
|
<_i16.CourseSubcategory>[]),
|
||||||
|
) as _i9.Future<List<_i16.CourseSubcategory>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<List<_i17.CourseProgress>> getCourseProgress(int? id) =>
|
_i9.Future<List<_i17.Course>> getCourses(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getCourses,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<List<_i17.Course>>.value(<_i17.Course>[]),
|
||||||
|
returnValueForMissingStub:
|
||||||
|
_i9.Future<List<_i17.Course>>.value(<_i17.Course>[]),
|
||||||
|
) as _i9.Future<List<_i17.Course>>);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i9.Future<List<_i18.CourseProgress>> getCourseProgress(int? id) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getCourseProgress,
|
#getCourseProgress,
|
||||||
[id],
|
[id],
|
||||||
),
|
),
|
||||||
returnValue: _i9.Future<List<_i17.CourseProgress>>.value(
|
returnValue: _i9.Future<List<_i18.CourseProgress>>.value(
|
||||||
<_i17.CourseProgress>[]),
|
<_i18.CourseProgress>[]),
|
||||||
returnValueForMissingStub: _i9.Future<List<_i17.CourseProgress>>.value(
|
returnValueForMissingStub: _i9.Future<List<_i18.CourseProgress>>.value(
|
||||||
<_i17.CourseProgress>[]),
|
<_i18.CourseProgress>[]),
|
||||||
) as _i9.Future<List<_i17.CourseProgress>>);
|
) as _i9.Future<List<_i18.CourseProgress>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<List<_i18.CourseLesson>> getCourseLessons(int? id) =>
|
_i9.Future<List<_i19.CourseLesson>> getCourseLessons(int? id) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getCourseLessons,
|
#getCourseLessons,
|
||||||
[id],
|
[id],
|
||||||
),
|
),
|
||||||
returnValue:
|
returnValue:
|
||||||
_i9.Future<List<_i18.CourseLesson>>.value(<_i18.CourseLesson>[]),
|
_i9.Future<List<_i19.CourseLesson>>.value(<_i19.CourseLesson>[]),
|
||||||
returnValueForMissingStub:
|
returnValueForMissingStub:
|
||||||
_i9.Future<List<_i18.CourseLesson>>.value(<_i18.CourseLesson>[]),
|
_i9.Future<List<_i19.CourseLesson>>.value(<_i19.CourseLesson>[]),
|
||||||
) as _i9.Future<List<_i18.CourseLesson>>);
|
) as _i9.Future<List<_i19.CourseLesson>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<Map<String, dynamic>> completeLesson(int? id) =>
|
_i9.Future<Map<String, dynamic>> completeLesson(int? id) =>
|
||||||
|
|
@ -1189,87 +1201,30 @@ class MockApiService extends _i1.Mock implements _i13.ApiService {
|
||||||
) as _i9.Future<Map<String, dynamic>>);
|
) as _i9.Future<Map<String, dynamic>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<List<_i19.Practice>> getCoursePractices(int? id) =>
|
_i9.Future<List<_i20.Practice>> getCoursePractices(int? id) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getCoursePractices,
|
#getCoursePractices,
|
||||||
[id],
|
[id],
|
||||||
),
|
),
|
||||||
returnValue: _i9.Future<List<_i19.Practice>>.value(<_i19.Practice>[]),
|
returnValue: _i9.Future<List<_i20.Practice>>.value(<_i20.Practice>[]),
|
||||||
returnValueForMissingStub:
|
returnValueForMissingStub:
|
||||||
_i9.Future<List<_i19.Practice>>.value(<_i19.Practice>[]),
|
_i9.Future<List<_i20.Practice>>.value(<_i20.Practice>[]),
|
||||||
) as _i9.Future<List<_i19.Practice>>);
|
) as _i9.Future<List<_i20.Practice>>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<List<_i20.PracticeQuestion>> getCoursePracticeQuestions(int? id) =>
|
_i9.Future<List<_i21.PracticeQuestion>> getCoursePracticeQuestions(int? id) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getCoursePracticeQuestions,
|
#getCoursePracticeQuestions,
|
||||||
[id],
|
[id],
|
||||||
),
|
),
|
||||||
returnValue: _i9.Future<List<_i20.PracticeQuestion>>.value(
|
returnValue: _i9.Future<List<_i21.PracticeQuestion>>.value(
|
||||||
<_i20.PracticeQuestion>[]),
|
<_i21.PracticeQuestion>[]),
|
||||||
returnValueForMissingStub:
|
returnValueForMissingStub:
|
||||||
_i9.Future<List<_i20.PracticeQuestion>>.value(
|
_i9.Future<List<_i21.PracticeQuestion>>.value(
|
||||||
<_i20.PracticeQuestion>[]),
|
<_i21.PracticeQuestion>[]),
|
||||||
) as _i9.Future<List<_i20.PracticeQuestion>>);
|
) as _i9.Future<List<_i21.PracticeQuestion>>);
|
||||||
|
|
||||||
@override
|
|
||||||
_i9.Future<_i14.Question?> getCoursePracticeQuestion(int? id) =>
|
|
||||||
(super.noSuchMethod(
|
|
||||||
Invocation.method(
|
|
||||||
#getCoursePracticeQuestion,
|
|
||||||
[id],
|
|
||||||
),
|
|
||||||
returnValue: _i9.Future<_i14.Question?>.value(),
|
|
||||||
returnValueForMissingStub: _i9.Future<_i14.Question?>.value(),
|
|
||||||
) as _i9.Future<_i14.Question?>);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_i9.Future<List<_i16.Subcategory>> getLearnSubcategories() =>
|
|
||||||
(super.noSuchMethod(
|
|
||||||
Invocation.method(
|
|
||||||
#getLearnSubcategories,
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
returnValue:
|
|
||||||
_i9.Future<List<_i16.Subcategory>>.value(<_i16.Subcategory>[]),
|
|
||||||
returnValueForMissingStub:
|
|
||||||
_i9.Future<List<_i16.Subcategory>>.value(<_i16.Subcategory>[]),
|
|
||||||
) as _i9.Future<List<_i16.Subcategory>>);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_i9.Future<List<_i21.Course>> getCourses(int? id) => (super.noSuchMethod(
|
|
||||||
Invocation.method(
|
|
||||||
#getCourses,
|
|
||||||
[id],
|
|
||||||
),
|
|
||||||
returnValue: _i9.Future<List<_i21.Course>>.value(<_i21.Course>[]),
|
|
||||||
returnValueForMissingStub:
|
|
||||||
_i9.Future<List<_i21.Course>>.value(<_i21.Course>[]),
|
|
||||||
) as _i9.Future<List<_i21.Course>>);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_i9.Future<List<_i22.Level>> getLevels(int? id) => (super.noSuchMethod(
|
|
||||||
Invocation.method(
|
|
||||||
#getLevels,
|
|
||||||
[id],
|
|
||||||
),
|
|
||||||
returnValue: _i9.Future<List<_i22.Level>>.value(<_i22.Level>[]),
|
|
||||||
returnValueForMissingStub:
|
|
||||||
_i9.Future<List<_i22.Level>>.value(<_i22.Level>[]),
|
|
||||||
) as _i9.Future<List<_i22.Level>>);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_i9.Future<List<_i23.Module>> getModules(int? id) => (super.noSuchMethod(
|
|
||||||
Invocation.method(
|
|
||||||
#getModules,
|
|
||||||
[id],
|
|
||||||
),
|
|
||||||
returnValue: _i9.Future<List<_i23.Module>>.value(<_i23.Module>[]),
|
|
||||||
returnValueForMissingStub:
|
|
||||||
_i9.Future<List<_i23.Module>>.value(<_i23.Module>[]),
|
|
||||||
) as _i9.Future<List<_i23.Module>>);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A class which mocks [SecureStorageService].
|
/// A class which mocks [SecureStorageService].
|
||||||
|
|
@ -1372,7 +1327,7 @@ class MockSecureStorageService extends _i1.Mock
|
||||||
/// A class which mocks [DioService].
|
/// A class which mocks [DioService].
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockDioService extends _i1.Mock implements _i24.DioService {
|
class MockDioService extends _i1.Mock implements _i22.DioService {
|
||||||
@override
|
@override
|
||||||
_i2.Dio get dio => (super.noSuchMethod(
|
_i2.Dio get dio => (super.noSuchMethod(
|
||||||
Invocation.getter(#dio),
|
Invocation.getter(#dio),
|
||||||
|
|
@ -1391,7 +1346,7 @@ class MockDioService extends _i1.Mock implements _i24.DioService {
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockStatusCheckerService extends _i1.Mock
|
class MockStatusCheckerService extends _i1.Mock
|
||||||
implements _i25.StatusCheckerService {
|
implements _i23.StatusCheckerService {
|
||||||
@override
|
@override
|
||||||
_i3.SecureStorageService get storage => (super.noSuchMethod(
|
_i3.SecureStorageService get storage => (super.noSuchMethod(
|
||||||
Invocation.getter(#storage),
|
Invocation.getter(#storage),
|
||||||
|
|
@ -1457,40 +1412,40 @@ class MockStatusCheckerService extends _i1.Mock
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockPermissionHandlerService extends _i1.Mock
|
class MockPermissionHandlerService extends _i1.Mock
|
||||||
implements _i26.PermissionHandlerService {
|
implements _i24.PermissionHandlerService {
|
||||||
@override
|
@override
|
||||||
_i9.Future<_i27.PermissionStatus> requestPermission(
|
_i9.Future<_i25.PermissionStatus> requestPermission(
|
||||||
_i27.Permission? requestedPermission) =>
|
_i25.Permission? requestedPermission) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#requestPermission,
|
#requestPermission,
|
||||||
[requestedPermission],
|
[requestedPermission],
|
||||||
),
|
),
|
||||||
returnValue: _i9.Future<_i27.PermissionStatus>.value(
|
returnValue: _i9.Future<_i25.PermissionStatus>.value(
|
||||||
_i27.PermissionStatus.denied),
|
_i25.PermissionStatus.denied),
|
||||||
returnValueForMissingStub: _i9.Future<_i27.PermissionStatus>.value(
|
returnValueForMissingStub: _i9.Future<_i25.PermissionStatus>.value(
|
||||||
_i27.PermissionStatus.denied),
|
_i25.PermissionStatus.denied),
|
||||||
) as _i9.Future<_i27.PermissionStatus>);
|
) as _i9.Future<_i25.PermissionStatus>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<_i27.PermissionStatus> request(_i27.Permission? permission) =>
|
_i9.Future<_i25.PermissionStatus> request(_i25.Permission? permission) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#request,
|
#request,
|
||||||
[permission],
|
[permission],
|
||||||
),
|
),
|
||||||
returnValue: _i9.Future<_i27.PermissionStatus>.value(
|
returnValue: _i9.Future<_i25.PermissionStatus>.value(
|
||||||
_i27.PermissionStatus.denied),
|
_i25.PermissionStatus.denied),
|
||||||
returnValueForMissingStub: _i9.Future<_i27.PermissionStatus>.value(
|
returnValueForMissingStub: _i9.Future<_i25.PermissionStatus>.value(
|
||||||
_i27.PermissionStatus.denied),
|
_i25.PermissionStatus.denied),
|
||||||
) as _i9.Future<_i27.PermissionStatus>);
|
) as _i9.Future<_i25.PermissionStatus>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A class which mocks [ImagePickerService].
|
/// A class which mocks [ImagePickerService].
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockImagePickerService extends _i1.Mock
|
class MockImagePickerService extends _i1.Mock
|
||||||
implements _i28.ImagePickerService {
|
implements _i26.ImagePickerService {
|
||||||
@override
|
@override
|
||||||
_i9.Future<String?> gallery() => (super.noSuchMethod(
|
_i9.Future<String?> gallery() => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
|
|
@ -1515,7 +1470,7 @@ class MockImagePickerService extends _i1.Mock
|
||||||
/// A class which mocks [GoogleAuthService].
|
/// A class which mocks [GoogleAuthService].
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockGoogleAuthService extends _i1.Mock implements _i29.GoogleAuthService {
|
class MockGoogleAuthService extends _i1.Mock implements _i27.GoogleAuthService {
|
||||||
@override
|
@override
|
||||||
int get listenersCount => (super.noSuchMethod(
|
int get listenersCount => (super.noSuchMethod(
|
||||||
Invocation.getter(#listenersCount),
|
Invocation.getter(#listenersCount),
|
||||||
|
|
@ -1585,7 +1540,7 @@ class MockGoogleAuthService extends _i1.Mock implements _i29.GoogleAuthService {
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockImageDownloaderService extends _i1.Mock
|
class MockImageDownloaderService extends _i1.Mock
|
||||||
implements _i30.ImageDownloaderService {
|
implements _i28.ImageDownloaderService {
|
||||||
@override
|
@override
|
||||||
_i9.Future<String> downloader(String? networkImage) => (super.noSuchMethod(
|
_i9.Future<String> downloader(String? networkImage) => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
|
|
@ -1614,7 +1569,7 @@ class MockImageDownloaderService extends _i1.Mock
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockNotificationService extends _i1.Mock
|
class MockNotificationService extends _i1.Mock
|
||||||
implements _i31.NotificationService {
|
implements _i29.NotificationService {
|
||||||
@override
|
@override
|
||||||
_i9.Future<void> initialize() => (super.noSuchMethod(
|
_i9.Future<void> initialize() => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
|
|
@ -1636,7 +1591,7 @@ class MockNotificationService extends _i1.Mock
|
||||||
) as _i9.Future<void>);
|
) as _i9.Future<void>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i9.Future<void> showNotification(_i32.RemoteMessage? message) =>
|
_i9.Future<void> showNotification(_i30.RemoteMessage? message) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#showNotification,
|
#showNotification,
|
||||||
|
|
@ -1670,7 +1625,7 @@ class MockNotificationService extends _i1.Mock
|
||||||
/// A class which mocks [SmartAuthService].
|
/// A class which mocks [SmartAuthService].
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockSmartAuthService extends _i1.Mock implements _i33.SmartAuthService {
|
class MockSmartAuthService extends _i1.Mock implements _i31.SmartAuthService {
|
||||||
@override
|
@override
|
||||||
bool get listenForMultipleSms => (super.noSuchMethod(
|
bool get listenForMultipleSms => (super.noSuchMethod(
|
||||||
Invocation.getter(#listenForMultipleSms),
|
Invocation.getter(#listenForMultipleSms),
|
||||||
|
|
@ -1702,26 +1657,26 @@ class MockSmartAuthService extends _i1.Mock implements _i33.SmartAuthService {
|
||||||
/// A class which mocks [CourseService].
|
/// A class which mocks [CourseService].
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockCourseService extends _i1.Mock implements _i34.CourseService {
|
class MockCourseService extends _i1.Mock implements _i32.CourseService {
|
||||||
@override
|
@override
|
||||||
_i9.Future<List<_i35.CourseDetail>> getCoursesDetail(int? id) =>
|
_i9.Future<List<_i33.CourseDetail>> getCoursesDetail(int? id) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getCoursesDetail,
|
#getCoursesDetail,
|
||||||
[id],
|
[id],
|
||||||
),
|
),
|
||||||
returnValue:
|
returnValue:
|
||||||
_i9.Future<List<_i35.CourseDetail>>.value(<_i35.CourseDetail>[]),
|
_i9.Future<List<_i33.CourseDetail>>.value(<_i33.CourseDetail>[]),
|
||||||
returnValueForMissingStub:
|
returnValueForMissingStub:
|
||||||
_i9.Future<List<_i35.CourseDetail>>.value(<_i35.CourseDetail>[]),
|
_i9.Future<List<_i33.CourseDetail>>.value(<_i33.CourseDetail>[]),
|
||||||
) as _i9.Future<List<_i35.CourseDetail>>);
|
) as _i9.Future<List<_i33.CourseDetail>>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A class which mocks [AudioPlayerService].
|
/// A class which mocks [AudioPlayerService].
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockAudioPlayerService extends _i1.Mock
|
class MockAudioPlayerService extends _i1.Mock
|
||||||
implements _i36.AudioPlayerService {
|
implements _i34.AudioPlayerService {
|
||||||
@override
|
@override
|
||||||
_i4.AudioPlayer get player => (super.noSuchMethod(
|
_i4.AudioPlayer get player => (super.noSuchMethod(
|
||||||
Invocation.getter(#player),
|
Invocation.getter(#player),
|
||||||
|
|
@ -1845,13 +1800,13 @@ class MockAudioPlayerService extends _i1.Mock
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockVoiceRecorderService extends _i1.Mock
|
class MockVoiceRecorderService extends _i1.Mock
|
||||||
implements _i37.VoiceRecorderService {
|
implements _i35.VoiceRecorderService {
|
||||||
@override
|
@override
|
||||||
_i38.VoiceRecordingState get recordingState => (super.noSuchMethod(
|
_i36.VoiceRecordingState get recordingState => (super.noSuchMethod(
|
||||||
Invocation.getter(#recordingState),
|
Invocation.getter(#recordingState),
|
||||||
returnValue: _i38.VoiceRecordingState.pending,
|
returnValue: _i36.VoiceRecordingState.pending,
|
||||||
returnValueForMissingStub: _i38.VoiceRecordingState.pending,
|
returnValueForMissingStub: _i36.VoiceRecordingState.pending,
|
||||||
) as _i38.VoiceRecordingState);
|
) as _i36.VoiceRecordingState);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i5.WaveformRecorderController get waveController => (super.noSuchMethod(
|
_i5.WaveformRecorderController get waveController => (super.noSuchMethod(
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
import 'package:yimaru_app/app/app.locator.dart';
|
|
||||||
|
|
||||||
import '../helpers/test_helpers.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
group('LearnSubcategoryViewModel Tests -', () {
|
|
||||||
setUp(() => registerServices());
|
|
||||||
tearDown(() => locator.reset());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user