From 42e88037e3a9a7ea47571031820103befb6a0c9c Mon Sep 17 00:00:00 2001 From: ho2ri2s Date: Wed, 10 Jun 2020 01:05:06 +0900 Subject: [PATCH] add: technical stack --- .idea/dictionaries/dictionary.xml | 2 + lib/model/technical_stack/language.dart | 5 + lib/model/technical_stack/proficiency.dart | 9 + lib/model/technical_stack/stack.dart | 11 + .../technical_stack/technical_stack.dart | 22 ++ .../technical_stack.freezed.dart | 240 ++++++++++++++++++ .../technical_stack/technical_stack.g.dart | 77 ++++++ 7 files changed, 366 insertions(+) create mode 100644 lib/model/technical_stack/language.dart create mode 100644 lib/model/technical_stack/proficiency.dart create mode 100644 lib/model/technical_stack/stack.dart create mode 100644 lib/model/technical_stack/technical_stack.dart create mode 100644 lib/model/technical_stack/technical_stack.freezed.dart create mode 100644 lib/model/technical_stack/technical_stack.g.dart diff --git a/.idea/dictionaries/dictionary.xml b/.idea/dictionaries/dictionary.xml index a83f77b..60051ca 100644 --- a/.idea/dictionaries/dictionary.xml +++ b/.idea/dictionaries/dictionary.xml @@ -1,7 +1,9 @@ + freezed hackathon + weakers \ No newline at end of file diff --git a/lib/model/technical_stack/language.dart b/lib/model/technical_stack/language.dart new file mode 100644 index 0000000..2b0493b --- /dev/null +++ b/lib/model/technical_stack/language.dart @@ -0,0 +1,5 @@ +// TODO: 言語増やす +enum Language { + Swift, + Kotlin, +} diff --git a/lib/model/technical_stack/proficiency.dart b/lib/model/technical_stack/proficiency.dart new file mode 100644 index 0000000..3a71cc6 --- /dev/null +++ b/lib/model/technical_stack/proficiency.dart @@ -0,0 +1,9 @@ +// TODO: できるできないとかを増やす +import 'package:freezed_annotation/freezed_annotation.dart'; + +enum Proficiency { + @JsonValue('GOOD') + Good, + @JsonValue('BAD') + Bad +} diff --git a/lib/model/technical_stack/stack.dart b/lib/model/technical_stack/stack.dart new file mode 100644 index 0000000..217d4b4 --- /dev/null +++ b/lib/model/technical_stack/stack.dart @@ -0,0 +1,11 @@ +// TODO: 増やす +import 'package:freezed_annotation/freezed_annotation.dart'; + +enum Stack { + @JsonValue('IOS') + iOS, + @JsonValue('ANDROID') + Android, + @JsonValue('Serverside') + Serverside, +} diff --git a/lib/model/technical_stack/technical_stack.dart b/lib/model/technical_stack/technical_stack.dart new file mode 100644 index 0000000..b74ae14 --- /dev/null +++ b/lib/model/technical_stack/technical_stack.dart @@ -0,0 +1,22 @@ +import 'package:flutter/foundation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:morning_weakers/model/technical_stack/language.dart'; +import 'package:morning_weakers/model/technical_stack/proficiency.dart'; +import 'package:morning_weakers/model/technical_stack/stack.dart'; + +part 'technical_stack.freezed.dart'; + +part 'technical_stack.g.dart'; + +@freezed +abstract class TechnicalStack with _$TechnicalStack { + const factory TechnicalStack({ + @required String id, + @required Stack stack, + List language, + @required Proficiency proficiency, + int priority, + }) = _TechnicalStack; + + factory TechnicalStack.fromJson(Map json) => _$TechnicalStackFromJson(json); +} diff --git a/lib/model/technical_stack/technical_stack.freezed.dart b/lib/model/technical_stack/technical_stack.freezed.dart new file mode 100644 index 0000000..ac936bd --- /dev/null +++ b/lib/model/technical_stack/technical_stack.freezed.dart @@ -0,0 +1,240 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named + +part of 'technical_stack.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; +TechnicalStack _$TechnicalStackFromJson(Map json) { + return _TechnicalStack.fromJson(json); +} + +class _$TechnicalStackTearOff { + const _$TechnicalStackTearOff(); + + _TechnicalStack call( + {@required String id, + @required Stack stack, + List language, + @required Proficiency proficiency, + int priority}) { + return _TechnicalStack( + id: id, + stack: stack, + language: language, + proficiency: proficiency, + priority: priority, + ); + } +} + +// ignore: unused_element +const $TechnicalStack = _$TechnicalStackTearOff(); + +mixin _$TechnicalStack { + String get id; + Stack get stack; + List get language; + Proficiency get proficiency; + int get priority; + + Map toJson(); + $TechnicalStackCopyWith get copyWith; +} + +abstract class $TechnicalStackCopyWith<$Res> { + factory $TechnicalStackCopyWith( + TechnicalStack value, $Res Function(TechnicalStack) then) = + _$TechnicalStackCopyWithImpl<$Res>; + $Res call( + {String id, + Stack stack, + List language, + Proficiency proficiency, + int priority}); +} + +class _$TechnicalStackCopyWithImpl<$Res> + implements $TechnicalStackCopyWith<$Res> { + _$TechnicalStackCopyWithImpl(this._value, this._then); + + final TechnicalStack _value; + // ignore: unused_field + final $Res Function(TechnicalStack) _then; + + @override + $Res call({ + Object id = freezed, + Object stack = freezed, + Object language = freezed, + Object proficiency = freezed, + Object priority = freezed, + }) { + return _then(_value.copyWith( + id: id == freezed ? _value.id : id as String, + stack: stack == freezed ? _value.stack : stack as Stack, + language: + language == freezed ? _value.language : language as List, + proficiency: proficiency == freezed + ? _value.proficiency + : proficiency as Proficiency, + priority: priority == freezed ? _value.priority : priority as int, + )); + } +} + +abstract class _$TechnicalStackCopyWith<$Res> + implements $TechnicalStackCopyWith<$Res> { + factory _$TechnicalStackCopyWith( + _TechnicalStack value, $Res Function(_TechnicalStack) then) = + __$TechnicalStackCopyWithImpl<$Res>; + @override + $Res call( + {String id, + Stack stack, + List language, + Proficiency proficiency, + int priority}); +} + +class __$TechnicalStackCopyWithImpl<$Res> + extends _$TechnicalStackCopyWithImpl<$Res> + implements _$TechnicalStackCopyWith<$Res> { + __$TechnicalStackCopyWithImpl( + _TechnicalStack _value, $Res Function(_TechnicalStack) _then) + : super(_value, (v) => _then(v as _TechnicalStack)); + + @override + _TechnicalStack get _value => super._value as _TechnicalStack; + + @override + $Res call({ + Object id = freezed, + Object stack = freezed, + Object language = freezed, + Object proficiency = freezed, + Object priority = freezed, + }) { + return _then(_TechnicalStack( + id: id == freezed ? _value.id : id as String, + stack: stack == freezed ? _value.stack : stack as Stack, + language: + language == freezed ? _value.language : language as List, + proficiency: proficiency == freezed + ? _value.proficiency + : proficiency as Proficiency, + priority: priority == freezed ? _value.priority : priority as int, + )); + } +} + +@JsonSerializable() +class _$_TechnicalStack + with DiagnosticableTreeMixin + implements _TechnicalStack { + const _$_TechnicalStack( + {@required this.id, + @required this.stack, + this.language, + @required this.proficiency, + this.priority}) + : assert(id != null), + assert(stack != null), + assert(proficiency != null); + + factory _$_TechnicalStack.fromJson(Map json) => + _$_$_TechnicalStackFromJson(json); + + @override + final String id; + @override + final Stack stack; + @override + final List language; + @override + final Proficiency proficiency; + @override + final int priority; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'TechnicalStack(id: $id, stack: $stack, language: $language, proficiency: $proficiency, priority: $priority)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'TechnicalStack')) + ..add(DiagnosticsProperty('id', id)) + ..add(DiagnosticsProperty('stack', stack)) + ..add(DiagnosticsProperty('language', language)) + ..add(DiagnosticsProperty('proficiency', proficiency)) + ..add(DiagnosticsProperty('priority', priority)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _TechnicalStack && + (identical(other.id, id) || + const DeepCollectionEquality().equals(other.id, id)) && + (identical(other.stack, stack) || + const DeepCollectionEquality().equals(other.stack, stack)) && + (identical(other.language, language) || + const DeepCollectionEquality() + .equals(other.language, language)) && + (identical(other.proficiency, proficiency) || + const DeepCollectionEquality() + .equals(other.proficiency, proficiency)) && + (identical(other.priority, priority) || + const DeepCollectionEquality() + .equals(other.priority, priority))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(id) ^ + const DeepCollectionEquality().hash(stack) ^ + const DeepCollectionEquality().hash(language) ^ + const DeepCollectionEquality().hash(proficiency) ^ + const DeepCollectionEquality().hash(priority); + + @override + _$TechnicalStackCopyWith<_TechnicalStack> get copyWith => + __$TechnicalStackCopyWithImpl<_TechnicalStack>(this, _$identity); + + @override + Map toJson() { + return _$_$_TechnicalStackToJson(this); + } +} + +abstract class _TechnicalStack implements TechnicalStack { + const factory _TechnicalStack( + {@required String id, + @required Stack stack, + List language, + @required Proficiency proficiency, + int priority}) = _$_TechnicalStack; + + factory _TechnicalStack.fromJson(Map json) = + _$_TechnicalStack.fromJson; + + @override + String get id; + @override + Stack get stack; + @override + List get language; + @override + Proficiency get proficiency; + @override + int get priority; + @override + _$TechnicalStackCopyWith<_TechnicalStack> get copyWith; +} diff --git a/lib/model/technical_stack/technical_stack.g.dart b/lib/model/technical_stack/technical_stack.g.dart new file mode 100644 index 0000000..e617f89 --- /dev/null +++ b/lib/model/technical_stack/technical_stack.g.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'technical_stack.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_TechnicalStack _$_$_TechnicalStackFromJson(Map json) { + return _$_TechnicalStack( + id: json['id'] as String, + stack: _$enumDecodeNullable(_$StackEnumMap, json['stack']), + language: (json['language'] as List) + ?.map((e) => _$enumDecodeNullable(_$LanguageEnumMap, e)) + ?.toList(), + proficiency: + _$enumDecodeNullable(_$ProficiencyEnumMap, json['proficiency']), + priority: json['priority'] as int, + ); +} + +Map _$_$_TechnicalStackToJson(_$_TechnicalStack instance) => + { + 'id': instance.id, + 'stack': _$StackEnumMap[instance.stack], + 'language': instance.language?.map((e) => _$LanguageEnumMap[e])?.toList(), + 'proficiency': _$ProficiencyEnumMap[instance.proficiency], + 'priority': instance.priority, + }; + +T _$enumDecode( + Map enumValues, + dynamic source, { + T unknownValue, +}) { + if (source == null) { + throw ArgumentError('A value must be provided. Supported values: ' + '${enumValues.values.join(', ')}'); + } + + final value = enumValues.entries + .singleWhere((e) => e.value == source, orElse: () => null) + ?.key; + + if (value == null && unknownValue == null) { + throw ArgumentError('`$source` is not one of the supported values: ' + '${enumValues.values.join(', ')}'); + } + return value ?? unknownValue; +} + +T _$enumDecodeNullable( + Map enumValues, + dynamic source, { + T unknownValue, +}) { + if (source == null) { + return null; + } + return _$enumDecode(enumValues, source, unknownValue: unknownValue); +} + +const _$StackEnumMap = { + Stack.iOS: 'iOS', + Stack.Android: 'Android', + Stack.Serverside: 'Serverside', +}; + +const _$LanguageEnumMap = { + Language.Swift: 'Swift', + Language.Kotlin: 'Kotlin', +}; + +const _$ProficiencyEnumMap = { + Proficiency.Good: 'Good', + Proficiency.Bad: 'Bad', +};