website icon indicating copy to clipboard operation
website copied to clipboard

Autogenerate src/_data/catalog/widgets.json

Open chalin opened this issue 6 years ago • 4 comments

Entries in the Widget catalog and the Widget index, come from src/_data/catalog/widgets.json.

We've had a few issues open over the widget list because of errors and/or omissions (I fixed a handful last Friday). We know for sure that the list isn't representative of the Flutter 1.0 collection of widgets. We should consider autogenerating the data from, say Flutter sources (once we agree on a few dartdoc metadata tags, this should be relatively easy to do).

chalin avatar Jan 28 '19 16:01 chalin

Yes, this would be good for keeping those pages up to date.

sfshaza2 avatar Jan 28 '19 16:01 sfshaza2

I like the idea. Depends on the metadata requirements, though. You means something like the following?

// A file in flutter/flutter

/// Blah blah blah widget.
///
/// [[catalog_widget]]
class CupertinoSliverRefreshControl extends Widget {
  // ...
}

(Ignore the syntax for now. Just clarifying what you mean by metadata in dartdoc.)

filiph avatar Jan 29 '19 00:01 filiph

Yes, something along those lines (though our tooling could be given enough smarts to be able to figure out which classes are widgets of interest -- along with an opt-out tag for those we want to exclude; such an approach usually reduces the annotation burden).

Btw, we already have a syntax in place, at least one that dartdoc understands and can potentially (pre-)process: the syntax is like that for Dart annotations, @foo. So it might even be something like this:

// A file in flutter/flutter

/// Blah blah blah widget.
///
/// @catalog(categories: ['aaa', 'bbb'], subcategories: ['xxx', 'yyy', ...])
class CupertinoSliverRefreshControl extends Widget {
  // ...
}

chalin avatar Jan 29 '19 10:01 chalin

Linking relevant issue https://github.com/flutter/website/issues/3320

guidezpl avatar Apr 28 '22 19:04 guidezpl