mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 04:57:23 +00:00
save to gallery
This commit is contained in:
@@ -166,7 +166,8 @@
|
|||||||
"Error": "错误",
|
"Error": "错误",
|
||||||
"Failed to register URL scheme.": "注册URL协议失败",
|
"Failed to register URL scheme.": "注册URL协议失败",
|
||||||
"Retry": "重试",
|
"Retry": "重试",
|
||||||
"Network": "网络"
|
"Network": "网络",
|
||||||
|
"Save to gallery": "保存到相册"
|
||||||
},
|
},
|
||||||
"zh_TW": {
|
"zh_TW": {
|
||||||
"Search": "搜索",
|
"Search": "搜索",
|
||||||
@@ -335,6 +336,7 @@
|
|||||||
"Error": "錯誤",
|
"Error": "錯誤",
|
||||||
"Failed to register URL scheme.": "註冊URL協議失敗",
|
"Failed to register URL scheme.": "註冊URL協議失敗",
|
||||||
"Retry": "重試",
|
"Retry": "重試",
|
||||||
"Network": "網絡"
|
"Network": "網絡",
|
||||||
|
"Save to gallery": "保存到相冊"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -56,5 +56,9 @@
|
|||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
|
<string>photo</string>
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>photo</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@@ -60,6 +60,8 @@ class _IllustGalleryPageState extends State<IllustGalleryPage> {
|
|||||||
|
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|
||||||
|
late int page = widget.initialPage;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
illusts = List.from(widget.illusts);
|
illusts = List.from(widget.illusts);
|
||||||
@@ -114,14 +116,16 @@ class _IllustGalleryPageState extends State<IllustGalleryPage> {
|
|||||||
return IllustPage(illusts[index],
|
return IllustPage(illusts[index],
|
||||||
nextPage: nextPage, previousPage: previousPage);
|
nextPage: nextPage, previousPage: previousPage);
|
||||||
},
|
},
|
||||||
onPageChanged: (value) => setState(() {}),
|
onPageChanged: (value) => setState(() {
|
||||||
|
page = value;
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (controller.page! < length - 1 && length > 1)
|
if (page < length - 1 && length > 1 && App.isDesktop)
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 16,
|
right: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 32,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(FluentIcons.chevron_right),
|
icon: const Icon(FluentIcons.chevron_right),
|
||||||
@@ -130,11 +134,11 @@ class _IllustGalleryPageState extends State<IllustGalleryPage> {
|
|||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
if (controller.page != 0 && length > 1)
|
if (page != 0 && length > 1 && App.isDesktop)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 16,
|
left: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 32,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(FluentIcons.chevron_left),
|
icon: const Icon(FluentIcons.chevron_left),
|
||||||
|
@@ -3,8 +3,10 @@ import 'dart:io';
|
|||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
||||||
import 'package:photo_view/photo_view_gallery.dart';
|
import 'package:photo_view/photo_view_gallery.dart';
|
||||||
import 'package:pixes/components/md.dart';
|
import 'package:pixes/components/md.dart';
|
||||||
|
import 'package:pixes/components/message.dart';
|
||||||
import 'package:pixes/components/page_route.dart';
|
import 'package:pixes/components/page_route.dart';
|
||||||
import 'package:pixes/foundation/app.dart';
|
import 'package:pixes/foundation/app.dart';
|
||||||
import 'package:pixes/foundation/cache_manager.dart';
|
import 'package:pixes/foundation/cache_manager.dart';
|
||||||
@@ -89,6 +91,8 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
|
|||||||
|
|
||||||
void showMenu() {
|
void showMenu() {
|
||||||
menuController.showFlyout(
|
menuController.showFlyout(
|
||||||
|
barrierColor: Colors.transparent,
|
||||||
|
position: Offset(context.size!.width, 0),
|
||||||
builder: (context) => MenuFlyout(
|
builder: (context) => MenuFlyout(
|
||||||
items: [
|
items: [
|
||||||
MenuFlyoutItem(
|
MenuFlyoutItem(
|
||||||
@@ -103,6 +107,23 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
|
|||||||
saveFile(file, fileName);
|
saveFile(file, fileName);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
if (App.isMobile)
|
||||||
|
MenuFlyoutItem(
|
||||||
|
text: Text("Save to gallery".tl),
|
||||||
|
onPressed: () async {
|
||||||
|
var file = await getFile();
|
||||||
|
if (file != null) {
|
||||||
|
var fileName = file.path.split('/').last;
|
||||||
|
if (!fileName.contains('.')) {
|
||||||
|
fileName += getExtensionName();
|
||||||
|
}
|
||||||
|
await ImageGallerySaver.saveFile(file.path,
|
||||||
|
name: fileName);
|
||||||
|
if (mounted) {
|
||||||
|
showToast(context, message: "Saved".tl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
MenuFlyoutItem(
|
MenuFlyoutItem(
|
||||||
text: Text("Share".tl),
|
text: Text("Share".tl),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@@ -58,6 +58,10 @@ dependencies:
|
|||||||
webview_flutter: ^4.7.0
|
webview_flutter: ^4.7.0
|
||||||
flutter_acrylic: 1.0.0+2
|
flutter_acrylic: 1.0.0+2
|
||||||
device_info_plus: ^10.1.0
|
device_info_plus: ^10.1.0
|
||||||
|
image_gallery_saver:
|
||||||
|
git:
|
||||||
|
url: https://github.com/wgh136/image_gallery_saver
|
||||||
|
ref: master
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
Reference in New Issue
Block a user