Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null safety upgrade #59

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
final _picker = ImagePicker();

@override
void initState() {
super.initState();
Expand All @@ -43,10 +45,10 @@ class _MyAppState extends State<MyApp> {
),
RaisedButton(
onPressed: () async {
File f = await ImagePicker.pickImage(
final res = await _picker.getImage(
source: ImageSource.gallery);
if (f != null) {
ShareExtend.share(f.path, "image",
if (res.path != null) {
ShareExtend.share(res.path, "image",
sharePanelTitle: "share image title",
subject: "share image subject");
}
Expand All @@ -55,10 +57,10 @@ class _MyAppState extends State<MyApp> {
),
RaisedButton(
onPressed: () async {
File f = await ImagePicker.pickVideo(
final res = await _picker.getVideo(
source: ImageSource.gallery);
if (f != null) {
ShareExtend.share(f.path, "video");
if (res.path != null) {
ShareExtend.share(res.path, "video");
}
},
child: Text("share video"),
Expand Down
8 changes: 4 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
path_provider: ^1.4.0
multi_image_picker: ^4.6.1
image_picker: ^0.6.3
cupertino_icons: ^1.0.2
path_provider: ^2.0.1
multi_image_picker: ^4.8.00
image_picker: ^0.7.4
# image_picker:
# git:
# url: [email protected]:miguelpruivo/plugins.git
Expand Down
16 changes: 8 additions & 8 deletions lib/share_extend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class ShareExtend {
/// [extraText] only supports android for Intent.EXTRA_TEXT when sharing image or file.
///
static Future<void> shareMultiple(List<String> list, String type,
{Rect sharePositionOrigin,
String sharePanelTitle,
{Rect? sharePositionOrigin,
String? sharePanelTitle,
String subject = "",
String extraText = ""}) {
assert(list != null && list.isNotEmpty);
Expand All @@ -48,8 +48,8 @@ class ShareExtend {
/// [extraText] only supports android for Intent.EXTRA_TEXT when sharing image or file.
///
static Future<void> share(String text, String type,
{Rect sharePositionOrigin,
String sharePanelTitle,
{Rect? sharePositionOrigin,
String? sharePanelTitle,
String subject = "",
String extraText = ""}) {
assert(text != null);
Expand All @@ -66,10 +66,10 @@ class ShareExtend {
}

static Future<void> _shareInner(List<String> list, String type,
{Rect sharePositionOrigin,
String sharePanelTitle,
String subject,
String extraText}) {
{Rect? sharePositionOrigin,
String? sharePanelTitle,
String? subject,
String? extraText}) {
assert(list != null && list.isNotEmpty);
final Map<String, dynamic> params = <String, dynamic>{
'list': list,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ author: zhouteng <[email protected]>
homepage: https://github.com/zhouteng0217/ShareExtend

environment:
sdk: ">=2.0.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.10.0 <2.0.0"

dependencies:
meta: ^1.0.5
meta: ^1.3.0
flutter:
sdk: flutter

Expand Down