Remove horizontal line support

pull/602/head
X Code 3 years ago
parent c99d84528e
commit 09e369ae70
  1. 3
      lib/src/models/documents/nodes/embed.dart
  2. 13
      lib/src/widgets/toolbar.dart
  3. 50
      lib/src/widgets/toolbar/insert_horizontal_line_button.dart

@ -34,9 +34,6 @@ class Embeddable {
class BlockEmbed extends Embeddable {
const BlockEmbed(String type, String data) : super(type, data);
static const String horizontalRuleType = 'divider';
static BlockEmbed horizontalRule = const BlockEmbed(horizontalRuleType, 'hr');
static const String imageType = 'image';
static BlockEmbed image(String imageUrl) => BlockEmbed(imageType, imageUrl);

@ -15,7 +15,6 @@ import 'toolbar/history_button.dart';
import 'toolbar/image_button.dart';
import 'toolbar/image_video_utils.dart';
import 'toolbar/indent_button.dart';
import 'toolbar/insert_horizontal_line_button.dart';
import 'toolbar/link_style_button.dart';
import 'toolbar/select_alignment_button.dart';
import 'toolbar/select_header_style_button.dart';
@ -29,7 +28,6 @@ export 'toolbar/history_button.dart';
export 'toolbar/image_button.dart';
export 'toolbar/image_video_utils.dart';
export 'toolbar/indent_button.dart';
export 'toolbar/insert_horizontal_line_button.dart';
export 'toolbar/link_style_button.dart';
export 'toolbar/quill_dropdown_button.dart';
export 'toolbar/quill_icon_button.dart';
@ -97,7 +95,6 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
bool showIndent = true,
bool showLink = true,
bool showHistory = true,
bool showHorizontalRule = false,
bool multiRowsDisplay = true,
bool showImageButton = true,
bool showVideoButton = true,
@ -147,7 +144,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
showHeaderStyle,
showListNumbers || showListBullets || showListCheck || showCodeBlock,
showQuote || showIndent,
showLink || showHorizontalRule
showLink
];
return QuillToolbar(
@ -409,14 +406,6 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
iconTheme: iconTheme,
dialogTheme: dialogTheme,
),
if (showHorizontalRule)
// ignore: deprecated_member_use_from_same_package
InsertHorizontalLineButton(
controller: controller,
icon: Icons.horizontal_rule,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
),
],
);
}

@ -1,50 +0,0 @@
import 'package:flutter/material.dart';
import '../../models/documents/nodes/embed.dart';
import '../../models/themes/quill_icon_theme.dart';
import '../controller.dart';
import '../toolbar.dart';
@Deprecated('This is for horizontal line and not supported')
class InsertHorizontalLineButton extends StatelessWidget {
const InsertHorizontalLineButton({
required this.controller,
required this.icon,
this.iconSize = kDefaultIconSize,
this.fillColor,
this.iconTheme,
Key? key,
}) : super(key: key);
final QuillController controller;
final IconData icon;
final double iconSize;
final Color? fillColor;
final QuillIconTheme? iconTheme;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
final iconFillColor =
iconTheme?.iconUnselectedFillColor ?? (fillColor ?? theme.canvasColor);
return QuillIconButton(
highlightElevation: 0,
hoverElevation: 0,
size: iconSize * kIconButtonFactor,
icon: Icon(
icon,
size: iconSize,
color: iconColor,
),
fillColor: iconFillColor,
onPressed: () {
final index = controller.selection.baseOffset;
final length = controller.selection.extentOffset - index;
controller.replaceText(index, length, BlockEmbed.horizontalRule, null);
},
);
}
}
Loading…
Cancel
Save