Skip to content

Commit

Permalink
feat: adding grouping to selections
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo committed Jul 26, 2024
1 parent 1a449b9 commit da74168
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 182 deletions.
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());
},
),
],
),
],
),
);
}
}
Loading

0 comments on commit da74168

Please sign in to comment.