issue: Unsupported operation: Platform._operatingSystem

This commit is contained in:
agorneo 2021-07-12 07:10:08 +03:00
parent 24da03af90
commit 90bd5e6c6c
3 changed files with 11 additions and 4 deletions

6
.gitignore vendored
View File

@ -73,3 +73,9 @@ build/
!**/ios/**/default.mode2v3 !**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser !**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3 !**/ios/**/default.perspectivev3
# ITG additions
.notes
.DS_Store
.idea

View File

@ -42,7 +42,7 @@ class RichEditorState extends State<RichEditor> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (Platform.isIOS) { if (!kIsWeb && Platform.isIOS) {
_initServer(); _initServer();
} }
} }
@ -67,7 +67,7 @@ class RichEditorState extends State<RichEditor> {
if (_controller != null) { if (_controller != null) {
_controller = null; _controller = null;
} }
if (!Platform.isAndroid) { if (!kIsWeb && !Platform.isAndroid) {
localServer!.close(); localServer!.close();
} }
super.dispose(); super.dispose();
@ -96,7 +96,7 @@ class RichEditorState extends State<RichEditor> {
onWebViewCreated: (controller) async { onWebViewCreated: (controller) async {
_controller = controller; _controller = controller;
setState(() {}); setState(() {});
if (!Platform.isAndroid) { if (!kIsWeb && !Platform.isAndroid) {
await _loadHtmlFromAssets(); await _loadHtmlFromAssets();
} else { } else {
await _controller!.loadUrl( await _controller!.loadUrl(

View File

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rich_editor/src/utils/javascript_executor_base.dart'; import 'package:rich_editor/src/utils/javascript_executor_base.dart';
import 'package:rich_editor/src/widgets/check_dialog.dart'; import 'package:rich_editor/src/widgets/check_dialog.dart';
@ -193,7 +194,7 @@ class EditorToolBar extends StatelessWidget {
), ),
// TODO: Show font button on iOS // TODO: Show font button on iOS
Visibility( Visibility(
visible: Platform.isAndroid, visible: (!kIsWeb && Platform.isAndroid),
child: TabButton( child: TabButton(
tooltip: 'Font face', tooltip: 'Font face',
icon: Icons.font_download, icon: Icons.font_download,