@@ -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, that shows post information like description, likes and image,
16
18
/// to create illusion of selecting meme from list.
@@ -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