@@ -39,7 +39,7 @@ class _FeedAdSettingsFormState extends State<FeedAdSettingsForm>
3939 /// Controllers for ad placement interval fields, mapped by user role.
4040 /// These are used to manage text input for each role's ad placement interval.
4141 late final Map <AppUserRole , TextEditingController >
42- _adPlacementIntervalControllers;
42+ _adPlacementIntervalControllers;
4343
4444 @override
4545 void initState () {
@@ -59,20 +59,26 @@ class _FeedAdSettingsFormState extends State<FeedAdSettingsForm>
5959 final feedAdConfig = widget.remoteConfig.adConfig.feedAdConfiguration;
6060 _adFrequencyControllers = {
6161 for (final role in AppUserRole .values)
62- role: TextEditingController (
63- text: _getAdFrequency (feedAdConfig, role).toString (),
64- )..selection = TextSelection .collapsed (
65- offset: _getAdFrequency (feedAdConfig, role).toString ().length,
66- ),
62+ role:
63+ TextEditingController (
64+ text: _getAdFrequency (feedAdConfig, role).toString (),
65+ )
66+ ..selection = TextSelection .collapsed (
67+ offset: _getAdFrequency (feedAdConfig, role).toString ().length,
68+ ),
6769 };
6870 _adPlacementIntervalControllers = {
6971 for (final role in AppUserRole .values)
70- role: TextEditingController (
71- text: _getAdPlacementInterval (feedAdConfig, role).toString (),
72- )..selection = TextSelection .collapsed (
73- offset:
74- _getAdPlacementInterval (feedAdConfig, role).toString ().length,
75- ),
72+ role:
73+ TextEditingController (
74+ text: _getAdPlacementInterval (feedAdConfig, role).toString (),
75+ )
76+ ..selection = TextSelection .collapsed (
77+ offset: _getAdPlacementInterval (
78+ feedAdConfig,
79+ role,
80+ ).toString ().length,
81+ ),
7682 };
7783 }
7884
@@ -89,20 +95,21 @@ class _FeedAdSettingsFormState extends State<FeedAdSettingsForm>
8995 );
9096 }
9197
92- final newPlacementIntervalValue =
93- _getAdPlacementInterval (feedAdConfig, role).toString ();
98+ final newPlacementIntervalValue = _getAdPlacementInterval (
99+ feedAdConfig,
100+ role,
101+ ).toString ();
94102 if (_adPlacementIntervalControllers[role]? .text !=
95103 newPlacementIntervalValue) {
96104 _adPlacementIntervalControllers[role]? .text = newPlacementIntervalValue;
97105 _adPlacementIntervalControllers[role]? .selection =
98106 TextSelection .collapsed (
99- offset: newPlacementIntervalValue.length,
100- );
107+ offset: newPlacementIntervalValue.length,
108+ );
101109 }
102110 }
103111 }
104112
105- 106113 @override
107114 void didUpdateWidget (covariant FeedAdSettingsForm oldWidget) {
108115 super .didUpdateWidget (oldWidget);
@@ -233,7 +240,7 @@ class _FeedAdSettingsFormState extends State<FeedAdSettingsForm>
233240 ),
234241 const SizedBox (height: AppSpacing .lg),
235242 SizedBox (
236- height: 350 ,// Increased height for better spacing
243+ height: 350 ,
237244 child: TabBarView (
238245 controller: _tabController,
239246 children: AppUserRole .values
@@ -271,10 +278,9 @@ class _FeedAdSettingsFormState extends State<FeedAdSettingsForm>
271278 children: [
272279 SwitchListTile (
273280 title: Text (l10n.visibleToRoleLabel (role.l10n (context))),
274- value: roleConfig != null ,// Value is true if roleConfig exists
281+ value: roleConfig != null ,
275282 onChanged: (value) {
276- final newVisibleTo =
277- Map <AppUserRole , FeedAdFrequencyConfig >.from (
283+ final newVisibleTo = Map <AppUserRole , FeedAdFrequencyConfig >.from (
278284 config.visibleTo,
279285 );
280286 if (value) {
@@ -310,12 +316,13 @@ class _FeedAdSettingsFormState extends State<FeedAdSettingsForm>
310316 description: l10n.adFrequencyDescription,
311317 value: roleConfig.adFrequency,
312318 onChanged: (value) {
313- final newRoleConfig =
314- roleConfig.copyWith (adFrequency: value);
319+ final newRoleConfig = roleConfig.copyWith (
320+ adFrequency: value,
321+ );
315322 final newVisibleTo =
316323 Map <AppUserRole , FeedAdFrequencyConfig >.from (
317- config.visibleTo,
318- )..[role] = newRoleConfig;
324+ config.visibleTo,
325+ )..[role] = newRoleConfig;
319326 widget.onConfigChanged (
320327 widget.remoteConfig.copyWith (
321328 adConfig: widget.remoteConfig.adConfig.copyWith (
@@ -333,12 +340,13 @@ class _FeedAdSettingsFormState extends State<FeedAdSettingsForm>
333340 description: l10n.adPlacementIntervalDescription,
334341 value: roleConfig.adPlacementInterval,
335342 onChanged: (value) {
336- final newRoleConfig =
337- roleConfig.copyWith (adPlacementInterval: value);
343+ final newRoleConfig = roleConfig.copyWith (
344+ adPlacementInterval: value,
345+ );
338346 final newVisibleTo =
339347 Map <AppUserRole , FeedAdFrequencyConfig >.from (
340- config.visibleTo,
341- )..[role] = newRoleConfig;
348+ config.visibleTo,
349+ )..[role] = newRoleConfig;
342350 widget.onConfigChanged (
343351 widget.remoteConfig.copyWith (
344352 adConfig: widget.remoteConfig.adConfig.copyWith (
0 commit comments