major refactoring

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-05-27 19:59:34 +05:30
parent 99afb0ba8e
commit 839ced618b
106 changed files with 4263 additions and 1937 deletions
@@ -23,6 +23,10 @@ environment:
dependencies:
flutter:
sdk: flutter
# stream_chat:
# path: ../../stream_chat
# stream_chat_flutter_core:
# path: ../../stream_chat_flutter_core
stream_chat_flutter:
path: ../
stream_chat_persistence:
@@ -132,10 +132,9 @@ class ChannelInfo extends StatelessWidget {
vertical: VisualDensity.minimumDensity,
),
),
onPressed: () async {
await client.disconnect();
await client.connect();
},
onPressed: () => client
..closeConnection()
..openConnection(),
child: Text(
'Try Again',
style: textStyle?.copyWith(
@@ -253,10 +253,9 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
),
),
TextButton(
onPressed: () async {
await client.disconnect();
await client.connect();
},
onPressed: () => client
..closeConnection()
..openConnection(),
child: Text(
'Try Again',
style: chatThemeData.channelListHeaderTheme.title?.copyWith(
@@ -58,9 +58,15 @@ class ChannelListView extends StatefulWidget {
const ChannelListView({
Key? key,
this.filter,
this.options,
this.sort,
this.pagination,
this.state = true,
this.watch = true,
this.presence = false,
this.memberLimit,
this.messageLimit,
this.pagination = const PaginationParams(
limit: 25,
),
this.onChannelTap,
this.onChannelLongPress,
this.channelWidget,
@@ -88,12 +94,6 @@ class ChannelListView extends StatefulWidget {
/// You can also filter other built-in channel fields.
final Filter? filter;
/// Query channels options.
///
/// state: if true returns the Channel state
/// watch: if true listen to changes to this Channel in real time.
final Map<String, dynamic>? options;
/// The sorting used for the channels matching the filters.
/// Sorting is based on field and direction, multiple sorting options
/// can be provided.
@@ -102,11 +102,22 @@ class ChannelListView extends StatefulWidget {
/// Direction can be ascending or descending.
final List<SortOption<ChannelModel>>? sort;
/// If true returns the Channel state
final bool state;
/// If true listen to changes to this Channel in real time.
final bool watch;
final bool presence;
final int? memberLimit;
final int? messageLimit;
/// Pagination parameters
/// limit: the number of channels to return (max is 30)
/// offset: the offset (max is 1000)
/// message_limit: how many messages should be included to each channel
final PaginationParams? pagination;
final PaginationParams pagination;
/// Function called when tapping on a channel
/// By default it calls [Navigator.push] building a [MaterialPageRoute]
@@ -170,13 +181,14 @@ class _ChannelListViewState extends State<ChannelListView> {
@override
Widget build(BuildContext context) {
Widget child = ChannelListCore(
pagination: widget.pagination ??
const PaginationParams(
limit: 25,
),
options: widget.options,
sort: widget.sort,
filter: widget.filter,
sort: widget.sort,
state: widget.state,
watch: widget.watch,
presence: widget.presence,
memberLimit: widget.memberLimit,
messageLimit: widget.messageLimit,
pagination: widget.pagination,
channelListController: _channelListController,
listBuilder: widget.listBuilder ?? _buildListView,
emptyBuilder: widget.emptyBuilder ?? _buildEmptyWidget,
@@ -47,8 +47,8 @@ class UserListView extends StatefulWidget {
const UserListView({
Key? key,
this.filter,
this.options,
this.sort,
this.presence,
this.pagination,
this.onUserTap,
this.onUserLongPress,
@@ -75,12 +75,6 @@ class UserListView extends StatefulWidget {
/// You can also filter other built-in channel fields.
final Filter? filter;
/// Query channels options.
///
/// state: if true returns the Channel state
/// watch: if true listen to changes to this Channel in real time.
final Map<String, dynamic>? options;
/// The sorting used for the channels matching the filters.
/// Sorting is based on field and direction, multiple sorting options can
/// be provided.
@@ -89,6 +83,9 @@ class UserListView extends StatefulWidget {
/// Direction can be ascending or descending.
final List<SortOption>? sort;
///
final bool? presence;
/// Pagination parameters
/// limit: the number of users to return (max is 30)
/// offset: the offset (max is 1000)
@@ -177,9 +174,9 @@ class _UserListViewState extends State<UserListView>
listBuilder:
widget.listBuilder ?? (context, list) => _buildListView(list),
pagination: widget.pagination,
options: widget.options,
sort: widget.sort,
filter: widget.filter,
presence: widget.presence,
groupAlphabetically: widget.groupAlphabetically,
userListController: _userListController,
);
@@ -53,6 +53,12 @@ flutter:
- animations/
uses-material-design: true
dependency_overrides:
stream_chat:
path: ../stream_chat
stream_chat_flutter_core:
path: ../stream_chat_flutter_core
dev_dependencies:
flutter_test:
sdk: flutter