Skip to content

Commit

Permalink
Update readme and fix directory spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
tneotia committed Feb 19, 2021
1 parent b8bf742 commit 74e57d0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 48 deletions.
84 changes: 36 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,68 @@
# Flutter Html Editor
# Flutter Html Editor - Enhanced

Flutter HTML Editor is a text editor for android and iOS to help write WYSIWYG HTML code based on the Summernote javascript wrapper. with this library you can insert images into the text editor
Flutter HTML Editor is a text editor for Android and iOS to help write WYSIWYG HTML code with on the Summernote JavaScript wrapper.

![demo example](https://github.com/xrb21/flutter-html-editor/blob/master/screenshoot/flutter_html_editor.gif) ![demo android](https://github.com/xrb21/flutter-html-editor/blob/master/screenshoot/sc.jpeg) ![demo ios](https://github.com/xrb21/flutter-html-editor/blob/master/screenshoot/sc_iphone.png)


## Setup

add ```html_editor: ^1.0.1``` as deppendecy to pubspec.yaml
Add `html_editor_enhanced: ^1.1.1` as dependency to your pubspec.yaml

<details><summary>Follow the setup instructions for the image_picker plugin</summary>

### iOS

Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:
Add the following keys to your _Info.plist_ file, located in `<project root>/ios/Runner/Info.plist`:

```
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Used to demonstrate image picker plugin</string>
<key>NSMicrophoneUsageDescription</key>
<string>Used to capture audio for image picker plugin</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Used to demonstrate image picker plugin</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
```
* `NSPhotoLibraryUsageDescription` - describe why your app needs permission for the photo library. This is called _Privacy - Photo Library Usage Description_ in the visual editor.
* `NSCameraUsageDescription` - describe why your app needs access to the camera. This is called _Privacy - Camera Usage Description_ in the visual editor.
* `NSMicrophoneUsageDescription` - describe why your app needs access to the microphone, if you intend to record videos. This is called _Privacy - Microphone Usage Description_ in the visual editor.

### Usage
### Android

1. import flutter html editor
```
import 'package:html_editor/html_editor.dart';
```
#### API < 29
No configuration required - the plugin should work out of the box.

2. Create Global key from HTML Editor State
```
GlobalKey<HtmlEditorState> keyEditor = GlobalKey();
```
#### API 29+

3. Add HTML Editor to widget
```
HtmlEditor(
hint: "Your text here...",
//value: "text content initial, if any",
key: keyEditor,
height: 400,
),
Add `android:requestLegacyExternalStorage="true"` as an attribute to the `<application>` tag in AndroidManifest.xml. The [attribute](https://developer.android.com/training/data-storage/compatibility) is `false` by default on apps targeting Android Q.

</details>

### Usage

```dart
import 'package:html_editor/html_editor.dart';
// other code here
@override Widget build(BuildContext context) {
return HtmlEditor(
hint: "Your text here...",
//value: "text content initial, if any",
key: keyEditor,
height: 400,
);
}
```

4. Get text from Html Editor
When you want to get text from the editor:
```
final txt = await keyEditor.currentState.getText();
final txt = await HtmlEditor.getText();
```


### Avalaible option parameters
### Available option parameters

Parameter | Type | Default | Description
------------ | ------------- | ------------- | -------------
**key** | GlobalKey<HtmlEditorState> | **required** | for get method & reset
**value** | String | empty | iniate text content for text editor
**value** | String | empty | initial text content for text editor
**height** | double | 380 | height of text editor
**decoration** | BoxDecoration | | Decoration editor
**useBottomSheet** | bool | true | if true Pickup image user bottomsheet or dialog if else
**useBottomSheet** | bool | true | if true, open a bottom sheet (OneUI style) to pick an image, otherwise use a dialog
**widthImage** | String | 100% | width of image picker
**showBottomToolbar** | bool | true | show hide bottom toolbar
**showBottomToolbar** | bool | true | show or hide bottom toolbar
**hint** | String | empty | Placeholder hint text


## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

`#MajalengkaExoticSundaland`
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 74e57d0

Please sign in to comment.