Skip to content

Commit dbb48cb

Browse files
committed
refactor(app_configuration): remove ad platform config form disablement
- Remove AbsorbPointer and Opacity widgets that were used to disable the form - Keep the form structure and content intact - Update commit message to reflect the changes made to the code
1 parent 5acba58 commit dbb48cb

File tree

1 file changed

+108
-114
lines changed

1 file changed

+108
-114
lines changed

lib/app_configuration/widgets/ad_platform_config_form.dart

Lines changed: 108 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -212,134 +212,128 @@ class _AdPlatformConfigFormState extends State<AdPlatformConfigForm> {
212212
final l10n = AppLocalizationsX(context).l10n;
213213
final adConfig = widget.remoteConfig.adConfig;
214214

215-
return AbsorbPointer(
216-
absorbing: !adConfig.enabled,
217-
child: Opacity(
218-
opacity: adConfig.enabled ? 1.0 : 0.5,
219-
child: Column(
220-
crossAxisAlignment: CrossAxisAlignment.start,
215+
return Column(
216+
crossAxisAlignment: CrossAxisAlignment.start,
217+
children: [
218+
// Primary Ad Platform Selection
219+
ExpansionTile(
220+
title: Text(l10n.primaryAdPlatformTitle),
221+
childrenPadding: const EdgeInsetsDirectional.only(
222+
start: AppSpacing.lg, // Adjusted padding for hierarchy
223+
top: AppSpacing.md,
224+
bottom: AppSpacing.md,
225+
),
226+
expandedCrossAxisAlignment:
227+
CrossAxisAlignment.start, // Align content to start
221228
children: [
222-
// Primary Ad Platform Selection
223-
ExpansionTile(
224-
title: Text(l10n.primaryAdPlatformTitle),
225-
childrenPadding: const EdgeInsetsDirectional.only(
226-
start: AppSpacing.lg, // Adjusted padding for hierarchy
227-
top: AppSpacing.md,
228-
bottom: AppSpacing.md,
229+
Text(
230+
l10n.primaryAdPlatformDescription,
231+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
232+
color: Theme.of(
233+
context,
234+
).colorScheme.onSurface.withOpacity(0.7),
229235
),
230-
expandedCrossAxisAlignment:
231-
CrossAxisAlignment.start, // Align content to start
232-
children: [
233-
Text(
234-
l10n.primaryAdPlatformDescription,
235-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
236-
color: Theme.of(
237-
context,
238-
).colorScheme.onSurface.withOpacity(0.7),
236+
textAlign: TextAlign.start, // Ensure text aligns to start
237+
),
238+
const SizedBox(height: AppSpacing.lg),
239+
Align(
240+
alignment: AlignmentDirectional.centerStart,
241+
child: SegmentedButton<AdPlatformType>(
242+
style: SegmentedButton.styleFrom(
243+
shape: const RoundedRectangleBorder(
244+
borderRadius: BorderRadius.zero,
239245
),
240-
textAlign: TextAlign.start, // Ensure text aligns to start
241246
),
242-
const SizedBox(height: AppSpacing.lg),
243-
Align(
244-
alignment: AlignmentDirectional.centerStart,
245-
child: SegmentedButton<AdPlatformType>(
246-
style: SegmentedButton.styleFrom(
247-
shape: const RoundedRectangleBorder(
248-
borderRadius: BorderRadius.zero,
247+
segments: AdPlatformType.values
248+
.map(
249+
(platform) => ButtonSegment<AdPlatformType>(
250+
value: platform,
251+
label: Text(platform.l10n(context)),
252+
),
253+
)
254+
.toList(),
255+
selected: {_selectedPlatform},
256+
onSelectionChanged: (newSelection) {
257+
setState(() {
258+
_selectedPlatform = newSelection.first;
259+
});
260+
widget.onConfigChanged(
261+
widget.remoteConfig.copyWith(
262+
adConfig: adConfig.copyWith(
263+
primaryAdPlatform: newSelection.first,
249264
),
250265
),
251-
segments: AdPlatformType.values
252-
.map(
253-
(platform) => ButtonSegment<AdPlatformType>(
254-
value: platform,
255-
label: Text(platform.l10n(context)),
256-
),
257-
)
258-
.toList(),
259-
selected: {_selectedPlatform},
260-
onSelectionChanged: (newSelection) {
261-
setState(() {
262-
_selectedPlatform = newSelection.first;
263-
});
264-
widget.onConfigChanged(
265-
widget.remoteConfig.copyWith(
266-
adConfig: adConfig.copyWith(
267-
primaryAdPlatform: newSelection.first,
268-
),
269-
),
270-
);
271-
},
272-
),
273-
),
274-
],
266+
);
267+
},
268+
),
275269
),
276-
const SizedBox(height: AppSpacing.lg),
270+
],
271+
),
272+
const SizedBox(height: AppSpacing.lg),
277273

278-
// Ad Unit Identifiers
279-
ExpansionTile(
280-
title: Text(l10n.adUnitIdentifiersTitle),
281-
childrenPadding: const EdgeInsetsDirectional.only(
282-
start: AppSpacing.lg, // Adjusted padding for hierarchy
283-
top: AppSpacing.md,
284-
bottom: AppSpacing.md,
285-
),
286-
expandedCrossAxisAlignment:
287-
CrossAxisAlignment.start, // Align content to start
288-
children: [
289-
Text(
290-
l10n.adUnitIdentifiersDescription,
291-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
292-
color: Theme.of(
293-
context,
294-
).colorScheme.onSurface.withOpacity(0.7),
295-
),
296-
textAlign: TextAlign.start, // Ensure text aligns to start
297-
),
298-
const SizedBox(height: AppSpacing.lg),
299-
_buildAdUnitIdentifierFields(
274+
// Ad Unit Identifiers
275+
ExpansionTile(
276+
title: Text(l10n.adUnitIdentifiersTitle),
277+
childrenPadding: const EdgeInsetsDirectional.only(
278+
start: AppSpacing.lg, // Adjusted padding for hierarchy
279+
top: AppSpacing.md,
280+
bottom: AppSpacing.md,
281+
),
282+
expandedCrossAxisAlignment:
283+
CrossAxisAlignment.start, // Align content to start
284+
children: [
285+
Text(
286+
l10n.adUnitIdentifiersDescription,
287+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
288+
color: Theme.of(
300289
context,
301-
l10n,
302-
_selectedPlatform,
303-
adConfig,
304-
),
305-
],
290+
).colorScheme.onSurface.withOpacity(0.7),
291+
),
292+
textAlign: TextAlign.start, // Ensure text aligns to start
306293
),
307294
const SizedBox(height: AppSpacing.lg),
295+
_buildAdUnitIdentifierFields(
296+
context,
297+
l10n,
298+
_selectedPlatform,
299+
adConfig,
300+
),
301+
],
302+
),
303+
const SizedBox(height: AppSpacing.lg),
308304

309-
// Local Ad Management
310-
if (_selectedPlatform == AdPlatformType.local)
311-
ExpansionTile(
312-
title: Text(l10n.localAdManagementTitle),
313-
childrenPadding: const EdgeInsetsDirectional.only(
314-
start: AppSpacing.lg, // Adjusted padding for hierarchy
315-
top: AppSpacing.md,
316-
bottom: AppSpacing.md,
305+
// Local Ad Management
306+
if (_selectedPlatform == AdPlatformType.local)
307+
ExpansionTile(
308+
title: Text(l10n.localAdManagementTitle),
309+
childrenPadding: const EdgeInsetsDirectional.only(
310+
start: AppSpacing.lg, // Adjusted padding for hierarchy
311+
top: AppSpacing.md,
312+
bottom: AppSpacing.md,
313+
),
314+
expandedCrossAxisAlignment:
315+
CrossAxisAlignment.start, // Align content to start
316+
children: [
317+
Text(
318+
l10n.localAdManagementDescription,
319+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
320+
color: Theme.of(
321+
context,
322+
).colorScheme.onSurface.withOpacity(0.7),
317323
),
318-
expandedCrossAxisAlignment:
319-
CrossAxisAlignment.start, // Align content to start
320-
children: [
321-
Text(
322-
l10n.localAdManagementDescription,
323-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
324-
color: Theme.of(
325-
context,
326-
).colorScheme.onSurface.withOpacity(0.7),
327-
),
328-
textAlign: TextAlign.start, // Ensure text aligns to start
329-
),
330-
const SizedBox(height: AppSpacing.lg),
331-
Center(
332-
child: ElevatedButton(
333-
onPressed: () =>
334-
context.goNamed(Routes.localAdsManagementName),
335-
child: Text(l10n.manageLocalAdsButton),
336-
),
337-
),
338-
],
324+
textAlign: TextAlign.start, // Ensure text aligns to start
339325
),
340-
],
341-
),
342-
),
326+
const SizedBox(height: AppSpacing.lg),
327+
Center(
328+
child: ElevatedButton(
329+
onPressed: () =>
330+
context.goNamed(Routes.localAdsManagementName),
331+
child: Text(l10n.manageLocalAdsButton),
332+
),
333+
),
334+
],
335+
),
336+
],
343337
);
344338
}
345339

0 commit comments

Comments
 (0)