Refactor code

pull/602/head
X Code 3 years ago
parent c54424d393
commit 6b9c85f7cc
  1. 2
      lib/src/translations/toolbar.i18n.dart
  2. 13
      lib/src/utils/platform_helper.dart
  3. 4
      lib/src/widgets/editor.dart
  4. 7
      lib/src/widgets/text_line.dart

@ -107,7 +107,7 @@ extension Localization on String {
'Remove': '제거하기',
'Save': '저장하기',
'Zoom': '확대하기',
'Saved': '저장되었습니다',
'Saved': '저장되었습니다.',
},
'ru': {
'Paste a link': 'Вставить ссылку',

@ -1,3 +1,12 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
bool isMobile() => Platform.isAndroid || Platform.isIOS;
bool isMobile([TargetPlatform? targetPlatform]) {
targetPlatform ??= defaultTargetPlatform;
return {TargetPlatform.iOS, TargetPlatform.android}.contains(targetPlatform);
}
bool get isDesktop => {
TargetPlatform.macOS,
TargetPlatform.linux,
TargetPlatform.windows
}.contains(defaultTargetPlatform);

@ -10,6 +10,7 @@ import 'package:flutter/services.dart';
import '../models/documents/document.dart';
import '../models/documents/nodes/container.dart' as container_node;
import '../models/documents/nodes/line.dart';
import '../utils/platform_helper.dart';
import 'box.dart';
import 'controller.dart';
import 'cursor.dart';
@ -444,8 +445,7 @@ class _QuillEditorState extends State<QuillEditor>
paste: widget.enableInteractiveSelection,
selectAll: widget.enableInteractiveSelection,
),
showSelectionHandles: theme.platform == TargetPlatform.iOS ||
theme.platform == TargetPlatform.android,
showSelectionHandles: isMobile(theme.platform),
showCursor: widget.showCursor,
cursorStyle: CursorStyle(
color: cursorColor,

@ -16,6 +16,7 @@ import '../models/documents/nodes/line.dart';
import '../models/documents/nodes/node.dart';
import '../models/documents/style.dart';
import '../utils/color.dart';
import '../utils/platform_helper.dart';
import 'box.dart';
import 'cursor.dart';
import 'delegate.dart';
@ -71,12 +72,6 @@ class _TextLineState extends State<TextLine> {
}
}
bool get isDesktop => {
TargetPlatform.macOS,
TargetPlatform.linux,
TargetPlatform.windows
}.contains(defaultTargetPlatform);
bool get canLaunchLinks {
// In readOnly mode users can launch links
// by simply tapping (clicking) on them

Loading…
Cancel
Save