widget_with_codeview 1.0.2

  • Readme
  • Changelog
  • Installing
  • 88

widget_with_codeview #

pub package GitHub

A widget with side-by-side source code view. Extracted from the flutter-catalog open-source app.

Usage #

First make sure to add the source file to the app's assets by editing pubspec.yaml:

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:

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/',
),

Changelogs #

[1.0.2] - 2019-10-19

Use SelectableText.rich() to make code selectable.

[1.0.1] - 2019-07-27

Fix multiple heroes tag issue.

[1.0.0] - 2019-07-22

Initial version: a small tweak from the MyRoute class in https://github.com/X-Wei/flutter_catalog.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  widget_with_codeview: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:widget_with_codeview/widget_with_codeview.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
86
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
74
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Oct 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

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 main.dart, example.dart, and widget_with_codeview.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
animated_floatactionbuttons ^0.1.0 0.1.0
flutter 0.0.0
string_scanner ^1.0.4 1.0.5
url_launcher ^5.0.3 5.2.3
Transitive dependencies
charcode 1.1.2
collection 1.14.11 1.14.12
meta 1.1.7
path 1.6.4
sky_engine 0.0.99
source_span 1.5.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test