Rich text editor for Flutter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

55 lines
1.5 KiB

import 'package:flutter/material.dart';
import '../../models/themes/quill_icon_theme.dart';
import '../controller.dart';
import '../toolbar.dart';
class IndentButton extends StatefulWidget {
const IndentButton({
required this.icon,
required this.controller,
required this.isIncrease,
this.iconSize = kDefaultIconSize,
this.iconTheme,
this.afterButtonPressed,
this.tooltip,
Key? key,
}) : super(key: key);
final IconData icon;
final double iconSize;
final QuillController controller;
final bool isIncrease;
final VoidCallback? afterButtonPressed;
final QuillIconTheme? iconTheme;
final String? tooltip;
@override
_IndentButtonState createState() => _IndentButtonState();
}
class _IndentButtonState extends State<IndentButton> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final iconColor =
widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
final iconFillColor =
widget.iconTheme?.iconUnselectedFillColor ?? theme.canvasColor;
return QuillIconButton(
tooltip: widget.tooltip,
highlightElevation: 0,
hoverElevation: 0,
size: widget.iconSize * kIconButtonFactor,
icon: Icon(widget.icon, size: widget.iconSize, color: iconColor),
fillColor: iconFillColor,
borderRadius: widget.iconTheme?.borderRadius ?? 2,
onPressed: () {
widget.controller.indentSelection(widget.isIncrease);
},
afterPressed: widget.afterButtonPressed,
);
}
}