Skip to content

Commit

Permalink
Silee/mbti question (#48)
Browse files Browse the repository at this point in the history
* add MBTIScreen bases

* add MBTI Provider(with Firebase) & PageView Animation

* add freezed files

* add mbti function

* fix Strings to Constant

* fix Enum class to Widget
remove TODO
fix list name obvious
  • Loading branch information
312Prime authored Jul 21, 2024
1 parent 207f9c5 commit cac9484
Show file tree
Hide file tree
Showing 23 changed files with 870 additions and 170 deletions.
31 changes: 31 additions & 0 deletions lib/model/MBTIModel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../widgets/mbti/MBTIHomeWidget.dart';

part 'generated/MBTIModel.freezed.dart';
part 'generated/MBTIModel.g.dart';

@freezed
class MBTIModel with _$MBTIModel {
const factory MBTIModel({
required Extroversion extroversion,
required Sensing sensing,
required Thinking thinking,
required Judging judging,
}) = _MBTIModel;

factory MBTIModel.fromJson(Map<String, dynamic> json) =>
_$MBTIModelFromJson(json);

// 2진수 각 자리 index 위치 MBTI 검색
MBTIType getMBTI() {
int index = 0;

if (extroversion == Extroversion.E) index += 8;
if (sensing == Sensing.S) index += 4;
if (thinking == Thinking.T) index += 2;
if (judging == Judging.J) index += 1;

return MBTIType.values[index];
}
}
16 changes: 16 additions & 0 deletions lib/model/MBTIQuestionModel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'generated/MBTIQuestionModel.freezed.dart';
part 'generated/MBTIQuestionModel.g.dart';

@freezed
class MBTIQuestionModel with _$MBTIQuestionModel {
const factory MBTIQuestionModel({
required String question,
required String type,
required String imageUrl,
}) = _MBTIQuestionModel;

factory MBTIQuestionModel.fromJson(Map<String, dynamic> json) =>
_$MBTIQuestionModelFromJson(json);
}
21 changes: 4 additions & 17 deletions lib/model/generated/AnimalModel.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ mixin _$AnimalModel {
String? get profilePicture => throw _privateConstructorUsedError;
String? get bio => throw _privateConstructorUsedError;

/// Serializes this AnimalModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

/// Create a copy of AnimalModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$AnimalModelCopyWith<AnimalModel> get copyWith =>
throw _privateConstructorUsedError;
}
Expand Down Expand Up @@ -68,8 +64,6 @@ class _$AnimalModelCopyWithImpl<$Res, $Val extends AnimalModel>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of AnimalModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -152,8 +146,6 @@ class __$$AnimalModelImplCopyWithImpl<$Res>
_$AnimalModelImpl _value, $Res Function(_$AnimalModelImpl) _then)
: super(_value, _then);

/// Create a copy of AnimalModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -267,14 +259,12 @@ class _$AnimalModelImpl implements _AnimalModel {
(identical(other.bio, bio) || other.bio == bio));
}

@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, animalId, userId, name, species,
breed, age, gender, profilePicture, bio);

/// Create a copy of AnimalModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$AnimalModelImplCopyWith<_$AnimalModelImpl> get copyWith =>
Expand Down Expand Up @@ -321,11 +311,8 @@ abstract class _AnimalModel implements AnimalModel {
String? get profilePicture;
@override
String? get bio;

/// Create a copy of AnimalModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$AnimalModelImplCopyWith<_$AnimalModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
21 changes: 4 additions & 17 deletions lib/model/generated/ChatModel.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ mixin _$ChatModel {
String get message => throw _privateConstructorUsedError;
DateTime get timestamp => throw _privateConstructorUsedError;

/// Serializes this ChatModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

/// Create a copy of ChatModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatModelCopyWith<ChatModel> get copyWith =>
throw _privateConstructorUsedError;
}
Expand Down Expand Up @@ -59,8 +55,6 @@ class _$ChatModelCopyWithImpl<$Res, $Val extends ChatModel>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of ChatModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -119,8 +113,6 @@ class __$$ChatModelImplCopyWithImpl<$Res>
_$ChatModelImpl _value, $Res Function(_$ChatModelImpl) _then)
: super(_value, _then);

/// Create a copy of ChatModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -198,14 +190,12 @@ class _$ChatModelImpl implements _ChatModel {
other.timestamp == timestamp));
}

@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, chatId, userId, friendId, message, timestamp);

