diff --git a/packages/survey_kit_image_answer/lib/src/answer_format/answer_format.dart b/packages/survey_kit_image_answer/lib/src/answer_format/answer_format.dart index 5c136e3..0fb43f9 100644 --- a/packages/survey_kit_image_answer/lib/src/answer_format/answer_format.dart +++ b/packages/survey_kit_image_answer/lib/src/answer_format/answer_format.dart @@ -9,5 +9,6 @@ abstract class ImageAnswerFormat extends AnswerFormat { throw AnswerFormatNotDefinedException(); } } + @override Map toJson(); } diff --git a/packages/survey_kit_image_answer/lib/src/answer_format/image_answer_format.dart b/packages/survey_kit_image_answer/lib/src/answer_format/image_answer_format.dart index 887a04c..897d197 100644 --- a/packages/survey_kit_image_answer/lib/src/answer_format/image_answer_format.dart +++ b/packages/survey_kit_image_answer/lib/src/answer_format/image_answer_format.dart @@ -1,5 +1,4 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:survey_kit/src/answer_format/answer_format.dart'; import 'package:survey_kit/survey_kit.dart'; part 'image_answer_format.g.dart'; @@ -23,5 +22,6 @@ class ImageAnswerFormat implements AnswerFormat { factory ImageAnswerFormat.fromJson(Map json) => _$ImageAnswerFormatFromJson(json); + @override Map toJson() => _$ImageAnswerFormatToJson(this); } diff --git a/packages/survey_kit_image_answer/lib/src/result/image_question_result.dart b/packages/survey_kit_image_answer/lib/src/result/image_question_result.dart index 9e8fdb3..7e35259 100644 --- a/packages/survey_kit_image_answer/lib/src/result/image_question_result.dart +++ b/packages/survey_kit_image_answer/lib/src/result/image_question_result.dart @@ -1,24 +1,17 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:survey_kit/src/result/question_result.dart'; -import 'package:survey_kit/src/steps/identifier/identifier.dart'; +import 'package:survey_kit/survey_kit.dart'; part 'image_question_result.g.dart'; @JsonSerializable(explicitToJson: true) class ImageQuestionResult extends QuestionResult { ImageQuestionResult({ - required Identifier id, - required DateTime startDate, - required DateTime endDate, - required String valueIdentifier, - required String? result, - }) : super( - id: id, - startDate: startDate, - endDate: endDate, - valueIdentifier: valueIdentifier, - result: result, - ); + required Identifier super.id, + required super.startDate, + required super.endDate, + required String super.valueIdentifier, + required super.result, + }); factory ImageQuestionResult.fromJson(Map json) => _$ImageQuestionResultFromJson(json); diff --git a/packages/survey_kit_image_answer/lib/src/view/image_answer_view.dart b/packages/survey_kit_image_answer/lib/src/view/image_answer_view.dart index 80be080..31cc9c8 100644 --- a/packages/survey_kit_image_answer/lib/src/view/image_answer_view.dart +++ b/packages/survey_kit_image_answer/lib/src/view/image_answer_view.dart @@ -1,19 +1,16 @@ import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; -import 'package:survey_kit/src/answer_format/image_answer_format.dart'; -import 'package:survey_kit/src/result/question/image_question_result.dart'; -import 'package:survey_kit/src/steps/predefined_steps/question_step.dart'; -import 'package:survey_kit/src/views/widget/step_view.dart'; +import 'package:survey_kit/survey_kit.dart'; class ImageAnswerView extends StatefulWidget { final QuestionStep questionStep; final ImageQuestionResult? result; const ImageAnswerView({ - Key? key, + super.key, required this.questionStep, required this.result, - }) : super(key: key); + }); @override State createState() => _ImageAnswerViewState(); @@ -23,7 +20,7 @@ class _ImageAnswerViewState extends State { late final ImageAnswerFormat _imageAnswerFormat; late final DateTime _startDate; - bool _isValid = false; + final bool _isValid = false; String filePath = ''; @override @@ -59,7 +56,7 @@ class _ImageAnswerViewState extends State { : widget.questionStep.content, child: Padding( padding: const EdgeInsets.symmetric(vertical: 32.0), - child: Container( + child: SizedBox( width: MediaQuery.of(context).size.width, child: Column( children: [ diff --git a/packages/survey_kit_image_answer/pubspec.lock b/packages/survey_kit_image_answer/pubspec.lock index 2e3a6e0..50179d8 100644 --- a/packages/survey_kit_image_answer/pubspec.lock +++ b/packages/survey_kit_image_answer/pubspec.lock @@ -319,7 +319,7 @@ packages: source: hosted version: "1.1.1" flutter: - dependency: transitive + dependency: "direct main" description: flutter source: sdk version: "0.0.0" diff --git a/packages/survey_kit_image_answer/pubspec.yaml b/packages/survey_kit_image_answer/pubspec.yaml index 748a684..393ce80 100644 --- a/packages/survey_kit_image_answer/pubspec.yaml +++ b/packages/survey_kit_image_answer/pubspec.yaml @@ -11,6 +11,8 @@ environment: dependencies: camera: ^0.11.0+1 + flutter: + sdk: flutter image_picker: ^1.0.4 json_annotation: ^4.0.1 survey_kit: ^0.2.1