parent
a35c5cf93c
commit
9db3efc308
2 changed files with 48 additions and 23 deletions
@ -1,40 +1,54 @@ |
|||||||
import 'package:flutter/material.dart'; |
import 'package:flutter/material.dart'; |
||||||
|
|
||||||
|
import '../../../utils/widgets.dart'; |
||||||
|
|
||||||
class QuillToolbarIconButton extends StatelessWidget { |
class QuillToolbarIconButton extends StatelessWidget { |
||||||
const QuillToolbarIconButton({ |
const QuillToolbarIconButton({ |
||||||
required this.onPressed, |
required this.onPressed, |
||||||
required this.icon, |
|
||||||
required this.isFilled, |
|
||||||
this.afterPressed, |
this.afterPressed, |
||||||
|
this.icon, |
||||||
|
this.size = 40, |
||||||
|
this.fillColor, |
||||||
|
this.hoverElevation = 1, |
||||||
|
this.highlightElevation = 1, |
||||||
|
this.borderRadius = 2, |
||||||
this.tooltip, |
this.tooltip, |
||||||
this.padding, |
|
||||||
super.key, |
super.key, |
||||||
}); |
}); |
||||||
|
|
||||||
final VoidCallback? onPressed; |
final VoidCallback? onPressed; |
||||||
final VoidCallback? afterPressed; |
final VoidCallback? afterPressed; |
||||||
final Widget icon; |
final Widget? icon; |
||||||
|
|
||||||
|
final double size; |
||||||
|
final Color? fillColor; |
||||||
|
final double hoverElevation; |
||||||
|
final double highlightElevation; |
||||||
|
final double borderRadius; |
||||||
final String? tooltip; |
final String? tooltip; |
||||||
final EdgeInsets? padding; |
|
||||||
final bool isFilled; |
|
||||||
|
|
||||||
@override |
@override |
||||||
Widget build(BuildContext context) { |
Widget build(BuildContext context) { |
||||||
if (isFilled) { |
return ConstrainedBox( |
||||||
return IconButton.filled( |
constraints: BoxConstraints.tightFor(width: size, height: size), |
||||||
padding: padding, |
child: UtilityWidgets.maybeTooltip( |
||||||
onPressed: onPressed, |
message: tooltip, |
||||||
icon: icon, |
child: RawMaterialButton( |
||||||
); |
visualDensity: VisualDensity.compact, |
||||||
} |
shape: RoundedRectangleBorder( |
||||||
return IconButton( |
borderRadius: BorderRadius.circular(borderRadius), |
||||||
padding: padding, |
), |
||||||
onPressed: () { |
fillColor: fillColor, |
||||||
onPressed?.call(); |
elevation: 0, |
||||||
afterPressed?.call(); |
hoverElevation: hoverElevation, |
||||||
}, |
highlightElevation: hoverElevation, |
||||||
icon: icon, |
onPressed: () { |
||||||
|
onPressed?.call(); |
||||||
|
afterPressed?.call(); |
||||||
|
}, |
||||||
|
child: icon, |
||||||
|
), |
||||||
|
), |
||||||
); |
); |
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue