-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Clone image handle * Dispose of image on removal * Close project after pop animation * Dispose of deleted images * Duplicate frame method * Add duplicate path counter * Implement make duplicate path * Schedule dispose task * Dispose in scheduled task * Extract duplicate scene / scene layer * Bump version
- Loading branch information
1 parent
91af8ff
commit 09d094e
Showing
19 changed files
with
191 additions
and
91 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
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,32 @@ | ||
import 'package:path/path.dart' as p; | ||
|
||
/// Returns a new path for a duplicate file. | ||
/// `example/path/image.png` -> `example/path/image_1.png` | ||
/// `example/path/image_1.png` -> `example/path/image_2.png` | ||
String makeDuplicatePath(String path) { | ||
final dir = p.dirname(path); | ||
final name = p.basenameWithoutExtension(path); | ||
final ext = p.extension(path); | ||
|
||
final newName = | ||
_hasCounter(name) ? _incrementCounter(name) : _createCounter(name); | ||
|
||
return p.join(dir, newName + ext); | ||
} | ||
|
||
bool _hasCounter(String name) { | ||
return RegExp(r'_\d+$').hasMatch(name); | ||
} | ||
|
||
String _createCounter(String name) { | ||
return name + '_1'; | ||
} | ||
|
||
String _incrementCounter(String name) { | ||
final parts = name.split('_'); | ||
|
||
final newCounterValue = int.parse(parts.last) + 1; | ||
parts.last = newCounterValue.toString(); | ||
|
||
return parts.join('_'); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,6 @@ abstract class TimeSpan { | |
final Duration _duration; | ||
|
||
TimeSpan copyWith({Duration? duration}); | ||
|
||
void dispose(); | ||
} |
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
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
Oops, something went wrong.