|
@@ -12,6 +12,7 @@ import 'package:photo_manager/photo_manager.dart';
|
|
|
import 'package:photos/core/event_bus.dart';
|
|
|
import 'package:photos/db/files_db.dart';
|
|
|
import 'package:photos/events/local_photos_updated_event.dart';
|
|
|
+import "package:photos/generated/l10n.dart";
|
|
|
import 'package:photos/models/file.dart' as ente;
|
|
|
import 'package:photos/models/location/location.dart';
|
|
|
import 'package:photos/services/sync_service.dart';
|
|
@@ -64,7 +65,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
return WillPopScope(
|
|
|
onWillPop: () async {
|
|
|
if (_hasBeenEdited()) {
|
|
|
- await _showExitConfirmationDialog();
|
|
|
+ await _showExitConfirmationDialog(context);
|
|
|
} else {
|
|
|
replacePage(context, DetailPage(widget.detailPageConfig));
|
|
|
}
|
|
@@ -182,7 +183,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
),
|
|
|
const Padding(padding: EdgeInsets.all(2)),
|
|
|
Text(
|
|
|
- "Flip",
|
|
|
+ S.of(context).flip,
|
|
|
style: subtitle2.copyWith(
|
|
|
color: subtitle2.color!.withOpacity(0.8),
|
|
|
),
|
|
@@ -212,7 +213,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
),
|
|
|
const Padding(padding: EdgeInsets.all(2)),
|
|
|
Text(
|
|
|
- "Rotate left",
|
|
|
+ S.of(context).rotateLeft,
|
|
|
style: subtitle2.copyWith(
|
|
|
color: subtitle2.color!.withOpacity(0.8),
|
|
|
),
|
|
@@ -242,7 +243,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
),
|
|
|
const Padding(padding: EdgeInsets.all(2)),
|
|
|
Text(
|
|
|
- "Rotate right",
|
|
|
+ S.of(context).rotateRight,
|
|
|
style: subtitle2.copyWith(
|
|
|
color: subtitle2.color!.withOpacity(0.8),
|
|
|
),
|
|
@@ -272,7 +273,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
),
|
|
|
const Padding(padding: EdgeInsets.all(2)),
|
|
|
Text(
|
|
|
- "Save copy",
|
|
|
+ S.of(context).saveCopy,
|
|
|
style: subtitle2.copyWith(
|
|
|
color: subtitle2.color!.withOpacity(0.8),
|
|
|
),
|
|
@@ -285,7 +286,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
}
|
|
|
|
|
|
Future<void> _saveEdits() async {
|
|
|
- final dialog = createProgressDialog(context, "Saving...");
|
|
|
+ final dialog = createProgressDialog(context, S.of(context).saving);
|
|
|
await dialog.show();
|
|
|
final ExtendedImageEditorState? state = editorKey.currentState;
|
|
|
if (state == null) {
|
|
@@ -304,7 +305,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
|
|
|
if (img == null) {
|
|
|
_logger.severe("null rawImageData");
|
|
|
- showToast(context, "Something went wrong");
|
|
|
+ showToast(context, S.of(context).somethingWentWrong);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -330,7 +331,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
);
|
|
|
if (result == null) {
|
|
|
_logger.severe("null result");
|
|
|
- showToast(context, "Something went wrong");
|
|
|
+ showToast(context, S.of(context).somethingWentWrong);
|
|
|
return;
|
|
|
}
|
|
|
_logger.info('Size before compression = ${result.length}');
|
|
@@ -371,7 +372,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
newFile.generatedID = await FilesDB.instance.insert(newFile);
|
|
|
Bus.instance.fire(LocalPhotosUpdatedEvent([newFile], source: "editSave"));
|
|
|
SyncService.instance.sync();
|
|
|
- showShortToast(context, "Edits saved");
|
|
|
+ showShortToast(context, S.of(context).editsSaved);
|
|
|
_logger.info("Original file " + widget.originalFile.toString());
|
|
|
_logger.info("Saved edits to file " + newFile.toString());
|
|
|
final existingFiles = widget.detailPageConfig.files;
|
|
@@ -398,7 +399,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
),
|
|
|
);
|
|
|
} catch (e, s) {
|
|
|
- showToast(context, "Oops, could not save edits");
|
|
|
+ showToast(context, S.of(context).oopsCouldNotSaveEdits);
|
|
|
_logger.severe(e, s);
|
|
|
} finally {
|
|
|
PhotoManager.startChangeNotify();
|
|
@@ -424,7 +425,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
SizedBox(
|
|
|
width: 40,
|
|
|
child: Text(
|
|
|
- "Color",
|
|
|
+ S.of(context).color,
|
|
|
style: subtitle2.copyWith(
|
|
|
color: subtitle2.color!.withOpacity(0.8),
|
|
|
),
|
|
@@ -470,7 +471,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
SizedBox(
|
|
|
width: 40,
|
|
|
child: Text(
|
|
|
- "Light",
|
|
|
+ S.of(context).light,
|
|
|
style: subtitle2.copyWith(
|
|
|
color: subtitle2.color!.withOpacity(0.8),
|
|
|
),
|
|
@@ -506,20 +507,20 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Future<void> _showExitConfirmationDialog() async {
|
|
|
+ Future<void> _showExitConfirmationDialog(BuildContext context) async {
|
|
|
final actionResult = await showActionSheet(
|
|
|
context: context,
|
|
|
buttons: [
|
|
|
- const ButtonWidget(
|
|
|
- labelText: "Yes, discard changes",
|
|
|
+ ButtonWidget(
|
|
|
+ labelText: S.of(context).yesDiscardChanges,
|
|
|
buttonType: ButtonType.critical,
|
|
|
buttonSize: ButtonSize.large,
|
|
|
shouldStickToDarkTheme: true,
|
|
|
buttonAction: ButtonAction.first,
|
|
|
isInAlert: true,
|
|
|
),
|
|
|
- const ButtonWidget(
|
|
|
- labelText: "No",
|
|
|
+ ButtonWidget(
|
|
|
+ labelText: S.of(context).no,
|
|
|
buttonType: ButtonType.secondary,
|
|
|
buttonSize: ButtonSize.large,
|
|
|
buttonAction: ButtonAction.second,
|
|
@@ -527,7 +528,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|
|
isInAlert: true,
|
|
|
),
|
|
|
],
|
|
|
- body: "Do you want to discard the edits you have made?",
|
|
|
+ body: S.of(context).doYouWantToDiscardTheEditsYouHaveMade,
|
|
|
actionSheetType: ActionSheetType.defaultActionSheet,
|
|
|
);
|
|
|
if (actionResult?.action != null &&
|