@@ -7,10 +7,12 @@ import 'package:devour/domain/misc/helper.dart';
7
7
import 'package:devour/injection.dart' ;
8
8
import 'package:devour/presentation/screens/feed/feed_image_widget.dart' ;
9
9
import 'package:devour/presentation/widgets/platform/platform_icon_button.dart' ;
10
+ import 'package:devour/presentation/widgets/platform/platform_theme.dart' ;
10
11
import 'package:flutter/cupertino.dart' ;
11
12
import 'package:flutter/material.dart' ;
12
13
import 'package:flutter/widgets.dart' ;
13
14
import 'package:flutter_cache_manager/flutter_cache_manager.dart' ;
15
+ import 'package:share_plus/share_plus.dart' ;
14
16
15
17
/// Widget to show post information like description and likes and image,
16
18
/// to create illusion of selecting meme from list.
@@ -50,27 +52,27 @@ class _PostWidgetState extends State<PostWidget> {
50
52
height: box? .size.height,
51
53
child: IgnorePointer (
52
54
child: AnimatedSwitcher (
53
- duration: const Duration (milliseconds: 100 ),
54
- layoutBuilder: (curr, prev) {
55
- return Stack (
56
- alignment: Alignment .center,
57
- children: < Widget > [
58
- // ...prev,
59
- if (curr != null ) curr,
60
- ],
61
- );
62
- },
63
- child: FeedImage (
64
- key: Key (widget.state.currentMemeModel.imageLink),
65
- imageProvider: CachedNetworkImageProvider (
66
- widget.state.currentMemeModel.imageLink,
67
- errorListener: () => print (
68
- 'error (${widget .state .currentMemeModel .imageLink })' ),
69
- cacheManager: serviceLocator <CacheManager >(),
70
- ),
71
- constraints: widget.constraints,
55
+ duration: const Duration (milliseconds: 100 ),
56
+ layoutBuilder: (curr, prev) {
57
+ return Stack (
58
+ alignment: Alignment .center,
59
+ children: < Widget > [
60
+ // ...prev,
61
+ if (curr != null ) curr,
62
+ ],
63
+ );
64
+ },
65
+ child: FeedImage (
66
+ key: Key (widget.state.currentMemeModel.imageLink),
67
+ imageProvider: CachedNetworkImageProvider (
68
+ widget.state.currentMemeModel.imageLink,
69
+ errorListener: () => print (
70
+ 'error (${widget .state .currentMemeModel .imageLink })' ),
71
+ cacheManager: serviceLocator <CacheManager >(),
72
72
),
73
+ constraints: widget.constraints,
73
74
),
75
+ ),
74
76
),
75
77
),
76
78
Positioned .fill (
@@ -96,6 +98,7 @@ class _PostWidgetState extends State<PostWidget> {
96
98
}
97
99
98
100
class PostActionsWidget extends StatelessWidget {
101
+ /// Column with actions, showed to user for certain post
99
102
const PostActionsWidget ({
100
103
Key ? key,
101
104
required this .currentPost,
@@ -123,7 +126,7 @@ class PostActionsWidget extends StatelessWidget {
123
126
text: currentPost.comments.toShortString (),
124
127
),
125
128
PlatformIconButton (
126
- onPressed: () => null ,
129
+ onPressed: share ,
127
130
icon: CupertinoIcons .share,
128
131
size: 42 ,
129
132
color: CupertinoColors .white,
@@ -132,6 +135,14 @@ class PostActionsWidget extends StatelessWidget {
132
135
],
133
136
);
134
137
}
138
+
139
+ void share () async {
140
+ final cacheManager = serviceLocator <CacheManager >();
141
+ final file = await cacheManager.getSingleFile (currentPost.imageLink);
142
+ // TODO: currentPost.isVideo ? mimeType: 'video/*'
143
+
144
+ Share .shareFiles ([file.path], mimeTypes: ['image/*' ]);
145
+ }
135
146
}
136
147
137
148
class PostDescriptionWidget extends StatelessWidget {
@@ -145,7 +156,7 @@ class PostDescriptionWidget extends StatelessWidget {
145
156
@override
146
157
Widget build (BuildContext context) {
147
158
final textStyle =
148
- CupertinoTheme . of (context).textTheme.textStyle .copyWith (fontSize: 19 );
159
+ PlatformTheme . getTextStyle (context).copyWith (fontSize: 19 );
149
160
return Column (
150
161
crossAxisAlignment: CrossAxisAlignment .start,
151
162
children: [
0 commit comments