-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: delete and duplicate selection (#937)
* feat: added duplication and deletion of selection * fix: added tooltips to selection options * refactor: shifting of duplicated selection * fix: typo in comment Co-authored-by: Adil Hanney <[email protected]> * fix: match duplication button in EditorPageManager Co-authored-by: Adil Hanney <[email protected]> * fix: match delete button in EditorPageManager Co-authored-by: Adil Hanney <[email protected]> * refactor: use conditional operator * refactor: use guard clauses and prevent unnecessary setState * refactor: rename SelectModal to SelectionBar * refactor: rename selectionOptions to selectionBar * fix: error in guard clause * fix: replace currentPageIndex with selectResult.pageIndex * fix: changed back to strokes.first.pageIndex becuase select.unselect() sets pageIndex to -1 * feat: only show selection options when selection is done * feat: unselect selection if selectionResullt is empty * ref: convert SelectionBar to StatelessWidget * chore: revert _missing_translations * ref: formatting * fix: assign new id to duplicated image * chore: revert timestamp to make merging easier --------- Co-authored-by: Adil Hanney <[email protected]>
- Loading branch information
1 parent
1a5a14f
commit 6c098bc
Showing
6 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
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,50 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:saber/components/theming/adaptive_icon.dart'; | ||
import 'package:saber/i18n/strings.g.dart'; | ||
|
||
class SelectionBar extends StatelessWidget { | ||
final VoidCallback duplicateSelection; | ||
final VoidCallback deleteSelection; | ||
|
||
const SelectionBar({ | ||
super.key, | ||
required this.duplicateSelection, | ||
required this.deleteSelection, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
IconButton( | ||
onPressed: duplicateSelection, | ||
style: TextButton.styleFrom( | ||
foregroundColor: Theme.of(context).colorScheme.secondary, | ||
backgroundColor: Colors.transparent, | ||
shape: const CircleBorder(), | ||
), | ||
tooltip: t.editor.selectionBar.duplicate, | ||
icon: const AdaptiveIcon( | ||
icon: Icons.content_copy, | ||
cupertinoIcon: CupertinoIcons.doc_on_clipboard, | ||
), | ||
), | ||
IconButton( | ||
onPressed: deleteSelection, | ||
style: TextButton.styleFrom( | ||
foregroundColor: Theme.of(context).colorScheme.secondary, | ||
backgroundColor: Colors.transparent, | ||
shape: const CircleBorder(), | ||
), | ||
tooltip: t.editor.selectionBar.delete, | ||
icon: const AdaptiveIcon( | ||
icon: Icons.delete, | ||
cupertinoIcon: CupertinoIcons.delete, | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
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
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
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
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
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
6c098bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New translation alert!
@Sdarfeesh @mamasch19 @fischerjosue @albanobattistella @jhihyulin @comcloudway @ShevT @ceskyDJ @fybx @mehdeej @Parameter15 @Polux49 @muhammadbahaa2001 @myanesp @theIuser @yufunagi @Jesse205 🚀
https://github.com/adil192/saber/edit/main/lib/i18n/_missing_translations.yaml
Instructions: https://github.com/adil192/saber#translating
See feat: delete and duplicate selection #937 for more context. Also note that
editor.selectionBar.delete
was copied fromeditor.imageOptions.delete
so isn't marked as(OUTDATED)
, but feel free to edit it if needed.