gskinner / gskinner/flutter_animate

Annotate extension methods with `@widgetFactory`

Open
#64 3 comments 0 reactions 0 assignees View on GitHub
documentation enhancement
Dominant language
Dart
Stars
1.1k
Forks
103
PR merge metrics
No merged PRs in 30d

Description

Flutter has recently introduced the [`@widgetFactory`](https://master-api.flutter.dev/flutter/widgets/widgetFactory-constant.html) annotation to improve the dev UX for widgets created in extension methods. It's currently only available in the master channel, so implementing this will have to wait until the next stable feature release and a point at which this package is fine with requiring that version of Flutter.

Take this example:

```dart
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';

void main() {
runApp(const SizedBox().animate());
}
```

Currently, the `Animate` widget, created in `animate`, is not included in the summary widget tree in the widget inspector:

![Screenshot 2023-02-18 at 12 54 02](https://user-images.githubusercontent.com/5929595/219864306-f0366214-a0de-4721-8997-a92a49d8d802.png)

After annotating the `animate` method with `@widgetFactory` the `Animate` widget is included in the summary widget tree like if `Animate` was used directly and not through the extension method.

![Screenshot 2023-02-18 at 12 54 30](https://user-images.githubusercontent.com/5929595/219864367-394af99a-99e2-4630-9055-1a943d1a2fb5.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.