novident_editor 1.0.3 copy "novident_editor: ^1.0.3" to clipboard
novident_editor: ^1.0.3 copied to clipboard

A highly customizable rich-text editor for Flutter, part of the Novident suite. Fork of AppFlowy Editor (AppFlowy-IO), used under the Mozilla Public License 2.0.

example/lib/main.dart

import 'dart:io';
import 'package:example/common/controller/tree_controller.dart';
import 'package:example/common/constants/default_files_nodes.dart';
import 'package:example/common/nodes/root.dart';
import 'package:example/common/store/document_content_store.dart';
import 'package:example/widgets/views/android_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:novident_editor/novident_editor.dart'
    show NovidentEditorLocalizations;
import 'package:novident_split_view/novident_split_view.dart';
import 'widgets/views/desktop_view.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final TreeController _controller = TreeController(
    root: Root(
      children: defaultNodes,
    ),
  );

  /// Split view weights (pane sizes) live above the MaterialApp so they
  /// survive navigation and rebuilds. Feed [SplitViewWeights.new] with
  /// persisted values to restore pane sizes between sessions.
  final SplitViewWeights _splitWeights = SplitViewWeights();

  /// Single source of truth for every document's content (node id →
  /// content). Panes sharing a document read/write here and stay in
  /// sync automatically.
  final DocumentContentStore _documentContents = DocumentContentStore(
    initialContents: defaultDocumentContents,
  );

  @override
  Widget build(BuildContext context) {
    return SplitViewProvider(
      weights: _splitWeights,
      child: DocumentContentProvider(
        store: _documentContents,
        child: MaterialApp(
          title: 'Novident',
          theme: ThemeData(
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueGrey),
            useMaterial3: true,
          ),
          debugShowCheckedModeBanner: false,
          localizationsDelegates: const [
            NovidentEditorLocalizations.delegate,
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          debugShowMaterialGrid: false,
          home: MiddlewareView(controller: _controller),
        ),
      ),
    );
  }
}

class MiddlewareView extends StatelessWidget {
  final TreeController controller;
  const MiddlewareView({
    super.key,
    required this.controller,
  });

  @override
  Widget build(BuildContext context) {
    if (Platform.isAndroid || Platform.isIOS || Platform.isFuchsia) {
      return AndroidTreeViewExample(controller: controller);
    }
    return DesktopTreeViewExample(controller: controller);
  }
}
0
likes
140
points
391
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

A highly customizable rich-text editor for Flutter, part of the Novident suite. Fork of AppFlowy Editor (AppFlowy-IO), used under the Mozilla Public License 2.0.

Homepage
Repository (GitHub)
View/report issues

Topics

#widget #editor #novident

License

MPL-2.0 (license)

Dependencies

collection, device_info_plus, diff_match_patch, file_picker, flutter, flutter_svg, html, http, intl, keyboard_height_plugin, logging, markdown, nanoid, novident_editor_document, numerus, provider, scroll_to_index, string_validator, universal_html, universal_platform, url_launcher

More

Packages that depend on novident_editor