Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart' hide Step;
import 'package:flutter/services.dart';
import 'package:survey_kit/survey_kit.dart';
import 'package:survey_kit_image_answer/survey_kit_image_answer.dart';

void main() {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
Expand Down
60 changes: 30 additions & 30 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ packages:
dependency: transitive
description:
name: camera_android_camerax
sha256: e3627fdc2132d89212b8a8676679f5b07008c7e3d8ae00cea775c3397f9e742b
sha256: "011be2ab0e5b3e3aa8094413fa890f8c5c5afd7cfdaef353a992047d4dab5780"
url: "https://pub.dev"
source: hosted
version: "0.6.10"
version: "0.6.8+2"
camera_avfoundation:
dependency: transitive
description:
Expand Down Expand Up @@ -239,10 +239,10 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: "9b78450b89f059e96c9ebb355fa6b3df1d6b330436e0b885fb49594c41721398"
sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda"
url: "https://pub.dev"
source: hosted
version: "2.0.23"
version: "2.0.22"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -294,10 +294,10 @@ packages:
dependency: transitive
description:
name: image_picker_android
sha256: "8faba09ba361d4b246dc0a17cb4289b3324c2b9f6db7b3d457ee69106a86bd32"
sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56"
url: "https://pub.dev"
source: hosted
version: "0.8.12+17"
version: "0.8.12+12"
image_picker_for_web:
dependency: transitive
description:
Expand Down Expand Up @@ -371,18 +371,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -419,18 +419,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.15.0"
version: "1.12.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -459,10 +459,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
version: "3.1.4"
plugin_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -544,10 +544,10 @@ packages:
dependency: "direct main"
description:
name: survey_kit
sha256: "3e224786905bbfb9a3bde53faf8e5a43b42f2771b4f9ad0fe261465ffd36aa93"
sha256: "08f6e0dcd934d98a609377a482e394f2fd3866860164345434c064e47265a573"
url: "https://pub.dev"
source: hosted
version: "0.2.1"
version: "0.3.0"
survey_kit_image_answer:
dependency: "direct main"
description:
Expand Down Expand Up @@ -575,18 +575,18 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.7.0"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.3.2"
url_launcher:
dependency: transitive
description:
Expand All @@ -599,10 +599,10 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79
url: "https://pub.dev"
source: hosted
version: "6.3.14"
version: "6.3.9"
url_launcher_ios:
dependency: transitive
description:
Expand Down Expand Up @@ -679,10 +679,10 @@ packages:
dependency: transitive
description:
name: video_player_android
sha256: "391e092ba4abe2f93b3e625bd6b6a6ec7d7414279462c1c0ee42b5ab8d0a0898"
sha256: e343701aa890b74a863fa460f5c0e628127ed06a975d7d9af6b697133fb25bdf
url: "https://pub.dev"
source: hosted
version: "2.7.16"
version: "2.7.1"
video_player_avfoundation:
dependency: transitive
description:
Expand Down Expand Up @@ -711,10 +711,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.5"
version: "14.2.1"
web:
dependency: transitive
description:
Expand All @@ -732,5 +732,5 @@ packages:
source: hosted
version: "3.0.3"
sdks:
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.22.0"
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter

survey_kit: ^0.2.1
survey_kit: ^0.3.0

survey_kit_image_answer:
path: ../packages/survey_kit_image_answer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ abstract class ImageAnswerFormat extends AnswerFormat {
case 'file':
return ImageAnswerFormat.fromJson(json);
default:
throw AnswerFormatNotDefinedException();
throw const AnswerFormatNotDefinedException();
}
}
@override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:survey_kit/survey_kit.dart';
import '../answer_format/image_answer_format.dart';
import '../result/image_question_result.dart';

class ImageAnswerView extends StatefulWidget {
final QuestionStep questionStep;
Expand Down Expand Up @@ -82,13 +84,13 @@ class _ImageAnswerViewState extends State<ImageAnswerView> {
child: Text(
filePath
.split('/')[filePath.split('/').length - 1],
style: TextStyle(
style: const TextStyle(
fontSize: 12,
),
),
),
)
: SizedBox(),
: const SizedBox(),
],
),
),
Expand All @@ -108,7 +110,7 @@ class _ImageAnswerViewState extends State<ImageAnswerView> {
child: ListBody(
children: <Widget>[
GestureDetector(
child: Text('Take a picture'),
child: const Text('Take a picture'),
onTap: () {
if (_imageAnswerFormat.hintImage != null &&
_imageAnswerFormat.hintTitle != null) {
Expand All @@ -117,15 +119,15 @@ class _ImageAnswerViewState extends State<ImageAnswerView> {
builder: (context) => AlertDialog(
title: Text(
_imageAnswerFormat.hintTitle.toString(),
style: TextStyle(color: Colors.black),
style: const TextStyle(color: Colors.black),
),
content: Image.network(
_imageAnswerFormat.hintImage.toString(),
),
actions: [
TextButton(
onPressed: () => _openCamera(),
child: Text('Open Camera')),
child: const Text('Open Camera')),
],
),
);
Expand All @@ -134,15 +136,15 @@ class _ImageAnswerViewState extends State<ImageAnswerView> {
}
},
),
Padding(padding: EdgeInsets.all(8.0)),
const Padding(padding: EdgeInsets.all(8.0)),
_imageAnswerFormat.useGallery
? GestureDetector(
child: Text('Select from Gallery'),
child: const Text('Select from Gallery'),
onTap: () {
_openGallery();
},
)
: SizedBox(),
: const SizedBox(),
],
),
),
Expand All @@ -158,9 +160,11 @@ class _ImageAnswerViewState extends State<ImageAnswerView> {
source: ImageSource.camera,
);

if (!mounted) return;
Navigator.pop(context);

picture?.readAsBytes().then((value) {
if (!mounted) return;
setState(() {
filePath = picture.path;
});
Expand All @@ -172,9 +176,11 @@ class _ImageAnswerViewState extends State<ImageAnswerView> {
source: ImageSource.gallery,
);

if (!mounted) return;
Navigator.pop(context);

picture?.readAsBytes().then((value) {
if (!mounted) return;
setState(() {
filePath = picture.path;
});
Expand Down
Loading
Loading