๐Ÿ“ฆ amake / org_flutter

Org Mode widgets for Flutter

โ˜… 22 stars โ‘‚ 4 forks ๐Ÿ‘ 22 watching โš–๏ธ MIT License
flutterorg-mode
๐Ÿ“ฅ Clone https://github.com/amake/org_flutter.git
HTTPS git clone https://github.com/amake/org_flutter.git
SSH git clone git@github.com:amake/org_flutter.git
CLI gh repo clone amake/org_flutter
Aaron Madlon-Kay Aaron Madlon-Kay v10.3.1 2b784e0 1 months ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ example
๐Ÿ“ lib
๐Ÿ“ test
๐Ÿ“„ .gitignore
๐Ÿ“„ .metadata
๐Ÿ“„ CHANGELOG.md
๐Ÿ“„ LICENSE
๐Ÿ“„ Makefile
๐Ÿ“„ pubspec.lock
๐Ÿ“„ pubspec.yaml
๐Ÿ“„ README.md
๐Ÿ“„ README.md

org_flutter

Org Mode widgets for Flutter.

Usage

For parsing Org Mode documents, see orgparser. For an example application that displays Org Mode documents with orgparser and orgflutter, see Orgro.

The simplest way to display an Org Mode document in your Flutter application is to use the Org widget:

import 'package:org_flutter/org_flutter.dart';

class MyOrgViewWidget extends StatelessWidget {
  Widget build(BuildContext context) {
    return Org('''* TODO [#A] foo bar
baz buzz''');
  }
}

See the example for more.

Rich text

Use Org markup to create rich Text-equivalent widgets with OrgText.

OrgText('*This* is a /rich/ text label ([[https://example.com][details]])')

Advanced

For more advanced usage, such as specifying link handling, use OrgController in concert with OrgRootWidget:

import 'package:org_flutter/org_flutter.dart';

Widget build(BuildContext context) {
  final doc = OrgDocument.parse(
    rawOrgModeDocString,
    // Interpret e.g. #+TODO: settings at the cost of a second parsing pass
    interpretEmbeddedSettings: true,
  );
  return OrgController(
    root: doc,
    child: OrgLocator( // Include OrgLocator to enable tap-to-jump on footnotes, etc.
      child: OrgRootWidget(
        style: myTextStyle,
        onLinkTap: launch, // e.g. from url_launcher package
        child: OrgDocumentWidget(doc),
      ),
    ),
  );
}

Place OrgController higher up in your widget hierarchy and access via OrgController.of(context) to dynamically control various properties of the displayed document:

IconButton(
  icon: const Icon(Icons.repeat),
  onPressed: OrgController.of(context).cycleVisibility,
);

Text selection

The Org Mode text is not selectable by default, but you can make it so by wrapping the widget in SelectionArea.