Add pedantic

pull/110/head
Xin Yao 4 years ago
parent 25eff9cd07
commit 811cb341bf
  1. 3
      CHANGELOG.md
  2. 2
      analysis_options.yaml
  3. 2
      example/main.dart
  4. 6
      lib/models/documents/document.dart
  5. 16
      lib/models/documents/history.dart
  6. 2
      lib/models/documents/nodes/block.dart
  7. 2
      lib/utils/universal_ui/fake_ui.dart
  8. 4
      lib/utils/universal_ui/real_ui.dart
  9. 5
      lib/utils/universal_ui/universal_ui.dart
  10. 6
      lib/widgets/text_line.dart
  11. 55
      lib/widgets/text_selection.dart
  12. 66
      lib/widgets/toolbar.dart
  13. 5
      pubspec.yaml

@ -1,3 +1,6 @@
## [1.1.2]
* Add pedantic.
## [1.1.1] ## [1.1.1]
* Base64 image support. * Base64 image support.

@ -1,3 +1,5 @@
include: package:pedantic/analysis_options.yaml
analyzer: analyzer:
errors: errors:
undefined_prefixed_name: ignore undefined_prefixed_name: ignore

@ -9,7 +9,7 @@ class HomePage extends StatefulWidget {
} }
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
QuillController _controller = QuillController.basic(); final QuillController _controller = QuillController.basic();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -117,7 +117,7 @@ class Document {
return block.queryChild(res.offset, true); return block.queryChild(res.offset, true);
} }
compose(Delta delta, ChangeSource changeSource) { void compose(Delta delta, ChangeSource changeSource) {
assert(!_observer.isClosed); assert(!_observer.isClosed);
delta.trim(); delta.trim();
assert(delta.isNotEmpty); assert(delta.isNotEmpty);
@ -208,14 +208,14 @@ class Document {
return Embeddable.fromJson(data as Map<String, dynamic>); return Embeddable.fromJson(data as Map<String, dynamic>);
} }
close() { void close() {
_observer.close(); _observer.close();
_history.clear(); _history.clear();
} }
String toPlainText() => _root.children.map((e) => e.toPlainText()).join(''); String toPlainText() => _root.children.map((e) => e.toPlainText()).join('');
_loadDocument(Delta doc) { void _loadDocument(Delta doc) {
assert((doc.last.data as String).endsWith('\n')); assert((doc.last.data as String).endsWith('\n'));
int offset = 0; int offset = 0;
for (final op in doc.toList()) { for (final op in doc.toList()) {

@ -69,8 +69,8 @@ class History {
///It will override pre local undo delta,replaced by remote change ///It will override pre local undo delta,replaced by remote change
/// ///
void transform(Delta delta) { void transform(Delta delta) {
transformStack(this.stack.undo, delta); transformStack(stack.undo, delta);
transformStack(this.stack.redo, delta); transformStack(stack.redo, delta);
} }
void transformStack(List<Delta> stack, Delta delta) { void transformStack(List<Delta> stack, Delta delta) {
@ -85,8 +85,8 @@ class History {
} }
Tuple2 _change(Document doc, List<Delta> source, List<Delta> dest) { Tuple2 _change(Document doc, List<Delta> source, List<Delta> dest) {
if (source.length == 0) { if (source.isEmpty) {
return new Tuple2(false, 0); return Tuple2(false, 0);
} }
Delta delta = source.removeLast(); Delta delta = source.removeLast();
// look for insert or delete // look for insert or delete
@ -102,11 +102,11 @@ class History {
Delta base = Delta.from(doc.toDelta()); Delta base = Delta.from(doc.toDelta());
Delta inverseDelta = delta.invert(base); Delta inverseDelta = delta.invert(base);
dest.add(inverseDelta); dest.add(inverseDelta);
this.lastRecorded = 0; lastRecorded = 0;
this.ignoreChange = true; ignoreChange = true;
doc.compose(delta, ChangeSource.LOCAL); doc.compose(delta, ChangeSource.LOCAL);
this.ignoreChange = false; ignoreChange = false;
return new Tuple2(true, len); return Tuple2(true, len);
} }
Tuple2 undo(Document doc) { Tuple2 undo(Document doc) {

@ -16,7 +16,7 @@ class Block extends Container<Line?> {
} }
@override @override
adjust() { void adjust() {
if (isEmpty) { if (isEmpty) {
Node? sibling = previous; Node? sibling = previous;
unlink(); unlink();

@ -1,3 +1,3 @@
class platformViewRegistry { class PlatformViewRegistry {
static registerViewFactory(String viewId, dynamic cb) {} static registerViewFactory(String viewId, dynamic cb) {}
} }

@ -1,9 +1,7 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
// ignore: camel_case_types class PlatformViewRegistry {
class platformViewRegistry {
static registerViewFactory(String viewId, dynamic cb) { static registerViewFactory(String viewId, dynamic cb) {
// ignore:undefined_prefixed_name
ui.platformViewRegistry.registerViewFactory(viewId, cb); ui.platformViewRegistry.registerViewFactory(viewId, cb);
} }
} }

@ -6,12 +6,11 @@ import 'fake_ui.dart' if (dart.library.html) 'real_ui.dart' as ui_instance;
class PlatformViewRegistryFix { class PlatformViewRegistryFix {
registerViewFactory(dynamic x, dynamic y) { registerViewFactory(dynamic x, dynamic y) {
if (kIsWeb) { if (kIsWeb) {
// ignore: undefined_prefixed_name ui_instance.PlatformViewRegistry.registerViewFactory(
ui_instance.platformViewRegistry.registerViewFactory(
x, x,
y, y,
); );
} else {} }
} }
} }

@ -843,7 +843,7 @@ class _TextLineElement extends RenderObjectElement {
throw UnimplementedError(); throw UnimplementedError();
} }
_mountChild(Widget? widget, TextLineSlot slot) { void _mountChild(Widget? widget, TextLineSlot slot) {
Element? oldChild = _slotToChildren[slot]; Element? oldChild = _slotToChildren[slot];
Element? newChild = updateChild(oldChild, widget, slot); Element? newChild = updateChild(oldChild, widget, slot);
if (oldChild != null) { if (oldChild != null) {
@ -854,7 +854,7 @@ class _TextLineElement extends RenderObjectElement {
} }
} }
_updateRenderObject(RenderBox? child, TextLineSlot? slot) { void _updateRenderObject(RenderBox? child, TextLineSlot? slot) {
switch (slot) { switch (slot) {
case TextLineSlot.LEADING: case TextLineSlot.LEADING:
renderObject.setLeading(child); renderObject.setLeading(child);
@ -867,7 +867,7 @@ class _TextLineElement extends RenderObjectElement {
} }
} }
_updateChild(Widget? widget, TextLineSlot slot) { void _updateChild(Widget? widget, TextLineSlot slot) {
Element? oldChild = _slotToChildren[slot]; Element? oldChild = _slotToChildren[slot];
Element? newChild = updateChild(oldChild, widget, slot); Element? newChild = updateChild(oldChild, widget, slot);
if (oldChild != null) { if (oldChild != null) {

@ -65,7 +65,7 @@ class EditorTextSelectionOverlay {
Animation<double> get _toolbarOpacity => _toolbarController.view; Animation<double> get _toolbarOpacity => _toolbarController.view;
setHandlesVisible(bool visible) { void setHandlesVisible(bool visible) {
if (handlesVisible == visible) { if (handlesVisible == visible) {
return; return;
} }
@ -78,7 +78,7 @@ class EditorTextSelectionOverlay {
} }
} }
hideHandles() { void hideHandles() {
if (_handles == null) { if (_handles == null) {
return; return;
} }
@ -87,14 +87,14 @@ class EditorTextSelectionOverlay {
_handles = null; _handles = null;
} }
hideToolbar() { void hideToolbar() {
assert(toolbar != null); assert(toolbar != null);
_toolbarController.stop(); _toolbarController.stop();
toolbar!.remove(); toolbar!.remove();
toolbar = null; toolbar = null;
} }
showToolbar() { void showToolbar() {
assert(toolbar == null); assert(toolbar == null);
toolbar = OverlayEntry(builder: _buildToolbar); toolbar = OverlayEntry(builder: _buildToolbar);
Overlay.of(context, rootOverlay: true, debugRequiredFor: debugRequiredFor)! Overlay.of(context, rootOverlay: true, debugRequiredFor: debugRequiredFor)!
@ -125,7 +125,7 @@ class EditorTextSelectionOverlay {
)); ));
} }
update(TextEditingValue newValue) { void update(TextEditingValue newValue) {
if (value == newValue) { if (value == newValue) {
return; return;
} }
@ -138,7 +138,7 @@ class EditorTextSelectionOverlay {
} }
} }
_handleSelectionHandleChanged( void _handleSelectionHandleChanged(
TextSelection? newSelection, _TextSelectionHandlePosition position) { TextSelection? newSelection, _TextSelectionHandlePosition position) {
TextPosition textPosition; TextPosition textPosition;
switch (position) { switch (position) {
@ -203,7 +203,7 @@ class EditorTextSelectionOverlay {
); );
} }
markNeedsBuild([Duration? duration]) { void markNeedsBuild([Duration? duration]) {
if (_handles != null) { if (_handles != null) {
_handles![0].markNeedsBuild(); _handles![0].markNeedsBuild();
_handles![1].markNeedsBuild(); _handles![1].markNeedsBuild();
@ -211,7 +211,7 @@ class EditorTextSelectionOverlay {
toolbar?.markNeedsBuild(); toolbar?.markNeedsBuild();
} }
hide() { void hide() {
if (_handles != null) { if (_handles != null) {
_handles![0].remove(); _handles![0].remove();
_handles![1].remove(); _handles![1].remove();
@ -222,7 +222,7 @@ class EditorTextSelectionOverlay {
} }
} }
dispose() { void dispose() {
hide(); hide();
_toolbarController.dispose(); _toolbarController.dispose();
} }
@ -299,7 +299,7 @@ class _TextSelectionHandleOverlayState
widget._visibility!.addListener(_handleVisibilityChanged); widget._visibility!.addListener(_handleVisibilityChanged);
} }
_handleVisibilityChanged() { void _handleVisibilityChanged() {
if (widget._visibility!.value) { if (widget._visibility!.value) {
_controller.forward(); _controller.forward();
} else { } else {
@ -308,7 +308,7 @@ class _TextSelectionHandleOverlayState
} }
@override @override
didUpdateWidget(_TextSelectionHandleOverlay oldWidget) { void didUpdateWidget(_TextSelectionHandleOverlay oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
oldWidget._visibility!.removeListener(_handleVisibilityChanged); oldWidget._visibility!.removeListener(_handleVisibilityChanged);
_handleVisibilityChanged(); _handleVisibilityChanged();
@ -322,9 +322,9 @@ class _TextSelectionHandleOverlayState
super.dispose(); super.dispose();
} }
_handleDragStart(DragStartDetails details) {} void _handleDragStart(DragStartDetails details) {}
_handleDragUpdate(DragUpdateDetails details) { void _handleDragUpdate(DragUpdateDetails details) {
TextPosition position = TextPosition position =
widget.renderObject!.getPositionForOffset(details.globalPosition); widget.renderObject!.getPositionForOffset(details.globalPosition);
if (widget.selection.isCollapsed) { if (widget.selection.isCollapsed) {
@ -357,10 +357,11 @@ class _TextSelectionHandleOverlayState
widget.onSelectionHandleChanged(newSelection); widget.onSelectionHandleChanged(newSelection);
} }
_handleTap() { void _handleTap() {
if (widget.onSelectionHandleTapped != null) if (widget.onSelectionHandleTapped != null) {
widget.onSelectionHandleTapped!(); widget.onSelectionHandleTapped!();
} }
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -530,7 +531,7 @@ class _EditorTextSelectionGestureDetectorState
super.dispose(); super.dispose();
} }
_handleTapDown(TapDownDetails details) { void _handleTapDown(TapDownDetails details) {
if (widget.onTapDown != null) { if (widget.onTapDown != null) {
widget.onTapDown!(details); widget.onTapDown!(details);
} }
@ -546,7 +547,7 @@ class _EditorTextSelectionGestureDetectorState
} }
} }
_handleTapUp(TapUpDetails details) { void _handleTapUp(TapUpDetails details) {
if (!_isDoubleTap) { if (!_isDoubleTap) {
if (widget.onSingleTapUp != null) { if (widget.onSingleTapUp != null) {
widget.onSingleTapUp!(details); widget.onSingleTapUp!(details);
@ -557,7 +558,7 @@ class _EditorTextSelectionGestureDetectorState
_isDoubleTap = false; _isDoubleTap = false;
} }
_handleTapCancel() { void _handleTapCancel() {
if (widget.onSingleTapCancel != null) { if (widget.onSingleTapCancel != null) {
widget.onSingleTapCancel!(); widget.onSingleTapCancel!();
} }
@ -567,7 +568,7 @@ class _EditorTextSelectionGestureDetectorState
DragUpdateDetails? _lastDragUpdateDetails; DragUpdateDetails? _lastDragUpdateDetails;
Timer? _dragUpdateThrottleTimer; Timer? _dragUpdateThrottleTimer;
_handleDragStart(DragStartDetails details) { void _handleDragStart(DragStartDetails details) {
assert(_lastDragStartDetails == null); assert(_lastDragStartDetails == null);
_lastDragStartDetails = details; _lastDragStartDetails = details;
if (widget.onDragSelectionStart != null) { if (widget.onDragSelectionStart != null) {
@ -575,13 +576,13 @@ class _EditorTextSelectionGestureDetectorState
} }
} }
_handleDragUpdate(DragUpdateDetails details) { void _handleDragUpdate(DragUpdateDetails details) {
_lastDragUpdateDetails = details; _lastDragUpdateDetails = details;
_dragUpdateThrottleTimer ??= _dragUpdateThrottleTimer ??=
Timer(Duration(milliseconds: 50), _handleDragUpdateThrottled); Timer(Duration(milliseconds: 50), _handleDragUpdateThrottled);
} }
_handleDragUpdateThrottled() { void _handleDragUpdateThrottled() {
assert(_lastDragStartDetails != null); assert(_lastDragStartDetails != null);
assert(_lastDragUpdateDetails != null); assert(_lastDragUpdateDetails != null);
if (widget.onDragSelectionUpdate != null) { if (widget.onDragSelectionUpdate != null) {
@ -592,7 +593,7 @@ class _EditorTextSelectionGestureDetectorState
_lastDragUpdateDetails = null; _lastDragUpdateDetails = null;
} }
_handleDragEnd(DragEndDetails details) { void _handleDragEnd(DragEndDetails details) {
assert(_lastDragStartDetails != null); assert(_lastDragStartDetails != null);
if (_dragUpdateThrottleTimer != null) { if (_dragUpdateThrottleTimer != null) {
_dragUpdateThrottleTimer!.cancel(); _dragUpdateThrottleTimer!.cancel();
@ -606,7 +607,7 @@ class _EditorTextSelectionGestureDetectorState
_lastDragUpdateDetails = null; _lastDragUpdateDetails = null;
} }
_forcePressStarted(ForcePressDetails details) { void _forcePressStarted(ForcePressDetails details) {
_doubleTapTimer?.cancel(); _doubleTapTimer?.cancel();
_doubleTapTimer = null; _doubleTapTimer = null;
if (widget.onForcePressStart != null) { if (widget.onForcePressStart != null) {
@ -614,25 +615,25 @@ class _EditorTextSelectionGestureDetectorState
} }
} }
_forcePressEnded(ForcePressDetails details) { void _forcePressEnded(ForcePressDetails details) {
if (widget.onForcePressEnd != null) { if (widget.onForcePressEnd != null) {
widget.onForcePressEnd!(details); widget.onForcePressEnd!(details);
} }
} }
_handleLongPressStart(LongPressStartDetails details) { void _handleLongPressStart(LongPressStartDetails details) {
if (!_isDoubleTap && widget.onSingleLongTapStart != null) { if (!_isDoubleTap && widget.onSingleLongTapStart != null) {
widget.onSingleLongTapStart!(details); widget.onSingleLongTapStart!(details);
} }
} }
_handleLongPressMoveUpdate(LongPressMoveUpdateDetails details) { void _handleLongPressMoveUpdate(LongPressMoveUpdateDetails details) {
if (!_isDoubleTap && widget.onSingleLongTapMoveUpdate != null) { if (!_isDoubleTap && widget.onSingleLongTapMoveUpdate != null) {
widget.onSingleLongTapMoveUpdate!(details); widget.onSingleLongTapMoveUpdate!(details);
} }
} }
_handleLongPressEnd(LongPressEndDetails details) { void _handleLongPressEnd(LongPressEndDetails details) {
if (!_isDoubleTap && widget.onSingleLongTapEnd != null) { if (!_isDoubleTap && widget.onSingleLongTapEnd != null) {
widget.onSingleLongTapEnd!(details); widget.onSingleLongTapEnd!(details);
} }

@ -251,7 +251,7 @@ class _ToggleStyleButtonState extends State<ToggleStyleButton> {
_isToggled, isEnabled ? _toggleAttribute : null); _isToggled, isEnabled ? _toggleAttribute : null);
} }
_toggleAttribute() { void _toggleAttribute() {
widget.controller.formatSelection(_isToggled! widget.controller.formatSelection(_isToggled!
? Attribute.clone(widget.attribute, null) ? Attribute.clone(widget.attribute, null)
: widget.attribute); : widget.attribute);
@ -336,7 +336,7 @@ class _ToggleCheckListButtonState extends State<ToggleCheckListButton> {
_isToggled, isEnabled ? _toggleAttribute : null); _isToggled, isEnabled ? _toggleAttribute : null);
} }
_toggleAttribute() { void _toggleAttribute() {
widget.controller.formatSelection(_isToggled! widget.controller.formatSelection(_isToggled!
? Attribute.clone(Attribute.unchecked, null) ? Attribute.clone(Attribute.unchecked, null)
: Attribute.unchecked); : Attribute.unchecked);
@ -445,42 +445,42 @@ Widget _selectHeadingStyleButtonBuilder(BuildContext context, Attribute? value,
hoverElevation: 0, hoverElevation: 0,
height: iconSize * 1.77, height: iconSize * 1.77,
fillColor: Theme.of(context).canvasColor, fillColor: Theme.of(context).canvasColor,
child: Text(
!kIsWeb
? _valueToText[value!]!
: _valueToText[value!.key == "header"
? Attribute.header
: (value.key == "h1")
? Attribute.h1
: (value.key == "h2")
? Attribute.h2
: Attribute.h3]!,
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600),
),
initialValue: value, initialValue: value,
items: [ items: [
PopupMenuItem( PopupMenuItem(
child: Text(_valueToText[Attribute.header]!, style: style),
value: Attribute.header, value: Attribute.header,
height: iconSize * 1.77, height: iconSize * 1.77,
child: Text(_valueToText[Attribute.header]!, style: style),
), ),
PopupMenuItem( PopupMenuItem(
child: Text(_valueToText[Attribute.h1]!, style: style),
value: Attribute.h1, value: Attribute.h1,
height: iconSize * 1.77, height: iconSize * 1.77,
child: Text(_valueToText[Attribute.h1]!, style: style),
), ),
PopupMenuItem( PopupMenuItem(
child: Text(_valueToText[Attribute.h2]!, style: style),
value: Attribute.h2, value: Attribute.h2,
height: iconSize * 1.77, height: iconSize * 1.77,
child: Text(_valueToText[Attribute.h2]!, style: style),
), ),
PopupMenuItem( PopupMenuItem(
child: Text(_valueToText[Attribute.h3]!, style: style),
value: Attribute.h3, value: Attribute.h3,
height: iconSize * 1.77, height: iconSize * 1.77,
child: Text(_valueToText[Attribute.h3]!, style: style),
), ),
], ],
onSelected: onSelected, onSelected: onSelected,
child: Text(
!kIsWeb
? _valueToText[value!]!
: _valueToText[value!.key == 'header'
? Attribute.header
: (value.key == 'h1')
? Attribute.h1
: (value.key == 'h2')
? Attribute.h2
: Attribute.h3]!,
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600),
),
); );
} }
@ -512,7 +512,7 @@ class _ImageButtonState extends State<ImageButton> {
List<PlatformFile>? _paths; List<PlatformFile>? _paths;
String? _extension; String? _extension;
final _picker = ImagePicker(); final _picker = ImagePicker();
FileType _pickingType = FileType.any; final FileType _pickingType = FileType.any;
Future<String?> _pickImage(ImageSource source) async { Future<String?> _pickImage(ImageSource source) async {
final PickedFile? pickedFile = await _picker.getImage(source: source); final PickedFile? pickedFile = await _picker.getImage(source: source);
@ -542,7 +542,7 @@ class _ImageButtonState extends State<ImageButton> {
)) ))
?.files; ?.files;
} on PlatformException catch (e) { } on PlatformException catch (e) {
print("Unsupported operation" + e.toString()); print('Unsupported operation' + e.toString());
} catch (ex) { } catch (ex) {
print(ex); print(ex);
} }
@ -656,9 +656,9 @@ class _ColorButtonState extends State<ColorButton> {
_isToggledBackground = _getIsToggledBackground( _isToggledBackground = _getIsToggledBackground(
widget.controller.getSelectionStyle().attributes); widget.controller.getSelectionStyle().attributes);
_isWhite = _isToggledColor && _isWhite = _isToggledColor &&
_selectionStyle.attributes["color"]!.value == '#ffffff'; _selectionStyle.attributes['color']!.value == '#ffffff';
_isWhitebackground = _isToggledBackground && _isWhitebackground = _isToggledBackground &&
_selectionStyle.attributes["background"]!.value == '#ffffff'; _selectionStyle.attributes['background']!.value == '#ffffff';
}); });
} }
@ -668,9 +668,9 @@ class _ColorButtonState extends State<ColorButton> {
_isToggledColor = _getIsToggledColor(_selectionStyle.attributes); _isToggledColor = _getIsToggledColor(_selectionStyle.attributes);
_isToggledBackground = _getIsToggledBackground(_selectionStyle.attributes); _isToggledBackground = _getIsToggledBackground(_selectionStyle.attributes);
_isWhite = _isToggledColor && _isWhite = _isToggledColor &&
_selectionStyle.attributes["color"]!.value == '#ffffff'; _selectionStyle.attributes['color']!.value == '#ffffff';
_isWhitebackground = _isToggledBackground && _isWhitebackground = _isToggledBackground &&
_selectionStyle.attributes["background"]!.value == '#ffffff'; _selectionStyle.attributes['background']!.value == '#ffffff';
widget.controller.addListener(_didChangeEditingValue); widget.controller.addListener(_didChangeEditingValue);
} }
@ -692,9 +692,9 @@ class _ColorButtonState extends State<ColorButton> {
_isToggledBackground = _isToggledBackground =
_getIsToggledBackground(_selectionStyle.attributes); _getIsToggledBackground(_selectionStyle.attributes);
_isWhite = _isToggledColor && _isWhite = _isToggledColor &&
_selectionStyle.attributes["color"]!.value == '#ffffff'; _selectionStyle.attributes['color']!.value == '#ffffff';
_isWhitebackground = _isToggledBackground && _isWhitebackground = _isToggledBackground &&
_selectionStyle.attributes["background"]!.value == '#ffffff'; _selectionStyle.attributes['background']!.value == '#ffffff';
} }
} }
@ -708,12 +708,12 @@ class _ColorButtonState extends State<ColorButton> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
Color? iconColor = _isToggledColor && !widget.background && !_isWhite Color? iconColor = _isToggledColor && !widget.background && !_isWhite
? stringToColor(_selectionStyle.attributes["color"]!.value) ? stringToColor(_selectionStyle.attributes['color']!.value)
: theme.iconTheme.color; : theme.iconTheme.color;
Color? iconColorBackground = var iconColorBackground =
_isToggledBackground && widget.background && !_isWhitebackground _isToggledBackground && widget.background && !_isWhitebackground
? stringToColor(_selectionStyle.attributes["background"]!.value) ? stringToColor(_selectionStyle.attributes['background']!.value)
: theme.iconTheme.color; : theme.iconTheme.color;
Color fillColor = _isToggledColor && !widget.background && _isWhite Color fillColor = _isToggledColor && !widget.background && _isWhite
@ -747,7 +747,7 @@ class _ColorButtonState extends State<ColorButton> {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
_showColorPicker() { void _showColorPicker() {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) => AlertDialog(
@ -755,7 +755,7 @@ class _ColorButtonState extends State<ColorButton> {
backgroundColor: Theme.of(context).canvasColor, backgroundColor: Theme.of(context).canvasColor,
content: SingleChildScrollView( content: SingleChildScrollView(
child: MaterialPicker( child: MaterialPicker(
pickerColor: Color(0), pickerColor: Color(0x00000000),
onColorChanged: _changeColor, onColorChanged: _changeColor,
), ),
)), )),
@ -1190,7 +1190,6 @@ class QuillIconButton extends StatelessWidget {
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints.tightFor(width: size, height: size), constraints: BoxConstraints.tightFor(width: size, height: size),
child: RawMaterialButton( child: RawMaterialButton(
child: icon,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -1199,6 +1198,7 @@ class QuillIconButton extends StatelessWidget {
hoverElevation: hoverElevation, hoverElevation: hoverElevation,
highlightElevation: hoverElevation, highlightElevation: hoverElevation,
onPressed: onPressed, onPressed: onPressed,
child: icon,
), ),
); );
} }
@ -1236,7 +1236,6 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints.tightFor(height: widget.height), constraints: BoxConstraints.tightFor(height: widget.height),
child: RawMaterialButton( child: RawMaterialButton(
child: _buildContent(context),
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -1245,6 +1244,7 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
hoverElevation: widget.hoverElevation, hoverElevation: widget.hoverElevation,
highlightElevation: widget.hoverElevation, highlightElevation: widget.hoverElevation,
onPressed: _showMenu, onPressed: _showMenu,
child: _buildContent(context),
), ),
); );
} }

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: One client and affiliated collaborator of Flutter Quill is Bullet Journal App. description: Rich text editor (Demo App https://bulletjournal.us/home/index.html ).
version: 1.1.1 version: 1.1.2
#author: bulletjournal #author: bulletjournal
homepage: https://bulletjournal.us/home/index.html homepage: https://bulletjournal.us/home/index.html
repository: https://github.com/singerdmx/flutter-quill repository: https://github.com/singerdmx/flutter-quill
@ -25,6 +25,7 @@ dependencies:
tuple: ^2.0.0 tuple: ^2.0.0
universal_html: ^2.0.4 universal_html: ^2.0.4
url_launcher: ^6.0.2 url_launcher: ^6.0.2
pedantic: ^1.11.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save