@@ -29,6 +29,7 @@ class _SettingMemberBlurScreenshotPageState extends State<SettingMemberBlurScree
2929 final listData = < _ItemSettingMember > [];
3030
3131 var isLoadingButton = false ;
32+ var isOverride = false ;
3233
3334 @override
3435 void setState (VoidCallback fn) {
@@ -70,6 +71,7 @@ class _SettingMemberBlurScreenshotPageState extends State<SettingMemberBlurScree
7071 }
7172 widgetHelper.showSnackBar (context, errorMessage.hideResponseCode ());
7273 } else if (state is SuccessLoadAllUserSettingState ) {
74+ isOverride = state.response.isOverrideBlurScreenshot ?? false ;
7375 listData.clear ();
7476 for (final element in state.response.data ?? < UserSettingResponse > []) {
7577 final id = element.id ?? - 1 ;
@@ -121,48 +123,26 @@ class _SettingMemberBlurScreenshotPageState extends State<SettingMemberBlurScree
121123
122124 return Column (
123125 children: [
124- const SizedBox (height: 4 ),
125- Row (
126- children: [
127- Text (
128- 'member_n' .plural (listData.length),
129- style: Theme .of (context).textTheme.bodyMedium? .copyWith (
130- color: Colors .grey,
131- ),
132- ),
133- Expanded (
134- child: Container (),
135- ),
136- TextButton (
137- onPressed: () {
138- for (final itemData in listData) {
139- itemData.isEnableBlurScreenshot = false ;
140- }
141- setState (() {});
142- },
143- child: Text ('disable_all' .tr ()),
144- ),
145- Container (
146- width: 1 ,
147- height: 24 ,
148- color: Colors .grey,
149- margin: const EdgeInsets .symmetric (horizontal: 8 ),
150- ),
151- TextButton (
152- onPressed: () {
153- for (final itemData in listData) {
154- itemData.isEnableBlurScreenshot = true ;
155- }
156- setState (() {});
157- },
158- child: Text ('enable_all' .tr ()),
159- ),
160- ],
161- ),
162- const SizedBox (height: 4 ),
163- Expanded (
164- child: buildWidgetListData (),
165- ),
126+ SizedBox (height: helper.getDefaultPaddingLayoutTop),
127+ buildWidgetOverrideSetting (),
128+ isOverride
129+ ? Expanded (
130+ child: Column (
131+ children: [
132+ const SizedBox (height: 16 ),
133+ const Divider (),
134+ const SizedBox (height: 8 ),
135+ buildWidgetActionAll (),
136+ const SizedBox (height: 4 ),
137+ Expanded (
138+ child: buildWidgetListData (),
139+ ),
140+ ],
141+ ),
142+ )
143+ : Expanded (
144+ child: Container (),
145+ ),
166146 Padding (
167147 padding: EdgeInsets .only (
168148 top: 16 ,
@@ -190,18 +170,67 @@ class _SettingMemberBlurScreenshotPageState extends State<SettingMemberBlurScree
190170 );
191171 }
192172
193- void submit () {
194- final body = UserSettingBody (
195- data: listData
196- .map (
197- (e) => ItemUserSettingBody (
198- id: e.id,
199- isEnableBlurScreenshot: e.isEnableBlurScreenshot,
200- userId: e.userId,
201- ),
202- )
203- .toList (),
173+ Widget buildWidgetActionAll () {
174+ return Row (
175+ children: [
176+ Text (
177+ 'member_n' .plural (listData.length),
178+ style: Theme .of (context).textTheme.bodyMedium? .copyWith (
179+ color: Colors .grey,
180+ ),
181+ ),
182+ Expanded (
183+ child: Container (),
184+ ),
185+ TextButton (
186+ onPressed: () {
187+ for (final itemData in listData) {
188+ itemData.isEnableBlurScreenshot = false ;
189+ }
190+ setState (() {});
191+ },
192+ child: Text ('disable_all' .tr ()),
193+ ),
194+ Container (
195+ width: 1 ,
196+ height: 24 ,
197+ color: Colors .grey,
198+ margin: const EdgeInsets .symmetric (horizontal: 8 ),
199+ ),
200+ TextButton (
201+ onPressed: () {
202+ for (final itemData in listData) {
203+ itemData.isEnableBlurScreenshot = true ;
204+ }
205+ setState (() {});
206+ },
207+ child: Text ('enable_all' .tr ()),
208+ ),
209+ ],
204210 );
211+ }
212+
213+ void submit () {
214+ UserSettingBody body;
215+ if (isOverride) {
216+ body = UserSettingBody (
217+ data: listData
218+ .map (
219+ (e) => ItemUserSettingBody (
220+ id: e.id,
221+ isEnableBlurScreenshot: e.isEnableBlurScreenshot,
222+ userId: e.userId,
223+ ),
224+ )
225+ .toList (),
226+ isOverrideBlurScreenshot: isOverride,
227+ );
228+ } else {
229+ body = UserSettingBody (
230+ data: [],
231+ isOverrideBlurScreenshot: false ,
232+ );
233+ }
205234 settingBloc.add (
206235 UpdateUserSettingEvent (
207236 body: body,
@@ -237,6 +266,39 @@ class _SettingMemberBlurScreenshotPageState extends State<SettingMemberBlurScree
237266 itemCount: listData.length,
238267 );
239268 }
269+
270+ Widget buildWidgetOverrideSetting () {
271+ return Row (
272+ crossAxisAlignment: CrossAxisAlignment .start,
273+ children: [
274+ Expanded (
275+ child: Column (
276+ crossAxisAlignment: CrossAxisAlignment .start,
277+ children: [
278+ Text (
279+ 'override' .tr (),
280+ style: Theme .of (context).textTheme.bodyLarge,
281+ ),
282+ Text (
283+ 'description_override_member_blur_screenshot' .tr (),
284+ style: Theme .of (context).textTheme.bodyMedium? .copyWith (
285+ color: Colors .grey,
286+ ),
287+ ),
288+ ],
289+ ),
290+ ),
291+ const SizedBox (width: 16 ),
292+ Switch .adaptive (
293+ value: isOverride,
294+ activeColor: Theme .of (context).colorScheme.primary,
295+ onChanged: (value) {
296+ setState (() => isOverride = value);
297+ },
298+ ),
299+ ],
300+ );
301+ }
240302}
241303
242304class _ItemSettingMember {
0 commit comments