Skip to content

Commit

Permalink
90: Use share_plus instead of share
Browse files Browse the repository at this point in the history
  • Loading branch information
JICA98 committed Aug 19, 2024
1 parent 0e8e4fa commit e691fdd
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/screens/forumposts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:flutter/services.dart';
import 'package:intl/intl.dart';
import 'package:dailyanimelist/generated/l10n.dart';
import 'package:scroll_to_index/scroll_to_index.dart';
import 'package:share/share.dart';
import 'package:share_plus/share_plus.dart';
import 'package:shimmer/shimmer.dart';

import 'generalsearchscreen.dart';
Expand Down
5 changes: 3 additions & 2 deletions lib/widgets/common/image_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import 'package:share/share.dart';
import 'package:share_plus/share_plus.dart';
import 'package:path/path.dart' as p;

void zoomInImage(BuildContext context, String url, [bool showButtons = true]) {
Expand Down Expand Up @@ -93,7 +93,8 @@ void saveImage(String url) async {
/// download image from url and share it
void shareImage(String url) async {
var path = await downloadImage(url);
Share.shareFiles([path], text: 'Image from DailyAnimeList');
XFile file = XFile(path);
Share.shareXFiles([file], text: 'Image from DailyAnimeList');
}

Future<String> downloadImage(String url) async {
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/common/share_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:dal_commons/commons.dart';
import 'package:flutter/material.dart';
import 'package:dailyanimelist/generated/l10n.dart';
import 'package:flutter/services.dart';
import 'package:share/share.dart';
import 'package:share_plus/share_plus.dart';

class ShareOutputProps {
final bool includeTitle;
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import flutter_local_notifications
import flutter_secure_storage_macos
import package_info_plus
import path_provider_foundation
import share_plus
import shared_preferences_foundation
import sqflite
import url_launcher_macos
Expand All @@ -26,6 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
Expand Down
16 changes: 12 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1168,14 +1168,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.8"
share:
share_plus:
dependency: "direct main"
description:
name: share
sha256: "97e6403f564ed1051a01534c2fc919cb6e40ea55e60a18ec23cee6e0ce19f4be"
name: share_plus
sha256: "468c43f285207c84bcabf5737f33b914ceb8eb38398b91e5e3ad1698d1b72a52"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
version: "10.0.2"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: "6ababf341050edff57da8b6990f11f4e99eaba837865e2e6defe16d039619db5"
url: "https://pub.dev"
source: hosted
version: "5.0.0"
shared_preferences:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies:
fl_chart: ^0.68.0
flutter_html: ^3.0.0-beta.2
scroll_to_index: ^3.0.1
share: ^2.0.1
share_plus: ^10.0.2
built_collection: ^5.1.0
flutter_local_notifications: ^17.2.2
timezone: ^0.9.4
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <file_selector_windows/file_selector_windows.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
Expand All @@ -24,6 +25,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
flutter_secure_storage_windows
permission_handler_windows
share_plus
url_launcher_windows
)

Expand Down

0 comments on commit e691fdd

Please sign in to comment.