Skip to content

Commit 1a31247

Browse files
soaresgGabriel Soares
andauthored
File step (QuickBirdEng#87)
* file step structure created * initial logic of take a picture * add logic of sending image * Adjustments in view Creation of a text showing the name of the file for a feedback to the user. * Return the main file to the standard Return the main file to the standard * Restored files to standard Restored the example files, AndroidManifest.xml, build.gradle and gradle-wrapper.properties to standard. * Issue Correction Issue corretion for flutter analyze * Requested Changes Co-authored-by: Gabriel Soares <gabriel.soares@simrede.com.br>
1 parent ec2b060 commit 1a31247

File tree

13 files changed

+514
-50
lines changed

13 files changed

+514
-50
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.buildlog/
99
.history
1010
.svn/
11+
.fvm/
1112

1213
# IntelliJ related
1314
*.iml

example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ android {
3535
defaultConfig {
3636
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3737
applicationId "com.quickbirdstudios.surveykit_example"
38-
minSdkVersion 16
38+
minSdkVersion 21
3939
targetSdkVersion 31
4040
versionCode flutterVersionCode.toInteger()
4141
versionName flutterVersionName

example/pubspec.lock

Lines changed: 113 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ packages:
1414
name: async
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.8.2"
17+
version: "2.9.0"
1818
bloc:
1919
dependency: transitive
2020
description:
@@ -29,6 +29,41 @@ packages:
2929
url: "https://pub.dartlang.org"
3030
source: hosted
3131
version: "2.1.0"
32+
camera:
33+
dependency: transitive
34+
description:
35+
name: camera
36+
url: "https://pub.dartlang.org"
37+
source: hosted
38+
version: "0.10.0+1"
39+
camera_android:
40+
dependency: transitive
41+
description:
42+
name: camera_android
43+
url: "https://pub.dartlang.org"
44+
source: hosted
45+
version: "0.10.0+2"
46+
camera_avfoundation:
47+
dependency: transitive
48+
description:
49+
name: camera_avfoundation
50+
url: "https://pub.dartlang.org"
51+
source: hosted
52+
version: "0.9.8+5"
53+
camera_platform_interface:
54+
dependency: transitive
55+
description:
56+
name: camera_platform_interface
57+
url: "https://pub.dartlang.org"
58+
source: hosted
59+
version: "2.2.0"
60+
camera_web:
61+
dependency: transitive
62+
description:
63+
name: camera_web
64+
url: "https://pub.dartlang.org"
65+
source: hosted
66+
version: "0.3.0"
3267
characters:
3368
dependency: transitive
3469
description:
@@ -57,6 +92,13 @@ packages:
5792
url: "https://pub.dartlang.org"
5893
source: hosted
5994
version: "1.16.0"
95+
cross_file:
96+
dependency: transitive
97+
description:
98+
name: cross_file
99+
url: "https://pub.dartlang.org"
100+
source: hosted
101+
version: "0.3.3+1"
60102
crypto:
61103
dependency: transitive
62104
description:
@@ -111,6 +153,13 @@ packages:
111153
url: "https://pub.dartlang.org"
112154
source: hosted
113155
version: "2.0.0"
156+
flutter_plugin_android_lifecycle:
157+
dependency: transitive
158+
description:
159+
name: flutter_plugin_android_lifecycle
160+
url: "https://pub.dartlang.org"
161+
source: hosted
162+
version: "2.0.7"
114163
flutter_test:
115164
dependency: "direct dev"
116165
description: flutter
@@ -135,6 +184,55 @@ packages:
135184
url: "https://pub.dartlang.org"
136185
source: hosted
137186
version: "0.15.0"
187+
http:
188+
dependency: transitive
189+
description:
190+
name: http
191+
url: "https://pub.dartlang.org"
192+
source: hosted
193+
version: "0.13.5"
194+
http_parser:
195+
dependency: transitive
196+
description:
197+
name: http_parser
198+
url: "https://pub.dartlang.org"
199+
source: hosted
200+
version: "4.0.1"
201+
image_picker:
202+
dependency: transitive
203+
description:
204+
name: image_picker
205+
url: "https://pub.dartlang.org"
206+
source: hosted
207+
version: "0.8.5+3"
208+
image_picker_android:
209+
dependency: transitive
210+
description:
211+
name: image_picker_android
212+
url: "https://pub.dartlang.org"
213+
source: hosted
214+
version: "0.8.5+3"
215+
image_picker_for_web:
216+
dependency: transitive
217+
description:
218+
name: image_picker_for_web
219+
url: "https://pub.dartlang.org"
220+
source: hosted
221+
version: "2.1.8"
222+
image_picker_ios:
223+
dependency: transitive
224+
description:
225+
name: image_picker_ios
226+
url: "https://pub.dartlang.org"
227+
source: hosted
228+
version: "0.8.6"
229+
image_picker_platform_interface:
230+
dependency: transitive
231+
description:
232+
name: image_picker_platform_interface
233+
url: "https://pub.dartlang.org"
234+
source: hosted
235+
version: "2.6.1"
138236
intl:
139237
dependency: transitive
140238
description:
@@ -219,6 +317,13 @@ packages:
219317
url: "https://pub.dartlang.org"
220318
source: hosted
221319
version: "6.0.3"
320+
quiver:
321+
dependency: transitive
322+
description:
323+
name: quiver
324+
url: "https://pub.dartlang.org"
325+
source: hosted
326+
version: "3.1.0"
222327
sky_engine:
223328
dependency: transitive
224329
description: flutter
@@ -245,6 +350,13 @@ packages:
245350
url: "https://pub.dartlang.org"
246351
source: hosted
247352
version: "2.1.0"
353+
stream_transform:
354+
dependency: transitive
355+
description:
356+
name: stream_transform
357+
url: "https://pub.dartlang.org"
358+
source: hosted
359+
version: "2.0.0"
248360
string_scanner:
249361
dependency: transitive
250362
description:

lib/src/answer_format/answer_format.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import 'package:survey_kit/src/answer_format/boolean_answer_format.dart';
44
import 'package:survey_kit/src/answer_format/date_answer_format.dart';
5-
import 'package:survey_kit/src/answer_format/integer_answer_format.dart';
65
import 'package:survey_kit/src/answer_format/double_answer_format.dart';
7-
import 'package:survey_kit/src/answer_format/multiple_double_answer_format.dart';
6+
import 'package:survey_kit/src/answer_format/image_answer_format.dart';
7+
import 'package:survey_kit/src/answer_format/integer_answer_format.dart';
88
import 'package:survey_kit/src/answer_format/multiple_choice_answer_format.dart';
9+
import 'package:survey_kit/src/answer_format/multiple_double_answer_format.dart';
910
import 'package:survey_kit/src/answer_format/scale_answer_format.dart';
1011
import 'package:survey_kit/src/answer_format/single_choice_answer_format.dart';
1112
import 'package:survey_kit/src/answer_format/text_answer_format.dart';
@@ -37,6 +38,8 @@ abstract class AnswerFormat {
3738
return ScaleAnswerFormat.fromJson(json);
3839
case 'time':
3940
return TimeAnswerFormat.fromJson(json);
41+
case 'file':
42+
return ImageAnswerFormat.fromJson(json);
4043
default:
4144
throw AnswerFormatNotDefinedException();
4245
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
import 'package:survey_kit/src/answer_format/answer_format.dart';
3+
4+
part 'image_answer_format.g.dart';
5+
6+
@JsonSerializable()
7+
class ImageAnswerFormat implements AnswerFormat {
8+
final String? defaultValue;
9+
final String buttonText;
10+
11+
const ImageAnswerFormat({
12+
this.defaultValue,
13+
this.buttonText = 'Image: ',
14+
}) : super();
15+
16+
factory ImageAnswerFormat.fromJson(Map<String, dynamic> json) =>
17+
_$ImageAnswerFormatFromJson(json);
18+
19+
Map<String, dynamic> toJson() => _$ImageAnswerFormatToJson(this);
20+
}

lib/src/answer_format/image_answer_format.g.dart

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:survey_kit/src/result/question_result.dart';
2+
import 'package:survey_kit/src/steps/identifier/identifier.dart';
3+
4+
part 'image_question_result.g.dart';
5+
6+
class ImageQuestionResult extends QuestionResult<String?> {
7+
ImageQuestionResult({
8+
required Identifier id,
9+
required DateTime startDate,
10+
required DateTime endDate,
11+
required String valueIdentifier,
12+
required String? result,
13+
}) : super(
14+
id: id,
15+
startDate: startDate,
16+
endDate: endDate,
17+
valueIdentifier: valueIdentifier,
18+
result: result,
19+
);
20+
21+
factory ImageQuestionResult.fromJson(Map<String, dynamic> json) =>
22+
_$ImageQuestionResultFromJson(json);
23+
24+
Map<String, dynamic> toJson() => _$ImageQuestionResultToJson(this);
25+
26+
@override
27+
List<Object?> get props => [id, startDate, endDate, valueIdentifier, result];
28+
}

lib/src/result/question/image_question_result.g.dart

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/steps/predefined_steps/question_step.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:survey_kit/src/answer_format/answer_format.dart';
44
import 'package:survey_kit/src/answer_format/boolean_answer_format.dart';
55
import 'package:survey_kit/src/answer_format/date_answer_format.dart';
66
import 'package:survey_kit/src/answer_format/double_answer_format.dart';
7+
import 'package:survey_kit/src/answer_format/image_answer_format.dart';
78
import 'package:survey_kit/src/answer_format/integer_answer_format.dart';
89
import 'package:survey_kit/src/answer_format/multiple_choice_answer_format.dart';
910
import 'package:survey_kit/src/answer_format/multiple_double_answer_format.dart';
@@ -14,26 +15,28 @@ import 'package:survey_kit/src/answer_format/time_answer_formart.dart';
1415
import 'package:survey_kit/src/result/question/boolean_question_result.dart';
1516
import 'package:survey_kit/src/result/question/date_question_result.dart';
1617
import 'package:survey_kit/src/result/question/double_question_result.dart';
18+
import 'package:survey_kit/src/result/question/image_question_result.dart';
1719
import 'package:survey_kit/src/result/question/integer_question_result.dart';
1820
import 'package:survey_kit/src/result/question/multiple_choice_question_result.dart';
1921
import 'package:survey_kit/src/result/question/multiple_double_question_result.dart';
2022
import 'package:survey_kit/src/result/question/scale_question_result.dart';
2123
import 'package:survey_kit/src/result/question/single_choice_question_result.dart';
2224
import 'package:survey_kit/src/result/question/text_question_result.dart';
2325
import 'package:survey_kit/src/result/question/time_question_result.dart';
26+
import 'package:survey_kit/src/result/question_result.dart';
27+
import 'package:survey_kit/src/steps/identifier/step_identifier.dart';
2428
import 'package:survey_kit/src/steps/predefined_steps/answer_format_not_defined_exception.dart';
29+
import 'package:survey_kit/src/steps/step.dart';
2530
import 'package:survey_kit/src/views/boolean_answer_view.dart';
2631
import 'package:survey_kit/src/views/date_answer_view.dart';
27-
import 'package:survey_kit/src/views/integer_answer_view.dart';
2832
import 'package:survey_kit/src/views/double_answer_view.dart';
33+
import 'package:survey_kit/src/views/image_answer_view.dart';
34+
import 'package:survey_kit/src/views/integer_answer_view.dart';
2935
import 'package:survey_kit/src/views/multiple_choice_answer_view.dart';
3036
import 'package:survey_kit/src/views/multiple_double_answer_view.dart';
3137
import 'package:survey_kit/src/views/scale_answer_view.dart';
3238
import 'package:survey_kit/src/views/single_choice_answer_view.dart';
3339
import 'package:survey_kit/src/views/text_answer_view.dart';
34-
import 'package:survey_kit/src/result/question_result.dart';
35-
import 'package:survey_kit/src/steps/step.dart';
36-
import 'package:survey_kit/src/steps/identifier/step_identifier.dart';
3740
import 'package:survey_kit/src/views/time_answer_view.dart';
3841

3942
part 'question_step.g.dart';
@@ -129,6 +132,12 @@ class QuestionStep extends Step {
129132
questionStep: this,
130133
result: questionResult as MultipleDoubleQuestionResult?,
131134
);
135+
case ImageAnswerFormat:
136+
return ImageAnswerView(
137+
key: key,
138+
questionStep: this,
139+
result: questionResult as ImageQuestionResult?,
140+
);
132141
default:
133142
throw AnswerFormatNotDefinedException();
134143
}

0 commit comments

Comments
 (0)