A widget with side-by-side source code view. Extracted from the flutter-catalog open-source app.
First make sure to add the source file to the app's assets by editing
dependencies: flutter: sdk: flutter widget_with_codeview: '1.0.1' flutter: assets: # Include a single source code file: - lib/my_awesome_source_code.dart # Include all files under a subfoler by adding trailing "/": - lib/my_awesome_source_code_subdir/ - ...
Then wrap the widget from that source file by a
WidgetWithCodeView( child: MyAwesomeWidget(), sourceFilePath: 'lib/my_awesome_source_code.dart', // 1codeLinkPrefix` is optional. When it's specified, two more buttons // (open-code-in-browser, copy-code-link) will be added in the code view. codeLinkPrefix: 'https://github.com/<my_username>/<my_project>/blob/master/', ),
You can also choose to only show the code:
SourceCodeView( sourceFilePath: 'lib/my_awesome_source_code.dart', codeLinkPrefix: 'https://github.com/<my_username>/<my_project>/blob/master/', ),
Fix multiple heroes tag issue.
Initial version: a small tweak from the MyRoute class in https://github.com/X-Wei/flutter_catalog.
Add this to your package's pubspec.yaml file:
dependencies: widget_with_codeview: ^1.0.1
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Aug 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
The package description is too short. (-16 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
widget_with_codeview.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
|Dart SDK||>=2.3.0 <3.0.0|