pull/1566/head
parent
b513bf21b1
commit
b07448420f
15 changed files with 30 additions and 115 deletions
@ -1,54 +1,32 @@ |
|||||||
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.size = 40, |
||||||
this.fillColor, |
|
||||||
this.hoverElevation = 1, |
|
||||||
this.highlightElevation = 1, |
|
||||||
this.borderRadius = 2, |
|
||||||
this.tooltip, |
this.tooltip, |
||||||
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 double size; |
||||||
final Color? fillColor; |
|
||||||
final double hoverElevation; |
|
||||||
final double highlightElevation; |
|
||||||
final double borderRadius; |
|
||||||
final String? tooltip; |
final String? tooltip; |
||||||
|
final bool isFilled; |
||||||
|
|
||||||
@override |
@override |
||||||
Widget build(BuildContext context) { |
Widget build(BuildContext context) { |
||||||
return ConstrainedBox( |
if (isFilled) { |
||||||
constraints: BoxConstraints.tightFor(width: size, height: size), |
return IconButton.filled(onPressed: onPressed, icon: icon); |
||||||
child: UtilityWidgets.maybeTooltip( |
} |
||||||
message: tooltip, |
return IconButton( |
||||||
child: RawMaterialButton( |
onPressed: onPressed, |
||||||
visualDensity: VisualDensity.compact, |
icon: icon, |
||||||
shape: RoundedRectangleBorder( |
|
||||||
borderRadius: BorderRadius.circular(borderRadius), |
|
||||||
), |
|
||||||
fillColor: fillColor, |
|
||||||
elevation: 0, |
|
||||||
hoverElevation: hoverElevation, |
|
||||||
highlightElevation: hoverElevation, |
|
||||||
onPressed: () { |
|
||||||
onPressed?.call(); |
|
||||||
afterPressed?.call(); |
|
||||||
}, |
|
||||||
child: icon, |
|
||||||
), |
|
||||||
), |
|
||||||
); |
); |
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue