From 151504db5102f2bf07d8477220c77084238a7dfc Mon Sep 17 00:00:00 2001 From: Khoren Markosyan Date: Sun, 11 Sep 2022 23:11:01 +0400 Subject: [PATCH] fixed share issue on ipad --- CHANGELOG.md | 2 ++ analysis_options.yaml | 4 ---- example/pubspec.lock | 2 +- zxscanner/lib/pages/barcodes_page.dart | 2 -- zxscanner/lib/pages/creator_page.dart | 33 +++++++++++++++++--------- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f500d30..993395d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +# Changelog + ## 0.8.0 * added ability to set localization messages for `writer_widget` diff --git a/analysis_options.yaml b/analysis_options.yaml index 45678fd..5dd564a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -26,10 +26,6 @@ analyzer: # Turned off until null-safe rollout is complete. unnecessary_null_comparison: warning exclude: - - "zxscanner/**" - - "bin/cache/**" - # Ignore protoc generated files - - "dev/conductor/lib/proto/*" - "lib/generated_bindings.dart" linter: diff --git a/example/pubspec.lock b/example/pubspec.lock index ba64a6f..ee1635c 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -141,7 +141,7 @@ packages: path: ".." relative: true source: path - version: "0.7.4" + version: "0.8.0" font_awesome_flutter: dependency: "direct main" description: diff --git a/zxscanner/lib/pages/barcodes_page.dart b/zxscanner/lib/pages/barcodes_page.dart index b86f4f1..6f3801f 100644 --- a/zxscanner/lib/pages/barcodes_page.dart +++ b/zxscanner/lib/pages/barcodes_page.dart @@ -1,5 +1,3 @@ -import 'dart:typed_data'; - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; diff --git a/zxscanner/lib/pages/creator_page.dart b/zxscanner/lib/pages/creator_page.dart index a89f4e7..199a6c7 100644 --- a/zxscanner/lib/pages/creator_page.dart +++ b/zxscanner/lib/pages/creator_page.dart @@ -84,17 +84,28 @@ class _CreatorPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - ElevatedButton( - onPressed: () { - // Save image to device - final File file = File(tempPath); - file.writeAsBytesSync(encode?.data ?? Uint8List(0)); - final String path = file.path; - // Share image - Share.shareFiles([path]); - }, - child: const Text('Share'), - ), + Builder(builder: (BuildContext context) { + return ElevatedButton( + onPressed: () { + // Save image to device + final File file = File(tempPath); + file.writeAsBytesSync(encode?.data ?? Uint8List(0)); + final String path = file.path; + + // Share image + final RenderBox? box = + context.findRenderObject() as RenderBox?; + if (box != null) { + Share.shareFiles( + [path], + sharePositionOrigin: + box.localToGlobal(Offset.zero) & box.size, + ); + } + }, + child: const Text('Share'), + ); + }), ElevatedButton( onPressed: () async { if (encode != null) {