@@ -68,7 +68,6 @@ class _IconButtonControlState extends State<IconButtonControl>
6868 var highlightColor = widget.control.getColor ("highlight_color" , context);
6969 var selectedIconColor =
7070 widget.control.getColor ("selected_icon_color" , context);
71- var bgcolor = widget.control.getColor ("bgcolor" , context);
7271 var disabledColor = widget.control.getColor ("disabled_color" , context);
7372 var hoverColor = widget.control.getColor ("hover_color" , context);
7473 var splashColor = widget.control.getColor ("splash_color" , context);
@@ -82,15 +81,13 @@ class _IconButtonControlState extends State<IconButtonControl>
8281 var autofocus = widget.control.getBool ("autofocus" , false )! ;
8382 var enableFeedback = widget.control.getBool ("enable_feedback" , true )! ;
8483 var selected = widget.control.getBool ("selected" , false )! ;
85- var url = widget.control.getString ("url" );
86- var urlTarget = widget.control.getString ("url_target" );
8784 var mouseCursor = widget.control.getMouseCursor ("mouse_cursor" );
88- var visualDensity = widget.control.getVisualDensity ( "visual_density " );
85+ var url = widget.control.getUrl ( "url " );
8986
9087 Function ()? onPressed = ! widget.control.disabled
9188 ? () {
9289 if (url != null ) {
93- openWebBrowser (url, webWindowName : urlTarget );
90+ openWebBrowser (url);
9491 }
9592 widget.control.triggerEvent ("click" );
9693 }
@@ -109,7 +106,7 @@ class _IconButtonControlState extends State<IconButtonControl>
109106
110107 var theme = Theme .of (context);
111108 var style = parseButtonStyle (
112- widget.control.get ( "style" ) , Theme .of (context),
109+ widget.control.internals ? [ "style" ] , Theme .of (context),
113110 defaultForegroundColor: theme.colorScheme.primary,
114111 defaultBackgroundColor: Colors .transparent,
115112 defaultOverlayColor: Colors .transparent,
@@ -126,28 +123,74 @@ class _IconButtonControlState extends State<IconButtonControl>
126123 if (icon is Control ) {
127124 iconWidget = ControlWidget (control: icon);
128125 } else if (icon is int ) {
129- // Icon values are stored as raw integers (set_id << 16 | index) in this codebase.
130- iconWidget = Icon (
131- widget.control.getIconData ("icon" ),
132- color: iconColor,
133- );
126+ iconWidget = Icon (widget.control.getIconData ("icon" ), color: iconColor);
134127 } else if (content != null ) {
135128 iconWidget = ControlWidget (control: content);
136129 }
137130
138131 Widget ? selectedIconWidget;
139-
140132 if (selectedIcon is Control ) {
141133 selectedIconWidget = ControlWidget (control: selectedIcon);
142134 } else if (selectedIcon is int ) {
143- selectedIconWidget = Icon (
144- widget.control.getIconData ("selected_icon" ),
145- color: selectedIconColor,
146- );
135+ selectedIconWidget = Icon (widget.control.getIconData ("selected_icon" ),
136+ color: selectedIconColor);
147137 }
148138
149- if (iconWidget != null ) {
150- button = IconButton (
139+ if (iconWidget == null ) {
140+ return const ErrorControl (
141+ "IconButton must have either icon or a visible content specified." );
142+ }
143+
144+ var variant = widget.control.type;
145+
146+ if (variant == "FilledIconButton" ) {
147+ button = IconButton .filled (
148+ autofocus: autofocus,
149+ focusNode: _focusNode,
150+ highlightColor: highlightColor,
151+ disabledColor: disabledColor,
152+ hoverColor: hoverColor,
153+ enableFeedback: enableFeedback,
154+ padding: padding,
155+ alignment: alignment,
156+ focusColor: focusColor,
157+ splashColor: splashColor,
158+ splashRadius: splashRadius,
159+ icon: iconWidget,
160+ iconSize: iconSize,
161+ mouseCursor: mouseCursor,
162+ style: style,
163+ isSelected: selected,
164+ constraints: sizeConstraints,
165+ onLongPress: onLongPressHandler,
166+ onHover: onHoverHandler,
167+ selectedIcon: selectedIconWidget,
168+ onPressed: onPressed);
169+ } else if (variant == "FilledTonalIconButton" ) {
170+ button = IconButton .filledTonal (
171+ autofocus: autofocus,
172+ focusNode: _focusNode,
173+ highlightColor: highlightColor,
174+ disabledColor: disabledColor,
175+ hoverColor: hoverColor,
176+ enableFeedback: enableFeedback,
177+ padding: padding,
178+ alignment: alignment,
179+ focusColor: focusColor,
180+ splashColor: splashColor,
181+ splashRadius: splashRadius,
182+ icon: iconWidget,
183+ iconSize: iconSize,
184+ mouseCursor: mouseCursor,
185+ style: style,
186+ isSelected: selected,
187+ constraints: sizeConstraints,
188+ onLongPress: onLongPressHandler,
189+ onHover: onHoverHandler,
190+ selectedIcon: selectedIconWidget,
191+ onPressed: onPressed);
192+ } else if (variant == "OutlinedIconButton" ) {
193+ button = IconButton .outlined (
151194 autofocus: autofocus,
152195 focusNode: _focusNode,
153196 highlightColor: highlightColor,
@@ -162,7 +205,6 @@ class _IconButtonControlState extends State<IconButtonControl>
162205 icon: iconWidget,
163206 iconSize: iconSize,
164207 mouseCursor: mouseCursor,
165- visualDensity: visualDensity,
166208 style: style,
167209 isSelected: selected,
168210 constraints: sizeConstraints,
@@ -171,16 +213,28 @@ class _IconButtonControlState extends State<IconButtonControl>
171213 selectedIcon: selectedIconWidget,
172214 onPressed: onPressed);
173215 } else {
174- return const ErrorControl (
175- "IconButton must have either icon or a visible content specified." );
176- }
177-
178- if (bgcolor != null ) {
179- button = Container (
180- decoration:
181- ShapeDecoration (color: bgcolor, shape: const CircleBorder ()),
182- child: button,
183- );
216+ button = IconButton (
217+ autofocus: autofocus,
218+ focusNode: _focusNode,
219+ highlightColor: highlightColor,
220+ disabledColor: disabledColor,
221+ hoverColor: hoverColor,
222+ enableFeedback: enableFeedback,
223+ padding: padding,
224+ alignment: alignment,
225+ focusColor: focusColor,
226+ splashColor: splashColor,
227+ splashRadius: splashRadius,
228+ icon: iconWidget,
229+ iconSize: iconSize,
230+ mouseCursor: mouseCursor,
231+ style: style,
232+ isSelected: selected,
233+ constraints: sizeConstraints,
234+ onLongPress: onLongPressHandler,
235+ onHover: onHoverHandler,
236+ selectedIcon: selectedIconWidget,
237+ onPressed: onPressed);
184238 }
185239
186240 return ConstrainedControl (control: widget.control, child: button);
0 commit comments