Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(mocktail_image_network): include pkg:flutter_svg in example #240

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 12 additions & 3 deletions packages/mocktail_image_network/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

/// {@template fake_app}
/// Sample app used to showcase `mocktail_image_network`
Expand All @@ -12,9 +13,17 @@ class FakeApp extends StatelessWidget {
return MaterialApp(
home: Scaffold(
body: Center(
child: Image.network(
// URL to the Flutter logo from https://flutter.dev/brand
'https://storage.googleapis.com/cms-storage-bucket/c823e53b3a1a7b0d36a9.png',
child: Column(
children: [
Image.network(
// URL to the png Flutter logo from https://flutter.dev/brand
'https://storage.googleapis.com/cms-storage-bucket/c823e53b3a1a7b0d36a9.png',
),
SvgPicture.network(
// URL to the svg Flutter logo from https://flutter.dev/brand
'https://storage.googleapis.com/cms-storage-bucket/847ae81f5430402216fd.svg',
),
],
),
),
),
Expand Down
1 change: 1 addition & 0 deletions packages/mocktail_image_network/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_svg: ^2.0.0

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:example/main.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail_image_network/mocktail_image_network.dart';

void main() {
testWidgets('can use mocktail for network images', (tester) async {
await mockNetworkImages(() async => tester.pumpWidget(const FakeApp()));
expect(find.byType(Image), findsOneWidget);
expect(find.byType(SvgPicture), findsOneWidget);
});
}
Loading