Remove unnecessary checks

pull/87/head
Miller Adulu 4 years ago
parent cff918a88e
commit b14c1dc9dc
  1. 3
      lib/models/documents/nodes/embed.dart
  2. 4
      lib/models/documents/nodes/leaf.dart
  3. 3
      lib/models/documents/nodes/node.dart
  4. 9
      lib/models/quill_delta.dart
  5. 4
      lib/models/rules/insert.dart
  6. 2
      lib/models/rules/rule.dart
  7. 13
      lib/widgets/controller.dart
  8. 3
      lib/widgets/default_styles.dart
  9. 2
      lib/widgets/delegate.dart
  10. 38
      lib/widgets/editor.dart
  11. 4
      lib/widgets/keyboard_listener.dart
  12. 2
      lib/widgets/raw_editor.dart
  13. 21
      lib/widgets/text_block.dart
  14. 23
      lib/widgets/text_selection.dart
  15. 33
      lib/widgets/toolbar.dart

@ -3,8 +3,7 @@ class Embeddable {
final dynamic data; final dynamic data;
Embeddable(this.type, this.data) Embeddable(this.type, this.data)
: assert(type != null), ;
assert(data != null);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map<String, String> m = {type: data}; Map<String, String> m = {type: data};

@ -27,7 +27,7 @@ abstract class Leaf extends Node {
@override @override
void applyStyle(Style value) { void applyStyle(Style value) {
assert( assert(
value != null && (value.isInline || value.isIgnored || value.isEmpty), (value.isInline || value.isIgnored || value.isEmpty),
'Unable to apply Style to leaf: $value'); 'Unable to apply Style to leaf: $value');
super.applyStyle(value); super.applyStyle(value);
} }
@ -52,7 +52,7 @@ abstract class Leaf extends Node {
@override @override
insert(int index, Object data, Style? style) { insert(int index, Object data, Style? style) {
assert(data != null && index >= 0 && index <= length); assert(index >= 0 && index <= length);
Leaf node = Leaf(data); Leaf node = Leaf(data);
if (index < length) { if (index < length) {
splitAt(index)!.insertBefore(node); splitAt(index)!.insertBefore(node);

@ -19,9 +19,6 @@ abstract class Node extends LinkedListEntry<Node> {
} }
void applyStyle(Style value) { void applyStyle(Style value) {
if (value == null) {
throw ArgumentError('null value');
}
_style = _style.mergeAll(value); _style = _style.mergeAll(value);
} }

@ -51,7 +51,7 @@ class Operation {
final Map<String, dynamic>? _attributes; final Map<String, dynamic>? _attributes;
Operation._(this.key, this.length, this.data, Map? attributes) Operation._(this.key, this.length, this.data, Map? attributes)
: assert(key != null && length != null && data != null), :
assert(_validKeys.contains(key), 'Invalid operation key "$key".'), assert(_validKeys.contains(key), 'Invalid operation key "$key".'),
assert(() { assert(() {
if (key != Operation.insertKey) return true; if (key != Operation.insertKey) return true;
@ -243,7 +243,7 @@ class Delta {
int _modificationCount = 0; int _modificationCount = 0;
Delta._(List<Operation> operations) Delta._(List<Operation> operations)
: assert(operations != null), :
_operations = operations; _operations = operations;
/// Creates new empty [Delta]. /// Creates new empty [Delta].
@ -312,7 +312,6 @@ class Delta {
/// Insert [data] at current position. /// Insert [data] at current position.
void insert(dynamic data, [Map<String, dynamic>? attributes]) { void insert(dynamic data, [Map<String, dynamic>? attributes]) {
assert(data != null);
if (data is String && data.isEmpty) return; // no-op if (data is String && data.isEmpty) return; // no-op
push(Operation.insert(data, attributes)); push(Operation.insert(data, attributes));
} }
@ -326,7 +325,7 @@ class Delta {
void _mergeWithTail(Operation operation) { void _mergeWithTail(Operation operation) {
assert(isNotEmpty); assert(isNotEmpty);
assert(operation != null && last.key == operation.key); assert(last.key == operation.key);
assert(operation.data is String && last.data is String); assert(operation.data is String && last.data is String);
final length = operation.length! + last.length!; final length = operation.length! + last.length!;
@ -640,8 +639,6 @@ class DeltaIterator {
/// Optional [length] specifies maximum length of operation to return. Note /// Optional [length] specifies maximum length of operation to return. Note
/// that actual length of returned operation may be less than specified value. /// that actual length of returned operation may be less than specified value.
Operation next([int length = 4294967296]) { Operation next([int length = 4294967296]) {
assert(length != null);
if (_modificationCount != delta._modificationCount) { if (_modificationCount != delta._modificationCount) {
throw ConcurrentModificationError(delta); throw ConcurrentModificationError(delta);
} }

@ -341,9 +341,7 @@ class PreserveInlineStylesRule extends InsertRule {
..retain(index) ..retain(index)
..insert(text, attributes.isEmpty ? null : attributes); ..insert(text, attributes.isEmpty ? null : attributes);
Operation next = itr.next(); Operation next = itr.next();
if (next == null) {
return delta;
}
Map<String, dynamic> nextAttributes = Map<String, dynamic> nextAttributes =
next.attributes ?? const <String, dynamic>{}; next.attributes ?? const <String, dynamic>{};
if (!nextAttributes.containsKey(Attribute.link.key)) { if (!nextAttributes.containsKey(Attribute.link.key)) {

@ -13,8 +13,6 @@ abstract class Rule {
Delta? apply(Delta document, int index, Delta? apply(Delta document, int index,
{int? len, Object? data, Attribute? attribute}) { {int? len, Object? data, Attribute? attribute}) {
assert(document != null);
assert(index != null);
validateArgs(len, data, attribute); validateArgs(len, data, attribute);
return applyRule(document, index, return applyRule(document, index,
len: len, data: data, attribute: attribute); len: len, data: data, attribute: attribute);

@ -15,8 +15,7 @@ class QuillController extends ChangeNotifier {
Style toggledStyle = Style(); Style toggledStyle = Style();
QuillController({required this.document, required this.selection}) QuillController({required this.document, required this.selection})
: assert(document != null), ;
assert(selection != null);
factory QuillController.basic() { factory QuillController.basic() {
return QuillController( return QuillController(
@ -86,7 +85,7 @@ class QuillController extends ChangeNotifier {
print('document.replace failed: $e'); print('document.replace failed: $e');
throw e; throw e;
} }
bool shouldRetainDelta = delta != null && bool shouldRetainDelta =
toggledStyle.isNotEmpty && toggledStyle.isNotEmpty &&
delta.isNotEmpty && delta.isNotEmpty &&
delta.length <= 2 && delta.length <= 2 &&
@ -165,9 +164,7 @@ class QuillController extends ChangeNotifier {
if (delta.isNotEmpty) { if (delta.isNotEmpty) {
document.compose(delta, source); document.compose(delta, source);
} }
if (textSelection != null) {
_updateSelection(textSelection, source);
} else {
textSelection = selection.copyWith( textSelection = selection.copyWith(
baseOffset: baseOffset:
delta.transformPosition(selection.baseOffset, force: false), delta.transformPosition(selection.baseOffset, force: false),
@ -176,7 +173,7 @@ class QuillController extends ChangeNotifier {
if (selection != textSelection) { if (selection != textSelection) {
_updateSelection(textSelection, source); _updateSelection(textSelection, source);
} }
}
notifyListeners(); notifyListeners();
} }
@ -187,8 +184,6 @@ class QuillController extends ChangeNotifier {
} }
_updateSelection(TextSelection textSelection, ChangeSource source) { _updateSelection(TextSelection textSelection, ChangeSource source) {
assert(textSelection != null);
assert(source != null);
selection = textSelection; selection = textSelection;
int end = document.length - 1; int end = document.length - 1;
selection = selection.copyWith( selection = selection.copyWith(

@ -9,8 +9,7 @@ class QuillStyles extends InheritedWidget {
Key? key, Key? key,
required this.data, required this.data,
required Widget child, required Widget child,
}) : assert(data != null), }) :
assert(child != null),
super(key: key, child: child); super(key: key, child: child);
@override @override

@ -22,7 +22,7 @@ class EditorTextSelectionGestureDetectorBuilder {
bool shouldShowSelectionToolbar = true; bool shouldShowSelectionToolbar = true;
EditorTextSelectionGestureDetectorBuilder(this.delegate) EditorTextSelectionGestureDetectorBuilder(this.delegate)
: assert(delegate != null); ;
EditorState? getEditor() { EditorState? getEditor() {
return delegate.getEditableTextKey().currentState; return delegate.getEditableTextKey().currentState;

@ -182,13 +182,7 @@ class QuillEditor extends StatefulWidget {
this.onLaunchUrl, this.onLaunchUrl,
this.embedBuilder = this.embedBuilder =
kIsWeb ? _defaultEmbedBuilderWeb : _defaultEmbedBuilder}) kIsWeb ? _defaultEmbedBuilderWeb : _defaultEmbedBuilder})
: assert(controller != null), ;
assert(scrollController != null),
assert(scrollable != null),
assert(focusNode != null),
assert(autoFocus != null),
assert(readOnly != null),
assert(embedBuilder != null);
factory QuillEditor.basic( factory QuillEditor.basic(
{required QuillController controller, required bool readOnly}) { {required QuillController controller, required bool readOnly}) {
@ -559,10 +553,7 @@ class RenderEditor extends RenderEditableContainerBox
this._startHandleLayerLink, this._startHandleLayerLink,
this._endHandleLayerLink, this._endHandleLayerLink,
EdgeInsets floatingCursorAddedMargin) EdgeInsets floatingCursorAddedMargin)
: assert(document != null), :
assert(textDirection != null),
assert(_hasFocus != null),
assert(floatingCursorAddedMargin != null),
super( super(
children, children,
document.root, document.root,
@ -571,7 +562,6 @@ class RenderEditor extends RenderEditableContainerBox
); );
setDocument(Document doc) { setDocument(Document doc) {
assert(doc != null);
if (document == doc) { if (document == doc) {
return; return;
} }
@ -580,7 +570,6 @@ class RenderEditor extends RenderEditableContainerBox
} }
setHasFocus(bool h) { setHasFocus(bool h) {
assert(h != null);
if (_hasFocus == h) { if (_hasFocus == h) {
return; return;
} }
@ -615,7 +604,6 @@ class RenderEditor extends RenderEditableContainerBox
@override @override
List<TextSelectionPoint> getEndpointsForSelection( List<TextSelectionPoint> getEndpointsForSelection(
TextSelection textSelection) { TextSelection textSelection) {
assert(constraints != null);
if (textSelection.isCollapsed) { if (textSelection.isCollapsed) {
RenderEditableBox child = childAtPosition(textSelection.extent); RenderEditableBox child = childAtPosition(textSelection.extent);
@ -686,11 +674,6 @@ class RenderEditor extends RenderEditableContainerBox
Offset? to, Offset? to,
SelectionChangedCause cause, SelectionChangedCause cause,
) { ) {
assert(cause != null);
assert(from != null);
if (onSelectionChanged == null) {
return;
}
TextPosition firstPosition = getPositionForOffset(from); TextPosition firstPosition = getPositionForOffset(from);
TextSelection firstWord = selectWordAtPosition(firstPosition); TextSelection firstWord = selectWordAtPosition(firstPosition);
TextSelection lastWord = TextSelection lastWord =
@ -718,18 +701,12 @@ class RenderEditor extends RenderEditableContainerBox
!focusingEmpty) { !focusingEmpty) {
return; return;
} }
if (onSelectionChanged != null) {
onSelectionChanged(nextSelection, cause); onSelectionChanged(nextSelection, cause);
} }
}
@override @override
selectWordEdge(SelectionChangedCause cause) { selectWordEdge(SelectionChangedCause cause) {
assert(cause != null);
assert(_lastTapDownPosition != null); assert(_lastTapDownPosition != null);
if (onSelectionChanged == null) {
return;
}
TextPosition position = getPositionForOffset(_lastTapDownPosition!); TextPosition position = getPositionForOffset(_lastTapDownPosition!);
RenderEditableBox child = childAtPosition(position); RenderEditableBox child = childAtPosition(position);
int nodeOffset = child.getContainer().getOffset(); int nodeOffset = child.getContainer().getOffset();
@ -763,11 +740,6 @@ class RenderEditor extends RenderEditableContainerBox
Offset? to, Offset? to,
SelectionChangedCause cause, SelectionChangedCause cause,
) { ) {
assert(cause != null);
assert(from != null);
if (onSelectionChanged == null) {
return;
}
TextPosition fromPosition = getPositionForOffset(from); TextPosition fromPosition = getPositionForOffset(from);
TextPosition? toPosition = to == null ? null : getPositionForOffset(to); TextPosition? toPosition = to == null ? null : getPositionForOffset(to);
@ -932,9 +904,7 @@ class RenderEditableContainerBox extends RenderBox
RenderEditableContainerBox(List<RenderEditableBox>? children, this._container, RenderEditableContainerBox(List<RenderEditableBox>? children, this._container,
this.textDirection, this._padding) this.textDirection, this._padding)
: assert(_container != null), :
assert(textDirection != null),
assert(_padding != null),
assert(_padding.isNonNegative) { assert(_padding.isNonNegative) {
addAll(children); addAll(children);
} }
@ -944,7 +914,6 @@ class RenderEditableContainerBox extends RenderBox
} }
setContainer(containerNode.Container c) { setContainer(containerNode.Container c) {
assert(c != null);
if (_container == c) { if (_container == c) {
return; return;
} }
@ -955,7 +924,6 @@ class RenderEditableContainerBox extends RenderBox
EdgeInsetsGeometry getPadding() => _padding; EdgeInsetsGeometry getPadding() => _padding;
setPadding(EdgeInsetsGeometry value) { setPadding(EdgeInsetsGeometry value) {
assert(value != null);
assert(value.isNonNegative); assert(value.isNonNegative);
if (_padding == value) { if (_padding == value) {
return; return;

@ -59,9 +59,7 @@ class KeyboardListener {
}; };
KeyboardListener(this.onCursorMove, this.onShortcut, this.onDelete) KeyboardListener(this.onCursorMove, this.onShortcut, this.onDelete)
: assert(onCursorMove != null), ;
assert(onShortcut != null),
assert(onDelete != null);
bool handleRawKeyEvent(RawKeyEvent event) { bool handleRawKeyEvent(RawKeyEvent event) {
if (event is! RawKeyDownEvent) { if (event is! RawKeyDownEvent) {

@ -907,7 +907,6 @@ class RawEditorState extends EditorState
_selectionOverlay?.hide(); _selectionOverlay?.hide();
_selectionOverlay = null; _selectionOverlay = null;
if (widget.selectionCtrls != null) {
_selectionOverlay = EditorTextSelectionOverlay( _selectionOverlay = EditorTextSelectionOverlay(
textEditingValue, textEditingValue,
false, false,
@ -926,7 +925,6 @@ class RawEditorState extends EditorState
_selectionOverlay!.showHandles(); _selectionOverlay!.showHandles();
} }
} }
}
_handleFocusChanged() { _handleFocusChanged() {
openOrCloseConnection(); openOrCloseConnection();

@ -74,9 +74,7 @@ class EditableTextBlock extends StatelessWidget {
this.embedBuilder, this.embedBuilder,
this.cursorCont, this.cursorCont,
this.indentLevelCounts) this.indentLevelCounts)
: assert(hasFocus != null), ;
assert(embedBuilder != null),
assert(cursorCont != null);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -263,11 +261,7 @@ class RenderEditableTextBlock extends RenderEditableContainerBox
required Decoration decoration, required Decoration decoration,
ImageConfiguration configuration = ImageConfiguration.empty, ImageConfiguration configuration = ImageConfiguration.empty,
EdgeInsets contentPadding = EdgeInsets.zero, EdgeInsets contentPadding = EdgeInsets.zero,
}) : assert(block != null), }) :
assert(textDirection != null),
assert(decoration != null),
assert(padding != null),
assert(contentPadding != null),
_decoration = decoration, _decoration = decoration,
_configuration = configuration, _configuration = configuration,
_savedPadding = padding, _savedPadding = padding,
@ -283,7 +277,6 @@ class RenderEditableTextBlock extends RenderEditableContainerBox
EdgeInsets _contentPadding; EdgeInsets _contentPadding;
set contentPadding(EdgeInsets value) { set contentPadding(EdgeInsets value) {
assert(value != null);
if (_contentPadding == value) return; if (_contentPadding == value) return;
_contentPadding = value; _contentPadding = value;
super.setPadding(_savedPadding.add(_contentPadding)); super.setPadding(_savedPadding.add(_contentPadding));
@ -301,7 +294,6 @@ class RenderEditableTextBlock extends RenderEditableContainerBox
Decoration _decoration; Decoration _decoration;
set decoration(Decoration value) { set decoration(Decoration value) {
assert(value != null);
if (value == _decoration) return; if (value == _decoration) return;
_painter?.dispose(); _painter?.dispose();
_painter = null; _painter = null;
@ -313,7 +305,6 @@ class RenderEditableTextBlock extends RenderEditableContainerBox
ImageConfiguration _configuration; ImageConfiguration _configuration;
set configuration(ImageConfiguration value) { set configuration(ImageConfiguration value) {
assert(value != null);
if (value == _configuration) return; if (value == _configuration) return;
_configuration = value; _configuration = value;
markNeedsPaint(); markNeedsPaint();
@ -495,8 +486,6 @@ class RenderEditableTextBlock extends RenderEditableContainerBox
} }
_paintDecoration(PaintingContext context, Offset offset) { _paintDecoration(PaintingContext context, Offset offset) {
assert(size.width != null);
assert(size.height != null);
_painter ??= _decoration.createBoxPainter(markNeedsPaint); _painter ??= _decoration.createBoxPainter(markNeedsPaint);
EdgeInsets decorationPadding = resolvedPadding! - _contentPadding; EdgeInsets decorationPadding = resolvedPadding! - _contentPadding;
@ -531,11 +520,7 @@ class _EditableBlock extends MultiChildRenderObjectWidget {
_EditableBlock(this.block, this.textDirection, this.padding, this.decoration, _EditableBlock(this.block, this.textDirection, this.padding, this.decoration,
this.contentPadding, List<Widget> children) this.contentPadding, List<Widget> children)
: assert(block != null), :
assert(textDirection != null),
assert(padding != null),
assert(decoration != null),
assert(children != null),
super(children: children); super(children: children);
EdgeInsets get _padding => EdgeInsets get _padding =>

@ -55,13 +55,9 @@ class EditorTextSelectionOverlay {
this.dragStartBehavior, this.dragStartBehavior,
this.onSelectionHandleTapped, this.onSelectionHandleTapped,
this.clipboardStatus) this.clipboardStatus)
: assert(value != null), {
assert(context != null),
assert(handlesVisible != null) {
OverlayState overlay = Overlay.of(context, rootOverlay: true)!; OverlayState overlay = Overlay.of(context, rootOverlay: true)!;
assert(
overlay != null,
);
_toolbarController = AnimationController( _toolbarController = AnimationController(
duration: Duration(milliseconds: 150), vsync: overlay); duration: Duration(milliseconds: 150), vsync: overlay);
} }
@ -71,7 +67,6 @@ class EditorTextSelectionOverlay {
Animation<double> get _toolbarOpacity => _toolbarController.view; Animation<double> get _toolbarOpacity => _toolbarController.view;
setHandlesVisible(bool visible) { setHandlesVisible(bool visible) {
assert(visible != null);
if (handlesVisible == visible) { if (handlesVisible == visible) {
return; return;
} }
@ -111,8 +106,8 @@ class EditorTextSelectionOverlay {
Widget _buildHandle( Widget _buildHandle(
BuildContext context, _TextSelectionHandlePosition position) { BuildContext context, _TextSelectionHandlePosition position) {
if ((_selection.isCollapsed && if ((_selection.isCollapsed &&
position == _TextSelectionHandlePosition.END) || position == _TextSelectionHandlePosition.END)
selectionCtrls == null) { ) {
return Container(); return Container();
} }
return Visibility( return Visibility(
@ -167,9 +162,7 @@ class EditorTextSelectionOverlay {
} }
Widget _buildToolbar(BuildContext context) { Widget _buildToolbar(BuildContext context) {
if (selectionCtrls == null) {
return Container();
}
List<TextSelectionPoint> endpoints = List<TextSelectionPoint> endpoints =
renderObject!.getEndpointsForSelection(_selection); renderObject!.getEndpointsForSelection(_selection);
@ -289,7 +282,6 @@ class _TextSelectionHandleOverlay extends StatefulWidget {
case _TextSelectionHandlePosition.END: case _TextSelectionHandlePosition.END:
return renderObject!.selectionEndInViewport; return renderObject!.selectionEndInViewport;
} }
return null;
} }
} }
@ -468,14 +460,12 @@ class _TextSelectionHandleOverlayState
) { ) {
if (widget.selection.isCollapsed) return TextSelectionHandleType.collapsed; if (widget.selection.isCollapsed) return TextSelectionHandleType.collapsed;
assert(textDirection != null);
switch (textDirection) { switch (textDirection) {
case TextDirection.ltr: case TextDirection.ltr:
return ltrType; return ltrType;
case TextDirection.rtl: case TextDirection.rtl:
return rtlType; return rtlType;
} }
return null;
} }
} }
@ -496,7 +486,7 @@ class EditorTextSelectionGestureDetector extends StatefulWidget {
this.onDragSelectionEnd, this.onDragSelectionEnd,
this.behavior, this.behavior,
required this.child, required this.child,
}) : assert(child != null), }) :
super(key: key); super(key: key);
final GestureTapDownCallback? onTapDown; final GestureTapDownCallback? onTapDown;
@ -660,7 +650,6 @@ class _EditorTextSelectionGestureDetectorState
} }
bool _isWithinDoubleTapTolerance(Offset secondTapOffset) { bool _isWithinDoubleTapTolerance(Offset secondTapOffset) {
assert(secondTapOffset != null);
if (_lastTapOffset == null) { if (_lastTapOffset == null) {
return false; return false;
} }

@ -186,11 +186,7 @@ class ToggleStyleButton extends StatefulWidget {
required this.icon, required this.icon,
required this.controller, required this.controller,
this.childBuilder = defaultToggleStyleButtonBuilder, this.childBuilder = defaultToggleStyleButtonBuilder,
}) : assert(attribute.value != null), }) : super(key: key);
assert(icon != null),
assert(controller != null),
assert(childBuilder != null),
super(key: key);
@override @override
_ToggleStyleButtonState createState() => _ToggleStyleButtonState(); _ToggleStyleButtonState createState() => _ToggleStyleButtonState();
@ -274,9 +270,7 @@ class ToggleCheckListButton extends StatefulWidget {
required this.controller, required this.controller,
this.childBuilder = defaultToggleStyleButtonBuilder, this.childBuilder = defaultToggleStyleButtonBuilder,
required this.attribute, required this.attribute,
}) : assert(icon != null), }) :
assert(controller != null),
assert(childBuilder != null),
super(key: key); super(key: key);
@override @override
@ -502,8 +496,7 @@ class ImageButton extends StatefulWidget {
required this.controller, required this.controller,
required this.imageSource, required this.imageSource,
this.onImagePickCallback}) this.onImagePickCallback})
: assert(icon != null), :
assert(controller != null),
super(key: key); super(key: key);
@override @override
@ -522,7 +515,6 @@ class _ImageButtonState extends State<ImageButton> {
final File file = File(pickedFile.path); final File file = File(pickedFile.path);
if (file == null || widget.onImagePickCallback == null) return null;
// We simply return the absolute path to selected file. // We simply return the absolute path to selected file.
try { try {
String url = await widget.onImagePickCallback!(file); String url = await widget.onImagePickCallback!(file);
@ -554,7 +546,6 @@ class _ImageButtonState extends State<ImageButton> {
if (_paths != null) { if (_paths != null) {
File file = File(_fileName); File file = File(_fileName);
if (file == null || widget.onImagePickCallback == null) return null;
// We simply return the absolute path to selected file. // We simply return the absolute path to selected file.
try { try {
String url = await widget.onImagePickCallback!(file); String url = await widget.onImagePickCallback!(file);
@ -611,9 +602,7 @@ class ColorButton extends StatefulWidget {
required this.icon, required this.icon,
required this.controller, required this.controller,
required this.background}) required this.background})
: assert(icon != null), :
assert(controller != null),
assert(background != null),
super(key: key); super(key: key);
@override @override
@ -752,9 +741,7 @@ class HistoryButton extends StatefulWidget {
required this.icon, required this.icon,
required this.controller, required this.controller,
required this.undo}) required this.undo})
: assert(icon != null), :
assert(controller != null),
assert(undo != null),
super(key: key); super(key: key);
@override @override
@ -827,9 +814,7 @@ class IndentButton extends StatefulWidget {
required this.icon, required this.icon,
required this.controller, required this.controller,
required this.isIncrease}) required this.isIncrease})
: assert(icon != null), :
assert(controller != null),
assert(isIncrease != null),
super(key: key); super(key: key);
@override @override
@ -881,8 +866,7 @@ class ClearFormatButton extends StatefulWidget {
final QuillController controller; final QuillController controller;
ClearFormatButton({Key? key, required this.icon, required this.controller}) ClearFormatButton({Key? key, required this.icon, required this.controller})
: assert(icon != null), :
assert(controller != null),
super(key: key); super(key: key);
@override @override
@ -1265,9 +1249,6 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
// if (widget.onCanceled != null) widget.onCanceled(); // if (widget.onCanceled != null) widget.onCanceled();
return null; return null;
} }
if (widget.onSelected != null) {
widget.onSelected(newValue);
}
}); });
} }

Loading…
Cancel
Save