refactor: used flutter_inappwebview instead of webview_flutter

This commit is contained in:
jideguru
2021-06-04 13:58:03 +01:00
parent 0ba6803269
commit 7677e120cc
17 changed files with 152 additions and 399 deletions

View File

@@ -62,29 +62,45 @@ class _CustomToolbarDemoState extends State<CustomToolbarDemo> {
),
],
),
body: RichEditor(
key: keyEditor,
body: Column(
children: [
Wrap(
children: [
IconButton(
icon: Icon(Icons.format_bold),
onPressed: () {
keyEditor.currentState!.javascriptExecutor.setBold();
},
),
],
),
Expanded(
child: RichEditor(
key: keyEditor,
// value: '', // initial HTML data
editorOptions: RichEditorOptions(
placeholder: 'Start typing',
// backgroundColor: Colors.blueGrey, // Editor's bg color
// baseTextColor: Colors.white,
// editor padding
padding: EdgeInsets.symmetric(horizontal: 5.0),
// font name
baseFontFamily: 'sans-serif',
// Position of the editing bar (BarPosition.TOP or BarPosition.BOTTOM)
barPosition: BarPosition.TOP,
),
editorOptions: RichEditorOptions(
placeholder: 'Start typing',
// backgroundColor: Colors.blueGrey, // Editor's bg color
// baseTextColor: Colors.white,
// editor padding
padding: EdgeInsets.symmetric(horizontal: 5.0),
// font name
baseFontFamily: 'sans-serif',
// Position of the editing bar (BarPosition.TOP or BarPosition.BOTTOM)
barPosition: BarPosition.CUSTOM,
),
// You can return a Link (maybe you need to upload the image to your
// storage before displaying in the editor or you can also use base64
getImageUrl: (image) {
String link = 'https://avatars.githubusercontent.com/u/24323581?v=4';
String base64 = base64Encode(image.readAsBytesSync());
String base64String = 'data:image/png;base64, $base64';
return base64String;
},
// You can return a Link (maybe you need to upload the image to your
// storage before displaying in the editor or you can also use base64
getImageUrl: (image) {
String link = 'https://avatars.githubusercontent.com/u/24323581?v=4';
String base64 = base64Encode(image.readAsBytesSync());
String base64String = 'data:image/png;base64, $base64';
return base64String;
},
),
),
],
),
);
}

View File

@@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:example/basic.dart';
import 'package:example/custom_toolbar_demo.dart';
import 'package:flutter/material.dart';
import 'package:rich_editor/rich_editor.dart';
@@ -18,6 +19,7 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
),
home: BasicDemo(),
// home: CustomToolbarDemo(),
);
}
}