@@ -177,12 +177,15 @@ void main() {
177177 expect (map['icon' ], 'info.circle' );
178178 });
179179
180- test ('toNativeMap returns empty map when only icon is provided' , () {
180+ test ('toNativeMap returns only spacerAfter when only icon is provided' , () {
181181 final action = AdaptiveAppBarAction (icon: Icons .info, onPressed: () {});
182182
183183 final map = action.toNativeMap ();
184184
185- expect (map.isEmpty, isTrue);
185+ expect (map.containsKey ('icon' ), isFalse);
186+ expect (map.containsKey ('title' ), isFalse);
187+ expect (map.containsKey ('spacerAfter' ), isTrue);
188+ expect (map['spacerAfter' ], 0 ); // Default is ToolbarSpacerType.none
186189 });
187190
188191 test ('equality ignores onPressed callback' , () {
@@ -196,5 +199,40 @@ void main() {
196199 // Equality should only check iosSymbol, icon, and title
197200 expect (action1, equals (action2));
198201 });
202+
203+ test ('toNativeMap includes spacerAfter as none by default' , () {
204+ final action = AdaptiveAppBarAction (
205+ iosSymbol: 'info.circle' ,
206+ onPressed: () {},
207+ );
208+
209+ final map = action.toNativeMap ();
210+
211+ expect (map['spacerAfter' ], 0 ); // ToolbarSpacerType.none.index
212+ });
213+
214+ test ('toNativeMap includes spacerAfter as fixed' , () {
215+ final action = AdaptiveAppBarAction (
216+ iosSymbol: 'info.circle' ,
217+ onPressed: () {},
218+ spacerAfter: ToolbarSpacerType .fixed,
219+ );
220+
221+ final map = action.toNativeMap ();
222+
223+ expect (map['spacerAfter' ], 1 ); // ToolbarSpacerType.fixed.index
224+ });
225+
226+ test ('toNativeMap includes spacerAfter as flexible' , () {
227+ final action = AdaptiveAppBarAction (
228+ iosSymbol: 'info.circle' ,
229+ onPressed: () {},
230+ spacerAfter: ToolbarSpacerType .flexible,
231+ );
232+
233+ final map = action.toNativeMap ();
234+
235+ expect (map['spacerAfter' ], 2 ); // ToolbarSpacerType.flexible.index
236+ });
199237 });
200238}
0 commit comments