Switch document generation to use the snippets package (#87231)

Switch document generation to use the snippets package instead of the snippets code in the Flutter repo. In the process, some bugs in sample code analysis have been fixed, and I've fixed some more errors in the samples.

This will allow the snippets package to be developed separately from the Flutter repo, and reduce the code in the Flutter repo.

The snippets code is deleted in this PR.

I also converted some comments in the snippet templates to be regular comments instead of doc comments, because having a doc comment block before the imports causes the Dart import sorter to lose the comment. They should have been regular comments in the first place.

The snippets package resides in the assets-for-api-docs repo.

The sample analysis has also been converted to be run in parallel, and I've bumped the Dartdoc version to 1.0.2.
This commit is contained in:
Greg Spencer
2021-08-11 19:48:29 -07:00
committed by GitHub
parent 0340319a96
commit 10e4b04010
47 changed files with 347 additions and 1378 deletions

View File

@@ -32,7 +32,7 @@ import 'theme.dart';
/// // Uncomment to change the background color
/// // backgroundColor: CupertinoColors.systemPink,
/// navigationBar: const CupertinoNavigationBar(
/// middle: const Text('Sample Code'),
/// middle: Text('Sample Code'),
/// ),
/// child: ListView(
/// children: <Widget>[

View File

@@ -1410,7 +1410,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
/// child: SizedBox(
/// height: 20,
/// child: Center(
/// child: const Text('Scroll to see the SliverAppBar in effect.'),
/// child: Text('Scroll to see the SliverAppBar in effect.'),
/// ),
/// ),
/// ),

View File

@@ -382,7 +382,7 @@ class DataCell {
/// child: DataTable(
/// columns: const <DataColumn>[
/// DataColumn(
/// label: const Text('Number'),
/// label: Text('Number'),
/// ),
/// ],
/// rows: List<DataRow>.generate(

View File

@@ -2426,7 +2426,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
/// hintText: 'Hint Text',
/// helperText: 'Helper Text',
/// counterText: '0 characters',
/// border: const OutlineInputBorder(),
/// border: OutlineInputBorder(),
/// ),
/// );
/// }

View File

@@ -281,7 +281,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
/// children: <Widget>[
/// const Text(
/// 'Linear progress indicator with a fixed color',
/// style: const TextStyle(fontSize: 20),
/// style: TextStyle(fontSize: 20),
/// ),
/// LinearProgressIndicator(
/// value: controller.value,

View File

@@ -339,10 +339,10 @@ abstract class Gradient {
/// Widget build(BuildContext context) {
/// return Container(
/// decoration: const BoxDecoration(
/// gradient: const LinearGradient(
/// gradient: LinearGradient(
/// begin: Alignment.topLeft,
/// end: Alignment(0.8, 0.0), // 10% of the width, so there are ten blinds.
/// colors: const <Color>[Color(0xffee0000), Color(0xffeeee00)], // red to yellow
/// colors: <Color>[Color(0xffee0000), Color(0xffeeee00)], // red to yellow
/// tileMode: TileMode.repeated, // repeats the gradient over the canvas
/// ),
/// ),

View File

@@ -444,7 +444,7 @@ typedef AutocompleteOptionToString<T extends Object> = String Function(T option)
/// ),
/// ElevatedButton(
/// onPressed: () {
/// FocusScope.of(context).requestFocus(new FocusNode());
/// FocusScope.of(context).unfocus();
/// if (!_formKey.currentState!.validate()) {
/// return;
/// }

View File

@@ -901,7 +901,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
/// return const SizedBox(
/// width: 200,
/// child: Padding(
/// padding: const EdgeInsets.all(8.0),
/// padding: EdgeInsets.all(8.0),
/// child: TextField(
/// decoration: InputDecoration(border: OutlineInputBorder()),
/// ),

View File

@@ -4433,7 +4433,7 @@ typedef ErrorWidgetBuilder = Widget Function(FlutterErrorDetails details);
/// alignment: Alignment.center,
/// child: const Text(
/// 'Error!',
/// style: const TextStyle(color: Colors.yellow),
/// style: TextStyle(color: Colors.yellow),
/// textDirection: TextDirection.ltr,
/// ),
/// );