Skip to content
Snippets Groups Projects
Unverified Commit f25b4b77 authored by Ben Konyi's avatar Ben Konyi Committed by GitHub
Browse files

[ Widget Previews ] Add support for detecting previews and generating code (#161911)

`flutter widget-preview start` will now look for functions annotated
with `@Preview()` within the developer's project. These functions will
be used to generate
`.dart_tool/widget_preview_scaffold/lib/generated_preview.dart`, which
inserts the returned value from each preview function into a
`List<WidgetPreview>` returned from a `previews()` method that is
invoked by the widget preview scaffold root.

**Example generated_preview.dart:**

```dart
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:foo/foo.dart' as _i1;
import 'package:foo/src/bar.dart' as _i2;
import 'package:widget_preview/widget_preview.dart';

List<WidgetPreview> previews() => [_i1.preview(), _i2.barPreview1(), _i2.barPreview2()];
```
parent a9c50335
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment