flutter_animate icon indicating copy to clipboard operation
flutter_animate copied to clipboard

Annotate extension methods with `@widgetFactory`

Open blaugold opened this issue 2 years ago • 2 comments
trafficstars

Flutter has recently introduced the @widgetFactory 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:

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

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

blaugold avatar Feb 18 '23 11:02 blaugold

Cool. I'll keep this open to implement in the future. Feel free to remind me. :)

gskinner avatar Feb 20 '23 17:02 gskinner

Note to self: @widgetFactory released in 3.10.0 on 2023/5/10.

gskinner avatar Jan 30 '24 21:01 gskinner