From 1de006664bc84c60d5358fcaae822eeddd47a968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C4=85dzio=C5=82ka?= Date: Tue, 19 Nov 2024 07:34:33 +0100 Subject: [PATCH] Pub dev setup (#6) * Extended readme * Filled CHANGELOG * Improved example * Update README.md --- .flutter-plugins-dependencies | 2 +- CHANGELOG.md | 13 +++- README.md | 79 ++++++++++++++++++++ example/lib/main.dart | 59 ++++++++------- example/pubspec.lock | 2 +- lib/src/presentation/styles/text_styles.dart | 2 +- pubspec.yaml | 2 +- 7 files changed, 129 insertions(+), 30 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 506528b..ec0b402 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"highlights_plugin","path":"/Users/tkadziolka/.pub-cache/hosted/pub.dev/highlights_plugin-0.2.0/","native_build":true,"dependencies":[]}],"android":[{"name":"highlights_plugin","path":"/Users/tkadziolka/.pub-cache/hosted/pub.dev/highlights_plugin-0.2.0/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"highlights_plugin","dependencies":[]}],"date_created":"2024-11-18 20:15:47.325704","version":"3.24.0","swift_package_manager_enabled":false} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"highlights_plugin","path":"/Users/tkadziolka/.pub-cache/hosted/pub.dev/highlights_plugin-0.2.0/","native_build":true,"dependencies":[]}],"android":[{"name":"highlights_plugin","path":"/Users/tkadziolka/.pub-cache/hosted/pub.dev/highlights_plugin-0.2.0/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"highlights_plugin","dependencies":[]}],"date_created":"2024-11-18 21:40:21.617016","version":"3.24.0","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 41cc7d8..4c4b052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## 0.1.0 + +### Added + +- highlights_plugin 0.2.0 +- extensions unit tests +- CodeEditText +- CodeTextView + ## 0.0.1 -* TODO: Describe initial release. +### Added + +- initial setup diff --git a/README.md b/README.md index cee8ef2..a7f326c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,85 @@ Flutter syntax highlighting widgets based on [Highlights](https://github.com/SnipMeDev/Highlights) library. +iShot_2024-11-18_21 55 36 + +## Installation + +```dart +flutter pub add kode_view +``` + +## Usage + +### CodeTextView + +```dart +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 + +```dart +import 'package:flutter/material.dart'; +import 'package:kode_view/kode_view.dart'; + +class _MyAppState extends State { + 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 🖋️ ======= diff --git a/example/lib/main.dart b/example/lib/main.dart index 024ff9d..fb51380 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -18,6 +18,7 @@ class MyApp extends StatefulWidget { class _MyAppState extends State { final SyntaxHighlightingController controller = SyntaxHighlightingController(text: codeSnippet); + @override Widget build(BuildContext context) { return MaterialApp( @@ -26,32 +27,40 @@ class _MyAppState extends State { title: const Text('Kode View example'), ), body: Center( - child: Column( - children: [ - const Text("CodeTextView"), - const SizedBox( - height: 12, - ), - CodeTextView( - code: codeSnippet, - language: "Java", - theme: "darcula", - options: TextSelectionOptions( - copy: true, - selectAll: true, - share: true, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Text("CodeTextView"), + const SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(16.0), + child: CodeTextView( + code: codeSnippet, + language: "Java", + theme: "darcula", + options: TextSelectionOptions( + copy: true, + selectAll: true, + share: true, + ), + ), ), - ), - const SizedBox(height: 24), - const Text("CodeEditText"), - const SizedBox(height: 12), - CodeEditText( - code: codeSnippet, - controller: controller, - showCursor: true, - ), - ], - )), + const SizedBox(height: 24), + const Text("CodeEditText"), + const SizedBox(height: 12), + Padding( + padding: const EdgeInsets.all(16.0), + child: CodeEditText( + code: codeSnippet, + controller: controller, + showCursor: true, + ), + ), + ], + ), + ), ), ); } diff --git a/example/pubspec.lock b/example/pubspec.lock index 55c2222..fb15d61 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -110,7 +110,7 @@ packages: path: ".." relative: true source: path - version: "0.0.1" + version: "0.1.0" leak_tracker: dependency: transitive description: diff --git a/lib/src/presentation/styles/text_styles.dart b/lib/src/presentation/styles/text_styles.dart index a7ad9b7..ee4d9be 100644 --- a/lib/src/presentation/styles/text_styles.dart +++ b/lib/src/presentation/styles/text_styles.dart @@ -17,7 +17,7 @@ class TextStyles extends Text { key: key, style: const TextStyle( fontSize: 16, - fontStyle: FontStyle.italic, + fontStyle: FontStyle.normal, ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 90d1e10..aea95cc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: kode_view description: Flutter syntax highlighting widgets based on Highlights -version: 0.0.1 +version: 0.1.0 homepage: https://github.com/SnipMeDev/kode_view environment: