kode_view 0.1.0 copy "kode_view: ^0.1.0" to clipboard
kode_view: ^0.1.0 copied to clipboard

Flutter syntax highlighting widgets based on Highlights

kode_view #

Flutter syntax highlighting widgets based on Highlights library.

iShot_2024-11-18_21 55 36

Installation #

flutter pub add kode_view

Usage #

CodeTextView #

import 'package:flutter/material.dart';
import 'package:kode_view/kode_view.dart';

@override
Widget build(BuildContext context) {
  final codeSnippet = "class HelloWorld {}";
  
  return MaterialApp(
    home: Scaffold(
      appBar: ...,
      body: CodeTextView(
        code: codeSnippet,
        language: "Java",
        theme: "darcula",
        options: ...,
      ),
    ),
  );
}

CodeEditText #

import 'package:flutter/material.dart';
import 'package:kode_view/kode_view.dart';

class _MyAppState extends State<MyApp> {
  final SyntaxHighlightingController controller =
  SyntaxHighlightingController(text: codeSnippet);

  @override
  Widget build(BuildContext context) {
    final codeSnippet = "class HelloWorld {}";

    return MaterialApp(
      home: Scaffold(
        appBar: ...,
        body: CodeEditText(
          code: codeSnippet,
          controller: controller,
          showCursor: true,
        ),
      ),
    );
  }
}

Features #

  • 17 supported languages (Kotlin, Dart, Swift, PHP, etc)
  • Light / dark mode
  • 6 built-in themes
  • Phrase bolding (emphasis)
  • Result caching and support for incremental changes

Support #

  • Android βœ…
  • iOS βœ…
  • macOS πŸ”΄ (Not yet)
  • Linux πŸ”΄ (Not yet)
  • Windows πŸ”΄ (Not yet)
  • Web πŸ”΄ (Not yet)

License πŸ–‹οΈ #

Copyright 2024 Tomasz KΔ…dzioΕ‚ka.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1
likes
120
points
16
downloads

Publisher

verified publishertkadziolka.pl

Weekly Downloads

Flutter syntax highlighting widgets based on Highlights

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

collection, equatable, flutter, highlights_plugin, plugin_platform_interface

More

Packages that depend on kode_view