@@ -33,64 +33,82 @@ class CommunityConfigForm extends StatelessWidget {
3333 final subtitleStyle = Theme .of (context).textTheme.bodySmall? .copyWith (
3434 color: Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
3535 );
36+ final communityConfig = remoteConfig.features.community;
3637
3738 return Column (
3839 crossAxisAlignment: CrossAxisAlignment .start,
3940 children: [
40- ExpansionTile (
41- title: Text (l10n.userEngagementTitle),
42- subtitle: Text (
43- l10n.userEngagementDescription,
44- style: subtitleStyle,
45- ),
46- childrenPadding: const EdgeInsetsDirectional .only (
47- start: AppSpacing .lg,
48- top: AppSpacing .md,
49- bottom: AppSpacing .md,
50- ),
51- expandedCrossAxisAlignment: CrossAxisAlignment .start,
52- children: [
53- EngagementSettingsForm (
54- remoteConfig: remoteConfig,
55- onConfigChanged: onConfigChanged,
56- ),
57- ],
41+ SwitchListTile (
42+ title: Text (l10n.enableCommunityFeaturesLabel),
43+ subtitle: Text (l10n.enableCommunityFeaturesDescription),
44+ value: communityConfig.enabled,
45+ onChanged: (value) {
46+ onConfigChanged (
47+ remoteConfig.copyWith (
48+ features: remoteConfig.features.copyWith (
49+ community: communityConfig.copyWith (enabled: value),
50+ ),
51+ ),
52+ );
53+ },
5854 ),
59- const SizedBox (height: AppSpacing .lg),
60- ExpansionTile (
61- title: Text (l10n.contentReportingTitle),
62- subtitle: Text (
63- l10n.contentReportingDescription,
64- style: subtitleStyle,
65- ),
66- childrenPadding: const EdgeInsetsDirectional .only (
67- start: AppSpacing .lg,
68- top: AppSpacing .md,
69- bottom: AppSpacing .md,
55+ if (communityConfig.enabled) ...[
56+ const SizedBox (height: AppSpacing .lg),
57+ ExpansionTile (
58+ title: Text (l10n.userEngagementTitle),
59+ subtitle: Text (
60+ l10n.userEngagementDescription,
61+ style: subtitleStyle,
62+ ),
63+ childrenPadding: const EdgeInsetsDirectional .only (
64+ start: AppSpacing .lg,
65+ top: AppSpacing .md,
66+ bottom: AppSpacing .md,
67+ ),
68+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
69+ children: [
70+ EngagementSettingsForm (
71+ remoteConfig: remoteConfig,
72+ onConfigChanged: onConfigChanged,
73+ ),
74+ ],
7075 ),
71- expandedCrossAxisAlignment: CrossAxisAlignment .start,
72- children: [
73- ReportingSettingsForm (
74- remoteConfig: remoteConfig,
75- onConfigChanged: onConfigChanged,
76+ const SizedBox (height: AppSpacing .lg),
77+ ExpansionTile (
78+ title: Text (l10n.contentReportingTitle),
79+ subtitle: Text (
80+ l10n.contentReportingDescription,
81+ style: subtitleStyle,
7682 ),
77- ],
78- ),
79- const SizedBox (height: AppSpacing .lg),
80- ExpansionTile (
81- title: Text (l10n.appReviewFunnelTitle),
82- subtitle: Text (
83- l10n.appReviewFunnelDescription,
84- style: subtitleStyle,
83+ childrenPadding: const EdgeInsetsDirectional .only (
84+ start: AppSpacing .lg,
85+ top: AppSpacing .md,
86+ bottom: AppSpacing .md,
87+ ),
88+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
89+ children: [
90+ ReportingSettingsForm (
91+ remoteConfig: remoteConfig,
92+ onConfigChanged: onConfigChanged,
93+ ),
94+ ],
8595 ),
86- expandedCrossAxisAlignment: CrossAxisAlignment .start,
87- children: [
88- AppReviewSettingsForm (
89- remoteConfig: remoteConfig,
90- onConfigChanged: onConfigChanged,
96+ const SizedBox (height: AppSpacing .lg),
97+ ExpansionTile (
98+ title: Text (l10n.appReviewFunnelTitle),
99+ subtitle: Text (
100+ l10n.appReviewFunnelDescription,
101+ style: subtitleStyle,
91102 ),
92- ],
93- ),
103+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
104+ children: [
105+ AppReviewSettingsForm (
106+ remoteConfig: remoteConfig,
107+ onConfigChanged: onConfigChanged,
108+ ),
109+ ],
110+ ),
111+ ],
94112 ],
95113 );
96114 }
0 commit comments