Skip to content

Commit e5446ca

Browse files
committed
refactor(app_configuration): remove AbsorbPointer and Opacity widgets
- Remove AbsorbPointer and Opacity widgets to improve performance - Simplify the layout by using a single Column widget - Maintain the existing functionality and UI structure
1 parent ae3897a commit e5446ca

File tree

1 file changed

+63
-69
lines changed

1 file changed

+63
-69
lines changed

lib/app_configuration/widgets/interstitial_ad_settings_form.dart

Lines changed: 63 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -110,82 +110,76 @@ class _InterstitialAdSettingsFormState extends State<InterstitialAdSettingsForm>
110110
final adConfig = widget.remoteConfig.adConfig;
111111
final interstitialAdConfig = adConfig.interstitialAdConfiguration;
112112

113-
return AbsorbPointer(
114-
absorbing: !adConfig.enabled,
115-
child: Opacity(
116-
opacity: adConfig.enabled ? 1.0 : 0.5,
117-
child: Column(
118-
crossAxisAlignment: CrossAxisAlignment.start,
119-
children: [
120-
SwitchListTile(
121-
title: Text(l10n.enableInterstitialAdsLabel),
122-
value: interstitialAdConfig.enabled,
123-
onChanged: (value) {
124-
widget.onConfigChanged(
125-
widget.remoteConfig.copyWith(
126-
adConfig: adConfig.copyWith(
127-
interstitialAdConfiguration: interstitialAdConfig
128-
.copyWith(enabled: value),
129-
),
130-
),
131-
);
132-
},
133-
),
134-
ExpansionTile(
135-
title: Text(l10n.userRoleInterstitialFrequencyTitle),
136-
childrenPadding: const EdgeInsetsDirectional.only(
137-
start: AppSpacing.lg,
138-
top: AppSpacing.md,
139-
bottom: AppSpacing.md,
113+
return Column(
114+
crossAxisAlignment: CrossAxisAlignment.start,
115+
children: [
116+
SwitchListTile(
117+
title: Text(l10n.enableInterstitialAdsLabel),
118+
value: interstitialAdConfig.enabled,
119+
onChanged: (value) {
120+
widget.onConfigChanged(
121+
widget.remoteConfig.copyWith(
122+
adConfig: adConfig.copyWith(
123+
interstitialAdConfiguration: interstitialAdConfig
124+
.copyWith(enabled: value),
125+
),
140126
),
141-
expandedCrossAxisAlignment: CrossAxisAlignment.start,
142-
children: [
143-
Text(
144-
l10n.userRoleInterstitialFrequencyDescription,
145-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
146-
color: Theme.of(
127+
);
128+
},
129+
),
130+
ExpansionTile(
131+
title: Text(l10n.userRoleInterstitialFrequencyTitle),
132+
childrenPadding: const EdgeInsetsDirectional.only(
133+
start: AppSpacing.lg,
134+
top: AppSpacing.md,
135+
bottom: AppSpacing.md,
136+
),
137+
expandedCrossAxisAlignment: CrossAxisAlignment.start,
138+
children: [
139+
Text(
140+
l10n.userRoleInterstitialFrequencyDescription,
141+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
142+
color: Theme.of(
147143
context,
148144
).colorScheme.onSurface.withOpacity(0.7),
149-
),
150-
textAlign: TextAlign.start,
151-
),
152-
const SizedBox(height: AppSpacing.lg),
153-
Align(
154-
alignment: AlignmentDirectional.centerStart,
155-
child: SizedBox(
156-
height: kTextTabBarHeight,
157-
child: TabBar(
158-
controller: _tabController,
159-
tabAlignment: TabAlignment.start,
160-
isScrollable: true,
161-
tabs: AppUserRole.values
162-
.map((role) => Tab(text: role.l10n(context)))
163-
.toList(),
164-
),
165-
),
166-
),
167-
const SizedBox(height: AppSpacing.lg),
168-
SizedBox(
169-
height: 250, // Fixed height for TabBarView within a ListView
170-
child: TabBarView(
171-
controller: _tabController,
172-
children: AppUserRole.values
173-
.map(
174-
(role) => _buildInterstitialRoleSpecificFields(
175-
context,
176-
l10n,
177-
role,
178-
interstitialAdConfig,
179-
),
180-
)
181-
.toList(),
182-
),
145+
),
146+
textAlign: TextAlign.start,
147+
),
148+
const SizedBox(height: AppSpacing.lg),
149+
Align(
150+
alignment: AlignmentDirectional.centerStart,
151+
child: SizedBox(
152+
height: kTextTabBarHeight,
153+
child: TabBar(
154+
controller: _tabController,
155+
tabAlignment: TabAlignment.start,
156+
isScrollable: true,
157+
tabs: AppUserRole.values
158+
.map((role) => Tab(text: role.l10n(context)))
159+
.toList(),
183160
),
184-
],
161+
),
162+
),
163+
const SizedBox(height: AppSpacing.lg),
164+
SizedBox(
165+
height: 250, // Fixed height for TabBarView within a ListView
166+
child: TabBarView(
167+
controller: _tabController,
168+
children: AppUserRole.values
169+
.map(
170+
(role) => _buildInterstitialRoleSpecificFields(
171+
context,
172+
l10n,
173+
role,
174+
interstitialAdConfig,
175+
),
176+
)
177+
.toList(),
178+
),
185179
),
186180
],
187181
),
188-
),
182+
],
189183
);
190184
}
191185

0 commit comments

Comments
 (0)