FLUTTER ECOSYSTEM

X-Wei/widget_with_codeview

横に並んだソースコード表示を持つウィジェット。

widget_with_codeview のプロジェクト画像
Stars
29
Forks
9
最終プッシュ(UTC)
2026/02/16
プロジェクト状態
公開中
xwei GitHub avatar
GITHUB User

xwei ↗

Zürich
言語DartHTML

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 8 件

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

widget_with_codeview

pub package GitHub

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

https://github.com/X-Wei/flutter_catalog/blob/master/screenshots/Screenshot_1541613193.png?raw=true https://github.com/X-Wei/flutter_catalog/blob/master/screenshots/Screenshot_1541613197.png?raw=true

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:
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(), // ⚡️ If null, will only show the source code view.
  filePath: 'lib/my_awesome_source_code.dart',
  /// [codeLinkPrefix] 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 by not setting the child argument.

See example/lib/main.dart for a concrete example.