13 changed files with 152 additions and 19 deletions
-
2lib/core/routers/my_routes.dart
-
16lib/core/widgets/hadith_dialog/hadith_dialog.dart
-
6lib/features/level/data/model/level_model.dart
-
4lib/features/level/domain/entity/level_entity.dart
-
7lib/features/level/domain/entity/level_entity.g.dart
-
21lib/features/question/data/model/hadith_model.dart
-
25lib/features/question/domain/entity/hadith_entity.dart
-
53lib/features/question/domain/entity/hadith_entity.g.dart
-
21lib/features/question/presentation/bloc/question_bloc.dart
-
8lib/features/question/presentation/bloc/question_event.dart
-
2lib/features/question/presentation/ui/screens/answer_screen.dart
-
4lib/features/question/presentation/ui/screens/question_screen.dart
-
2lib/init_bindings.dart
@ -0,0 +1,21 @@ |
|||||
|
import 'package:hadi_hoda_flutter/features/question/domain/entity/hadith_entity.dart'; |
||||
|
|
||||
|
class HadithModel extends HadithEntity { |
||||
|
HadithModel({ |
||||
|
super.id, |
||||
|
super.hadithText, |
||||
|
super.narratorName, |
||||
|
super.translation, |
||||
|
super.status, |
||||
|
}); |
||||
|
|
||||
|
factory HadithModel.fromJson(Map<String, dynamic> json) { |
||||
|
return HadithModel( |
||||
|
id: json['id'], |
||||
|
hadithText: json['hadith_text'], |
||||
|
narratorName: json['narrator_name'], |
||||
|
translation: json['translation'], |
||||
|
status: json['status'], |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
import 'package:hive/hive.dart'; |
||||
|
|
||||
|
part 'hadith_entity.g.dart'; |
||||
|
|
||||
|
@HiveType(typeId: 5) |
||||
|
class HadithEntity extends HiveObject { |
||||
|
@HiveField(0) |
||||
|
int? id; |
||||
|
@HiveField(1) |
||||
|
String? hadithText; |
||||
|
@HiveField(2) |
||||
|
String? narratorName; |
||||
|
@HiveField(3) |
||||
|
String? translation; |
||||
|
@HiveField(4) |
||||
|
String? status; |
||||
|
|
||||
|
HadithEntity({ |
||||
|
this.id, |
||||
|
this.hadithText, |
||||
|
this.narratorName, |
||||
|
this.translation, |
||||
|
this.status, |
||||
|
}); |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
|
||||
|
part of 'hadith_entity.dart'; |
||||
|
|
||||
|
// ************************************************************************** |
||||
|
// TypeAdapterGenerator |
||||
|
// ************************************************************************** |
||||
|
|
||||
|
class HadithEntityAdapter extends TypeAdapter<HadithEntity> { |
||||
|
@override |
||||
|
final int typeId = 5; |
||||
|
|
||||
|
@override |
||||
|
HadithEntity read(BinaryReader reader) { |
||||
|
final numOfFields = reader.readByte(); |
||||
|
final fields = <int, dynamic>{ |
||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), |
||||
|
}; |
||||
|
return HadithEntity( |
||||
|
id: fields[0] as int?, |
||||
|
hadithText: fields[1] as String?, |
||||
|
narratorName: fields[2] as String?, |
||||
|
translation: fields[3] as String?, |
||||
|
status: fields[4] as String?, |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
void write(BinaryWriter writer, HadithEntity obj) { |
||||
|
writer |
||||
|
..writeByte(5) |
||||
|
..writeByte(0) |
||||
|
..write(obj.id) |
||||
|
..writeByte(1) |
||||
|
..write(obj.hadithText) |
||||
|
..writeByte(2) |
||||
|
..write(obj.narratorName) |
||||
|
..writeByte(3) |
||||
|
..write(obj.translation) |
||||
|
..writeByte(4) |
||||
|
..write(obj.status); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
int get hashCode => typeId.hashCode; |
||||
|
|
||||
|
@override |
||||
|
bool operator ==(Object other) => |
||||
|
identical(this, other) || |
||||
|
other is HadithEntityAdapter && |
||||
|
runtimeType == other.runtimeType && |
||||
|
typeId == other.typeId; |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue