gskinner / flutter_animate

Add beautiful animated effects & builders in Flutter, via an easy, highly customizable unified API.
BSD 3-Clause "New" or "Revised" License
914 stars 76 forks source link

Annotate extension methods with `@widgetFactory` #64

Open blaugold opened 1 year ago

blaugold commented 1 year ago

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

gskinner commented 1 year ago

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

gskinner commented 7 months ago

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