/// Create a copy of ChatModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatModelImplCopyWith<_$ChatModelImpl> get copyWith =>
Expand Down Expand Up @@ -240,11 +230,8 @@ abstract class _ChatModel implements ChatModel {
String get message;
@override
DateTime get timestamp;

/// Create a copy of ChatModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatModelImplCopyWith<_$ChatModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
21 changes: 4 additions & 17 deletions lib/model/generated/DogProfileModel.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ mixin _$DogProfileModel {
String get imageUrl => throw _privateConstructorUsedError;
String get location => throw _privateConstructorUsedError;

/// Serializes this DogProfileModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

/// Create a copy of DogProfileModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$DogProfileModelCopyWith<DogProfileModel> get copyWith =>
throw _privateConstructorUsedError;
}
Expand Down Expand Up @@ -62,8 +58,6 @@ class _$DogProfileModelCopyWithImpl<$Res, $Val extends DogProfileModel>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of DogProfileModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -128,8 +122,6 @@ class __$$DogProfileModelImplCopyWithImpl<$Res>
_$DogProfileModelImpl _value, $Res Function(_$DogProfileModelImpl) _then)
: super(_value, _then);

/// Create a copy of DogProfileModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -216,14 +208,12 @@ class _$DogProfileModelImpl implements _DogProfileModel {
other.location == location));
}

@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, name, gender, breed, bio, imageUrl, location);

/// Create a copy of DogProfileModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DogProfileModelImplCopyWith<_$DogProfileModelImpl> get copyWith =>
Expand Down Expand Up @@ -262,11 +252,8 @@ abstract class _DogProfileModel implements DogProfileModel {
String get imageUrl;
@override
String get location;

/// Create a copy of DogProfileModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DogProfileModelImplCopyWith<_$DogProfileModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
21 changes: 4 additions & 17 deletions lib/model/generated/FriendsModel.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ mixin _$FriendsModel {
String get status => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;

/// Serializes this FriendsModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

/// Create a copy of FriendsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$FriendsModelCopyWith<FriendsModel> get copyWith =>
throw _privateConstructorUsedError;
}
Expand All @@ -54,8 +50,6 @@ class _$FriendsModelCopyWithImpl<$Res, $Val extends FriendsModel>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of FriendsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -104,8 +98,6 @@ class __$$FriendsModelImplCopyWithImpl<$Res>
_$FriendsModelImpl _value, $Res Function(_$FriendsModelImpl) _then)
: super(_value, _then);

/// Create a copy of FriendsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -174,14 +166,12 @@ class _$FriendsModelImpl implements _FriendsModel {
other.createdAt == createdAt));
}

@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, userId, friendId, status, createdAt);

/// Create a copy of FriendsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$FriendsModelImplCopyWith<_$FriendsModelImpl> get copyWith =>
Expand Down Expand Up @@ -213,11 +203,8 @@ abstract class _FriendsModel implements FriendsModel {
String get status;
@override
DateTime get createdAt;

/// Create a copy of FriendsModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$FriendsModelImplCopyWith<_$FriendsModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
21 changes: 4 additions & 17 deletions lib/model/generated/LikeModel.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ mixin _$LikeModel {
int get postId => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;

/// Serializes this LikeModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

/// Create a copy of LikeModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$LikeModelCopyWith<LikeModel> get copyWith =>
throw _privateConstructorUsedError;
}
Expand All @@ -53,8 +49,6 @@ class _$LikeModelCopyWithImpl<$Res, $Val extends LikeModel>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of LikeModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -103,8 +97,6 @@ class __$$LikeModelImplCopyWithImpl<$Res>
_$LikeModelImpl _value, $Res Function(_$LikeModelImpl) _then)
: super(_value, _then);

/// Create a copy of LikeModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -172,14 +164,12 @@ class _$LikeModelImpl implements _LikeModel {
other.createdAt == createdAt));
}

@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, likeId, userId, postId, createdAt);

/// Create a copy of LikeModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$LikeModelImplCopyWith<_$LikeModelImpl> get copyWith =>
Expand Down Expand Up @@ -211,11 +201,8 @@ abstract class _LikeModel implements LikeModel {
int get postId;
@override
DateTime get createdAt;

/// Create a copy of LikeModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$LikeModelImplCopyWith<_$LikeModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
Loading

0 comments on commit cac9484

Please sign in to comment.