[MessageSearchListView] : Minor improvements.
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -14,6 +14,10 @@ typedef MessageSearchItemTapCallback = void Function(GetMessageResponse);
|
|||||||
typedef MessageSearchItemBuilder = Widget Function(
|
typedef MessageSearchItemBuilder = Widget Function(
|
||||||
BuildContext, GetMessageResponse);
|
BuildContext, GetMessageResponse);
|
||||||
|
|
||||||
|
/// Builder used when [MessageSearchListView] is empty
|
||||||
|
typedef EmptyMessageSearchBuilder = Widget Function(
|
||||||
|
BuildContext context, String searchQuery);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// It shows the list of searched messages.
|
/// It shows the list of searched messages.
|
||||||
///
|
///
|
||||||
@@ -85,7 +89,7 @@ class MessageSearchListView extends StatefulWidget {
|
|||||||
final MessageSearchItemTapCallback onItemTap;
|
final MessageSearchItemTapCallback onItemTap;
|
||||||
|
|
||||||
/// The builder used when the channel list is empty.
|
/// The builder used when the channel list is empty.
|
||||||
final WidgetBuilder emptyBuilder;
|
final EmptyMessageSearchBuilder emptyBuilder;
|
||||||
|
|
||||||
/// The builder that will be used in case of error
|
/// The builder that will be used in case of error
|
||||||
final Widget Function(Error error) errorBuilder;
|
final Widget Function(Error error) errorBuilder;
|
||||||
@@ -250,11 +254,10 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
|
|||||||
|
|
||||||
final items = snapshot.data;
|
final items = snapshot.data;
|
||||||
|
|
||||||
if (items.isEmpty && widget.emptyBuilder != null) {
|
if (items.isEmpty) {
|
||||||
return widget.emptyBuilder(context);
|
if (widget.emptyBuilder != null) {
|
||||||
}
|
return widget.emptyBuilder(context, widget.messageQuery);
|
||||||
|
}
|
||||||
if (items.isEmpty && widget.emptyBuilder == null) {
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, viewportConstraints) {
|
builder: (context, viewportConstraints) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
|
|||||||
Reference in New Issue
Block a user