lint changes image
This commit is contained in:
@@ -192,7 +192,8 @@ class AttachmentActionsModal extends StatelessWidget {
|
||||
VoidCallback? onTap, {
|
||||
Color? color,
|
||||
Key? key,
|
||||
}) => Material(
|
||||
}) =>
|
||||
Material(
|
||||
key: key,
|
||||
color: StreamChatTheme.of(context).colorTheme.white,
|
||||
child: InkWell(
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// Back button implementation
|
||||
class StreamBackButton extends StatelessWidget {
|
||||
|
||||
/// Constructor for creating back button
|
||||
const StreamBackButton({
|
||||
Key? key,
|
||||
|
||||
@@ -243,7 +243,8 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
Widget _buildDisconnectedTitleState(
|
||||
BuildContext context,
|
||||
StreamChatClient client,
|
||||
) => Row(
|
||||
) =>
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:stream_chat_flutter/src/utils.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
|
||||
/// Callback called when tapping on a channel
|
||||
typedef ChannelTapCallback = void Function(Channel, Widget?);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
|
||||
/// It shows the current [Channel] name using a [Text] widget.
|
||||
///
|
||||
/// The widget uses a [StreamBuilder] to render the channel information
|
||||
@@ -60,8 +59,7 @@ class ChannelName extends StatelessWidget {
|
||||
|
||||
final exceedingMembers =
|
||||
otherMembers.length - currentMembers.length;
|
||||
title =
|
||||
'${currentMembers.map((e) => e.user?.name).join(', ')} '
|
||||
title = '${currentMembers.map((e) => e.user?.name).join(', ')} '
|
||||
'${exceedingMembers > 0 ? '+ $exceedingMembers' : ''}';
|
||||
} else {
|
||||
title = 'No title';
|
||||
|
||||
@@ -21,7 +21,6 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
/// [StreamChatTheme].
|
||||
/// Modify it to change the widget appearance.
|
||||
class ChannelPreview extends StatelessWidget {
|
||||
|
||||
/// Constructor for creating [ChannelPreview]
|
||||
const ChannelPreview({
|
||||
required this.channel,
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// It shows a date divider depending on the date difference
|
||||
class DateDivider extends StatelessWidget {
|
||||
|
||||
/// Constructor for creating a [DateDivider]
|
||||
const DateDivider({
|
||||
Key? key,
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// Widget to display deleted message
|
||||
class DeletedMessage extends StatelessWidget {
|
||||
|
||||
/// Constructor to create [DeletedMessage]
|
||||
const DeletedMessage({
|
||||
Key? key,
|
||||
|
||||
@@ -13,7 +13,6 @@ import 'package:video_player/video_player.dart';
|
||||
|
||||
/// Return action for coming back from pages
|
||||
enum ReturnActionType {
|
||||
|
||||
/// No return action
|
||||
none,
|
||||
|
||||
|
||||
@@ -12,7 +12,22 @@ import 'package:stream_chat_flutter/src/video_thumbnail_image.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
/// Footer widget for media display
|
||||
class ImageFooter extends StatefulWidget implements PreferredSizeWidget {
|
||||
/// Creates a channel header
|
||||
const ImageFooter({
|
||||
Key? key,
|
||||
required this.message,
|
||||
this.onBackPressed,
|
||||
this.onTitleTap,
|
||||
this.onImageTap,
|
||||
this.currentPage = 0,
|
||||
this.totalPages = 0,
|
||||
this.mediaAttachments = const [],
|
||||
this.mediaSelectedCallBack,
|
||||
}) : preferredSize = const Size.fromHeight(kToolbarHeight),
|
||||
super(key: key);
|
||||
|
||||
/// Callback to call when pressing the back button.
|
||||
/// By default it calls [Navigator.pop]
|
||||
final VoidCallback? onBackPressed;
|
||||
@@ -23,28 +38,21 @@ class ImageFooter extends StatefulWidget implements PreferredSizeWidget {
|
||||
/// Callback to call when the image is tapped.
|
||||
final VoidCallback? onImageTap;
|
||||
|
||||
/// Stores the current index of media shown
|
||||
final int currentPage;
|
||||
|
||||
/// Total number of pages of media
|
||||
final int totalPages;
|
||||
|
||||
/// All attachments to show
|
||||
final List<Attachment> mediaAttachments;
|
||||
|
||||
/// Message which attachments are attached to
|
||||
final Message message;
|
||||
|
||||
/// Callback when media is selected
|
||||
final ValueChanged<int>? mediaSelectedCallBack;
|
||||
|
||||
/// Creates a channel header
|
||||
ImageFooter({
|
||||
Key? key,
|
||||
required this.message,
|
||||
this.onBackPressed,
|
||||
this.onTitleTap,
|
||||
this.onImageTap,
|
||||
this.currentPage = 0,
|
||||
this.totalPages = 0,
|
||||
this.mediaAttachments = const [],
|
||||
this.mediaSelectedCallBack,
|
||||
}) : preferredSize = Size.fromHeight(kToolbarHeight),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_ImageFooterState createState() => _ImageFooterState();
|
||||
|
||||
@@ -119,7 +127,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
),
|
||||
InkWell(
|
||||
onTap: widget.onTitleTap,
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -169,8 +177,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
expand: false,
|
||||
initialChildSize: initialChildSize / size.height,
|
||||
minChildSize: initialChildSize / size.height,
|
||||
builder: (context, scrollController) {
|
||||
return SingleChildScrollView(
|
||||
builder: (context, scrollController) => SingleChildScrollView(
|
||||
controller: scrollController,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -205,7 +212,9 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: widget.mediaAttachments.length,
|
||||
padding: const EdgeInsets.all(1),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// ignore: lines_longer_than_80_chars
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: crossAxisCount,
|
||||
mainAxisSpacing: 2,
|
||||
crossAxisSpacing: 2,
|
||||
@@ -244,7 +253,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
media,
|
||||
if (widget.message.user != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
@@ -264,7 +273,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
child: UserAvatar(
|
||||
user: widget.message.user!,
|
||||
constraints:
|
||||
BoxConstraints.tight(Size(24, 24)),
|
||||
BoxConstraints.tight(const Size(24, 24)),
|
||||
showOnlineStatus: false,
|
||||
),
|
||||
),
|
||||
@@ -276,8 +285,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -304,29 +312,3 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
|
||||
/// Used for clipping textfield prefix icon
|
||||
class IconClipper extends CustomClipper<Path> {
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
final leftX = size.width / 5;
|
||||
final rightX = 4 * size.width / 5;
|
||||
final topY = size.height / 5;
|
||||
final bottomY = 4 * size.height / 5;
|
||||
|
||||
final path = Path();
|
||||
path.moveTo(leftX, topY);
|
||||
path.lineTo(leftX, bottomY);
|
||||
path.lineTo(rightX, bottomY);
|
||||
path.lineTo(rightX, topY);
|
||||
path.lineTo(leftX, topY);
|
||||
path.lineTo(0, 0);
|
||||
path.close();
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReclip(CustomClipper oldClipper) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ import 'package:stream_chat_flutter/src/full_screen_media.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
/// Widget for constructing a group of images in message
|
||||
class ImageGroup extends StatelessWidget {
|
||||
/// Constructor for creating [ImageGroup] widget
|
||||
const ImageGroup({
|
||||
Key? key,
|
||||
required this.images,
|
||||
@@ -13,15 +15,23 @@ class ImageGroup extends StatelessWidget {
|
||||
this.onShowMessage,
|
||||
}) : super(key: key);
|
||||
|
||||
/// List of attachments to show
|
||||
final List<Attachment> images;
|
||||
|
||||
/// Message which images are attached to
|
||||
final Message message;
|
||||
|
||||
/// [MessageTheme] to apply to message
|
||||
final MessageTheme messageTheme;
|
||||
|
||||
/// Size of iamges
|
||||
final Size size;
|
||||
|
||||
/// Callback for when show message is tapped
|
||||
final ShowMessageCallback? onShowMessage;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ConstrainedBox(
|
||||
Widget build(BuildContext context) => ConstrainedBox(
|
||||
constraints: BoxConstraints.loose(size),
|
||||
child: Flex(
|
||||
direction: Axis.vertical,
|
||||
@@ -77,7 +87,7 @@ class ImageGroup extends StatelessWidget {
|
||||
child: Center(
|
||||
child: Text(
|
||||
'+ ${images.length - 4}',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 26,
|
||||
),
|
||||
@@ -97,7 +107,6 @@ class ImageGroup extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onTap(
|
||||
BuildContext context,
|
||||
@@ -122,8 +131,7 @@ class ImageGroup extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildImage(BuildContext context, int index) {
|
||||
return ImageAttachment(
|
||||
Widget _buildImage(BuildContext context, int index) => ImageAttachment(
|
||||
attachment: images[index],
|
||||
size: size,
|
||||
message: message,
|
||||
@@ -131,4 +139,3 @@ class ImageGroup extends StatelessWidget {
|
||||
onAttachmentTap: () => _onTap(context, index),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/src/attachment_actions_modal.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
import 'attachment_actions_modal.dart';
|
||||
|
||||
/// Header/AppBar widget for media display screen
|
||||
class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
/// Creates a channel header
|
||||
const ImageHeader({
|
||||
Key? key,
|
||||
required this.message,
|
||||
this.currentIndex = 0,
|
||||
this.showBackButton = true,
|
||||
this.onBackPressed,
|
||||
this.onShowMessage,
|
||||
this.onTitleTap,
|
||||
this.onImageTap,
|
||||
this.userName = '',
|
||||
this.sentAt = '',
|
||||
}) : preferredSize = const Size.fromHeight(kToolbarHeight),
|
||||
super(key: key);
|
||||
|
||||
/// True if this header shows the leading back button
|
||||
final bool showBackButton;
|
||||
|
||||
@@ -22,31 +37,20 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
/// Callback to call when the image is tapped.
|
||||
final VoidCallback? onImageTap;
|
||||
|
||||
/// Message which attachments are attached to
|
||||
final Message message;
|
||||
|
||||
/// Username of sender
|
||||
final String userName;
|
||||
|
||||
/// Text which connotes the time the message was sent
|
||||
final String sentAt;
|
||||
|
||||
/// Stores the current index of media shown
|
||||
final int currentIndex;
|
||||
|
||||
/// Creates a channel header
|
||||
ImageHeader({
|
||||
Key? key,
|
||||
required this.message,
|
||||
this.currentIndex = 0,
|
||||
this.showBackButton = true,
|
||||
this.onBackPressed,
|
||||
this.onShowMessage,
|
||||
this.onTitleTap,
|
||||
this.onImageTap,
|
||||
this.userName = '',
|
||||
this.sentAt = '',
|
||||
}) : preferredSize = Size.fromHeight(kToolbarHeight),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
Widget build(BuildContext context) => AppBar(
|
||||
brightness: Theme.of(context).brightness,
|
||||
elevation: 1,
|
||||
leading: showBackButton
|
||||
@@ -57,7 +61,7 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
onPressed: onBackPressed,
|
||||
)
|
||||
: SizedBox(),
|
||||
: const SizedBox(),
|
||||
backgroundColor:
|
||||
StreamChatTheme.of(context).channelTheme.channelHeaderTheme.color,
|
||||
actions: <Widget>[
|
||||
@@ -75,7 +79,7 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
title: message.type != 'ephemeral'
|
||||
? InkWell(
|
||||
onTap: onTitleTap,
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
height: preferredSize.height,
|
||||
width: preferredSize.width,
|
||||
child: Column(
|
||||
@@ -84,7 +88,8 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
children: <Widget>[
|
||||
Text(
|
||||
userName,
|
||||
style: StreamChatTheme.of(context).textTheme.headlineBold,
|
||||
style:
|
||||
StreamChatTheme.of(context).textTheme.headlineBold,
|
||||
),
|
||||
Text(
|
||||
sentAt,
|
||||
@@ -96,9 +101,8 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox(),
|
||||
: const SizedBox(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
final Size preferredSize;
|
||||
@@ -109,16 +113,14 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
final result = await showDialog(
|
||||
context: context,
|
||||
barrierColor: StreamChatTheme.of(context).colorTheme.overlay,
|
||||
builder: (context) {
|
||||
return StreamChannel(
|
||||
builder: (context) => StreamChannel(
|
||||
channel: channel,
|
||||
child: AttachmentActionsModal(
|
||||
message: message,
|
||||
currentIndex: currentIndex,
|
||||
onShowMessage: onShowMessage,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
|
||||
@@ -812,7 +812,8 @@ class MessageInputState extends State<MessageInput> {
|
||||
final renderBox = context.findRenderObject() as RenderBox;
|
||||
final size = renderBox.size;
|
||||
|
||||
return OverlayEntry(builder: (context) => Positioned(
|
||||
return OverlayEntry(
|
||||
builder: (context) => Positioned(
|
||||
bottom: size.height + MediaQuery.of(context).viewInsets.bottom,
|
||||
left: 0,
|
||||
right: 0,
|
||||
@@ -832,9 +833,12 @@ class MessageInputState extends State<MessageInput> {
|
||||
color: StreamChatTheme.of(context).colorTheme.white,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Container(
|
||||
constraints: BoxConstraints.loose(Size.fromHeight(400)),
|
||||
constraints:
|
||||
BoxConstraints.loose(Size.fromHeight(400)),
|
||||
decoration: BoxDecoration(
|
||||
color: StreamChatTheme.of(context).colorTheme.white,
|
||||
color: StreamChatTheme.of(context)
|
||||
.colorTheme
|
||||
.white,
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(0),
|
||||
@@ -891,17 +895,20 @@ class MessageInputState extends State<MessageInput> {
|
||||
TextSpan(
|
||||
text: c.name.capitalize(),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: ' /${c.name} ${c.args}',
|
||||
text:
|
||||
' /${c.name} ${c.args}',
|
||||
style:
|
||||
StreamChatTheme.of(context)
|
||||
StreamChatTheme.of(
|
||||
context)
|
||||
.textTheme
|
||||
.body
|
||||
.copyWith(
|
||||
color: StreamChatTheme
|
||||
.of(context)
|
||||
color: StreamChatTheme.of(
|
||||
context)
|
||||
.colorTheme
|
||||
.grey,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user