feature/question
#10
Merged
amirreza.chegini
merged 3 commits from feature/question
into develop
6 days ago
30 changed files with 464 additions and 281 deletions
-
1android/app/src/main/AndroidManifest.xml
-
196assets/json/levels.json
-
2lib/common_ui/resources/my_assets.dart
-
2lib/common_ui/theme/theme_service.dart
-
7lib/core/routers/my_routes.dart
-
11lib/core/utils/storage_path.dart
-
33lib/core/widgets/answer_box/answer_box.dart
-
31lib/core/widgets/answer_box/styles/picture_box.dart
-
6lib/core/widgets/answer_box/styles/text_box.dart
-
4lib/features/intro/presentation/bloc/intro_bloc.dart
-
3lib/features/intro/presentation/ui/intro_page.dart
-
1lib/features/intro/presentation/ui/widgets/intro_loading_widget.dart
-
4lib/features/level/domain/usecases/get_levels_usecase.dart
-
43lib/features/level/presentation/bloc/level_bloc.dart
-
6lib/features/level/presentation/bloc/level_event.dart
-
9lib/features/level/presentation/bloc/level_state.dart
-
36lib/features/level/presentation/ui/level_page.dart
-
14lib/features/level/presentation/ui/widgets/hint_level_widget.dart
-
16lib/features/level/presentation/ui/widgets/level_widget.dart
-
28lib/features/question/data/datasource/question_datasource.dart
-
6lib/features/question/data/repository_impl/question_repository_impl.dart
-
4lib/features/question/domain/repository/question_repository.dart
-
10lib/features/question/domain/usecases/get_level_usecase.dart
-
26lib/features/question/presentation/bloc/question_bloc.dart
-
14lib/features/question/presentation/bloc/question_event.dart
-
18lib/features/question/presentation/bloc/question_state.dart
-
49lib/features/question/presentation/ui/question_page.dart
-
17lib/features/question/presentation/ui/widgets/question_stepper.dart
-
8lib/init_bindings.dart
-
2lib/main.dart
@ -0,0 +1,11 @@ |
|||
import 'dart:io'; |
|||
|
|||
import 'package:path_provider/path_provider.dart'; |
|||
|
|||
class StoragePath { |
|||
static Directory applicationDir = Directory(''); |
|||
|
|||
static Future<void> getApplicationDir() async { |
|||
applicationDir = await getApplicationDocumentsDirectory(); |
|||
} |
|||
} |
@ -1,5 +1,11 @@ |
|||
import 'package:hadi_hoda_flutter/features/level/domain/entity/level_entity.dart'; |
|||
|
|||
sealed class LevelEvent { |
|||
const LevelEvent(); |
|||
} |
|||
|
|||
class GetLevelListEvent extends LevelEvent {} |
|||
class ChooseLevelEvent extends LevelEvent { |
|||
final LevelEntity level; |
|||
const ChooseLevelEvent(this.level); |
|||
} |
@ -1,15 +1,22 @@ |
|||
import 'package:hadi_hoda_flutter/core/status/base_status.dart'; |
|||
import 'package:hadi_hoda_flutter/features/level/domain/entity/level_entity.dart'; |
|||
|
|||
class LevelState { |
|||
final BaseStatus getLevelStatus; |
|||
final LevelEntity? chooseLevel; |
|||
|
|||
const LevelState({this.getLevelStatus = const BaseInit()}); |
|||
const LevelState({ |
|||
this.getLevelStatus = const BaseInit(), |
|||
this.chooseLevel, |
|||
}); |
|||
|
|||
LevelState copyWith({ |
|||
BaseStatus? getLevelStatus, |
|||
LevelEntity? chooseLevel, |
|||
}) { |
|||
return LevelState( |
|||
getLevelStatus: getLevelStatus ?? this.getLevelStatus, |
|||
chooseLevel: chooseLevel ?? chooseLevel, |
|||
); |
|||
} |
|||
} |
@ -1,8 +1,8 @@ |
|||
import 'package:hadi_hoda_flutter/core/error_handler/my_exception.dart'; |
|||
import 'package:hadi_hoda_flutter/core/params/question_params.dart'; |
|||
import 'package:hadi_hoda_flutter/core/utils/data_state.dart'; |
|||
import 'package:hadi_hoda_flutter/features/question/domain/entity/question_entity.dart'; |
|||
import 'package:hadi_hoda_flutter/features/level/domain/entity/level_entity.dart'; |
|||
|
|||
abstract class IQuestionRepository { |
|||
Future<DataState<QuestionEntity, MyException>> getData({required QuestionParams params}); |
|||
Future<DataState<LevelEntity, MyException>> getLevel({required QuestionParams params}); |
|||
} |
@ -1,5 +1,17 @@ |
|||
import 'package:hadi_hoda_flutter/features/question/domain/entity/answer_entity.dart'; |
|||
|
|||
sealed class QuestionEvent { |
|||
const QuestionEvent(); |
|||
} |
|||
|
|||
class GetQuestionEvent extends QuestionEvent {} |
|||
class GetLevelEvent extends QuestionEvent { |
|||
final String? id; |
|||
|
|||
const GetLevelEvent(this.id); |
|||
} |
|||
|
|||
class ChooseAnswerEvent extends QuestionEvent { |
|||
final AnswerEntity? answer; |
|||
|
|||
const ChooseAnswerEvent(this.answer); |
|||
} |
@ -1,15 +1,31 @@ |
|||
import 'package:hadi_hoda_flutter/core/status/base_status.dart'; |
|||
import 'package:hadi_hoda_flutter/features/level/domain/entity/level_entity.dart'; |
|||
import 'package:hadi_hoda_flutter/features/question/domain/entity/answer_entity.dart'; |
|||
|
|||
class QuestionState { |
|||
final BaseStatus getQuestionStatus; |
|||
final LevelEntity? levelEntity; |
|||
final int currentStep; |
|||
final AnswerEntity? chooseAnswer; |
|||
|
|||
const QuestionState({this.getQuestionStatus = const BaseInit()}); |
|||
const QuestionState({ |
|||
this.getQuestionStatus = const BaseInit(), |
|||
this.levelEntity, |
|||
this.currentStep = 0, |
|||
this.chooseAnswer, |
|||
}); |
|||
|
|||
QuestionState copyWith({ |
|||
BaseStatus? getQuestionStatus, |
|||
LevelEntity? levelEntity, |
|||
int? currentStep, |
|||
AnswerEntity? chooseAnswer, |
|||
}) { |
|||
return QuestionState( |
|||
getQuestionStatus: getQuestionStatus ?? this.getQuestionStatus, |
|||
levelEntity: levelEntity ?? this.levelEntity, |
|||
currentStep: currentStep ?? this.currentStep, |
|||
chooseAnswer: chooseAnswer ?? this.chooseAnswer, |
|||
); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue