[ImageActionsModal] Remove cross icon and fix dividers

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-13 13:25:38 +05:30
parent b27f04bf36
commit 7c8bd11fd2
+58 -60
View File
@@ -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,61 +36,49 @@ class ImageActionsModal extends StatelessWidget {
} }
Widget _buildPage(context) { Widget _buildPage(context) {
return Material( return Column(
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
SizedBox( SizedBox(height: kToolbarHeight),
height: kToolbarHeight, Padding(
child: IconButton( padding: const EdgeInsets.only(right: 8.0),
icon: StreamSvgIcon.close(),
onPressed: () => Navigator.maybePop(context),
),
),
Align(
alignment: Alignment.centerRight,
child: Container( child: Container(
width: MediaQuery.of(context).size.width / 1.8, width: MediaQuery.of(context).size.width * 0.5,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Material(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16.0),
), ),
child: Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.end,
children: ListTile.divideTiles( mainAxisSize: MainAxisSize.min,
color: StreamChatTheme.of(context).colorTheme.greyWhisper, children: [
context: context,
tiles: [
_buildButton( _buildButton(
context, context,
'Reply', 'Reply',
StreamSvgIcon.Icon_curve_line_left_up( StreamSvgIcon.Icon_curve_line_left_up(
size: 24.0, size: 24.0,
color: color: StreamChatTheme.of(context).colorTheme.grey,
StreamChatTheme.of(context).colorTheme.grey, ),
() {},
), ),
() {}),
_buildButton( _buildButton(
context, context,
'Show in Chat', 'Show in Chat',
StreamSvgIcon.eye( StreamSvgIcon.eye(
size: 24.0, size: 24.0,
color: color: StreamChatTheme.of(context).colorTheme.black,
StreamChatTheme.of(context).colorTheme.black, ),
onShowMessage,
), ),
onShowMessage),
_buildButton( _buildButton(
context, context,
'Save ${urls[currentIndex].type == 'video' ? 'Video' : 'Image'}', 'Save ${urls[currentIndex].type == 'video' ? 'Video' : 'Image'}',
StreamSvgIcon.Icon_save( StreamSvgIcon.Icon_save(
size: 24.0, size: 24.0,
color: color: StreamChatTheme.of(context).colorTheme.grey,
StreamChatTheme.of(context).colorTheme.grey, ),
), () async { () async {
var url = urls[currentIndex].imageUrl ?? var url = urls[currentIndex].imageUrl ??
urls[currentIndex].assetUrl ?? urls[currentIndex].assetUrl ??
urls[currentIndex].thumbUrl; urls[currentIndex].thumbUrl;
@@ -101,16 +90,15 @@ class ImageActionsModal extends StatelessWidget {
await _saveImage(url); await _saveImage(url);
Navigator.pop(context); Navigator.pop(context);
} }
}), },
),
if (StreamChat.of(context).user.id == message.user.id) if (StreamChat.of(context).user.id == message.user.id)
_buildButton( _buildButton(
context, context,
'Delete', 'Delete',
StreamSvgIcon.delete( StreamSvgIcon.delete(
size: 24.0, size: 24.0,
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context).colorTheme.accentRed,
.colorTheme
.accentRed,
), ),
() { () {
Navigator.pop(context); Navigator.pop(context);
@@ -120,42 +108,52 @@ class ImageActionsModal extends StatelessWidget {
StreamChannel.of(context).channel.cid, StreamChannel.of(context).channel.cid,
); );
}, },
color: StreamChatTheme.of(context) color: StreamChatTheme.of(context).colorTheme.accentRed,
.colorTheme
.accentRed,
), ),
]
.map<Widget>((e) =>
Align(alignment: Alignment.centerRight, child: e))
.insertBetween(
Container(
height: 1,
color:
StreamChatTheme.of(context).colorTheme.greyWhisper,
),
),
),
),
),
)
], ],
).toList(),
),
),
),
),
),
],
),
); );
} }
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(
children: [
icon,
SizedBox(width: 16),
Text(
title, title,
style: style: StreamChatTheme.of(context)
color == null ? titleStyle : titleStyle.copyWith(color: color), .textTheme
.body
.copyWith(color: color),
),
],
), ),
leading: icon,
), ),
), ),
); );