[Channel Image] Fix selection state
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -53,6 +53,8 @@ class ChannelImage extends StatelessWidget {
|
|||||||
this.showOnlineStatus = true,
|
this.showOnlineStatus = true,
|
||||||
this.borderRadius,
|
this.borderRadius,
|
||||||
this.selected = false,
|
this.selected = false,
|
||||||
|
this.selectionColor = const Color(0xFF006CFF),
|
||||||
|
this.selectionThickness = 4,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final BorderRadius borderRadius;
|
final BorderRadius borderRadius;
|
||||||
@@ -70,6 +72,10 @@ class ChannelImage extends StatelessWidget {
|
|||||||
|
|
||||||
final bool selected;
|
final bool selected;
|
||||||
|
|
||||||
|
final Color selectionColor;
|
||||||
|
|
||||||
|
final double selectionThickness;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final streamChat = StreamChat.of(context);
|
final streamChat = StreamChat.of(context);
|
||||||
@@ -97,12 +103,10 @@ class ChannelImage extends StatelessWidget {
|
|||||||
.channelPreviewTheme
|
.channelPreviewTheme
|
||||||
.avatarTheme
|
.avatarTheme
|
||||||
.constraints,
|
.constraints,
|
||||||
onTap: onTap != null
|
onTap: onTap != null ? (_) => onTap() : null,
|
||||||
? (_) {
|
|
||||||
onTap();
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
selected: selected,
|
selected: selected,
|
||||||
|
selectionColor: selectionColor,
|
||||||
|
selectionThickness: selectionThickness,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -123,10 +127,12 @@ class ChannelImage extends StatelessWidget {
|
|||||||
.constraints,
|
.constraints,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
selected: selected,
|
selected: selected,
|
||||||
|
selectionColor: selectionColor,
|
||||||
|
selectionThickness: selectionThickness,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ClipRRect(
|
Widget child = ClipRRect(
|
||||||
borderRadius: borderRadius ??
|
borderRadius: borderRadius ??
|
||||||
StreamChatTheme.of(context)
|
StreamChatTheme.of(context)
|
||||||
.channelPreviewTheme
|
.channelPreviewTheme
|
||||||
@@ -175,6 +181,29 @@ class ChannelImage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
if (selected) {
|
||||||
|
child = ClipRRect(
|
||||||
|
borderRadius: (borderRadius ??
|
||||||
|
StreamChatTheme.of(context)
|
||||||
|
.ownMessageTheme
|
||||||
|
.avatarTheme
|
||||||
|
.borderRadius) +
|
||||||
|
BorderRadius.circular(selectionThickness),
|
||||||
|
child: Container(
|
||||||
|
constraints: constraints ??
|
||||||
|
StreamChatTheme.of(context)
|
||||||
|
.ownMessageTheme
|
||||||
|
.avatarTheme
|
||||||
|
.constraints,
|
||||||
|
color: selectionColor,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(selectionThickness),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return child;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user