@@ -75,7 +75,6 @@ class _CreateUpdateRestrictionGroupState
7575
7676 @override
7777 Widget build (BuildContext context) {
78- final isUpdating = widget.group != null ;
7978 final timeSpent = ref
8079 .watch (todaysAppsUsageProvider.select (
8180 (v) => v.value? .entries
@@ -105,36 +104,21 @@ class _CreateUpdateRestrictionGroupState
105104 icon: FluentIcons .tab_desktop_bottom_20_regular,
106105 filledIcon: FluentIcons .tab_desktop_bottom_20_filled,
107106 titleText: _group.groupName,
108- fab: Column (
109- mainAxisAlignment: MainAxisAlignment .end,
110- crossAxisAlignment: CrossAxisAlignment .end,
111- children: [
112- /// Create OR Update FAB
113- DefaultFabButton (
114- heroTag: widget.group == null
115- ? null
116- : HeroTags .updateRestrictionGroupTag (_group.id),
117- icon: widget.group == null
118- ? FluentIcons .add_20_filled
119- : FluentIcons .arrow_upload_20_filled,
120- label: widget.group == null
121- ? context.locale.create_button
122- : context.locale.update_button,
123- onPressed: widget.group == null
124- ? _createNewGroup
125- : _updateCurrentGroup,
126- ),
127- 8. vBox,
128-
129- /// Delete FAB
130- if (isUpdating)
131- DefaultFabButton (
132- heroTag: HeroTags .removeRestrictionGroupTag (_group.id),
133- icon: FluentIcons .delete_20_filled,
134- label: context.locale.dialog_button_remove,
135- onPressed: _deleteCurrentGroup,
136- ),
137- ],
107+
108+ /// Create OR Update FAB
109+ fab: DefaultFabButton (
110+ heroTag: widget.group == null
111+ ? null
112+ : HeroTags .updateRestrictionGroupTag (_group.id),
113+ icon: widget.group == null
114+ ? FluentIcons .add_20_filled
115+ : FluentIcons .arrow_upload_20_filled,
116+ label: widget.group == null
117+ ? context.locale.create_button
118+ : context.locale.update_button,
119+ onPressed: widget.group == null
120+ ? _createNewGroup
121+ : _updateCurrentGroup,
138122 ),
139123 sliverBody: CustomScrollView (
140124 physics: const BouncingScrollPhysics (),
@@ -372,43 +356,6 @@ class _CreateUpdateRestrictionGroupState
372356 if (pop) _goBack ();
373357 }
374358
375- void _deleteCurrentGroup () async {
376- /// Return if cannot delete
377- if (! widget.canUpdateTimer || ! widget.canUpdateActivePeriod) {
378- context.showSnackAlert (
379- context.locale.invincible_mode_snack_alert,
380- );
381- return ;
382- }
383-
384- /// Confirm first
385- final confirm = await showConfirmationDialog (
386- context: context,
387- heroTag: HeroTags .removeRestrictionGroupTag (_group.id),
388- title: context.locale.remove_restriction_group_dialog_title,
389- info:
390- context.locale.remove_restriction_group_dialog_info (_group.groupName),
391- icon: FluentIcons .delete_20_filled,
392- positiveLabel: context.locale.dialog_button_remove,
393- );
394-
395- if (! confirm) return ;
396-
397- /// update associated apps and remove group
398- await _updateAssociatedApps (
399- {
400- ..._group.distractingApps,
401-
402- /// if user modified the group before removing
403- ...widget.group? .distractingApps ?? [],
404- }.toList (),
405- null ,
406- );
407- ref.read (restrictionGroupsProvider.notifier).removeGroup (group: _group);
408-
409- _goBack ();
410- }
411-
412359 bool _checkIfGroupIsValid () {
413360 if (_group.distractingApps.isEmpty) {
414361 context
0 commit comments