@@ -8,6 +8,7 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuratio
88import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuration/widgets/push_notification_settings_form.dart' ;
99import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart' ;
1010import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/feed_decorator_type_l10n.dart' ;
11+ import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/feed_item_click_behavior_l10n.dart' ;
1112import 'package:ui_kit/ui_kit.dart' ;
1213
1314/// {@template features_configuration_tab}
@@ -66,6 +67,12 @@ class _FeaturesConfigurationTabState extends State<FeaturesConfigurationTab> {
6667 _expandedTileIndex.value = isExpanded ? tileIndex : null ;
6768 },
6869 initiallyExpanded: expandedIndex == tileIndex,
70+ childrenPadding: const EdgeInsetsDirectional .only (
71+ start: AppSpacing .lg,
72+ top: AppSpacing .md,
73+ bottom: AppSpacing .md,
74+ ),
75+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
6976 children: [
7077 AdConfigForm (
7178 remoteConfig: widget.remoteConfig,
@@ -104,6 +111,12 @@ class _FeaturesConfigurationTabState extends State<FeaturesConfigurationTab> {
104111 _expandedTileIndex.value = isExpanded ? tileIndex : null ;
105112 },
106113 initiallyExpanded: expandedIndex == tileIndex,
114+ childrenPadding: const EdgeInsetsDirectional .only (
115+ start: AppSpacing .lg,
116+ top: AppSpacing .md,
117+ bottom: AppSpacing .md,
118+ ),
119+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
107120 children: [
108121 PushNotificationSettingsForm (
109122 remoteConfig: widget.remoteConfig,
@@ -115,54 +128,118 @@ class _FeaturesConfigurationTabState extends State<FeaturesConfigurationTab> {
115128 ),
116129 const SizedBox (height: AppSpacing .lg),
117130
118- // Feed Decorators
131+ // Feed
119132 ValueListenableBuilder <int ?>(
120133 valueListenable: _expandedTileIndex,
121134 builder: (context, expandedIndex, child) {
122135 const tileIndex = 2 ;
123136 return ExpansionTile (
124- key: ValueKey ('feedDecoratorsTile_$expandedIndex ' ),
125- title: Text (l10n.feedDecoratorsTitle),
137+ key: ValueKey ('feedTile_$expandedIndex ' ),
138+ title: Text (l10n.feedTab),
139+ onExpansionChanged: (isExpanded) {
140+ _expandedTileIndex.value = isExpanded ? tileIndex : null ;
141+ },
142+ initiallyExpanded: expandedIndex == tileIndex,
126143 childrenPadding: const EdgeInsetsDirectional .only (
127144 start: AppSpacing .lg,
128145 top: AppSpacing .md,
129146 bottom: AppSpacing .md,
130147 ),
131148 expandedCrossAxisAlignment: CrossAxisAlignment .start,
132- onExpansionChanged: (isExpanded) {
133- _expandedTileIndex.value = isExpanded ? tileIndex : null ;
134- },
135- initiallyExpanded: expandedIndex == tileIndex,
136149 children: [
137- Text (
138- l10n.feedDecoratorsDescription ,
139- style : Theme . of (context).textTheme.bodySmall ? . copyWith (
140- color : Theme . of (
141- context ,
142- ).colorScheme.onSurface. withOpacity ( 0.7 ) ,
150+ ExpansionTile (
151+ title : Text ( l10n.feedItemClickBehaviorTitle) ,
152+ childrenPadding : const EdgeInsetsDirectional . only (
153+ start : AppSpacing .lg,
154+ top : AppSpacing .md ,
155+ bottom : AppSpacing .md ,
143156 ),
157+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
158+ children: [
159+ Text (
160+ l10n.feedItemClickBehaviorDescription,
161+ style: Theme .of (context).textTheme.bodySmall? .copyWith (
162+ color: Theme .of (
163+ context,
164+ ).colorScheme.onSurface.withOpacity (0.7 ),
165+ ),
166+ ),
167+ const SizedBox (height: AppSpacing .lg),
168+ Align (
169+ alignment: AlignmentDirectional .centerStart,
170+ child: SegmentedButton <FeedItemClickBehavior >(
171+ segments: FeedItemClickBehavior .values
172+ .where (
173+ (b) => b != FeedItemClickBehavior .defaultBehavior,
174+ )
175+ .map (
176+ (behavior) =>
177+ ButtonSegment <FeedItemClickBehavior >(
178+ value: behavior,
179+ label: Text (behavior.l10n (context)),
180+ ),
181+ )
182+ .toList (),
183+ selected: {
184+ widget.remoteConfig.features.feed.itemClickBehavior,
185+ },
186+ onSelectionChanged: (newSelection) {
187+ widget.onConfigChanged (
188+ widget.remoteConfig.copyWith (
189+ features: widget.remoteConfig.features.copyWith (
190+ feed: widget.remoteConfig.features.feed
191+ .copyWith (
192+ itemClickBehavior: newSelection.first,
193+ ),
194+ ),
195+ ),
196+ );
197+ },
198+ ),
199+ ),
200+ ],
144201 ),
145202 const SizedBox (height: AppSpacing .lg),
146- for (final decoratorType in FeedDecoratorType .values)
147- Padding (
148- padding: const EdgeInsets .only (bottom: AppSpacing .md),
149- child: ExpansionTile (
150- title: Text (decoratorType.l10n (context)),
151- childrenPadding: const EdgeInsetsDirectional .only (
152- start: AppSpacing .xl,
153- top: AppSpacing .md,
154- bottom: AppSpacing .md,
203+ ExpansionTile (
204+ title: Text (l10n.feedDecoratorsTitle),
205+ childrenPadding: const EdgeInsetsDirectional .only (
206+ start: AppSpacing .lg,
207+ top: AppSpacing .md,
208+ bottom: AppSpacing .md,
209+ ),
210+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
211+ children: [
212+ Text (
213+ l10n.feedDecoratorsDescription,
214+ style: Theme .of (context).textTheme.bodySmall? .copyWith (
215+ color: Theme .of (
216+ context,
217+ ).colorScheme.onSurface.withOpacity (0.7 ),
155218 ),
156- expandedCrossAxisAlignment: CrossAxisAlignment .start,
157- children: [
158- FeedDecoratorForm (
159- decoratorType: decoratorType,
160- remoteConfig: widget.remoteConfig,
161- onConfigChanged: widget.onConfigChanged,
162- ),
163- ],
164219 ),
165- ),
220+ const SizedBox (height: AppSpacing .lg),
221+ for (final decoratorType in FeedDecoratorType .values)
222+ Padding (
223+ padding: const EdgeInsets .only (bottom: AppSpacing .md),
224+ child: ExpansionTile (
225+ title: Text (decoratorType.l10n (context)),
226+ childrenPadding: const EdgeInsetsDirectional .only (
227+ start: AppSpacing .xl,
228+ top: AppSpacing .md,
229+ bottom: AppSpacing .md,
230+ ),
231+ expandedCrossAxisAlignment: CrossAxisAlignment .start,
232+ children: [
233+ FeedDecoratorForm (
234+ decoratorType: decoratorType,
235+ remoteConfig: widget.remoteConfig,
236+ onConfigChanged: widget.onConfigChanged,
237+ ),
238+ ],
239+ ),
240+ ),
241+ ],
242+ ),
166243 ],
167244 );
168245 },
0 commit comments