[ImageActionsModal] Remove cross icon and fix dividers
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
+102
-104
@@ -8,6 +8,7 @@ import 'package:image_gallery_saver/image_gallery_saver.dart';
|
|||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
import '../stream_chat_flutter.dart';
|
import '../stream_chat_flutter.dart';
|
||||||
|
import 'extension.dart';
|
||||||
|
|
||||||
class ImageActionsModal extends StatelessWidget {
|
class ImageActionsModal extends StatelessWidget {
|
||||||
final Message message;
|
final Message message;
|
||||||
@@ -35,127 +36,124 @@ class ImageActionsModal extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPage(context) {
|
Widget _buildPage(context) {
|
||||||
return Material(
|
return Column(
|
||||||
color: Colors.transparent,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
child: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
SizedBox(height: kToolbarHeight),
|
||||||
children: [
|
Padding(
|
||||||
SizedBox(
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
height: kToolbarHeight,
|
child: Container(
|
||||||
child: IconButton(
|
width: MediaQuery.of(context).size.width * 0.5,
|
||||||
icon: StreamSvgIcon.close(),
|
clipBehavior: Clip.hardEdge,
|
||||||
onPressed: () => Navigator.maybePop(context),
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Container(
|
child: Container(
|
||||||
width: MediaQuery.of(context).size.width / 1.8,
|
child: Column(
|
||||||
child: Padding(
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
padding: const EdgeInsets.all(8.0),
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Material(
|
children: [
|
||||||
clipBehavior: Clip.hardEdge,
|
_buildButton(
|
||||||
shape: RoundedRectangleBorder(
|
context,
|
||||||
borderRadius: BorderRadius.circular(16),
|
'Reply',
|
||||||
|
StreamSvgIcon.Icon_curve_line_left_up(
|
||||||
|
size: 24.0,
|
||||||
|
color: StreamChatTheme.of(context).colorTheme.grey,
|
||||||
|
),
|
||||||
|
() {},
|
||||||
),
|
),
|
||||||
child: Column(
|
_buildButton(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
context,
|
||||||
children: ListTile.divideTiles(
|
'Show in Chat',
|
||||||
color: StreamChatTheme.of(context).colorTheme.greyWhisper,
|
StreamSvgIcon.eye(
|
||||||
context: context,
|
size: 24.0,
|
||||||
tiles: [
|
color: StreamChatTheme.of(context).colorTheme.black,
|
||||||
_buildButton(
|
),
|
||||||
context,
|
onShowMessage,
|
||||||
'Reply',
|
),
|
||||||
StreamSvgIcon.Icon_curve_line_left_up(
|
_buildButton(
|
||||||
size: 24.0,
|
context,
|
||||||
color:
|
'Save ${urls[currentIndex].type == 'video' ? 'Video' : 'Image'}',
|
||||||
StreamChatTheme.of(context).colorTheme.grey,
|
StreamSvgIcon.Icon_save(
|
||||||
),
|
size: 24.0,
|
||||||
() {}),
|
color: StreamChatTheme.of(context).colorTheme.grey,
|
||||||
_buildButton(
|
),
|
||||||
context,
|
() async {
|
||||||
'Show in Chat',
|
var url = urls[currentIndex].imageUrl ??
|
||||||
StreamSvgIcon.eye(
|
urls[currentIndex].assetUrl ??
|
||||||
size: 24.0,
|
urls[currentIndex].thumbUrl;
|
||||||
color:
|
|
||||||
StreamChatTheme.of(context).colorTheme.black,
|
|
||||||
),
|
|
||||||
onShowMessage),
|
|
||||||
_buildButton(
|
|
||||||
context,
|
|
||||||
'Save ${urls[currentIndex].type == 'video' ? 'Video' : 'Image'}',
|
|
||||||
StreamSvgIcon.Icon_save(
|
|
||||||
size: 24.0,
|
|
||||||
color:
|
|
||||||
StreamChatTheme.of(context).colorTheme.grey,
|
|
||||||
), () async {
|
|
||||||
var url = urls[currentIndex].imageUrl ??
|
|
||||||
urls[currentIndex].assetUrl ??
|
|
||||||
urls[currentIndex].thumbUrl;
|
|
||||||
|
|
||||||
if (urls[currentIndex].type == 'video') {
|
if (urls[currentIndex].type == 'video') {
|
||||||
await _saveVideo(url);
|
await _saveVideo(url);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} else {
|
} else {
|
||||||
await _saveImage(url);
|
await _saveImage(url);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
if (StreamChat.of(context).user.id == message.user.id)
|
|
||||||
_buildButton(
|
|
||||||
context,
|
|
||||||
'Delete',
|
|
||||||
StreamSvgIcon.delete(
|
|
||||||
size: 24.0,
|
|
||||||
color: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.accentRed,
|
|
||||||
),
|
|
||||||
() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
Navigator.pop(context);
|
|
||||||
StreamChat.of(context).client.deleteMessage(
|
|
||||||
message,
|
|
||||||
StreamChannel.of(context).channel.cid,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
color: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.accentRed,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).toList(),
|
|
||||||
),
|
),
|
||||||
),
|
if (StreamChat.of(context).user.id == message.user.id)
|
||||||
|
_buildButton(
|
||||||
|
context,
|
||||||
|
'Delete',
|
||||||
|
StreamSvgIcon.delete(
|
||||||
|
size: 24.0,
|
||||||
|
color: StreamChatTheme.of(context).colorTheme.accentRed,
|
||||||
|
),
|
||||||
|
() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
StreamChat.of(context).client.deleteMessage(
|
||||||
|
message,
|
||||||
|
StreamChannel.of(context).channel.cid,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
color: StreamChatTheme.of(context).colorTheme.accentRed,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
.map<Widget>((e) =>
|
||||||
|
Align(alignment: Alignment.centerRight, child: e))
|
||||||
|
.insertBetween(
|
||||||
|
Container(
|
||||||
|
height: 1,
|
||||||
|
color:
|
||||||
|
StreamChatTheme.of(context).colorTheme.greyWhisper,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildButton(
|
Widget _buildButton(
|
||||||
context, String title, StreamSvgIcon icon, VoidCallback onTap,
|
context,
|
||||||
{Color color}) {
|
String title,
|
||||||
var titleStyle = TextStyle(
|
StreamSvgIcon icon,
|
||||||
fontSize: 14.5,
|
VoidCallback onTap, {
|
||||||
color: StreamChatTheme.of(context).colorTheme.black,
|
Color color,
|
||||||
);
|
}) {
|
||||||
|
|
||||||
return Material(
|
return Material(
|
||||||
color: StreamChatTheme.of(context).colorTheme.white,
|
color: StreamChatTheme.of(context).colorTheme.white,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: ListTile(
|
child: Padding(
|
||||||
dense: true,
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
title: Text(
|
child: Row(
|
||||||
title,
|
children: [
|
||||||
style:
|
icon,
|
||||||
color == null ? titleStyle : titleStyle.copyWith(color: color),
|
SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: StreamChatTheme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.body
|
||||||
|
.copyWith(color: color),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
leading: icon,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user