Merge pull request #568 from GetStream/hotfix/listBackground

fix(ui): list background
This commit is contained in:
Salvatore Giordano
2021-07-21 12:32:18 +02:00
committed by GitHub
4 changed files with 311 additions and 275 deletions
@@ -231,13 +231,21 @@ class _ChannelListViewState extends State<ChannelListView> {
); );
} }
return ColoredBox( child = LazyLoadScrollView(
color: ChannelListViewTheme.of(context).backgroundColor!,
child: LazyLoadScrollView(
onEndOfPage: () => _channelListController.paginateData!(), onEndOfPage: () => _channelListController.paginateData!(),
child: child, child: child,
),
); );
final backgroundColor = ChannelListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: child,
);
}
return child;
} }
Widget _buildListView(BuildContext context, List<Channel> channels) { Widget _buildListView(BuildContext context, List<Channel> channels) {
@@ -386,9 +386,7 @@ class _MessageListViewState extends State<MessageListView> {
1 // parent message 1 // parent message
; ;
return ColoredBox( final child = Stack(
color: MessageListViewTheme.of(context).backgroundColor!,
child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
ConnectionStatusBuilder( ConnectionStatusBuilder(
@@ -560,8 +558,7 @@ class _MessageListViewState extends State<MessageListView> {
const Offstage(); const Offstage();
} }
const bottomMessageIndex = const bottomMessageIndex = 2; // 1 -> loader // 0 -> footer
2; // 1 -> loader // 0 -> footer
final message = messages[i - 2]; final message = messages[i - 2];
Widget messageWidget; Widget messageWidget;
@@ -588,8 +585,18 @@ class _MessageListViewState extends State<MessageListView> {
if (widget.showFloatingDateDivider) if (widget.showFloatingDateDivider)
_buildFloatingDateDivider(itemCount), _buildFloatingDateDivider(itemCount),
], ],
),
); );
final backgroundColor = MessageListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: child,
);
}
return child;
} }
Widget _buildThreadSeparator() { Widget _buildThreadSeparator() {
@@ -144,9 +144,8 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
widget.messageSearchListController ?? _defaultController; widget.messageSearchListController ?? _defaultController;
@override @override
Widget build(BuildContext context) => ColoredBox( Widget build(BuildContext context) {
color: MessageSearchListViewTheme.of(context).backgroundColor!, final messageSearchListCore = MessageSearchListCore(
child: MessageSearchListCore(
filters: widget.filters, filters: widget.filters,
sortOptions: widget.sortOptions, sortOptions: widget.sortOptions,
messageQuery: widget.messageQuery, messageQuery: widget.messageQuery,
@@ -197,9 +196,21 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
), ),
), ),
childBuilder: widget.childBuilder ?? _buildListView, childBuilder: widget.childBuilder ?? _buildListView,
),
); );
final backgroundColor =
MessageSearchListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: messageSearchListCore,
);
}
return messageSearchListCore;
}
Widget _separatorBuilder(BuildContext context, int index) => Container( Widget _separatorBuilder(BuildContext context, int index) => Container(
height: 1, height: 1,
color: StreamChatTheme.of(context).colorTheme.borders, color: StreamChatTheme.of(context).colorTheme.borders,
@@ -160,9 +160,7 @@ class _UserListViewState extends State<UserListView>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final child = ColoredBox( final userListCore = UserListCore(
color: UserListViewTheme.of(context).backgroundColor!,
child: UserListCore(
errorBuilder: widget.errorBuilder ?? errorBuilder: widget.errorBuilder ??
(BuildContext context, Object err) => _buildError(err), (BuildContext context, Object err) => _buildError(err),
emptyBuilder: widget.emptyBuilder ?? (context) => _buildEmpty(), emptyBuilder: widget.emptyBuilder ?? (context) => _buildEmpty(),
@@ -189,9 +187,21 @@ class _UserListViewState extends State<UserListView>
presence: widget.presence, presence: widget.presence,
groupAlphabetically: widget.groupAlphabetically, groupAlphabetically: widget.groupAlphabetically,
userListController: _userListController, userListController: _userListController,
),
); );
final backgroundColor = UserListViewTheme.of(context).backgroundColor;
Widget child;
if (backgroundColor != null) {
child = ColoredBox(
color: backgroundColor,
child: userListCore,
);
} else {
child = userListCore;
}
if (!widget.pullToRefresh) { if (!widget.pullToRefresh) {
return child; return child;
} else { } else {