有没有办法测试显示对话框中的内容?我正在尝试在项目中进行BDD,以下是场景:
As a User, I would like to add a photo or select one from the gallery so that I can use it on the item.
以下是我用来测试它的代码,但由于某种原因,测试失败了。
add_item_view.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:my_app_mobile/models/graded_item/graded_item.dart';
import 'package:my_app_mobile/template/index.dart' as template;
import 'package:image_picker/image_picker.dart';
class AddItemView extends HookWidget {
final GradedItem gradedItem;
static final Key photoKey = Key('#photoKey');
static final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final void Function() onPhoto;
final ImagePicker _imagePicker = ImagePicker();
AddItemView({
@required this.gradedItem,
this.onPhoto,
});
@override
Widget build(BuildContext context) …Run Code Online (Sandbox Code Playgroud)