Skip to content

Commit

Permalink
### 2.1.9
Browse files Browse the repository at this point in the history
- Added a customisable option to make toolbar scrollable horizontally or vertically
- Fixed `onFocusChanged` method not returning focus on iOS properly
- Fixed text-change method is not returning text properly on Android
- Fixed moving cursor to end after `setDelta`
- Fix the white space in theme dark mode after adding minHeight property, thanks to `cabbagelol` for PR
- Fix Mobile Web -  Clicking on toolbar icon does not toggle highlight color, and keyboard loses focus
- Updated `webview_flutter_android`, `webview_flutter_wkwebview` to latest versions
- Fix customToolBarList: ToolBarStyle.background adds table items #63
- Improved `onEditorCreated` callback functionality
  • Loading branch information
the-airbender committed Apr 28, 2023
1 parent 14f96a1 commit 8137931
Show file tree
Hide file tree
Showing 6 changed files with 327 additions and 107 deletions.
85 changes: 48 additions & 37 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,21 @@ class _MyAppState extends State<MyApp> {
ToolBarStyle.italic,
ToolBarStyle.align,
ToolBarStyle.color,
ToolBarStyle.background,
ToolBarStyle.listBullet,
ToolBarStyle.listOrdered,
ToolBarStyle.clean,
ToolBarStyle.addTable,
ToolBarStyle.editTable,
];

final _toolbarColor = Colors.greenAccent.shade100;
final _toolbarColor = Colors.grey.shade200;
final _backgroundColor = Colors.white70;
final _toolbarIconColor = Colors.black87;
final _editorTextStyle = const TextStyle(
fontSize: 18, color: Colors.black, fontWeight: FontWeight.normal);
final _hintTextStyle = const TextStyle(
fontSize: 18, color: Colors.teal, fontWeight: FontWeight.normal);
fontSize: 18, color: Colors.black12, fontWeight: FontWeight.normal);

@override
void initState() {
Expand All @@ -56,41 +62,44 @@ class _MyAppState extends State<MyApp> {
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomInset: true,
backgroundColor: Colors.white70,
body: Column(
body: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
ToolBar(
toolBarColor: _toolbarColor,
padding: const EdgeInsets.all(8),
iconSize: 25,
iconColor: _toolbarIconColor,
activeIconColor: Colors.purple.shade300,
controller: controller,
alignment: WrapAlignment.start,
crossAxisAlignment: WrapCrossAlignment.center,
customButtons: [
InkWell(
onTap: () => unFocusEditor(),
child: const Icon(
Icons.favorite,
color: Colors.black,
)),
InkWell(
onTap: () async {
var selectedText = await controller.getSelectedText();
debugPrint('selectedText $selectedText');
var selectedHtmlText =
await controller.getSelectedHtmlText();
debugPrint('selectedHtmlText $selectedHtmlText');
},
child: const Icon(
Icons.add_circle,
color: Colors.black,
)),
],
SizedBox(
width: 50,
child: ToolBar.scroll(
toolBarColor: _toolbarColor,
padding: const EdgeInsets.all(8),
iconSize: 25,
iconColor: _toolbarIconColor,
activeIconColor: Colors.greenAccent.shade400,
controller: controller,
crossAxisAlignment: CrossAxisAlignment.center,
direction: Axis.vertical,
customButtons: [
InkWell(
onTap: () => unFocusEditor(),
child: const Icon(
Icons.favorite,
color: Colors.black,
)),
InkWell(
onTap: () async {
var selectedText = await controller.getSelectedText();
debugPrint('selectedText $selectedText');
var selectedHtmlText =
await controller.getSelectedHtmlText();
debugPrint('selectedHtmlText $selectedHtmlText');
},
child: const Icon(
Icons.add_circle,
color: Colors.black,
)),
],
),
),
Flexible(
fit: FlexFit.tight,
Expand All @@ -99,7 +108,7 @@ class _MyAppState extends State<MyApp> {
hintText: 'Hint text goes here',
controller: controller,
isEnabled: true,
minHeight: 300,
minHeight: 500,
textStyle: _editorTextStyle,
hintTextStyle: _hintTextStyle,
hintTextAlign: TextAlign.start,
Expand All @@ -108,7 +117,10 @@ class _MyAppState extends State<MyApp> {
backgroundColor: _backgroundColor,
onFocusChanged: (hasFocus) => debugPrint('has focus $hasFocus'),
onTextChanged: (text) => debugPrint('widget text change $text'),
onEditorCreated: () => debugPrint('Editor has been loaded'),
onEditorCreated: () {
debugPrint('Editor has been loaded');
setHtmlText('Testing text on load');
},
onEditorResized: (height) =>
debugPrint('Editor resized $height'),
onSelectionChanged: (sel) =>
Expand All @@ -127,8 +139,7 @@ class _MyAppState extends State<MyApp> {
textButton(
text: 'Set Text',
onPressed: () {
setHtmlText(
'<iframe src="https://www.youtube.com/embed/JCDfh5bs1xc" width="100%" height="315"</iframe>');
setHtmlText('This text is set by you 🫵');
}),
textButton(
text: 'Get Text',
Expand Down
10 changes: 5 additions & 5 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.1.7"
version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -328,10 +328,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_android
sha256: "9e223788e1954087dac30d813dc151f8e12f09f1139f116ce20b5658893f3627"
sha256: "5906c9aa8c88ed372b2ad3c88c942790b4fb16f73fdd1c0647b4d747d9cf5b3f"
url: "https://pub.dev"
source: hosted
version: "3.4.4"
version: "3.4.5"
webview_flutter_platform_interface:
dependency: transitive
description:
Expand All @@ -344,10 +344,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: d601aba11ad8d4481e17a34a76fa1d30dee92dcbbe2c58b0df3120e9453099c7
sha256: "9a78d963cce191dd6a9df547301fc5c008bf3dae95a323ec281fff1284e0a037"
url: "https://pub.dev"
source: hosted
version: "3.2.3"
version: "3.2.4"
win32:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 8137931

Please sign in to comment.