Merge branch 'develop' into hotfix/messagePagination

This commit is contained in:
Salvatore Giordano
2022-05-16 15:53:18 +02:00
183 changed files with 666 additions and 762 deletions
@@ -3,4 +3,4 @@
# Fast fail the script on failures.
set -e
pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r '\.freezed\.dart$'
flutter pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r '\.freezed\.dart$'
@@ -94,7 +94,7 @@ jobs:
- name: "Install Tools"
run: |
flutter pub global activate melos ${{ env.melos_version }}
pub global activate remove_from_coverage
flutter pub global activate remove_from_coverage
- name: "Bootstrap Workspace"
run: melos bootstrap
- name: "Flutter Test"
+16
View File
@@ -147,6 +147,22 @@ linter:
- tighten_type_of_initializing_formals
- null_check_on_nullable_type_parameter
- conditional_uri_does_not_exist
- secure_pubspec_urls
- sized_box_shrink_expand
- unnecessary_constructor_name
- unnecessary_late
- use_colored_box
- use_decorated_box
- use_enums
- use_super_parameters
- avoid_escaping_inner_quotes
- unnecessary_overrides
- prefer_null_aware_method_calls
- prefer_null_aware_operators
- use_named_constants
- use_raw_strings
# https://dartcodemetrics.dev/docs/getting-started/introduction
dart_code_metrics:
rules:
View File
+13 -2
View File
@@ -1,4 +1,5 @@
name: stream_chat_flutter
repository: https://github.com/GetStream/stream-chat-flutter
versioning:
mode: independent
@@ -7,6 +8,10 @@ packages:
- packages/**
scripts:
postclean:
run: melos run clean:flutter --no-select
description: Runs "flutter clean" in all Flutter packages
lint:all:
run: melos run analyze && melos run format
description: Run all static analysis checks
@@ -74,6 +79,12 @@ scripts:
flutter: true
dir-exists: test
clean:flutter:
run: melos exec -c 4 --fail-fast -- "flutter clean"
description: Run Flutter clean for a specific package in this project.
select-package:
flutter: true
coverage:ignore-file:
run: |
melos exec -c 5 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh"
@@ -91,5 +102,5 @@ dev_dependencies:
dart_code_metrics: ^4.4.0
environment:
sdk: '>=2.12.0 <3.0.0'
flutter: '>=1.17.0 <2.0.0'
sdk: '>=2.17.0 <3.0.0'
flutter: '>=1.17.0 <3.0.0'
+6 -6
View File
@@ -43,10 +43,10 @@ class StreamExample extends StatelessWidget {
/// To initialize this example, an instance of
/// [client] and [channel] is required.
const StreamExample({
Key? key,
super.key,
required this.client,
required this.channel,
}) : super(key: key);
});
/// Instance of [StreamChatClient] we created earlier.
/// This contains information about our application and connection state.
@@ -67,9 +67,9 @@ class StreamExample extends StatelessWidget {
class HomeScreen extends StatelessWidget {
/// [HomeScreen] is constructed using the [Channel] we defined earlier.
const HomeScreen({
Key? key,
super.key,
required this.channel,
}) : super(key: key);
});
/// Channel object containing the [Channel.id] we'd like to observe.
final Channel channel;
@@ -119,10 +119,10 @@ class HomeScreen extends StatelessWidget {
class MessageView extends StatefulWidget {
/// Message takes the latest list of messages and the current channel.
const MessageView({
Key? key,
super.key,
required this.messages,
required this.channel,
}) : super(key: key);
});
/// List of messages sent in the given channel.
final List<Message> messages;
+1 -1
View File
@@ -5,7 +5,7 @@ publish_to: "none"
version: 1.0.0+1
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'
dependencies:
cupertino_icons: ^1.0.0
@@ -2173,7 +2173,7 @@ class ChannelClientState {
/// The channel threads related to this channel.
Map<String, List<Message>> get threads =>
_threadsController.value.map((key, value) => MapEntry(key, value));
_threadsController.value.map(MapEntry.new);
/// The channel threads related to this channel as a stream.
Stream<Map<String, List<Message>>> get threadsStream =>
@@ -21,9 +21,9 @@ class StreamChatError with EquatableMixin implements Exception {
class StreamWebSocketError extends StreamChatError {
///
const StreamWebSocketError(
String message, {
super.message, {
this.data,
}) : super(message);
});
///
factory StreamWebSocketError.fromStreamError(Map<String, Object?> error) {
@@ -6,14 +6,11 @@ class StreamChatDioError extends DioError {
/// Initialize a stream chat dio error
StreamChatDioError({
required this.error,
required RequestOptions requestOptions,
Response? response,
DioErrorType type = DioErrorType.other,
required super.requestOptions,
super.response,
super.type,
}) : super(
error: error,
requestOptions: requestOptions,
response: response,
type: type,
);
@override
@@ -136,19 +136,21 @@ class _$UploadStateCopyWithImpl<$Res> implements $UploadStateCopyWith<$Res> {
}
/// @nodoc
abstract class $PreparingCopyWith<$Res> {
factory $PreparingCopyWith(Preparing value, $Res Function(Preparing) then) =
_$PreparingCopyWithImpl<$Res>;
abstract class _$$PreparingCopyWith<$Res> {
factory _$$PreparingCopyWith(
_$Preparing value, $Res Function(_$Preparing) then) =
__$$PreparingCopyWithImpl<$Res>;
}
/// @nodoc
class _$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $PreparingCopyWith<$Res> {
_$PreparingCopyWithImpl(Preparing _value, $Res Function(Preparing) _then)
: super(_value, (v) => _then(v as Preparing));
class __$$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$PreparingCopyWith<$Res> {
__$$PreparingCopyWithImpl(
_$Preparing _value, $Res Function(_$Preparing) _then)
: super(_value, (v) => _then(v as _$Preparing));
@override
Preparing get _value => super._value as Preparing;
_$Preparing get _value => super._value as _$Preparing;
}
/// @nodoc
@@ -170,7 +172,7 @@ class _$Preparing implements Preparing {
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is Preparing);
(other.runtimeType == runtimeType && other is _$Preparing);
}
@override
@@ -263,28 +265,29 @@ abstract class Preparing implements UploadState {
}
/// @nodoc
abstract class $InProgressCopyWith<$Res> {
factory $InProgressCopyWith(
InProgress value, $Res Function(InProgress) then) =
_$InProgressCopyWithImpl<$Res>;
abstract class _$$InProgressCopyWith<$Res> {
factory _$$InProgressCopyWith(
_$InProgress value, $Res Function(_$InProgress) then) =
__$$InProgressCopyWithImpl<$Res>;
$Res call({int uploaded, int total});
}
/// @nodoc
class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $InProgressCopyWith<$Res> {
_$InProgressCopyWithImpl(InProgress _value, $Res Function(InProgress) _then)
: super(_value, (v) => _then(v as InProgress));
class __$$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$InProgressCopyWith<$Res> {
__$$InProgressCopyWithImpl(
_$InProgress _value, $Res Function(_$InProgress) _then)
: super(_value, (v) => _then(v as _$InProgress));
@override
InProgress get _value => super._value as InProgress;
_$InProgress get _value => super._value as _$InProgress;
@override
$Res call({
Object? uploaded = freezed,
Object? total = freezed,
}) {
return _then(InProgress(
return _then(_$InProgress(
uploaded: uploaded == freezed
? _value.uploaded
: uploaded // ignore: cast_nullable_to_non_nullable
@@ -324,7 +327,7 @@ class _$InProgress implements InProgress {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is InProgress &&
other is _$InProgress &&
const DeepCollectionEquality().equals(other.uploaded, uploaded) &&
const DeepCollectionEquality().equals(other.total, total));
}
@@ -337,8 +340,8 @@ class _$InProgress implements InProgress {
@JsonKey(ignore: true)
@override
$InProgressCopyWith<InProgress> get copyWith =>
_$InProgressCopyWithImpl<InProgress>(this, _$identity);
_$$InProgressCopyWith<_$InProgress> get copyWith =>
__$$InProgressCopyWithImpl<_$InProgress>(this, _$identity);
@override
@optionalTypeArgs
@@ -430,24 +433,24 @@ abstract class InProgress implements UploadState {
int get uploaded;
int get total;
@JsonKey(ignore: true)
$InProgressCopyWith<InProgress> get copyWith =>
_$$InProgressCopyWith<_$InProgress> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SuccessCopyWith<$Res> {
factory $SuccessCopyWith(Success value, $Res Function(Success) then) =
_$SuccessCopyWithImpl<$Res>;
abstract class _$$SuccessCopyWith<$Res> {
factory _$$SuccessCopyWith(_$Success value, $Res Function(_$Success) then) =
__$$SuccessCopyWithImpl<$Res>;
}
/// @nodoc
class _$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $SuccessCopyWith<$Res> {
_$SuccessCopyWithImpl(Success _value, $Res Function(Success) _then)
: super(_value, (v) => _then(v as Success));
class __$$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$SuccessCopyWith<$Res> {
__$$SuccessCopyWithImpl(_$Success _value, $Res Function(_$Success) _then)
: super(_value, (v) => _then(v as _$Success));
@override
Success get _value => super._value as Success;
_$Success get _value => super._value as _$Success;
}
/// @nodoc
@@ -469,7 +472,7 @@ class _$Success implements Success {
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is Success);
(other.runtimeType == runtimeType && other is _$Success);
}
@override
@@ -562,26 +565,26 @@ abstract class Success implements UploadState {
}
/// @nodoc
abstract class $FailedCopyWith<$Res> {
factory $FailedCopyWith(Failed value, $Res Function(Failed) then) =
_$FailedCopyWithImpl<$Res>;
abstract class _$$FailedCopyWith<$Res> {
factory _$$FailedCopyWith(_$Failed value, $Res Function(_$Failed) then) =
__$$FailedCopyWithImpl<$Res>;
$Res call({String error});
}
/// @nodoc
class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $FailedCopyWith<$Res> {
_$FailedCopyWithImpl(Failed _value, $Res Function(Failed) _then)
: super(_value, (v) => _then(v as Failed));
class __$$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$FailedCopyWith<$Res> {
__$$FailedCopyWithImpl(_$Failed _value, $Res Function(_$Failed) _then)
: super(_value, (v) => _then(v as _$Failed));
@override
Failed get _value => super._value as Failed;
_$Failed get _value => super._value as _$Failed;
@override
$Res call({
Object? error = freezed,
}) {
return _then(Failed(
return _then(_$Failed(
error: error == freezed
? _value.error
: error // ignore: cast_nullable_to_non_nullable
@@ -614,7 +617,7 @@ class _$Failed implements Failed {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Failed &&
other is _$Failed &&
const DeepCollectionEquality().equals(other.error, error));
}
@@ -624,8 +627,8 @@ class _$Failed implements Failed {
@JsonKey(ignore: true)
@override
$FailedCopyWith<Failed> get copyWith =>
_$FailedCopyWithImpl<Failed>(this, _$identity);
_$$FailedCopyWith<_$Failed> get copyWith =>
__$$FailedCopyWithImpl<_$Failed>(this, _$identity);
@override
@optionalTypeArgs
@@ -714,5 +717,6 @@ abstract class Failed implements UploadState {
String get error;
@JsonKey(ignore: true)
$FailedCopyWith<Failed> get copyWith => throw _privateConstructorUsedError;
_$$FailedCopyWith<_$Failed> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -177,36 +177,21 @@ class EventChannel extends ChannelModel {
/// Constructor used for json serialization
EventChannel({
this.members,
String? id,
String? type,
required String cid,
required ChannelConfig config,
User? createdBy,
bool frozen = false,
DateTime? lastMessageAt,
required DateTime createdAt,
required DateTime updatedAt,
DateTime? deletedAt,
int memberCount = 0,
super.id,
super.type,
required String super.cid,
required ChannelConfig super.config,
super.createdBy,
super.frozen,
super.lastMessageAt,
required DateTime super.createdAt,
required DateTime super.updatedAt,
super.deletedAt,
super.memberCount,
Map<String, Object?>? extraData,
int cooldown = 0,
String? team,
}) : super(
id: id,
type: type,
cid: cid,
config: config,
createdBy: createdBy,
frozen: frozen,
lastMessageAt: lastMessageAt,
createdAt: createdAt,
updatedAt: updatedAt,
deletedAt: deletedAt,
memberCount: memberCount,
extraData: extraData ?? {},
cooldown: cooldown,
team: team,
);
super.cooldown,
super.team,
}) : super(extraData: extraData ?? {});
/// Create a new instance from a json
factory EventChannel.fromJson(Map<String, dynamic> json) =>
@@ -60,21 +60,21 @@ enum FilterOperator {
extension FilterOperatorX on FilterOperator {
/// Converts [FilterOperator] into rew values
String get rawValue => {
FilterOperator.equal: '\$eq',
FilterOperator.notEqual: '\$ne',
FilterOperator.greater: '\$gt',
FilterOperator.greaterOrEqual: '\$gte',
FilterOperator.less: '\$lt',
FilterOperator.lessOrEqual: '\$lte',
FilterOperator.in_: '\$in',
FilterOperator.notIn: '\$nin',
FilterOperator.query: '\$q',
FilterOperator.autoComplete: '\$autocomplete',
FilterOperator.exists: '\$exists',
FilterOperator.and: '\$and',
FilterOperator.or: '\$or',
FilterOperator.nor: '\$nor',
FilterOperator.contains: '\$contains',
FilterOperator.equal: r'$eq',
FilterOperator.notEqual: r'$ne',
FilterOperator.greater: r'$gt',
FilterOperator.greaterOrEqual: r'$gte',
FilterOperator.less: r'$lt',
FilterOperator.lessOrEqual: r'$lte',
FilterOperator.in_: r'$in',
FilterOperator.notIn: r'$nin',
FilterOperator.query: r'$q',
FilterOperator.autoComplete: r'$autocomplete',
FilterOperator.exists: r'$exists',
FilterOperator.and: r'$and',
FilterOperator.or: r'$or',
FilterOperator.nor: r'$nor',
FilterOperator.contains: r'$contains',
}[this]!;
}
@@ -17,34 +17,20 @@ class OwnUser extends User {
this.totalUnreadCount = 0,
this.unreadChannels = 0,
this.channelMutes = const [],
required String id,
String? role,
String? name,
String? image,
DateTime? createdAt,
DateTime? updatedAt,
DateTime? lastActive,
bool online = false,
Map<String, Object?> extraData = const {},
bool banned = false,
DateTime? banExpires,
List<String> teams = const [],
String? language,
}) : super(
id: id,
role: role,
name: name,
image: image,
createdAt: createdAt,
updatedAt: updatedAt,
lastActive: lastActive,
online: online,
extraData: extraData,
banned: banned,
banExpires: banExpires,
teams: teams,
language: language,
);
required super.id,
super.role,
super.name,
super.image,
super.createdAt,
super.updatedAt,
super.lastActive,
super.online,
super.extraData,
super.banned,
super.banExpires,
super.teams,
super.language,
});
/// Create a new instance from json.
factory OwnUser.fromJson(Map<String, dynamic> json) => _$OwnUserFromJson(
+5 -5
View File
@@ -6,17 +6,17 @@ repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'
dependencies:
async: ^2.5.0
collection: ^1.15.0
dio: ^4.0.0
equatable: ^2.0.0
freezed_annotation: ^1.0.0
freezed_annotation: ^2.0.3
http_parser: ^4.0.0
jose: ^0.3.2
json_annotation: ^4.3.0
json_annotation: ^4.5.0
logging: ^1.0.1
meta: ^1.3.0
mime: ^1.0.0
@@ -28,7 +28,7 @@ dependencies:
dev_dependencies:
build_runner: ^2.0.1
dart_code_metrics: ^4.4.0
freezed: ^1.0.0
json_serializable: ^6.0.1
freezed: ^2.0.3
json_serializable: ^6.2.0
mocktail: ^0.3.0
test: ^1.17.12
@@ -49,6 +49,7 @@ void main() {
channel: ChannelModel.fromJson(j['channel']),
members: [],
messages:
// ignore: unnecessary_lambdas
(j['messages'] as List).map((m) => Message.fromJson(m)).toList(),
read: [],
watcherCount: 5,
@@ -123,7 +123,7 @@ void main() {
test('custom', () {
const key = 'testKey';
const value = 'testValue';
const operator = '\$customOperator';
const operator = r'$customOperator';
const filter = Filter.custom(operator: operator, key: key, value: value);
expect(filter.key, key);
expect(filter.value, value);
@@ -1,3 +1,9 @@
## Upcoming
🐞 Fixed
- [[#1133]](https://github.com/GetStream/stream-chat-flutter/issues/1133) Visibility override flags not being passed to `StreamMessageActionsModal`
## 4.1.0
✅ Added
@@ -47,10 +47,10 @@ class MyApp extends StatelessWidget {
/// If you'd prefer using minimal wrapper widgets for your app, please see
/// our other package, `stream_chat_flutter_core`.
const MyApp({
Key? key,
super.key,
required this.client,
required this.channel,
}) : super(key: key);
});
/// Instance of Stream Client.
///
@@ -94,8 +94,8 @@ class MyApp extends StatelessWidget {
class ChannelPage extends StatelessWidget {
/// Creates the page that shows the list of messages
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) => Scaffold(
@@ -22,9 +22,9 @@ void main() async {
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.client,
}) : super(key: key);
});
final StreamChatClient client;
@@ -40,8 +40,8 @@ class MyApp extends StatelessWidget {
class SplitView extends StatefulWidget {
const SplitView({
Key? key,
}) : super(key: key);
super.key,
});
@override
_SplitViewState createState() => _SplitViewState();
@@ -86,9 +86,9 @@ class _SplitViewState extends State<SplitView> {
class ChannelListPage extends StatefulWidget {
const ChannelListPage({
Key? key,
super.key,
this.onTap,
}) : super(key: key);
});
final void Function(Channel)? onTap;
@@ -118,8 +118,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) => Navigator(
@@ -58,10 +58,10 @@ void main() async {
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.client,
required this.channel,
}) : super(key: key);
});
final StreamChatClient client;
@@ -86,8 +86,8 @@ class MyApp extends StatelessWidget {
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) => Scaffold(
@@ -51,9 +51,9 @@ void main() async {
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.client,
}) : super(key: key);
});
final StreamChatClient client;
@@ -73,9 +73,9 @@ class MyApp extends StatelessWidget {
class ChannelListPage extends StatefulWidget {
const ChannelListPage({
Key? key,
super.key,
required this.client,
}) : super(key: key);
});
final StreamChatClient client;
@@ -121,8 +121,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) => Scaffold(
@@ -51,9 +51,9 @@ Future<void> main() async {
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.client,
}) : super(key: key);
});
final StreamChatClient client;
@@ -71,8 +71,8 @@ class MyApp extends StatelessWidget {
class ChannelListPage extends StatefulWidget {
const ChannelListPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
State<ChannelListPage> createState() => _ChannelListPageState();
@@ -164,8 +164,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) {
@@ -38,9 +38,9 @@ Future<void> main() async {
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.client,
}) : super(key: key);
});
final StreamChatClient client;
@@ -58,8 +58,8 @@ class MyApp extends StatelessWidget {
class ChannelListPage extends StatefulWidget {
const ChannelListPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
State<ChannelListPage> createState() => _ChannelListPageState();
@@ -102,8 +102,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) => Scaffold(
@@ -125,9 +125,9 @@ class ChannelPage extends StatelessWidget {
class ThreadPage extends StatelessWidget {
const ThreadPage({
Key? key,
super.key,
this.parent,
}) : super(key: key);
});
final Message? parent;
@@ -41,9 +41,9 @@ Future<void> main() async {
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.client,
}) : super(key: key);
});
final StreamChatClient client;
@@ -61,8 +61,8 @@ class MyApp extends StatelessWidget {
class ChannelListPage extends StatefulWidget {
const ChannelListPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
State<ChannelListPage> createState() => _ChannelListPageState();
@@ -105,8 +105,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) {
@@ -139,7 +139,7 @@ class ChannelPage extends StatelessWidget {
return Padding(
padding: const EdgeInsets.all(5),
child: Container(
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: color,
@@ -48,9 +48,9 @@ Future<void> main() async {
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.client,
}) : super(key: key);
});
final StreamChatClient client;
@@ -101,8 +101,8 @@ class MyApp extends StatelessWidget {
class ChannelListPage extends StatefulWidget {
const ChannelListPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
State<ChannelListPage> createState() => _ChannelListPageState();
@@ -145,8 +145,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) => Scaffold(
@@ -168,9 +168,9 @@ class ChannelPage extends StatelessWidget {
class ThreadPage extends StatelessWidget {
const ThreadPage({
Key? key,
super.key,
this.parent,
}) : super(key: key);
});
final Message? parent;
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'
dependencies:
# The following adds the Cupertino Icons font to your application.
@@ -320,7 +320,7 @@ class _PositionedListState extends State<PositionedList> {
void _schedulePositionNotificationUpdate() {
if (!updateScheduled) {
updateScheduled = true;
SchedulerBinding.instance!.addPostFrameCallback((_) {
SchedulerBinding.instance.addPostFrameCallback((_) {
if (registeredElements.value == null) {
updateScheduled = false;
return;
@@ -439,7 +439,7 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
}
if (_isTransitioning) {
_stopScroll(canceled: true);
SchedulerBinding.instance!.addPostFrameCallback((_) {
SchedulerBinding.instance.addPostFrameCallback((_) {
_startScroll(
index: index,
alignment: alignment,
@@ -488,7 +488,7 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
final startCompleter = Completer<void>();
final endCompleter = Completer<void>();
startAnimationCallback = () {
SchedulerBinding.instance!.addPostFrameCallback((_) {
SchedulerBinding.instance.addPostFrameCallback((_) {
startAnimationCallback = () {};
opacity.parent = _opacityAnimation(opacityAnimationWeights).animate(
@@ -11,10 +11,10 @@ typedef AttachmentTitle = StreamAttachmentTitle;
class StreamAttachmentTitle extends StatelessWidget {
/// Supply attachment and theme for constructing title
const StreamAttachmentTitle({
Key? key,
super.key,
required this.attachment,
required this.messageTheme,
}) : super(key: key);
});
/// Theme to apply to text
final StreamMessageThemeData messageTheme;
@@ -19,14 +19,14 @@ typedef AttachmentUploadStateBuilder = StreamAttachmentUploadStateBuilder;
class StreamAttachmentUploadStateBuilder extends StatelessWidget {
/// Constructor for creating an [StreamAttachmentUploadStateBuilder] widget
const StreamAttachmentUploadStateBuilder({
Key? key,
super.key,
required this.message,
required this.attachment,
this.failedBuilder,
this.successBuilder,
this.inProgressBuilder,
this.preparingBuilder,
}) : super(key: key);
});
/// Message which attachment is added to
final Message message;
@@ -85,30 +85,24 @@ class StreamAttachmentUploadStateBuilder extends StatelessWidget {
class _IconButton extends StatelessWidget {
const _IconButton({
Key? key,
this.icon,
this.iconSize = 24.0,
this.onPressed,
this.fillColor,
}) : super(key: key);
});
final Widget? icon;
final double iconSize;
final VoidCallback? onPressed;
final Color? fillColor;
@override
Widget build(BuildContext context) => SizedBox(
height: iconSize,
width: iconSize,
height: 24,
width: 24,
child: RawMaterialButton(
elevation: 0,
highlightElevation: 0,
focusElevation: 0,
hoverElevation: 0,
onPressed: onPressed,
fillColor:
fillColor ?? StreamChatTheme.of(context).colorTheme.overlayDark,
fillColor: StreamChatTheme.of(context).colorTheme.overlayDark,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
@@ -118,10 +112,7 @@ class _IconButton extends StatelessWidget {
}
class _PreparingState extends StatelessWidget {
const _PreparingState({
Key? key,
required this.attachmentId,
}) : super(key: key);
const _PreparingState({required this.attachmentId});
final String attachmentId;
@@ -155,11 +146,10 @@ class _PreparingState extends StatelessWidget {
class _InProgressState extends StatelessWidget {
const _InProgressState({
Key? key,
required this.sent,
required this.total,
required this.attachmentId,
}) : super(key: key);
});
final int sent;
final int total;
@@ -195,11 +185,10 @@ class _InProgressState extends StatelessWidget {
class _FailedState extends StatelessWidget {
const _FailedState({
Key? key,
this.error,
required this.messageId,
required this.attachmentId,
}) : super(key: key);
});
final String? error;
final String messageId;
@@ -222,7 +211,7 @@ class _FailedState extends StatelessWidget {
},
),
Center(
child: Container(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: theme.colorTheme.overlayDark.withOpacity(0.6),
@@ -38,13 +38,12 @@ typedef AttachmentWidget = StreamAttachmentWidget;
abstract class StreamAttachmentWidget extends StatelessWidget {
/// Constructor for creating attachment widget
const StreamAttachmentWidget({
Key? key,
super.key,
required this.message,
required this.attachment,
this.size,
AttachmentSource? source,
}) : _source = source,
super(key: key);
}) : _source = source;
/// Size of attachments
final Size? size;
@@ -68,9 +67,9 @@ abstract class StreamAttachmentWidget extends StatelessWidget {
class AttachmentError extends StatelessWidget {
/// Constructor for creating AttachmentError
const AttachmentError({
Key? key,
super.key,
this.size,
}) : super(key: key);
});
/// Size of error
final Size? size;
@@ -20,19 +20,14 @@ typedef FileAttachment = StreamFileAttachment;
class StreamFileAttachment extends StreamAttachmentWidget {
/// Constructor for creating a widget when attachment is of type 'file'
const StreamFileAttachment({
Key? key,
required Message message,
required Attachment attachment,
Size? size,
super.key,
required super.message,
required super.attachment,
super.size,
this.title,
this.trailing,
this.onAttachmentTap,
}) : super(
key: key,
message: message,
attachment: attachment,
size: size,
);
});
/// Title for attachment
final Widget? title;
@@ -15,19 +15,14 @@ typedef GiphyAttachment = StreamGiphyAttachment;
class StreamGiphyAttachment extends StreamAttachmentWidget {
/// Constructor for creating a [StreamGiphyAttachment] widget
const StreamGiphyAttachment({
Key? key,
required Message message,
required Attachment attachment,
Size? size,
super.key,
required super.message,
required super.attachment,
super.size,
this.onShowMessage,
this.onReturnAction,
this.onAttachmentTap,
}) : super(
key: key,
message: message,
attachment: attachment,
size: size,
);
});
/// Callback when show message is tapped
final ShowMessageCallback? onShowMessage;
@@ -15,21 +15,16 @@ typedef ImageAttachment = StreamImageAttachment;
class StreamImageAttachment extends StreamAttachmentWidget {
/// Constructor for creating a [StreamImageAttachment] widget
const StreamImageAttachment({
Key? key,
required Message message,
required Attachment attachment,
super.key,
required super.message,
required super.attachment,
required this.messageTheme,
Size? size,
super.size,
this.showTitle = false,
this.onShowMessage,
this.onReturnAction,
this.onAttachmentTap,
}) : super(
key: key,
message: message,
attachment: attachment,
size: size,
);
});
/// [StreamMessageThemeData] for showing image title
final StreamMessageThemeData messageTheme;
@@ -12,7 +12,7 @@ typedef UrlAttachment = StreamUrlAttachment;
class StreamUrlAttachment extends StatelessWidget {
/// Constructor for creating a [StreamUrlAttachment]
const StreamUrlAttachment({
Key? key,
super.key,
required this.urlAttachment,
required this.hostDisplayName,
required this.messageTheme,
@@ -21,7 +21,7 @@ class StreamUrlAttachment extends StatelessWidget {
vertical: 8,
),
this.onLinkTap,
}) : super(key: key);
});
/// Attachment to be displayed
final Attachment urlAttachment;
@@ -70,7 +70,7 @@ class StreamUrlAttachment extends StatelessWidget {
Positioned(
left: 0,
bottom: -1,
child: Container(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(16),
@@ -14,20 +14,15 @@ typedef VideoAttachment = StreamVideoAttachment;
class StreamVideoAttachment extends StreamAttachmentWidget {
/// Constructor for creating a [StreamVideoAttachment] widget
const StreamVideoAttachment({
Key? key,
required Message message,
required Attachment attachment,
super.key,
required super.message,
required super.attachment,
required this.messageTheme,
Size? size,
super.size,
this.onShowMessage,
this.onReturnAction,
this.onAttachmentTap,
}) : super(
key: key,
message: message,
attachment: attachment,
size: size,
);
});
/// [StreamMessageThemeData] for showing title
final StreamMessageThemeData messageTheme;
@@ -19,7 +19,7 @@ typedef DownloadedPathCallback = void Function(String? path);
class AttachmentActionsModal extends StatelessWidget {
/// Returns a new [AttachmentActionsModal]
const AttachmentActionsModal({
Key? key,
super.key,
required this.attachment,
required this.message,
this.onShowMessage,
@@ -30,7 +30,7 @@ class AttachmentActionsModal extends StatelessWidget {
this.showSave = true,
this.showDelete = true,
this.customActions = const [],
}) : super(key: key);
});
/// The attachment object for which the actions are to be performed
final Attachment attachment;
@@ -6,11 +6,11 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class StreamBackButton extends StatelessWidget {
/// Constructor for creating back button
const StreamBackButton({
Key? key,
super.key,
this.onPressed,
this.showUnreads = false,
this.cid,
}) : super(key: key);
});
/// Callback for when button is pressed
final VoidCallback? onPressed;
@@ -52,7 +52,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class ChannelAvatar extends StatelessWidget {
/// Instantiate a new ChannelImage
const ChannelAvatar({
Key? key,
super.key,
this.channel,
this.constraints,
this.onTap,
@@ -60,7 +60,7 @@ class ChannelAvatar extends StatelessWidget {
this.selected = false,
this.selectionColor,
this.selectionThickness = 4,
}) : super(key: key);
});
/// [BorderRadius] to display the widget
final BorderRadius? borderRadius;
@@ -7,7 +7,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
@Deprecated("Use 'StreamChannelInfoBottomSheet' instead")
class ChannelBottomSheet extends StatefulWidget {
/// Constructor for creating bottom sheet
const ChannelBottomSheet({Key? key, this.onViewInfoTap}) : super(key: key);
const ChannelBottomSheet({super.key, this.onViewInfoTap});
/// Callback when 'View Info' is tapped
final VoidCallback? onViewInfoTap;
@@ -60,7 +60,7 @@ class StreamChannelHeader extends StatelessWidget
implements PreferredSizeWidget {
/// Creates a channel header
const StreamChannelHeader({
Key? key,
super.key,
this.showBackButton = true,
this.onBackPressed,
this.onTitleTap,
@@ -74,8 +74,7 @@ class StreamChannelHeader extends StatelessWidget
this.actions,
this.backgroundColor,
this.elevation = 1,
}) : preferredSize = const Size.fromHeight(kToolbarHeight),
super(key: key);
}) : preferredSize = const Size.fromHeight(kToolbarHeight);
/// True if this header shows the leading back button
final bool showBackButton;
@@ -13,12 +13,12 @@ typedef ChannelInfo = StreamChannelInfo;
class StreamChannelInfo extends StatelessWidget {
/// Constructor which creates a [StreamChannelInfo] widget
const StreamChannelInfo({
Key? key,
super.key,
required this.channel,
this.textStyle,
this.showTypingIndicator = true,
this.parentId,
}) : super(key: key);
});
/// The channel about which the info is to be displayed
final Channel channel;
@@ -138,7 +138,7 @@ class StreamChannelInfo extends StatelessWidget {
),
TextButton(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: const VisualDensity(
horizontal: VisualDensity.minimumDensity,
@@ -54,7 +54,7 @@ class StreamChannelListHeader extends StatelessWidget
implements PreferredSizeWidget {
/// Instantiates a ChannelListHeader
const StreamChannelListHeader({
Key? key,
super.key,
this.client,
this.titleBuilder,
this.onUserAvatarTap,
@@ -67,7 +67,7 @@ class StreamChannelListHeader extends StatelessWidget
this.actions,
this.backgroundColor,
this.elevation = 1,
}) : super(key: key);
});
/// Pass this if you don't have a [StreamChatClient] in your widget tree.
final StreamChatClient? client;
@@ -155,9 +155,7 @@ class StreamChannelListHeader extends StatelessWidget
showOnlineStatus: false,
onTap: onUserAvatarTap ??
(_) {
if (preNavigationCallback != null) {
preNavigationCallback!();
}
preNavigationCallback?.call();
Scaffold.of(context).openDrawer();
},
borderRadius: channelListHeaderThemeData
@@ -57,8 +57,9 @@ typedef ViewInfoCallback = void Function(Channel);
@Deprecated("Use 'StreamChannelListView' instead")
class ChannelListView extends StatefulWidget {
/// Instantiate a new ChannelListView
@Deprecated("Use 'StreamChannelListView' instead")
ChannelListView({
Key? key,
super.key,
this.filter,
this.sort,
this.state = true,
@@ -93,8 +94,7 @@ class ChannelListView extends StatefulWidget {
this.onDeletePressed,
this.swipeActions,
this.channelListController,
}) : limit = limit ?? pagination?.limit ?? 25,
super(key: key);
}) : limit = limit ?? pagination?.limit ?? 25;
/// If true a default swipe to action behaviour will be added to this widget
final bool swipeToAction;
@@ -688,7 +688,7 @@ class _ChannelListViewState extends State<ChannelListView> {
initialData: false,
errorBuilder: (context, err) {
final theme = StreamChatTheme.of(context);
return Container(
return ColoredBox(
color: theme.colorTheme.textLowEmphasis.withOpacity(0.9),
child: Padding(
padding: const EdgeInsets.all(16),
@@ -10,10 +10,10 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class ChannelName extends StatelessWidget {
/// Instantiate a new ChannelName
const ChannelName({
Key? key,
super.key,
this.textStyle,
this.textOverflow = TextOverflow.ellipsis,
}) : super(key: key);
});
/// The style of the text displayed
final TextStyle? textStyle;
@@ -25,7 +25,7 @@ class ChannelPreview extends StatelessWidget {
/// Constructor for creating [ChannelPreview]
const ChannelPreview({
required this.channel,
Key? key,
super.key,
this.onTap,
this.onLongPress,
this.onImageTap,
@@ -34,7 +34,7 @@ class ChannelPreview extends StatelessWidget {
this.leading,
this.sendingIndicator,
this.trailing,
}) : super(key: key);
});
/// Function called when tapping this widget
final void Function(Channel)? onTap;
@@ -17,8 +17,8 @@ class StreamCommandsOverlay extends StatelessWidget {
required this.onCommandResult,
required this.size,
required this.channel,
Key? key,
}) : super(key: key);
super.key,
});
/// The size of the overlay
final Size size;
@@ -60,7 +60,7 @@ class StreamCommandsOverlay extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
),
child: ListView(
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
shrinkWrap: true,
children: [
if (commands.isNotEmpty)
@@ -15,12 +15,12 @@ typedef ConnectionStatusBuilder = StreamConnectionStatusBuilder;
class StreamConnectionStatusBuilder extends StatelessWidget {
/// Creates a new ConnectionStatusBuilder
const StreamConnectionStatusBuilder({
Key? key,
super.key,
required this.statusBuilder,
this.connectionStatusStream,
this.errorBuilder,
this.loadingBuilder,
}) : super(key: key);
});
/// The asynchronous computation to which this builder is currently connected.
final Stream<ConnectionStatus>? connectionStatusStream;
@@ -13,10 +13,10 @@ typedef DateDivider = StreamDateDivider;
class StreamDateDivider extends StatelessWidget {
/// Constructor for creating a [StreamDateDivider]
const StreamDateDivider({
Key? key,
super.key,
required this.dateTime,
this.uppercase = false,
}) : super(key: key);
});
/// [DateTime] to display
final DateTime dateTime;
@@ -13,13 +13,13 @@ typedef DeletedMessage = StreamDeletedMessage;
class StreamDeletedMessage extends StatelessWidget {
/// Constructor to create [StreamDeletedMessage]
const StreamDeletedMessage({
Key? key,
super.key,
required this.messageTheme,
this.borderRadiusGeometry,
this.shape,
this.borderSide,
this.reverse = false,
}) : super(key: key);
});
/// The theme of the message
final StreamMessageThemeData messageTheme;
@@ -17,8 +17,8 @@ class StreamEmojiOverlay extends StatelessWidget {
required this.query,
required this.onEmojiResult,
required this.size,
Key? key,
}) : super(key: key);
super.key,
});
/// The size of the overlay
final Size size;
@@ -65,7 +65,7 @@ class StreamEmojiOverlay extends StatelessWidget {
color: _streamChatTheme.colorTheme.barsBg,
),
child: ListView.builder(
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: emojis.length + 1,
itemBuilder: (context, i) {
@@ -31,15 +31,14 @@ typedef FullScreenMedia = StreamFullScreenMedia;
class StreamFullScreenMedia extends StatefulWidget {
/// Instantiate a new FullScreenImage
const StreamFullScreenMedia({
Key? key,
super.key,
required this.mediaAttachmentPackages,
this.startIndex = 0,
String? userName,
this.onShowMessage,
this.attachmentActionsModalBuilder,
this.autoplayVideos = false,
}) : userName = userName ?? '',
super(key: key);
}) : userName = userName ?? '';
/// The url of the image
final List<StreamAttachmentPackage> mediaAttachmentPackages;
@@ -20,7 +20,7 @@ class StreamGalleryFooter extends StatefulWidget
implements PreferredSizeWidget {
/// Creates a StreamGalleryFooter
const StreamGalleryFooter({
Key? key,
super.key,
this.onBackPressed,
this.onTitleTap,
this.onImageTap,
@@ -29,8 +29,7 @@ class StreamGalleryFooter extends StatefulWidget
required this.mediaAttachmentPackages,
this.mediaSelectedCallBack,
this.backgroundColor,
}) : preferredSize = const Size.fromHeight(kToolbarHeight),
super(key: key);
}) : preferredSize = const Size.fromHeight(kToolbarHeight);
/// Callback to call when pressing the back button.
/// By default it calls [Navigator.pop]
@@ -26,7 +26,7 @@ class StreamGalleryHeader extends StatelessWidget
implements PreferredSizeWidget {
/// Creates a channel header
const StreamGalleryHeader({
Key? key,
super.key,
required this.message,
required this.attachment,
this.showBackButton = true,
@@ -38,8 +38,7 @@ class StreamGalleryHeader extends StatelessWidget
this.sentAt = '',
this.backgroundColor,
this.attachmentActionsModalBuilder,
}) : preferredSize = const Size.fromHeight(kToolbarHeight),
super(key: key);
}) : preferredSize = const Size.fromHeight(kToolbarHeight);
/// True if this header shows the leading back button
final bool showBackButton;
@@ -13,10 +13,10 @@ typedef GradientAvatar = StreamGradientAvatar;
class StreamGradientAvatar extends StatefulWidget {
/// Constructor for [StreamGradientAvatar]
const StreamGradientAvatar({
Key? key,
super.key,
required this.name,
required this.userId,
}) : super(key: key);
});
/// Name of user to shorten and display
final String name;
@@ -11,7 +11,7 @@ typedef GroupAvatar = StreamGroupAvatar;
class StreamGroupAvatar extends StatelessWidget {
/// Constructor for creating a [StreamGroupAvatar]
const StreamGroupAvatar({
Key? key,
super.key,
this.channel,
required this.members,
this.constraints,
@@ -20,7 +20,7 @@ class StreamGroupAvatar extends StatelessWidget {
this.selected = false,
this.selectionColor,
this.selectionThickness = 4,
}) : super(key: key);
});
/// The channel of the avatar
final Channel? channel;
@@ -11,7 +11,7 @@ typedef ImageGroup = StreamImageGroup;
class StreamImageGroup extends StatelessWidget {
/// Constructor for creating [StreamImageGroup] widget
const StreamImageGroup({
Key? key,
super.key,
required this.images,
required this.message,
required this.messageTheme,
@@ -19,7 +19,7 @@ class StreamImageGroup extends StatelessWidget {
this.onReturnAction,
this.onShowMessage,
this.onAttachmentTap,
}) : super(key: key);
});
/// List of attachments to show
final List<Attachment> images;
@@ -12,7 +12,7 @@ typedef InfoTile = StreamInfoTile;
class StreamInfoTile extends StatelessWidget {
/// Constructor for creating an [StreamInfoTile] widget
const StreamInfoTile({
Key? key,
super.key,
required this.message,
required this.child,
required this.showMessage,
@@ -20,7 +20,7 @@ class StreamInfoTile extends StatelessWidget {
this.childAnchor,
this.textStyle,
this.backgroundColor,
}) : super(key: key);
});
/// String to display
final String message;
@@ -391,7 +391,7 @@ class DefaultTranslations implements Translations {
@override
String get sendMessagePermissionError =>
'You don\'t have permission to send messages';
"You don't have permission to send messages";
@override
String get emptyMessagesText => 'There are no messages currently';
@@ -528,7 +528,7 @@ class DefaultTranslations implements Translations {
@override
String get operationCouldNotBeCompletedText =>
'The operation couldn\'t be completed.';
"The operation couldn't be completed.";
@override
String get replyLabel => 'Reply';
@@ -18,11 +18,11 @@ typedef MediaListView = StreamMediaListView;
class StreamMediaListView extends StatefulWidget {
/// Constructor for creating a [StreamMediaListView] widget
const StreamMediaListView({
Key? key,
super.key,
this.selectedIds = const [],
this.onSelect,
this.controller,
}) : super(key: key);
});
/// Stores the media selected
final List<String> selectedIds;
@@ -67,11 +67,9 @@ class _StreamMediaListViewState extends State<StreamMediaListView> {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 1, vertical: 1),
child: InkWell(
onTap: () {
if (widget.onSelect != null) {
widget.onSelect!(media);
}
},
onTap: widget.onSelect == null
? null
: () => widget.onSelect!(media),
child: Stack(
children: [
AspectRatio(
@@ -13,7 +13,7 @@ typedef MessageActionsModal = StreamMessageActionsModal;
class StreamMessageActionsModal extends StatefulWidget {
/// Constructor for creating a [StreamMessageActionsModal] widget
const StreamMessageActionsModal({
Key? key,
super.key,
required this.message,
required this.messageWidget,
required this.messageTheme,
@@ -32,7 +32,7 @@ class StreamMessageActionsModal extends StatefulWidget {
this.reverse = false,
this.customActions = const [],
this.onCopyTap,
}) : super(key: key);
});
/// Widget that shows the message
final Widget messageWidget;
@@ -252,7 +252,7 @@ class _StreamMessageActionsModalState extends State<StreamMessageActionsModal> {
sigmaX: 10,
sigmaY: 10,
),
child: Container(
child: ColoredBox(
color: streamChatThemeData.colorTheme.overlay,
),
),
@@ -406,9 +406,7 @@ class _StreamMessageActionsModalState extends State<StreamMessageActionsModal> {
return InkWell(
onTap: () {
Navigator.pop(context);
if (widget.onReplyTap != null) {
widget.onReplyTap!(widget.message);
}
widget.onReplyTap?.call(widget.message);
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 11, horizontal: 16),
@@ -660,9 +658,7 @@ class _StreamMessageActionsModalState extends State<StreamMessageActionsModal> {
return InkWell(
onTap: () {
Navigator.pop(context);
if (widget.onThreadReplyTap != null) {
widget.onThreadReplyTap!(widget.message);
}
widget.onThreadReplyTap?.call(widget.message);
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 11, horizontal: 16),
@@ -163,7 +163,7 @@ const _kDefaultMaxAttachmentSize = 20971520; // 20MB in Bytes
class MessageInput extends StatefulWidget {
/// Instantiate a new MessageInput
const MessageInput({
Key? key,
super.key,
this.onMessageSent,
this.preMessageSending,
this.parentMessage,
@@ -197,11 +197,10 @@ class MessageInput extends StatefulWidget {
this.customOverlays = const [],
this.mentionAllAppUsers = false,
this.shouldKeepFocusAfterMessage,
}) : assert(
}) : assert(
initialMessage == null || editMessage == null,
"Can't provide both `initialMessage` and `editMessage`",
),
super(key: key);
);
/// List of options for showing overlays
final List<OverlayOptions> customOverlays;
@@ -628,7 +627,7 @@ class MessageInputState extends State<MessageInput> {
color: _messageInputTheme.expandButtonColor,
),
),
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
@@ -797,7 +796,7 @@ class MessageInputState extends State<MessageInput> {
child: IconButton(
icon: StreamSvgIcon.closeSmall(),
splashRadius: 24,
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
@@ -980,7 +979,7 @@ class MessageInputState extends State<MessageInput> {
return AnimatedContainer(
duration: _openFilePickerSection
? const Duration(milliseconds: 300)
: const Duration(),
: Duration.zero,
curve: Curves.easeOut,
height: _openFilePickerSection ? _kMinMediaPickerSize : 0,
child: SingleChildScrollView(
@@ -1034,7 +1033,7 @@ class MessageInputState extends State<MessageInput> {
},
),
IconButton(
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
icon: StreamSvgIcon.record(
color: _getIconColor(3),
),
@@ -1436,9 +1435,9 @@ class MessageInputState extends State<MessageInput> {
],
);
default:
return Container(
return const ColoredBox(
color: Colors.black26,
child: const Icon(Icons.insert_drive_file),
child: Icon(Icons.insert_drive_file),
);
}
}
@@ -1453,7 +1452,7 @@ class MessageInputState extends State<MessageInput> {
? _messageInputTheme.actionButtonColor
: _messageInputTheme.actionButtonIdleColor),
),
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
@@ -1482,7 +1481,7 @@ class MessageInputState extends State<MessageInput> {
? _messageInputTheme.actionButtonColor
: _messageInputTheme.actionButtonIdleColor,
),
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
@@ -1699,7 +1698,7 @@ class MessageInputState extends State<MessageInput> {
padding: const EdgeInsets.all(8),
child: IconButton(
onPressed: sendMessage,
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
splashRadius: 24,
constraints: const BoxConstraints.tightFor(
height: 24,
@@ -1926,7 +1925,6 @@ class MessageInputState extends State<MessageInput> {
class _PickerWidget extends StatefulWidget {
const _PickerWidget({
Key? key,
required this.filePickerIndex,
required this.containsFile,
required this.selectedMedias,
@@ -1934,7 +1932,7 @@ class _PickerWidget extends StatefulWidget {
required this.onMediaSelected,
required this.streamChatTheme,
required this.mediaListViewController,
}) : super(key: key);
});
final int filePickerIndex;
final bool containsFile;
@@ -2002,7 +2000,7 @@ class _PickerWidgetState extends State<_PickerWidget> {
onTap: () async {
PhotoManager.openSetting();
},
child: Container(
child: ColoredBox(
color: widget.streamChatTheme.colorTheme.inputBg,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@@ -2040,10 +2038,7 @@ class _PickerWidgetState extends State<_PickerWidget> {
}
class _CountdownButton extends StatelessWidget {
const _CountdownButton({
Key? key,
required this.count,
}) : super(key: key);
const _CountdownButton({required this.count});
final int count;
@@ -169,7 +169,7 @@ typedef MessageListView = StreamMessageListView;
class StreamMessageListView extends StatefulWidget {
/// Instantiate a new StreamMessageListView.
const StreamMessageListView({
Key? key,
super.key,
this.showScrollToBottom = true,
this.scrollToBottomBuilder,
this.messageBuilder,
@@ -206,7 +206,7 @@ class StreamMessageListView extends StatefulWidget {
this.paginationLoadingIndicatorBuilder,
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.onDrag,
this.spacingWidgetBuilder,
}) : super(key: key);
});
/// [ScrollViewKeyboardDismissBehavior] the defines how this [PositionedList] will
/// dismiss the keyboard automatically.
@@ -751,7 +751,7 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
StreamMessageListViewTheme.of(context).backgroundImage;
if (backgroundColor != null || backgroundImage != null) {
return Container(
return DecoratedBox(
decoration: BoxDecoration(
color: backgroundColor,
image: backgroundImage,
@@ -1039,9 +1039,7 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
}
},
onMessageTap: (message) {
if (widget.onMessageTap != null) {
widget.onMessageTap!(message);
}
widget.onMessageTap?.call(message);
FocusScope.of(context).unfocus();
},
showPinButton: currentUserMember != null &&
@@ -1066,9 +1064,7 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
StreamSystemMessage(
message: message,
onMessageTap: (message) {
if (widget.onSystemMessageTap != null) {
widget.onSystemMessageTap!(message);
}
widget.onSystemMessageTap?.call(message);
FocusScope.of(context).unfocus();
},
);
@@ -1230,9 +1226,7 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
}
},
onMessageTap: (message) {
if (widget.onMessageTap != null) {
widget.onMessageTap!(message);
}
widget.onMessageTap?.call(message);
FocusScope.of(context).unfocus();
},
showPinButton: currentUserMember != null &&
@@ -1287,8 +1281,8 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
),
duration: const Duration(seconds: 3),
onEnd: () => initialMessageHighlightComplete = true,
builder: (_, color, child) => Container(
color: color,
builder: (_, color, child) => ColoredBox(
color: color!,
child: child,
),
child: Padding(
@@ -1389,11 +1383,10 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
void _getOnThreadTap() {
if (widget.onThreadTap != null) {
_onThreadTap = (Message message) {
final threadBuilder = widget.threadBuilder;
widget.onThreadTap!(
message,
widget.threadBuilder != null
? widget.threadBuilder!(context, message)
: null,
threadBuilder != null ? threadBuilder(context, message) : null,
);
};
} else if (widget.threadBuilder != null) {
@@ -1431,13 +1424,12 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
class _LoadingIndicator extends StatelessWidget {
const _LoadingIndicator({
Key? key,
required this.streamTheme,
required this.isThreadConversation,
required this.direction,
required this.streamChannel,
this.indicatorBuilder,
}) : super(key: key);
});
final StreamChatThemeData streamTheme;
final bool isThreadConversation;
@@ -1454,7 +1446,7 @@ class _LoadingIndicator extends StatelessWidget {
key: Key('LOADING-INDICATOR $direction'),
stream: stream,
initialData: false,
errorBuilder: (context, error) => Container(
errorBuilder: (context, error) => ColoredBox(
color: streamTheme.colorTheme.accentError.withOpacity(0.2),
child: Center(
child: Text(context.translations.loadingMessagesError),
@@ -15,14 +15,14 @@ typedef MessageReactionsModal = StreamMessageReactionsModal;
class StreamMessageReactionsModal extends StatelessWidget {
/// Constructor for creating a [StreamMessageReactionsModal] reactions
const StreamMessageReactionsModal({
Key? key,
super.key,
required this.message,
required this.messageWidget,
required this.messageTheme,
this.showReactions,
this.reverse = false,
this.onUserAvatarTap,
}) : super(key: key);
});
/// Widget that shows the message
final Widget messageWidget;
@@ -16,11 +16,11 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class MessageSearchItem extends StatelessWidget {
/// Instantiate a new MessageSearchItem
const MessageSearchItem({
Key? key,
super.key,
required this.getMessageResponse,
this.onTap,
this.showOnlineStatus = true,
}) : super(key: key);
});
/// [Message] displayed
final GetMessageResponse getMessageResponse;
@@ -54,8 +54,9 @@ typedef EmptyMessageSearchBuilder = Widget Function(
@Deprecated("Use 'StreamMessageSearchListView' instead")
class MessageSearchListView extends StatefulWidget {
/// Instantiate a new MessageSearchListView
@Deprecated("Use 'StreamMessageSearchListView' instead")
const MessageSearchListView({
Key? key,
super.key,
required this.filters,
this.messageQuery,
this.sortOptions,
@@ -72,7 +73,7 @@ class MessageSearchListView extends StatefulWidget {
this.loadingBuilder,
this.childBuilder,
this.messageSearchListController,
}) : super(key: key);
});
/// Message String to search on
final String? messageQuery;
@@ -238,7 +239,7 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
initialData: false,
builder: (context, snapshot) {
if (snapshot.hasError) {
return Container(
return ColoredBox(
color: StreamChatTheme.of(context)
.colorTheme
.accentError
@@ -14,12 +14,12 @@ typedef MessageText = StreamMessageText;
class StreamMessageText extends StatelessWidget {
/// Constructor for creating a [StreamMessageText] widget
const StreamMessageText({
Key? key,
super.key,
required this.message,
required this.messageTheme,
this.onMentionTap,
this.onLinkTap,
}) : super(key: key);
});
/// Message whose text is to be displayed
final Message message;
@@ -52,7 +52,7 @@ typedef MessageWidget = StreamMessageWidget;
class StreamMessageWidget extends StatefulWidget {
/// Creates a new instance of the message widget.
StreamMessageWidget({
Key? key,
super.key,
required this.message,
required this.messageTheme,
this.reverse = false,
@@ -105,7 +105,7 @@ class StreamMessageWidget extends StatefulWidget {
this.customActions = const [],
this.onAttachmentTap,
this.usernameBuilder,
}) : attachmentBuilders = {
}) : attachmentBuilders = {
'image': (context, message, attachments) {
final border = RoundedRectangleBorder(
borderRadius: attachmentBorderRadiusGeometry ?? BorderRadius.zero,
@@ -261,8 +261,7 @@ class StreamMessageWidget extends StatefulWidget {
.toList(),
);
},
}..addAll(customAttachmentBuilders ?? {}),
super(key: key);
}..addAll(customAttachmentBuilders ?? {});
/// Function called on mention tap
final void Function(User)? onMentionTap;
@@ -1080,7 +1079,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
showTimestamp: false,
translateUserAvatar: false,
showSendingIndicator: false,
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
showReactionPickerIndicator: widget.showReactions &&
(widget.message.status == MessageSendingStatus.sent) &&
channel.ownCapabilities.contains(PermissionType.sendReaction),
@@ -1111,6 +1110,13 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
widget.onThreadTap != null,
showFlagButton: widget.showFlagButton,
customActions: widget.customActions,
showDeleteMessage: widget.showDeleteMessage || isDeleteFailed,
showEditMessage: widget.showEditMessage &&
!isDeleteFailed &&
!widget.message.attachments
.any((element) => element.type == 'giphy'),
showPinButton: widget.showPinButton,
showReactions: widget.showReactions,
),
),
);
@@ -1137,7 +1143,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
showTimestamp: false,
translateUserAvatar: false,
showSendingIndicator: false,
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
showReactionPickerIndicator: widget.showReactions &&
(widget.message.status == MessageSendingStatus.sent) &&
channel.ownCapabilities.contains(PermissionType.sendReaction),
@@ -1401,11 +1407,9 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
class _ThreadParticipants extends StatelessWidget {
const _ThreadParticipants({
Key? key,
required StreamChatThemeData streamChatTheme,
required this.threadParticipants,
}) : _streamChatTheme = streamChatTheme,
super(key: key);
}) : _streamChatTheme = streamChatTheme;
final StreamChatThemeData _streamChatTheme;
final Iterable<User> threadParticipants;
@@ -17,12 +17,12 @@ class StreamMultiOverlay extends StatelessWidget {
/// [childAnchor] - the anchor relative to the child
/// [child] - the child widget
const StreamMultiOverlay({
Key? key,
super.key,
required this.overlayOptions,
required this.child,
required this.overlayAnchor,
required this.childAnchor,
}) : super(key: key);
});
/// The list of overlay options
final List<OverlayOptions> overlayOptions;
@@ -11,7 +11,7 @@ typedef OptionListTile = StreamOptionListTile;
class StreamOptionListTile extends StatelessWidget {
/// Constructor for creating [StreamOptionListTile]
const StreamOptionListTile({
Key? key,
super.key,
required this.title,
this.leading,
this.trailing,
@@ -20,7 +20,7 @@ class StreamOptionListTile extends StatelessWidget {
this.tileColor,
this.separatorColor,
this.titleTextStyle,
}) : super(key: key);
});
/// Title for tile
final String title;
@@ -18,7 +18,7 @@ typedef QuotedMessageWidget = StreamQuotedMessageWidget;
class StreamQuotedMessageWidget extends StatelessWidget {
/// Creates a new instance of the widget.
const StreamQuotedMessageWidget({
Key? key,
super.key,
required this.message,
required this.messageTheme,
this.reverse = false,
@@ -27,7 +27,7 @@ class StreamQuotedMessageWidget extends StatelessWidget {
this.attachmentThumbnailBuilders,
this.padding = const EdgeInsets.all(8),
this.onTap,
}) : super(key: key);
});
/// The message
final Message message;
@@ -251,12 +251,10 @@ class StreamQuotedMessageWidget extends StatelessWidget {
class _VideoAttachmentThumbnail extends StatefulWidget {
const _VideoAttachmentThumbnail({
Key? key,
super.key,
required this.attachment,
this.size = const Size(32, 32),
}) : super(key: key);
});
final Size size;
final Attachment attachment;
@override
@@ -285,8 +283,8 @@ class _VideoAttachmentThumbnailState extends State<_VideoAttachmentThumbnail> {
@override
Widget build(BuildContext context) => SizedBox(
height: widget.size.height,
width: widget.size.width,
height: 32,
width: 32,
child: _controller.value.isInitialized
? VideoPlayer(_controller)
: const CircularProgressIndicator(),
@@ -14,7 +14,7 @@ typedef ReactionBubble = StreamReactionBubble;
class StreamReactionBubble extends StatelessWidget {
/// Constructor for creating a [StreamReactionBubble]
const StreamReactionBubble({
Key? key,
super.key,
required this.reactions,
required this.borderColor,
required this.backgroundColor,
@@ -23,7 +23,7 @@ class StreamReactionBubble extends StatelessWidget {
this.flipTail = false,
this.highlightOwnReactions = true,
this.tailCirclesSpacing = 0,
}) : super(key: key);
});
/// Reactions to show
final List<Reaction> reactions;
@@ -19,9 +19,9 @@ typedef ReactionPicker = StreamReactionPicker;
class StreamReactionPicker extends StatefulWidget {
/// Constructor for creating a [StreamReactionPicker] widget
const StreamReactionPicker({
Key? key,
super.key,
required this.message,
}) : super(key: key);
});
/// Message to attach the reaction to
final Message message;
@@ -11,11 +11,11 @@ typedef SendingIndicator = StreamSendingIndicator;
class StreamSendingIndicator extends StatelessWidget {
/// Constructor for creating a [StreamSendingIndicator] widget
const StreamSendingIndicator({
Key? key,
super.key,
required this.message,
this.isMessageRead = false,
this.size = 12,
}) : super(key: key);
});
/// Message for sending indicator
final Message message;
@@ -28,14 +28,14 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class StreamChat extends StatefulWidget {
/// Constructor for creating a [StreamChat] widget
const StreamChat({
Key? key,
super.key,
required this.client,
required this.child,
this.streamChatThemeData,
this.onBackgroundEventReceived,
this.backgroundKeepAlive = const Duration(minutes: 1),
this.connectivityStream,
}) : super(key: key);
});
/// Client to do chat ops with
final StreamChatClient client;
@@ -5,19 +5,16 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class StreamChatTheme extends InheritedWidget {
/// Constructor for creating a [StreamChatTheme]
const StreamChatTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(
key: key,
child: child,
);
required super.child,
});
/// Theme data
final StreamChatThemeData data;
@override
bool updateShouldNotify(StreamChatTheme old) => data != old.data;
bool updateShouldNotify(StreamChatTheme oldWidget) => data != oldWidget.data;
/// Use this method to get the current [StreamChatThemeData] instance
static StreamChatThemeData of(BuildContext context) {
@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
class StreamNeumorphicButton extends StatelessWidget {
/// Constructor for creating [StreamNeumorphicButton]
const StreamNeumorphicButton({
Key? key,
super.key,
required this.child,
this.backgroundColor = Colors.white,
}) : super(key: key);
});
/// Child contained in the button
final Widget child;
@@ -5,12 +5,12 @@ import 'package:flutter_svg/flutter_svg.dart';
class StreamSvgIcon extends StatelessWidget {
/// Constructor for creating a [StreamSvgIcon]
const StreamSvgIcon({
Key? key,
super.key,
this.assetName,
this.color,
this.width = 24,
this.height = 24,
}) : super(key: key);
});
/// [StreamSvgIcon] type
factory StreamSvgIcon.settings({
@@ -7,14 +7,14 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class Swipeable extends StatefulWidget {
/// Constructor for creating a [Swipeable] widget
const Swipeable({
Key? key,
super.key,
required this.child,
required this.backgroundIcon,
this.onSwipeStart,
this.onSwipeCancel,
this.onSwipeEnd,
this.threshold = 82.0,
}) : super(key: key);
});
/// Child to make swipeable
final Widget child;
@@ -77,9 +77,7 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin {
}
void _handleDragStart(DragStartDetails details) {
if (widget.onSwipeStart != null) {
widget.onSwipeStart!();
}
widget.onSwipeStart?.call();
}
void _handleDragUpdate(DragUpdateDetails details) {
@@ -11,10 +11,10 @@ typedef SystemMessage = StreamSystemMessage;
class StreamSystemMessage extends StatelessWidget {
/// Constructor for creating a [StreamSystemMessage]
const StreamSystemMessage({
Key? key,
super.key,
required this.message,
this.onMessageTap,
}) : super(key: key);
});
/// This message
final Message message;
@@ -28,11 +28,7 @@ class StreamSystemMessage extends StatelessWidget {
final theme = StreamChatTheme.of(context);
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (onMessageTap != null) {
onMessageTap!(message);
}
},
onTap: onMessageTap == null ? null : () => onMessageTap!(message),
child: Text(
message.text!,
textAlign: TextAlign.center,
@@ -20,10 +20,10 @@ class StreamChannelHeaderTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamChannelHeaderTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamChannelHeaderThemeData data;
@@ -20,10 +20,10 @@ class StreamChannelListHeaderTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamChannelListHeaderTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamChannelListHeaderThemeData data;
@@ -18,10 +18,10 @@ class StreamChannelListViewTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamChannelListViewTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamChannelListViewThemeData data;
@@ -19,10 +19,10 @@ class StreamChannelPreviewTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamChannelPreviewTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamChannelPreviewThemeData data;
@@ -18,10 +18,10 @@ class StreamGalleryFooterTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamGalleryFooterTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamGalleryFooterThemeData data;
@@ -18,10 +18,10 @@ class StreamGalleryHeaderTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamGalleryHeaderTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamGalleryHeaderThemeData data;
@@ -21,10 +21,10 @@ class StreamMessageInputTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamMessageInputTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamMessageInputThemeData data;
@@ -18,10 +18,10 @@ class StreamMessageListViewTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamMessageListViewTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamMessageListViewThemeData data;
@@ -18,10 +18,10 @@ class StreamMessageSearchListViewTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamMessageSearchListViewTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamMessageSearchListViewThemeData data;
@@ -18,10 +18,10 @@ class StreamUserListViewTheme extends InheritedTheme {
///
/// The [data] parameter must not be null.
const StreamUserListViewTheme({
Key? key,
super.key,
required this.data,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});
/// The configuration of this theme.
final StreamUserListViewThemeData data;
@@ -66,7 +66,7 @@ class StreamThreadHeader extends StatelessWidget
implements PreferredSizeWidget {
/// Instantiate a new ThreadHeader
const StreamThreadHeader({
Key? key,
super.key,
required this.parent,
this.showBackButton = true,
this.onBackPressed,
@@ -79,8 +79,7 @@ class StreamThreadHeader extends StatelessWidget
this.showTypingIndicator = true,
this.backgroundColor,
this.elevation = 1,
}) : preferredSize = const Size.fromHeight(kToolbarHeight),
super(key: key);
}) : preferredSize = const Size.fromHeight(kToolbarHeight);
/// True if this header shows the leading back button
final bool showBackButton;
@@ -13,13 +13,13 @@ typedef TypingIndicator = StreamTypingIndicator;
class StreamTypingIndicator extends StatelessWidget {
/// Instantiate a new TypingIndicator
const StreamTypingIndicator({
Key? key,
super.key,
this.channel,
this.alternativeWidget,
this.style,
this.padding = const EdgeInsets.all(0),
this.padding = EdgeInsets.zero,
this.parentId,
}) : super(key: key);
});
/// Style of the text widget
final TextStyle? style;
@@ -11,9 +11,9 @@ typedef UnreadIndicator = StreamUnreadIndicator;
class StreamUnreadIndicator extends StatelessWidget {
/// Constructor for creating an [StreamUnreadIndicator]
const StreamUnreadIndicator({
Key? key,
super.key,
this.cid,
}) : super(key: key);
});
/// Channel cid used to retrieve unread count
final String? cid;
@@ -11,7 +11,7 @@ typedef UploadProgressIndicator = StreamUploadProgressIndicator;
class StreamUploadProgressIndicator extends StatelessWidget {
/// Constructor for creating an [StreamUploadProgressIndicator]
const StreamUploadProgressIndicator({
Key? key,
super.key,
required this.uploaded,
required this.total,
this.progressIndicatorColor = const Color(0xffb2b2b2),
@@ -23,7 +23,7 @@ class StreamUploadProgressIndicator extends StatelessWidget {
),
this.showBackground = true,
this.textStyle,
}) : super(key: key);
});
/// Bytes uploaded
final int uploaded;
@@ -72,7 +72,7 @@ class StreamUploadProgressIndicator extends StatelessWidget {
),
);
if (showBackground) {
child = Container(
child = DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: theme.colorTheme.overlayDark.withOpacity(0.6),
@@ -12,7 +12,7 @@ typedef UserAvatar = StreamUserAvatar;
class StreamUserAvatar extends StatelessWidget {
/// Constructor to create a [StreamUserAvatar]
const StreamUserAvatar({
Key? key,
super.key,
required this.user,
this.constraints,
this.onlineIndicatorConstraints,
@@ -25,7 +25,7 @@ class StreamUserAvatar extends StatelessWidget {
this.selectionColor,
this.selectionThickness = 4,
this.placeholder,
}) : super(key: key);
});
/// User whose avatar is to displayed
final User user;
@@ -91,7 +91,7 @@ class StreamUserAvatar extends StatelessWidget {
placeholder: placeholder != null
? (context, __) => placeholder(context, user)
: null,
imageBuilder: (context, imageProvider) => Container(
imageBuilder: (context, imageProvider) => DecoratedBox(
decoration: BoxDecoration(
borderRadius: borderRadius ??
streamChatTheme
@@ -22,14 +22,14 @@ typedef UserItem = StreamUserItem;
class StreamUserItem extends StatelessWidget {
/// Instantiate a new UserItem
const StreamUserItem({
Key? key,
super.key,
required this.user,
this.onTap,
this.onLongPress,
this.onImageTap,
this.selected = false,
this.showLastOnline = true,
}) : super(key: key);
});
/// Function called when tapping this widget
final void Function(User)? onTap;
@@ -53,23 +53,11 @@ class StreamUserItem extends StatelessWidget {
Widget build(BuildContext context) {
final chatThemeData = StreamChatTheme.of(context);
return ListTile(
onTap: () {
if (onTap != null) {
onTap!(user);
}
},
onLongPress: () {
if (onLongPress != null) {
onLongPress!(user);
}
},
onTap: onTap == null ? null : () => onTap!(user),
onLongPress: onLongPress == null ? null : () => onLongPress!(user),
leading: StreamUserAvatar(
user: user,
onTap: (user) {
if (onImageTap != null) {
onImageTap!(user);
}
},
onTap: onImageTap,
constraints: const BoxConstraints.tightFor(
height: 40,
width: 40,
@@ -49,8 +49,9 @@ typedef UserItemBuilder = Widget Function(BuildContext, User, bool);
@Deprecated("Use 'StreamUserListView' instead")
class UserListView extends StatefulWidget {
/// Instantiate a new UserListView
@Deprecated("Use 'StreamUserListView' instead")
UserListView({
Key? key,
super.key,
this.filter = const Filter.empty(),
this.sort,
this.presence,
@@ -79,8 +80,7 @@ class UserListView extends StatefulWidget {
crossAxisCount == 1 || !groupAlphabetically,
'Cannot group alphabetically when crossAxisCount > 1',
),
limit = limit ?? pagination?.limit ?? 30,
super(key: key);
limit = limit ?? pagination?.limit ?? 30;
/// The query filters to use.
/// You can query on any of the custom fields you've defined on the [Channel].
@@ -315,7 +315,7 @@ class _UserListViewState extends State<UserListView>
return item.when(
headerItem: (header) {
final chatThemeData = StreamChatTheme.of(context);
return Container(
return ColoredBox(
key: ValueKey<String>('HEADER-$header'),
color: chatThemeData.colorTheme.textHighEmphasis.withOpacity(0.05),
child: Padding(
@@ -414,7 +414,7 @@ class _UserListViewState extends State<UserListView>
initialData: false,
builder: (context, snapshot) {
if (snapshot.hasError) {
return Container(
return ColoredBox(
color: StreamChatTheme.of(context)
.colorTheme
.accentError
@@ -14,12 +14,12 @@ class StreamUserMentionTile extends StatelessWidget {
/// Constructor for creating a [StreamUserMentionTile] widget
const StreamUserMentionTile(
this.user, {
Key? key,
super.key,
this.title,
this.subtitle,
this.leading,
this.trailing,
}) : super(key: key);
});
/// User to display in the tile
final User user;
@@ -22,7 +22,7 @@ typedef UserMentionsOverlay = StreamUserMentionsOverlay;
class StreamUserMentionsOverlay extends StatefulWidget {
/// Constructor for creating a [StreamUserMentionsOverlay].
StreamUserMentionsOverlay({
Key? key,
super.key,
required this.query,
required this.channel,
required this.size,
@@ -38,8 +38,7 @@ class StreamUserMentionsOverlay extends StatefulWidget {
assert(
!mentionAllAppUsers || (mentionAllAppUsers && client != null),
'StreamChatClient is required in order to use mentionAllAppUsers',
),
super(key: key);
);
/// Query for searching users.
final String query;
@@ -113,7 +112,7 @@ class _StreamUserMentionsOverlayState extends State<StreamUserMentionsOverlay> {
if (!snapshot.hasData) return const Offstage();
final users = snapshot.data!;
return ListView.builder(
padding: const EdgeInsets.all(0),
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: users.length,
itemBuilder: (context, index) {

Some files were not shown because too many files have changed in this diff Show More