Baseflow / Baseflow/flutter_cache_manager
How to test imagebuilder
- 主要言語
- Dart
- スター
- 809
- フォーク
- 510
- 平均マージ
- 6分
- マージ済み PR(30日)
- 1
説明
## 💬 Questions and Help
I need to test imageBuilder, I have this code, but I can't.
```dart
testWidgets('Cached networked image builder', (tester) async {
final widget = CachedNetworkImage(
cacheManager: cacheManager, //<<< FakeCacheManager
imageBuilder: (
context,
url,
) =>
Container(
key: Key('image'),
),
progressIndicatorBuilder: (context, url, progress) => Container(
key: Key('progress'),
),
errorWidget: (context, url, error) => Container(
key: Key('failed'),
),
imageUrl: 'foo.nl',
);
await tester.pumpWidget(
MediaQuery(
data: MediaQueryData(),
child: MaterialApp(
home: widget,
),
),
);
await tester.pumpAndSettle();
expect(find.byKey(Key('image')), findsOneWidget);
});
コントリビューションガイド
調査の方向性
Start with the testWidgets example and its FakeCacheManager setup. Check the widget states represented by the imageBuilder, progressIndicatorBuilder, and errorWidget callbacks, then verify the intended state with tester.pumpAndSettle. Done means the test reliably reaches the expected widget identified by the image key.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- dart
- 領域
- mobile, testing
- issue の種類
- ドキュメント
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100