forked from singerdmx/flutter-quill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Style custom toolbar buttons like builtins (singerdmx#1267)
- Loading branch information
1 parent
ba809c8
commit 3fb5b7a
Showing
6 changed files
with
93 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../models/themes/quill_icon_theme.dart'; | ||
import '../toolbar.dart'; | ||
|
||
class CustomButton extends StatelessWidget { | ||
const CustomButton({ | ||
required this.onPressed, | ||
required this.icon, | ||
this.iconColor, | ||
this.iconSize = kDefaultIconSize, | ||
this.iconTheme, | ||
this.afterButtonPressed, | ||
this.tooltip, | ||
Key? key, | ||
}) : super(key: key); | ||
|
||
final VoidCallback? onPressed; | ||
final IconData? icon; | ||
final Color? iconColor; | ||
final double iconSize; | ||
final QuillIconTheme? iconTheme; | ||
final VoidCallback? afterButtonPressed; | ||
final String? tooltip; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = Theme.of(context); | ||
|
||
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color; | ||
return QuillIconButton( | ||
highlightElevation: 0, | ||
hoverElevation: 0, | ||
size: iconSize * kIconButtonFactor, | ||
icon: Icon(icon, size: iconSize, color: iconColor), | ||
tooltip: tooltip, | ||
borderRadius: iconTheme?.borderRadius ?? 2, | ||
onPressed: onPressed, | ||
afterPressed: afterButtonPressed, | ||
fillColor: iconTheme?.iconUnselectedFillColor ?? theme.canvasColor, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters