Add pull request template

pull/1443/head
Ahmed Hnewa 2 years ago
parent 7e998fc7cf
commit 55d76819aa
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 17
      .github/ISSUE_TEMPLATE/issue-template.md
  2. 36
      .github/PULL_REQUEST_TEMPLATE.md
  3. 767
      CHANGELOG.md
  4. 10
      lib/src/widgets/editor.dart
  5. 71
      lib/src/widgets/raw_editor.dart
  6. 11
      lib/src/widgets/toolbar/toggle_check_list_button.dart

@ -15,3 +15,20 @@ I have tried running `example` directory successfully before creating an issue h
Please note that we are using <b>latest</b> flutter version in stable channel on branch master. If you are using beta or master channel, or you are not using <b>latest</b> flutter version in stable channel, you may experience error.
## Pre-launch Checklist
<!-- Mark all that applies with `x` -->
- [] I have updated `CHANGELOG.md` with my changes in the next section <!-- REQUIRED -->
- [] I have run "dart format ." on the project <!-- REQUIRED -->
- [] I have added/updated relevant documentation <!-- REQUIRED -->
- [] I have run `flutter test` and `flutter analyze` and it passed successfully <!-- REQUIRED -->
<!-- Please explain how to encounter the issue in details if possible -->
<!-- Don't forgot to mention the platform you are testing in -->
<!-- Insert your images here if possible -->
<!-- Images: -->
<!-- Add short video that showcase the problem will help -->

@ -0,0 +1,36 @@
# Pull Request
## Description
Provide a brief description of your changes.
## Issues
Closes #IssueNumber
(Replace "IssueNumber" with the actual issue number you are addressing.)
## Improvements
<!-- Please tell us the improvemenets you made in a list -->
<!-- Example: -->
- Improve code readability
- Improve peformance
## Features
<!-- Please tell us the features you added in a list -->
<!-- Example: -->
- Add a new feature
- Allow to custmize the widgets
## Checklist
<!-- Mark all that applies with `[x]` -->
- [ ] I have added/updated relevant documentation <!-- REQUIRED -->
- [ ] I have tested these changes locally. <!-- REQUIRED -->
- [ ] I have added tests for these changes. <!-- Not required but will be helpful-->
- [ ] I have followed the code style and guidelines. <!-- REQUIRED -->
- [ ] I have updated `CHANGELOG.md` with my changes in the next section <!-- REQUIRED -->
- [ ] I have run "dart format ." on the project <!-- REQUIRED -->
- [ ] I have run `flutter test` and `flutter analyze` and it passed successfully <!-- REQUIRED -->

File diff suppressed because it is too large Load Diff

