Skip to content

Commit d57b323

Browse files
README: Add screenshots
1 parent bae23b3 commit d57b323

File tree

1 file changed

+15
-79
lines changed

1 file changed

+15
-79
lines changed

README.md

Lines changed: 15 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,22 @@
22
A toolkit for writing golden tests.
33

44
## Getting Started
5-
The following shows an example of how to define a golden test that captures
6-
a variety of independent UIs as a gallery.
5+
Learn how to use `flutter_test_goldens` at [FlutterGoldens.com](https://fluttergoldens.com).
76

8-
```dart
9-
testGoldenSceneOnMac("extended floating action button gallery", (tester) async {
10-
await Gallery(
11-
tester,
12-
itemDecorator: (context, child) {
13-
return FlutterWidgetScaffold(
14-
child: child,
15-
);
16-
},
17-
items: [
18-
GalleryItem.withWidget(
19-
id: "1",
20-
description: "Icon + Text",
21-
child: FloatingActionButton.extended(
22-
icon: Icon(Icons.edit),
23-
label: Text("Hello"),
24-
onPressed: () {},
25-
),
26-
),
27-
GalleryItem.withWidget(
28-
id: "2",
29-
description: "Icon",
30-
child: FloatingActionButton.extended(
31-
icon: Icon(Icons.edit),
32-
label: Text(""),
33-
onPressed: () {},
34-
),
35-
),
36-
GalleryItem.withWidget(
37-
id: "3",
38-
description: "Text",
39-
child: FloatingActionButton.extended(
40-
label: Text("Hello"),
41-
onPressed: () {},
42-
),
43-
),
44-
],
45-
).renderOrCompareGolden(
46-
goldenName: "button_extended_fab_gallery",
47-
layout: SceneLayout.row,
48-
);
49-
});
50-
```
7+
## Examples
8+
The following are examples of what you can render in your golden tests with `flutter_test_goldens`:
519

52-
The following shows an example of how to define a golden test that captures
53-
screenshots over time, placing all of them in a single scene file.
10+
### Single Shot Galleries
11+
![single_shot_standalone](https://github.com/user-attachments/assets/9024157e-68cf-4d72-bdf0-fd7632ac701f)
5412

55-
```dart
56-
testGoldenSceneOnMac("elevated button interactions", (tester) async {
57-
final goldenKey = GlobalKey();
13+
### Multi-Golden Galleries
14+
![gallery](https://github.com/user-attachments/assets/5f5810fb-e189-485f-a6b7-5eb558734726)
5815

59-
await FilmStrip(tester)
60-
// Setup the widget tree.
61-
.setupWithPump(() {
62-
return FlutterWidgetScaffold(
63-
goldenKey: goldenKey,
64-
child: ElevatedButton(
65-
onPressed: () {},
66-
child: Text("Hello"),
67-
),
68-
);
69-
})
70-
// Take a photo.
71-
.takePhoto(find.byKey(goldenKey), "idle")
72-
// Adjust the existing widget tree by hovering over the ElevatedButton.
73-
.hoverOver(find.byType(ElevatedButton))
74-
// Take a photo.
75-
.takePhoto(find.byKey(goldenKey), "hover")
76-
// Adjust the existing widget tree by pressing down at the current offset.
77-
.pressHover()
78-
// Take a photo.
79-
.takePhoto(find.byKey(goldenKey), "pressed")
80-
// Either stitch the photos into a single scene file, or compare them against
81-
// an existing scene file.
82-
.renderOrCompareGolden(
83-
goldenName: "button_elevated_interactions",
84-
layout: SceneLayout.row,
85-
);
86-
});
87-
```
16+
### Magazine Galleries
17+
![slack_chat_magazine_layout](https://github.com/user-attachments/assets/c72b3662-8d93-45a2-9f43-e0ee7c1ed50f)
18+
19+
### Animation Timelines
20+
![crazy-switch_5-shot](https://github.com/user-attachments/assets/5da0356b-1d88-4302-84eb-358bbb62d234)
21+
22+
### Interaction Timelines
23+
![otp](https://github.com/user-attachments/assets/a0030a92-03d4-467d-984c-c6566069cd95)

0 commit comments

Comments
 (0)