File tree Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change 1
1
import 'package:apidash_design_system/apidash_design_system.dart' ;
2
2
import 'package:flutter/material.dart' ;
3
- import 'package:flutter/foundation.dart' ;
4
3
import 'package:apidash/consts.dart' ;
5
4
import 'package:share_plus/share_plus.dart' ;
6
5
@@ -17,29 +16,22 @@ class ShareButton extends StatelessWidget {
17
16
@override
18
17
Widget build (BuildContext context) {
19
18
var sm = ScaffoldMessenger .of (context);
20
- onPressed () async {
21
- try {
22
- final box = context.findRenderObject () as RenderBox ? ;
23
- await Share .share (
24
- toShare,
25
- sharePositionOrigin: box! .localToGlobal (Offset .zero) & box.size,
26
- );
27
- } catch (e) {
28
- if (kDebugMode) {
29
- print (e);
30
- }
31
- sm.hideCurrentSnackBar ();
32
- sm.showSnackBar (getSnackBar ("Cannot share" ));
33
- }
34
- }
35
19
36
20
return ADIconButton (
37
21
icon: Icons .share,
38
22
iconSize: kButtonIconSizeLarge,
39
23
tooltip: kLabelShare,
40
24
color: Theme .of (context).colorScheme.primary,
41
25
visualDensity: VisualDensity .compact,
42
- onPressed: onPressed,
26
+ onPressed: () async {
27
+ sm.hideCurrentSnackBar ();
28
+ try {
29
+ await Share .share (toShare);
30
+ } catch (e) {
31
+ debugPrint ("$e " );
32
+ sm.showSnackBar (getSnackBar (kMsgShareError));
33
+ }
34
+ },
43
35
);
44
36
}
45
37
}
You can’t perform that action at this time.
0 commit comments