@ -583,7 +583,7 @@ class QuillEditorState extends State<QuillEditor>
: child,
);
if (kIsWeb) {
if (isWeb()) {
// Intercept RawKeyEvent on Web to prevent it from propagating to parents
// that might interfere with the editor key behavior, such as
// SingleChildScrollView. Thanks to @wliumelb for the workaround.
@ -633,7 +633,13 @@ class QuillEditorState extends State<QuillEditor>
bool get selectionEnabled => widget.enableInteractiveSelection;
void _requestKeyboard() {
_editorKey.currentState!.requestKeyboard();
final editorCurrentState = _editorKey.currentState;
if (editorCurrentState == null) {
throw ArgumentError.notNull(
'To request keyboard the editor key must not be null',
);
}
editorCurrentState.requestKeyboard();
}
}

@ -1,17 +1,28 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:async' show StreamSubscription;
import 'dart:convert' show jsonDecode;
import 'dart:io' show Platform;
import 'dart:math' as math;
import 'dart:ui' as ui hide TextStyle;
import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/foundation.dart' show defaultTargetPlatform;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:pasteboard/pasteboard.dart';
import 'package:flutter/rendering.dart'
show RenderAbstractViewport, ViewportOffset;
import 'package:flutter/scheduler.dart' show SchedulerBinding;
import 'package:flutter/services.dart'
show
LogicalKeyboardKey,
Uint8List,
RawKeyDownEvent,
HardwareKeyboard,
Clipboard,
ClipboardData,
TextLayoutMetrics,
TextInputControl;
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'
show KeyboardVisibilityController;
import 'package:pasteboard/pasteboard.dart' show Pasteboard;
import '../models/documents/attribute.dart';
import '../models/documents/document.dart';
@ -423,7 +434,7 @@ class RawEditorState extends EditorState
// in the web browser, but we do unfocus for all other kinds of events.
switch (event.kind) {
case ui.PointerDeviceKind.touch:
if (kIsWeb) {
if (isWeb()) {
widget.focusNode.unfocus();
}
break;
@ -838,7 +849,9 @@ class RawEditorState extends EditorState
}
void _handleSelectionChanged(
TextSelection selection, SelectionChangedCause cause) {
TextSelection selection,
SelectionChangedCause cause,
) {
final oldSelection = controller.selection;
controller.updateSelection(selection, ChangeSource.LOCAL);
@ -1034,15 +1047,17 @@ class RawEditorState extends EditorState
return const VerticalSpacing(0, 0);
}
void _didChangeTextEditingValueListener() {
_didChangeTextEditingValue(controller.ignoreFocusOnTextChange);
}
@override
void initState() {
super.initState();
_clipboardStatus.addListener(_onChangedClipboardStatus);
controller.addListener(() {
_didChangeTextEditingValue(controller.ignoreFocusOnTextChange);
});
controller.addListener(_didChangeTextEditingValueListener);
_scrollController = widget.scrollController;
_scrollController.addListener(_updateSelectionOverlayForScroll);
@ -1059,7 +1074,7 @@ class RawEditorState extends EditorState
if (isKeyboardOS()) {
_keyboardVisible = true;
} else if (!kIsWeb && Platform.environment.containsKey('FLUTTER_TEST')) {
} else if (!isWeb() && Platform.environment.containsKey('FLUTTER_TEST')) {
// treat tests like a keyboard OS
_keyboardVisible = true;
} else {
@ -1189,7 +1204,7 @@ class RawEditorState extends EditorState
assert(!hasConnection);
_selectionOverlay?.dispose();
_selectionOverlay = null;
controller.removeListener(_didChangeTextEditingValue);
controller.removeListener(_didChangeTextEditingValueListener);
widget.focusNode.removeListener(_handleFocusChanged);
_cursorCont.dispose();
_clipboardStatus
@ -1208,13 +1223,17 @@ class RawEditorState extends EditorState
/// state being in sync with the controller know they may be
/// operating on stale data.
void _markNeedsBuild() {
if (_dirty) {
// No need to rebuilt if it already darty
return;
}
setState(() {
_dirty = true;
});
}
void _didChangeTextEditingValue([bool ignoreFocus = false]) {
if (kIsWeb) {
if (isWeb()) {
_onChangeTextEditingValue(ignoreFocus);
if (!ignoreFocus) {
requestKeyboard();
@ -1393,7 +1412,10 @@ class RawEditorState extends EditorState
/// keyboard become visible.
@override
void requestKeyboard() {
print('Time:');
if (controller.skipRequestKeyboard) {
// TODO: There is a bug, requestKeyboard is being called 2-4 times!
// and that just by one simple change
controller.skipRequestKeyboard = false;
return;
}
@ -1402,7 +1424,10 @@ class RawEditorState extends EditorState
openConnectionIfNeeded();
if (!keyboardAlreadyShown) {
/// delay 500 milliseconds for waiting keyboard show up
Future.delayed(const Duration(milliseconds: 500), _showCaretOnScreen);
Future.delayed(
const Duration(milliseconds: 500),
_showCaretOnScreen,
);
} else {
_showCaretOnScreen();
}
@ -1421,7 +1446,7 @@ class RawEditorState extends EditorState
// toolbar: copy, paste, select, cut. It might also provide additional
// functionality depending on the browser (such as translate). Due to this
// we should not show a Flutter toolbar for the editable text elements.
if (kIsWeb) {
if (isWeb()) {
return false;
}
@ -1769,7 +1794,9 @@ class RawEditorState extends EditorState
@override
void didChangeInputControl(
TextInputControl? oldControl, TextInputControl? newControl) {
TextInputControl? oldControl,
TextInputControl? newControl,
) {
// TODO: implement didChangeInputControl
}
@ -1850,7 +1877,9 @@ class _Editor extends MultiChildRenderObjectWidget {
@override
void updateRenderObject(
BuildContext context, covariant RenderEditor renderObject) {
BuildContext context,
covariant RenderEditor renderObject,
) {
renderObject
..offset = offset
..document = document

@ -111,8 +111,15 @@ class _ToggleCheckListButtonState extends State<ToggleCheckListButton> {
}
void _toggleAttribute() {
widget.controller.formatSelection(_isToggled!
// By default don't show the keybaord request as it's quite annoying
// We will provide the option to control this in the next major update
// See https://github.com/singerdmx/flutter-quill/issues/1440
widget.controller
..skipRequestKeyboard = true
..formatSelection(
_isToggled!
? Attribute.clone(Attribute.unchecked, null)
: Attribute.unchecked);
: Attribute.unchecked,
);
}
}

Loading…
Cancel
Save