-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a449b9
commit da74168
Showing
6 changed files
with
412 additions
and
182 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
fire_atlas_editor/lib/screens/editor_screen/widgets/edit_selection_folder_modal.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import 'package:fire_atlas_editor/store/actions/atlas_actions.dart'; | ||
import 'package:fire_atlas_editor/store/actions/editor_actions.dart'; | ||
import 'package:fire_atlas_editor/store/store.dart'; | ||
import 'package:fire_atlas_editor/widgets/button.dart'; | ||
import 'package:fire_atlas_editor/widgets/text.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:slices/slices.dart'; | ||
|
||
class EditSelectionFolderModal extends StatefulWidget { | ||
const EditSelectionFolderModal({ | ||
required this.selectionId, | ||
this.folderId, | ||
super.key, | ||
}); | ||
|
||
final String selectionId; | ||
final String? folderId; | ||
|
||
@override | ||
State<EditSelectionFolderModal> createState() => | ||
_EditSelectionFolderModalState(); | ||
} | ||
|
||
class _EditSelectionFolderModalState extends State<EditSelectionFolderModal> { | ||
late final _groupTextController = TextEditingController() | ||
..value = TextEditingValue(text: widget.folderId ?? ''); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final store = SlicesProvider.of<FireAtlasState>(context); | ||
|
||
return Padding( | ||
padding: const EdgeInsets.all(16), | ||
child: Column( | ||
children: [ | ||
const FSubtitleTitle(title: 'Move to folder'), | ||
const SizedBox(height: 8), | ||
TextFormField( | ||
controller: _groupTextController, | ||
decoration: const InputDecoration( | ||
labelText: 'Folder name (leave empty to remove from folder)', | ||
), | ||
), | ||
const SizedBox(height: 8), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
FButton( | ||
label: 'Cancel', | ||
onSelect: () { | ||
store.dispatch(CloseEditorModal()); | ||
}, | ||
), | ||
const SizedBox(width: 5), | ||
FButton( | ||
selected: true, | ||
label: 'Ok', | ||
onSelect: () { | ||
store.dispatch( | ||
UpdateSelectionGroup( | ||
selectionId: widget.selectionId, | ||
group: _groupTextController.text.isEmpty | ||
? null | ||
: _groupTextController.text, | ||
), | ||
); | ||
store.dispatch(CloseEditorModal()); | ||
}, | ||
), | ||
], | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.