This commit is contained in:
My-Responsitories
2026-02-27 16:07:24 +08:00
parent 4dbb35307f
commit 7ee6d1e905
9 changed files with 50 additions and 161 deletions

View File

@@ -20,20 +20,16 @@ class DisabledIcon extends SingleChildRenderObjectWidget {
final StrokeCap strokeCap;
final double lineLengthScale;
Icon? get _icon => child is Icon ? child as Icon : null;
@override
RenderObject createRenderObject(BuildContext context) {
late final iconTheme = IconTheme.of(context);
final icon = _icon;
return RenderMaskedIcon(
disable: disable,
iconSize:
iconSize ??
(child is Icon ? (child as Icon).size : null) ??
iconTheme.size ??
24.0,
color:
color ??
(child is Icon ? (child as Icon).color : null) ??
iconTheme.color!,
iconSize: iconSize ?? icon?.size ?? iconTheme.size ?? 24.0,
color: color ?? icon?.color ?? iconTheme.color!,
strokeCap: strokeCap,
lineLengthScale: lineLengthScale,
);
@@ -42,17 +38,11 @@ class DisabledIcon extends SingleChildRenderObjectWidget {
@override
void updateRenderObject(BuildContext context, RenderMaskedIcon renderObject) {
late final iconTheme = IconTheme.of(context);
final icon = _icon;
renderObject
..disable = disable
..iconSize =
iconSize ??
(child is Icon ? (child as Icon).size : null) ??
iconTheme.size ??
24.0
..color =
color ??
(child is Icon ? (child as Icon).color : null) ??
iconTheme.color!
..iconSize = iconSize ?? icon?.size ?? iconTheme.size ?? 24.0
..color = color ?? icon?.color ?? iconTheme.color!
..strokeCap = strokeCap
..lineLengthScale = lineLengthScale;
}