From 01ce8647e5a6ad3f4bc42c1669518cda8803899e Mon Sep 17 00:00:00 2001 From: tomu28 Date: Sat, 13 Jun 2020 18:00:03 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Edit:=20=E5=8F=82=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E6=97=A5=E6=95=B0=E3=81=AEText?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/input_participant_info/widgets/working_days.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/input_participant_info/widgets/working_days.dart b/lib/pages/input_participant_info/widgets/working_days.dart index 7cd173a..c3af57c 100644 --- a/lib/pages/input_participant_info/widgets/working_days.dart +++ b/lib/pages/input_participant_info/widgets/working_days.dart @@ -9,7 +9,7 @@ class WorkingDays extends StatelessWidget { padding: const EdgeInsets.all(8), child: Column( children: [ - const Text('参加可能日程(複数選択可)'), + const Text('稼働可能日数(目安でOKです😃)'), Column( children: workingDays.map( (workingDay) => ListTile( From a3d33faf19f001b09260a98d1d8fe0e6a13b2b1c Mon Sep 17 00:00:00 2001 From: tomu28 Date: Sat, 13 Jun 2020 18:44:28 +0900 Subject: [PATCH 2/6] Add: Submit Button --- .../input_participant_info_page.dart | 4 +++- .../widgets/submit_btn.dart | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/pages/input_participant_info/widgets/submit_btn.dart diff --git a/lib/pages/input_participant_info/input_participant_info_page.dart b/lib/pages/input_participant_info/input_participant_info_page.dart index 8842a8b..5bd2273 100644 --- a/lib/pages/input_participant_info/input_participant_info_page.dart +++ b/lib/pages/input_participant_info/input_participant_info_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:morning_weakers/pages/input_participant_info/widgets/desired_occupation.dart'; import 'package:morning_weakers/pages/input_participant_info/widgets/schedule_candidate.dart'; import 'package:morning_weakers/pages/input_participant_info/widgets/working_days.dart'; +import 'package:morning_weakers/pages/input_participant_info/widgets/submit_btn.dart'; import 'package:firebase_auth/firebase_auth.dart'; class InputParticipantInfoPage extends StatelessWidget { @@ -29,7 +30,8 @@ class InputParticipantInfoPage extends StatelessWidget { decoration: const InputDecoration( labelText: '備考欄' ), - ) + ), + SubmitBtn(), ], ), ), diff --git a/lib/pages/input_participant_info/widgets/submit_btn.dart b/lib/pages/input_participant_info/widgets/submit_btn.dart new file mode 100644 index 0000000..14c5a2b --- /dev/null +++ b/lib/pages/input_participant_info/widgets/submit_btn.dart @@ -0,0 +1,15 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class SubmitBtn extends StatelessWidget { + @override + Widget build(BuildContext context) { + return FlatButton( + child: const Text('OK'), + color: Theme.of(context).accentColor, + onPressed: () async { +// await context.read().handlePost(); + }); + } +} From 893887135595ad8f9480ed086ea67300638cf3ae Mon Sep 17 00:00:00 2001 From: tomu28 Date: Sat, 13 Jun 2020 21:21:26 +0900 Subject: [PATCH 3/6] Add: InputParticipantInfoState --- .../input_participant_info_state.dart | 16 ++ .../input_participant_info_state.freezed.dart | 216 ++++++++++++++++++ .../input_participant_info_state.g.dart | 28 +++ 3 files changed, 260 insertions(+) create mode 100644 lib/pages/input_participant_info/input_participant_info_state.dart create mode 100644 lib/pages/input_participant_info/input_participant_info_state.freezed.dart create mode 100644 lib/pages/input_participant_info/input_participant_info_state.g.dart diff --git a/lib/pages/input_participant_info/input_participant_info_state.dart b/lib/pages/input_participant_info/input_participant_info_state.dart new file mode 100644 index 0000000..15884f9 --- /dev/null +++ b/lib/pages/input_participant_info/input_participant_info_state.dart @@ -0,0 +1,16 @@ +import 'package:flutter/foundation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:morning_weakers/models/models.dart'; +part 'input_participant_info_state.freezed.dart'; +part 'input_participant_info_state.g.dart'; + +@freezed +abstract class InputParticipantInfoState with _$InputParticipantInfoState { + const factory InputParticipantInfoState({ + @JsonKey(name: 'desired_occupations') List desiredOccupations, + @JsonKey(name: 'working_days') String workingDays, + String note, + }) = _InputParticipantInfoState; + + factory InputParticipantInfoState.fromJson(Map json) => _$InputParticipantInfoStateFromJson(json); +} diff --git a/lib/pages/input_participant_info/input_participant_info_state.freezed.dart b/lib/pages/input_participant_info/input_participant_info_state.freezed.dart new file mode 100644 index 0000000..9663dd1 --- /dev/null +++ b/lib/pages/input_participant_info/input_participant_info_state.freezed.dart @@ -0,0 +1,216 @@ +// 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 'input_participant_info_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; +InputParticipantInfoState _$InputParticipantInfoStateFromJson( + Map json) { + return _InputParticipantInfoState.fromJson(json); +} + +class _$InputParticipantInfoStateTearOff { + const _$InputParticipantInfoStateTearOff(); + + _InputParticipantInfoState call( + {@JsonKey(name: 'desired_occupations') + List desiredOccupations, + @JsonKey(name: 'working_days') + String workingDays, + String note}) { + return _InputParticipantInfoState( + desiredOccupations: desiredOccupations, + workingDays: workingDays, + note: note, + ); + } +} + +// ignore: unused_element +const $InputParticipantInfoState = _$InputParticipantInfoStateTearOff(); + +mixin _$InputParticipantInfoState { + @JsonKey(name: 'desired_occupations') + List get desiredOccupations; + @JsonKey(name: 'working_days') + String get workingDays; + String get note; + + Map toJson(); + $InputParticipantInfoStateCopyWith get copyWith; +} + +abstract class $InputParticipantInfoStateCopyWith<$Res> { + factory $InputParticipantInfoStateCopyWith(InputParticipantInfoState value, + $Res Function(InputParticipantInfoState) then) = + _$InputParticipantInfoStateCopyWithImpl<$Res>; + $Res call( + {@JsonKey(name: 'desired_occupations') + List desiredOccupations, + @JsonKey(name: 'working_days') + String workingDays, + String note}); +} + +class _$InputParticipantInfoStateCopyWithImpl<$Res> + implements $InputParticipantInfoStateCopyWith<$Res> { + _$InputParticipantInfoStateCopyWithImpl(this._value, this._then); + + final InputParticipantInfoState _value; + // ignore: unused_field + final $Res Function(InputParticipantInfoState) _then; + + @override + $Res call({ + Object desiredOccupations = freezed, + Object workingDays = freezed, + Object note = freezed, + }) { + return _then(_value.copyWith( + desiredOccupations: desiredOccupations == freezed + ? _value.desiredOccupations + : desiredOccupations as List, + workingDays: + workingDays == freezed ? _value.workingDays : workingDays as String, + note: note == freezed ? _value.note : note as String, + )); + } +} + +abstract class _$InputParticipantInfoStateCopyWith<$Res> + implements $InputParticipantInfoStateCopyWith<$Res> { + factory _$InputParticipantInfoStateCopyWith(_InputParticipantInfoState value, + $Res Function(_InputParticipantInfoState) then) = + __$InputParticipantInfoStateCopyWithImpl<$Res>; + @override + $Res call( + {@JsonKey(name: 'desired_occupations') + List desiredOccupations, + @JsonKey(name: 'working_days') + String workingDays, + String note}); +} + +class __$InputParticipantInfoStateCopyWithImpl<$Res> + extends _$InputParticipantInfoStateCopyWithImpl<$Res> + implements _$InputParticipantInfoStateCopyWith<$Res> { + __$InputParticipantInfoStateCopyWithImpl(_InputParticipantInfoState _value, + $Res Function(_InputParticipantInfoState) _then) + : super(_value, (v) => _then(v as _InputParticipantInfoState)); + + @override + _InputParticipantInfoState get _value => + super._value as _InputParticipantInfoState; + + @override + $Res call({ + Object desiredOccupations = freezed, + Object workingDays = freezed, + Object note = freezed, + }) { + return _then(_InputParticipantInfoState( + desiredOccupations: desiredOccupations == freezed + ? _value.desiredOccupations + : desiredOccupations as List, + workingDays: + workingDays == freezed ? _value.workingDays : workingDays as String, + note: note == freezed ? _value.note : note as String, + )); + } +} + +@JsonSerializable() +class _$_InputParticipantInfoState + with DiagnosticableTreeMixin + implements _InputParticipantInfoState { + const _$_InputParticipantInfoState( + {@JsonKey(name: 'desired_occupations') this.desiredOccupations, + @JsonKey(name: 'working_days') this.workingDays, + this.note}); + + factory _$_InputParticipantInfoState.fromJson(Map json) => + _$_$_InputParticipantInfoStateFromJson(json); + + @override + @JsonKey(name: 'desired_occupations') + final List desiredOccupations; + @override + @JsonKey(name: 'working_days') + final String workingDays; + @override + final String note; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'InputParticipantInfoState(desiredOccupations: $desiredOccupations, workingDays: $workingDays, note: $note)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'InputParticipantInfoState')) + ..add(DiagnosticsProperty('desiredOccupations', desiredOccupations)) + ..add(DiagnosticsProperty('workingDays', workingDays)) + ..add(DiagnosticsProperty('note', note)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other is _InputParticipantInfoState && + (identical(other.desiredOccupations, desiredOccupations) || + const DeepCollectionEquality() + .equals(other.desiredOccupations, desiredOccupations)) && + (identical(other.workingDays, workingDays) || + const DeepCollectionEquality() + .equals(other.workingDays, workingDays)) && + (identical(other.note, note) || + const DeepCollectionEquality().equals(other.note, note))); + } + + @override + int get hashCode => + runtimeType.hashCode ^ + const DeepCollectionEquality().hash(desiredOccupations) ^ + const DeepCollectionEquality().hash(workingDays) ^ + const DeepCollectionEquality().hash(note); + + @override + _$InputParticipantInfoStateCopyWith<_InputParticipantInfoState> + get copyWith => + __$InputParticipantInfoStateCopyWithImpl<_InputParticipantInfoState>( + this, _$identity); + + @override + Map toJson() { + return _$_$_InputParticipantInfoStateToJson(this); + } +} + +abstract class _InputParticipantInfoState implements InputParticipantInfoState { + const factory _InputParticipantInfoState( + {@JsonKey(name: 'desired_occupations') + List desiredOccupations, + @JsonKey(name: 'working_days') + String workingDays, + String note}) = _$_InputParticipantInfoState; + + factory _InputParticipantInfoState.fromJson(Map json) = + _$_InputParticipantInfoState.fromJson; + + @override + @JsonKey(name: 'desired_occupations') + List get desiredOccupations; + @override + @JsonKey(name: 'working_days') + String get workingDays; + @override + String get note; + @override + _$InputParticipantInfoStateCopyWith<_InputParticipantInfoState> get copyWith; +} diff --git a/lib/pages/input_participant_info/input_participant_info_state.g.dart b/lib/pages/input_participant_info/input_participant_info_state.g.dart new file mode 100644 index 0000000..e38d15e --- /dev/null +++ b/lib/pages/input_participant_info/input_participant_info_state.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'input_participant_info_state.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_InputParticipantInfoState _$_$_InputParticipantInfoStateFromJson( + Map json) { + return _$_InputParticipantInfoState( + desiredOccupations: (json['desired_occupations'] as List) + ?.map((e) => e == null + ? null + : TechnicalStack.fromJson(e as Map)) + ?.toList(), + workingDays: json['working_days'] as String, + note: json['note'] as String, + ); +} + +Map _$_$_InputParticipantInfoStateToJson( + _$_InputParticipantInfoState instance) => + { + 'desired_occupations': instance.desiredOccupations, + 'working_days': instance.workingDays, + 'note': instance.note, + }; From aaef9c3a96a375ec0939cdec64d919bca2c59d5e Mon Sep 17 00:00:00 2001 From: tomu28 Date: Sat, 13 Jun 2020 22:16:02 +0900 Subject: [PATCH 4/6] =?UTF-8?q?Edit:=20workingDays=E3=81=AE=E5=9E=8B?= =?UTF-8?q?=E5=A4=89=E6=8F=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../input_participant_info_state.dart | 2 +- .../input_participant_info_state.freezed.dart | 18 +++++++++--------- .../input_participant_info_state.g.dart | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/pages/input_participant_info/input_participant_info_state.dart b/lib/pages/input_participant_info/input_participant_info_state.dart index 15884f9..0b1d98b 100644 --- a/lib/pages/input_participant_info/input_participant_info_state.dart +++ b/lib/pages/input_participant_info/input_participant_info_state.dart @@ -8,7 +8,7 @@ part 'input_participant_info_state.g.dart'; abstract class InputParticipantInfoState with _$InputParticipantInfoState { const factory InputParticipantInfoState({ @JsonKey(name: 'desired_occupations') List desiredOccupations, - @JsonKey(name: 'working_days') String workingDays, + @JsonKey(name: 'working_days') int workingDays, String note, }) = _InputParticipantInfoState; diff --git a/lib/pages/input_participant_info/input_participant_info_state.freezed.dart b/lib/pages/input_participant_info/input_participant_info_state.freezed.dart index 9663dd1..b98a514 100644 --- a/lib/pages/input_participant_info/input_participant_info_state.freezed.dart +++ b/lib/pages/input_participant_info/input_participant_info_state.freezed.dart @@ -20,7 +20,7 @@ class _$InputParticipantInfoStateTearOff { {@JsonKey(name: 'desired_occupations') List desiredOccupations, @JsonKey(name: 'working_days') - String workingDays, + int workingDays, String note}) { return _InputParticipantInfoState( desiredOccupations: desiredOccupations, @@ -37,7 +37,7 @@ mixin _$InputParticipantInfoState { @JsonKey(name: 'desired_occupations') List get desiredOccupations; @JsonKey(name: 'working_days') - String get workingDays; + int get workingDays; String get note; Map toJson(); @@ -52,7 +52,7 @@ abstract class $InputParticipantInfoStateCopyWith<$Res> { {@JsonKey(name: 'desired_occupations') List desiredOccupations, @JsonKey(name: 'working_days') - String workingDays, + int workingDays, String note}); } @@ -75,7 +75,7 @@ class _$InputParticipantInfoStateCopyWithImpl<$Res> ? _value.desiredOccupations : desiredOccupations as List, workingDays: - workingDays == freezed ? _value.workingDays : workingDays as String, + workingDays == freezed ? _value.workingDays : workingDays as int, note: note == freezed ? _value.note : note as String, )); } @@ -91,7 +91,7 @@ abstract class _$InputParticipantInfoStateCopyWith<$Res> {@JsonKey(name: 'desired_occupations') List desiredOccupations, @JsonKey(name: 'working_days') - String workingDays, + int workingDays, String note}); } @@ -117,7 +117,7 @@ class __$InputParticipantInfoStateCopyWithImpl<$Res> ? _value.desiredOccupations : desiredOccupations as List, workingDays: - workingDays == freezed ? _value.workingDays : workingDays as String, + workingDays == freezed ? _value.workingDays : workingDays as int, note: note == freezed ? _value.note : note as String, )); } @@ -140,7 +140,7 @@ class _$_InputParticipantInfoState final List desiredOccupations; @override @JsonKey(name: 'working_days') - final String workingDays; + final int workingDays; @override final String note; @@ -197,7 +197,7 @@ abstract class _InputParticipantInfoState implements InputParticipantInfoState { {@JsonKey(name: 'desired_occupations') List desiredOccupations, @JsonKey(name: 'working_days') - String workingDays, + int workingDays, String note}) = _$_InputParticipantInfoState; factory _InputParticipantInfoState.fromJson(Map json) = @@ -208,7 +208,7 @@ abstract class _InputParticipantInfoState implements InputParticipantInfoState { List get desiredOccupations; @override @JsonKey(name: 'working_days') - String get workingDays; + int get workingDays; @override String get note; @override diff --git a/lib/pages/input_participant_info/input_participant_info_state.g.dart b/lib/pages/input_participant_info/input_participant_info_state.g.dart index e38d15e..f6bbeee 100644 --- a/lib/pages/input_participant_info/input_participant_info_state.g.dart +++ b/lib/pages/input_participant_info/input_participant_info_state.g.dart @@ -14,7 +14,7 @@ _$_InputParticipantInfoState _$_$_InputParticipantInfoStateFromJson( ? null : TechnicalStack.fromJson(e as Map)) ?.toList(), - workingDays: json['working_days'] as String, + workingDays: json['working_days'] as int, note: json['note'] as String, ); } From 3ea11b6cd93c213d1edacfb86d8e628e9518b7d2 Mon Sep 17 00:00:00 2001 From: tomu28 Date: Sat, 13 Jun 2020 23:18:31 +0900 Subject: [PATCH 5/6] Change: InputParticipantInfoState --- .../input_participant_info_state.dart | 3 + .../input_participant_info_state.freezed.dart | 61 +++++++++++++++---- .../input_participant_info_state.g.dart | 6 ++ 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/lib/pages/input_participant_info/input_participant_info_state.dart b/lib/pages/input_participant_info/input_participant_info_state.dart index 0b1d98b..40271da 100644 --- a/lib/pages/input_participant_info/input_participant_info_state.dart +++ b/lib/pages/input_participant_info/input_participant_info_state.dart @@ -7,9 +7,12 @@ part 'input_participant_info_state.g.dart'; @freezed abstract class InputParticipantInfoState with _$InputParticipantInfoState { const factory InputParticipantInfoState({ + // Participant Model @JsonKey(name: 'desired_occupations') List desiredOccupations, @JsonKey(name: 'working_days') int workingDays, String note, + // Questionnaire Model + @required @JsonKey(name: 'schedule_candidate') List scheduleCandidates, }) = _InputParticipantInfoState; factory InputParticipantInfoState.fromJson(Map json) => _$InputParticipantInfoStateFromJson(json); diff --git a/lib/pages/input_participant_info/input_participant_info_state.freezed.dart b/lib/pages/input_participant_info/input_participant_info_state.freezed.dart index b98a514..882af81 100644 --- a/lib/pages/input_participant_info/input_participant_info_state.freezed.dart +++ b/lib/pages/input_participant_info/input_participant_info_state.freezed.dart @@ -21,11 +21,15 @@ class _$InputParticipantInfoStateTearOff { List desiredOccupations, @JsonKey(name: 'working_days') int workingDays, - String note}) { + String note, + @required + @JsonKey(name: 'schedule_candidate') + List scheduleCandidates}) { return _InputParticipantInfoState( desiredOccupations: desiredOccupations, workingDays: workingDays, note: note, + scheduleCandidates: scheduleCandidates, ); } } @@ -39,6 +43,8 @@ mixin _$InputParticipantInfoState { @JsonKey(name: 'working_days') int get workingDays; String get note; + @JsonKey(name: 'schedule_candidate') + List get scheduleCandidates; Map toJson(); $InputParticipantInfoStateCopyWith get copyWith; @@ -53,7 +59,9 @@ abstract class $InputParticipantInfoStateCopyWith<$Res> { List desiredOccupations, @JsonKey(name: 'working_days') int workingDays, - String note}); + String note, + @JsonKey(name: 'schedule_candidate') + List scheduleCandidates}); } class _$InputParticipantInfoStateCopyWithImpl<$Res> @@ -69,6 +77,7 @@ class _$InputParticipantInfoStateCopyWithImpl<$Res> Object desiredOccupations = freezed, Object workingDays = freezed, Object note = freezed, + Object scheduleCandidates = freezed, }) { return _then(_value.copyWith( desiredOccupations: desiredOccupations == freezed @@ -77,6 +86,9 @@ class _$InputParticipantInfoStateCopyWithImpl<$Res> workingDays: workingDays == freezed ? _value.workingDays : workingDays as int, note: note == freezed ? _value.note : note as String, + scheduleCandidates: scheduleCandidates == freezed + ? _value.scheduleCandidates + : scheduleCandidates as List, )); } } @@ -92,7 +104,9 @@ abstract class _$InputParticipantInfoStateCopyWith<$Res> List desiredOccupations, @JsonKey(name: 'working_days') int workingDays, - String note}); + String note, + @JsonKey(name: 'schedule_candidate') + List scheduleCandidates}); } class __$InputParticipantInfoStateCopyWithImpl<$Res> @@ -111,6 +125,7 @@ class __$InputParticipantInfoStateCopyWithImpl<$Res> Object desiredOccupations = freezed, Object workingDays = freezed, Object note = freezed, + Object scheduleCandidates = freezed, }) { return _then(_InputParticipantInfoState( desiredOccupations: desiredOccupations == freezed @@ -119,6 +134,9 @@ class __$InputParticipantInfoStateCopyWithImpl<$Res> workingDays: workingDays == freezed ? _value.workingDays : workingDays as int, note: note == freezed ? _value.note : note as String, + scheduleCandidates: scheduleCandidates == freezed + ? _value.scheduleCandidates + : scheduleCandidates as List, )); } } @@ -130,7 +148,9 @@ class _$_InputParticipantInfoState const _$_InputParticipantInfoState( {@JsonKey(name: 'desired_occupations') this.desiredOccupations, @JsonKey(name: 'working_days') this.workingDays, - this.note}); + this.note, + @required @JsonKey(name: 'schedule_candidate') this.scheduleCandidates}) + : assert(scheduleCandidates != null); factory _$_InputParticipantInfoState.fromJson(Map json) => _$_$_InputParticipantInfoStateFromJson(json); @@ -143,10 +163,13 @@ class _$_InputParticipantInfoState final int workingDays; @override final String note; + @override + @JsonKey(name: 'schedule_candidate') + final List scheduleCandidates; @override String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'InputParticipantInfoState(desiredOccupations: $desiredOccupations, workingDays: $workingDays, note: $note)'; + return 'InputParticipantInfoState(desiredOccupations: $desiredOccupations, workingDays: $workingDays, note: $note, scheduleCandidates: $scheduleCandidates)'; } @override @@ -156,7 +179,8 @@ class _$_InputParticipantInfoState ..add(DiagnosticsProperty('type', 'InputParticipantInfoState')) ..add(DiagnosticsProperty('desiredOccupations', desiredOccupations)) ..add(DiagnosticsProperty('workingDays', workingDays)) - ..add(DiagnosticsProperty('note', note)); + ..add(DiagnosticsProperty('note', note)) + ..add(DiagnosticsProperty('scheduleCandidates', scheduleCandidates)); } @override @@ -170,7 +194,10 @@ class _$_InputParticipantInfoState const DeepCollectionEquality() .equals(other.workingDays, workingDays)) && (identical(other.note, note) || - const DeepCollectionEquality().equals(other.note, note))); + const DeepCollectionEquality().equals(other.note, note)) && + (identical(other.scheduleCandidates, scheduleCandidates) || + const DeepCollectionEquality() + .equals(other.scheduleCandidates, scheduleCandidates))); } @override @@ -178,7 +205,8 @@ class _$_InputParticipantInfoState runtimeType.hashCode ^ const DeepCollectionEquality().hash(desiredOccupations) ^ const DeepCollectionEquality().hash(workingDays) ^ - const DeepCollectionEquality().hash(note); + const DeepCollectionEquality().hash(note) ^ + const DeepCollectionEquality().hash(scheduleCandidates); @override _$InputParticipantInfoStateCopyWith<_InputParticipantInfoState> @@ -194,11 +222,15 @@ class _$_InputParticipantInfoState abstract class _InputParticipantInfoState implements InputParticipantInfoState { const factory _InputParticipantInfoState( - {@JsonKey(name: 'desired_occupations') - List desiredOccupations, - @JsonKey(name: 'working_days') - int workingDays, - String note}) = _$_InputParticipantInfoState; + {@JsonKey(name: 'desired_occupations') + List desiredOccupations, + @JsonKey(name: 'working_days') + int workingDays, + String note, + @required + @JsonKey(name: 'schedule_candidate') + List scheduleCandidates}) = + _$_InputParticipantInfoState; factory _InputParticipantInfoState.fromJson(Map json) = _$_InputParticipantInfoState.fromJson; @@ -212,5 +244,8 @@ abstract class _InputParticipantInfoState implements InputParticipantInfoState { @override String get note; @override + @JsonKey(name: 'schedule_candidate') + List get scheduleCandidates; + @override _$InputParticipantInfoStateCopyWith<_InputParticipantInfoState> get copyWith; } diff --git a/lib/pages/input_participant_info/input_participant_info_state.g.dart b/lib/pages/input_participant_info/input_participant_info_state.g.dart index f6bbeee..39a971f 100644 --- a/lib/pages/input_participant_info/input_participant_info_state.g.dart +++ b/lib/pages/input_participant_info/input_participant_info_state.g.dart @@ -16,6 +16,11 @@ _$_InputParticipantInfoState _$_$_InputParticipantInfoStateFromJson( ?.toList(), workingDays: json['working_days'] as int, note: json['note'] as String, + scheduleCandidates: (json['schedule_candidate'] as List) + ?.map((e) => e == null + ? null + : ScheduleCandidate.fromJson(e as Map)) + ?.toList(), ); } @@ -25,4 +30,5 @@ Map _$_$_InputParticipantInfoStateToJson( 'desired_occupations': instance.desiredOccupations, 'working_days': instance.workingDays, 'note': instance.note, + 'schedule_candidate': instance.scheduleCandidates, }; From 7eb6d5f86a052987b448d20766a0f02358d33508 Mon Sep 17 00:00:00 2001 From: tomu28 Date: Sat, 13 Jun 2020 23:39:43 +0900 Subject: [PATCH 6/6] Add: import package --- .../input_participant_info_page.dart | 11 +++++++---- .../widgets/desired_occupation.dart | 2 ++ .../widgets/schedule_candidate.dart | 4 +++- .../input_participant_info/widgets/submit_btn.dart | 4 ++-- .../input_participant_info/widgets/working_days.dart | 2 ++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/pages/input_participant_info/input_participant_info_page.dart b/lib/pages/input_participant_info/input_participant_info_page.dart index 5bd2273..e102fa7 100644 --- a/lib/pages/input_participant_info/input_participant_info_page.dart +++ b/lib/pages/input_participant_info/input_participant_info_page.dart @@ -1,20 +1,23 @@ import 'package:flutter/material.dart'; +import 'package:flutter_state_notifier/flutter_state_notifier.dart'; +import 'package:morning_weakers/pages/input_participant_info/input_participant_info_controller.dart'; +import 'package:morning_weakers/pages/input_participant_info/input_participant_info_state.dart'; import 'package:morning_weakers/pages/input_participant_info/widgets/desired_occupation.dart'; import 'package:morning_weakers/pages/input_participant_info/widgets/schedule_candidate.dart'; import 'package:morning_weakers/pages/input_participant_info/widgets/working_days.dart'; import 'package:morning_weakers/pages/input_participant_info/widgets/submit_btn.dart'; -import 'package:firebase_auth/firebase_auth.dart'; class InputParticipantInfoPage extends StatelessWidget { @override Widget build(BuildContext context) { - FirebaseUser userData; - print('input:$userData'); return Scaffold( appBar: AppBar( title: const Text('参加者情報入力'), ), - body: _inputParticipantInfo, + body: StateNotifierProvider( + create: (_) => InputParticipantInfoController(), + child: _inputParticipantInfo, + ), ); } diff --git a/lib/pages/input_participant_info/widgets/desired_occupation.dart b/lib/pages/input_participant_info/widgets/desired_occupation.dart index 20d5532..3bd99b1 100644 --- a/lib/pages/input_participant_info/widgets/desired_occupation.dart +++ b/lib/pages/input_participant_info/widgets/desired_occupation.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:morning_weakers/pages/input_participant_info/input_participant_info_controller.dart'; class DesiredOccupation extends StatelessWidget { final List desires = ['参加希望職種(第1希望)', '参加希望職種(第2希望)', '参加希望職種(第3希望)' ]; diff --git a/lib/pages/input_participant_info/widgets/schedule_candidate.dart b/lib/pages/input_participant_info/widgets/schedule_candidate.dart index b5cab9c..ff2a216 100644 --- a/lib/pages/input_participant_info/widgets/schedule_candidate.dart +++ b/lib/pages/input_participant_info/widgets/schedule_candidate.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:morning_weakers/pages/input_participant_info/input_participant_info_controller.dart'; class ScheduleCandidate extends StatelessWidget { final List scheduleCandidates = [ @@ -19,7 +21,7 @@ class ScheduleCandidate extends StatelessWidget { children: scheduleCandidates.map( (scheduleCandidate) => CheckboxListTile( value: false, - // onChanged: _handleCheckbox(), +// onChanged: context.read().setDesiredOccupationsState(value), activeColor: Theme.of(context).primaryColor, title: Text(scheduleCandidate), ), diff --git a/lib/pages/input_participant_info/widgets/submit_btn.dart b/lib/pages/input_participant_info/widgets/submit_btn.dart index 14c5a2b..42201b0 100644 --- a/lib/pages/input_participant_info/widgets/submit_btn.dart +++ b/lib/pages/input_participant_info/widgets/submit_btn.dart @@ -1,6 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:morning_weakers/pages/input_participant_info/input_participant_info_controller.dart'; class SubmitBtn extends StatelessWidget { @override @@ -9,7 +9,7 @@ class SubmitBtn extends StatelessWidget { child: const Text('OK'), color: Theme.of(context).accentColor, onPressed: () async { -// await context.read().handlePost(); + await context.read().handlePostParticipantInfo(); }); } } diff --git a/lib/pages/input_participant_info/widgets/working_days.dart b/lib/pages/input_participant_info/widgets/working_days.dart index c3af57c..a4f7b55 100644 --- a/lib/pages/input_participant_info/widgets/working_days.dart +++ b/lib/pages/input_participant_info/widgets/working_days.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:morning_weakers/pages/input_participant_info/input_participant_info_controller.dart'; class WorkingDays extends StatelessWidget { final List workingDays = ['1', '2', '3', '4', '5'];