diff --git a/.fvm/flutter_sdk b/.fvm/flutter_sdk
deleted file mode 120000
index 736618a..0000000
--- a/.fvm/flutter_sdk
+++ /dev/null
@@ -1 +0,0 @@
-/Users/tkadziolka/fvm/versions/3.13.6
\ No newline at end of file
diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json
deleted file mode 100644
index 9acb749..0000000
--- a/.fvm/fvm_config.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "flutterSdkVersion": "3.13.6",
- "flavors": {}
-}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 96486fd..8451c89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,4 +27,4 @@ migrate_working_dir/
**/doc/api/
.dart_tool/
.packages
-build/
+build/
\ No newline at end of file
diff --git a/.pubignore b/.pubignore
new file mode 100644
index 0000000..8942522
--- /dev/null
+++ b/.pubignore
@@ -0,0 +1,10 @@
+.DS_Store
+.idea
+.pub/
+.dart_tool/
+.settings/
+build/
+packages
+.packages
+pubspec.lock
+package-lock.json
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0ed18c..9daa114 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,21 @@
+## 0.2.0
+
+### Added
+- pub.dev setup
+- unit tests
+
+### Changed
+- Flutter sdk version to 3.24.0
+- dependencies to newer
+- Highlights library to 1.0.0
+- `getHighlights` to `getHighlightsAsync` in plugins
+
+## 0.1.0
+
+### Added
+- emphasis (bold) phrase parts
+- bold option on selected text in example
+
## 0.0.1
### Added
diff --git a/README.md b/README.md
index ee40b1d..e9973ee 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,35 @@
# highlights_plugin
-Dart implementation of highlights KMM engine:
+Dart implementation of highlights KMP engine:
https://github.com/SnipMeDev/Highlights
+## Installation
+```sh
+flutter pub add highlights_plugin
+```
+
+## Usage
+```dart
+final plugin = HighlightsPlugin(debug: true);
+
+// ['kotlin', 'dart', 'swift', 'php', 'java', ...]
+final languages = await plugin.getLanguages();
+// ['monokai', 'darcula', 'notepad', ...]
+final themes = await plugin.getThemes();
+// Bold Hello
+final emphasis = PhraseLocation(start: 3, length: 8);
+// List with ColorHighlight or BoldHighlight
+final result = await plugin.getHighlights(
+ '// Hello, World!',
+ languages.first,
+ themes.first,
+ [emphasis],
+);
+```
+
## Features
- 17 supported languages (Kotlin, Dart, Swift, PHP, etc)
- Light / dark mode
diff --git a/android/build.gradle b/android/build.gradle
index fd9e25c..f8307a9 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,4 +1,4 @@
-group 'pl.tkadziolka.highlights_plugin'
+group 'dev.snipme.highlights_plugin'
version '1.0-SNAPSHOT'
buildscript {
@@ -26,6 +26,7 @@ apply plugin: 'kotlin-android'
android {
compileSdkVersion 31
+ namespace 'dev.snipme.highlights_plugin'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index 79254bd..f80070f 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,3 +1 @@
-
-
+
diff --git a/android/src/main/kotlin/pl/tkadziolka/highlights_plugin/HighlightsPlugin.kt b/android/src/main/kotlin/dev/snipme/highlights_plugin/HighlightsPlugin.kt
similarity index 83%
rename from android/src/main/kotlin/pl/tkadziolka/highlights_plugin/HighlightsPlugin.kt
rename to android/src/main/kotlin/dev/snipme/highlights_plugin/HighlightsPlugin.kt
index e32c41d..848a7d9 100644
--- a/android/src/main/kotlin/pl/tkadziolka/highlights_plugin/HighlightsPlugin.kt
+++ b/android/src/main/kotlin/dev/snipme/highlights_plugin/HighlightsPlugin.kt
@@ -1,4 +1,4 @@
-package pl.tkadziolka.highlights_plugin
+package dev.snipme.highlights_plugin
import dev.snipme.highlights.DefaultHighlightsResultListener
import dev.snipme.highlights.Highlights
@@ -15,12 +15,7 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result
-/** HighlightsPlugin */
class HighlightsPlugin : FlutterPlugin, MethodCallHandler {
- /// The MethodChannel that will the communication between Flutter and native Android
- ///
- /// This local reference serves to register the plugin with the Flutter Engine and unregister it
- /// when the Flutter Engine is detached from the Activity
private lateinit var channel: MethodChannel
private lateinit var highlights: Highlights
private var useDarkMode = false
@@ -35,8 +30,6 @@ class HighlightsPlugin : FlutterPlugin, MethodCallHandler {
channel.setMethodCallHandler(null)
}
- // TODO Implement EventChannel
-
override fun onMethodCall(call: MethodCall, result: Result) {
when (call.method) {
"getHighlights" -> {
@@ -49,8 +42,8 @@ class HighlightsPlugin : FlutterPlugin, MethodCallHandler {
highlights.getHighlightsAsync(
object: DefaultHighlightsResultListener() {
- override fun onComplete(highlightList: List) {
- result.success(highlightList.toJson())
+ override fun onSuccess(highlights: List) {
+ result.success(highlights.toJson())
}
override fun onCancel() {
@@ -81,11 +74,7 @@ class HighlightsPlugin : FlutterPlugin, MethodCallHandler {
theme: SyntaxTheme?,
emphasisLocations: List?,
) {
- println("Update instance $code $language $theme $emphasisLocations")
-
if (highlights.getLanguage() == language && highlights.getTheme() == theme) {
- println("Only change code $code")
- println("Only change emphasis $emphasisLocations")
code?.let { highlights.setCode(it) }
emphasisLocations?.let { locations -> locations.forEach { highlights.setEmphasis(it) } }
} else {
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 068d580..7789b22 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -44,7 +44,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "pl.tkadziolka.highlights_plugin_example"
+ applicationId "dev.snipme.highlights_plugin_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml
index b97a442..5affa73 100644
--- a/example/android/app/src/debug/AndroidManifest.xml
+++ b/example/android/app/src/debug/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="dev.snipme.highlights_plugin_example">