diff --git a/.github/workflows/scripts/remove-from-coverage.sh b/.github/workflows/scripts/remove-from-coverage.sh index c6850e899..0ea18f975 100755 --- a/.github/workflows/scripts/remove-from-coverage.sh +++ b/.github/workflows/scripts/remove-from-coverage.sh @@ -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$' diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 81039fd12..e9138e36d 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -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" diff --git a/analysis_options.yaml b/analysis_options.yaml index 336d222ef..c2c1d6923 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -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: diff --git a/melos b/melos deleted file mode 100644 index e69de29bb..000000000 diff --git a/melos.yaml b/melos.yaml index 4e1c08ac2..10e7ca7ba 100644 --- a/melos.yaml +++ b/melos.yaml @@ -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' \ No newline at end of file + sdk: '>=2.17.0 <3.0.0' + flutter: '>=1.17.0 <3.0.0' \ No newline at end of file diff --git a/packages/stream_chat/example/lib/main.dart b/packages/stream_chat/example/lib/main.dart index 629f4a322..8dde5c0d1 100644 --- a/packages/stream_chat/example/lib/main.dart +++ b/packages/stream_chat/example/lib/main.dart @@ -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 messages; diff --git a/packages/stream_chat/example/pubspec.yaml b/packages/stream_chat/example/pubspec.yaml index f3fad2d17..9faa8ec74 100644 --- a/packages/stream_chat/example/pubspec.yaml +++ b/packages/stream_chat/example/pubspec.yaml @@ -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 diff --git a/packages/stream_chat/lib/src/client/channel.dart b/packages/stream_chat/lib/src/client/channel.dart index a27b672ff..f5d874047 100644 --- a/packages/stream_chat/lib/src/client/channel.dart +++ b/packages/stream_chat/lib/src/client/channel.dart @@ -2173,7 +2173,7 @@ class ChannelClientState { /// The channel threads related to this channel. Map> 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>> get threadsStream => diff --git a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart b/packages/stream_chat/lib/src/core/error/stream_chat_error.dart index bebea7515..80e83079b 100644 --- a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart +++ b/packages/stream_chat/lib/src/core/error/stream_chat_error.dart @@ -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 error) { diff --git a/packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart b/packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart index a8ee09881..b494671c2 100644 --- a/packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart +++ b/packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart @@ -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 diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart index f6442a53f..9140ec5e8 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart @@ -103,19 +103,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 @@ -137,7 +139,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); } @JsonKey(ignore: true) @@ -231,28 +233,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 @@ -292,7 +295,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)); } @@ -306,8 +309,8 @@ class _$InProgress implements InProgress { @JsonKey(ignore: true) @override - $InProgressCopyWith get copyWith => - _$InProgressCopyWithImpl(this, _$identity); + _$$InProgressCopyWith<_$InProgress> get copyWith => + __$$InProgressCopyWithImpl<_$InProgress>(this, _$identity); @override @optionalTypeArgs @@ -399,24 +402,24 @@ abstract class InProgress implements UploadState { int get uploaded => throw _privateConstructorUsedError; int get total => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $InProgressCopyWith 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 @@ -438,7 +441,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); } @JsonKey(ignore: true) @@ -532,26 +535,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 @@ -584,7 +587,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)); } @@ -595,8 +598,8 @@ class _$Failed implements Failed { @JsonKey(ignore: true) @override - $FailedCopyWith get copyWith => - _$FailedCopyWithImpl(this, _$identity); + _$$FailedCopyWith<_$Failed> get copyWith => + __$$FailedCopyWithImpl<_$Failed>(this, _$identity); @override @optionalTypeArgs @@ -685,5 +688,6 @@ abstract class Failed implements UploadState { String get error => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $FailedCopyWith get copyWith => throw _privateConstructorUsedError; + _$$FailedCopyWith<_$Failed> get copyWith => + throw _privateConstructorUsedError; } diff --git a/packages/stream_chat/lib/src/core/models/event.dart b/packages/stream_chat/lib/src/core/models/event.dart index 1801ceae8..47270d404 100644 --- a/packages/stream_chat/lib/src/core/models/event.dart +++ b/packages/stream_chat/lib/src/core/models/event.dart @@ -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? 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 json) => diff --git a/packages/stream_chat/lib/src/core/models/filter.dart b/packages/stream_chat/lib/src/core/models/filter.dart index 108efcb2f..132475887 100644 --- a/packages/stream_chat/lib/src/core/models/filter.dart +++ b/packages/stream_chat/lib/src/core/models/filter.dart @@ -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]!; } diff --git a/packages/stream_chat/lib/src/core/models/own_user.dart b/packages/stream_chat/lib/src/core/models/own_user.dart index 6133dd763..85b6ba57b 100644 --- a/packages/stream_chat/lib/src/core/models/own_user.dart +++ b/packages/stream_chat/lib/src/core/models/own_user.dart @@ -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 extraData = const {}, - bool banned = false, - DateTime? banExpires, - List 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 json) => _$OwnUserFromJson( diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 1689550a1..be5fbec1b 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -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 \ No newline at end of file diff --git a/packages/stream_chat/test/src/core/models/channel_state_test.dart b/packages/stream_chat/test/src/core/models/channel_state_test.dart index 65a589b89..c8b92a0bb 100644 --- a/packages/stream_chat/test/src/core/models/channel_state_test.dart +++ b/packages/stream_chat/test/src/core/models/channel_state_test.dart @@ -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, diff --git a/packages/stream_chat/test/src/core/models/filter_test.dart b/packages/stream_chat/test/src/core/models/filter_test.dart index f836d8452..f9c6ebd05 100644 --- a/packages/stream_chat/test/src/core/models/filter_test.dart +++ b/packages/stream_chat/test/src/core/models/filter_test.dart @@ -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); diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index ab8d0dfc8..8864858f5 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -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( diff --git a/packages/stream_chat_flutter/example/lib/split_view.dart b/packages/stream_chat_flutter/example/lib/split_view.dart index 6f4c51e60..5b9cc6fb5 100644 --- a/packages/stream_chat_flutter/example/lib/split_view.dart +++ b/packages/stream_chat_flutter/example/lib/split_view.dart @@ -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 { 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 { class ChannelPage extends StatelessWidget { const ChannelPage({ - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) => Navigator( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart index 94524ebbe..2b388d6ad 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart @@ -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( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart index 15f7914c4..6992527f7 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart @@ -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 { class ChannelPage extends StatelessWidget { const ChannelPage({ - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) => Scaffold( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart index 7d994ae16..fbadcf0a8 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart @@ -51,9 +51,9 @@ Future 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 createState() => _ChannelListPageState(); @@ -164,8 +164,8 @@ class _ChannelListPageState extends State { class ChannelPage extends StatelessWidget { const ChannelPage({ - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) { diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart index 376b0ba84..e4886df33 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart @@ -38,9 +38,9 @@ Future 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 createState() => _ChannelListPageState(); @@ -102,8 +102,8 @@ class _ChannelListPageState extends State { 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; diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart index 7977d3be5..ae11a8a08 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart @@ -41,9 +41,9 @@ Future 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 createState() => _ChannelListPageState(); @@ -105,8 +105,8 @@ class _ChannelListPageState extends State { 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, diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart index a3d02a1dc..1b416e919 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart @@ -48,9 +48,9 @@ Future 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 createState() => _ChannelListPageState(); @@ -145,8 +145,8 @@ class _ChannelListPageState extends State { 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; diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index ead5158ad..12a7dc63c 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -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. diff --git a/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/positioned_list.dart b/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/positioned_list.dart index bc24ed468..b25495007 100644 --- a/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/positioned_list.dart +++ b/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/positioned_list.dart @@ -320,7 +320,7 @@ class _PositionedListState extends State { void _schedulePositionNotificationUpdate() { if (!updateScheduled) { updateScheduled = true; - SchedulerBinding.instance!.addPostFrameCallback((_) { + SchedulerBinding.instance.addPostFrameCallback((_) { if (registeredElements.value == null) { updateScheduled = false; return; diff --git a/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/scrollable_positioned_list.dart b/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/scrollable_positioned_list.dart index ab3ab00d1..d38b42550 100644 --- a/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/scrollable_positioned_list.dart +++ b/packages/stream_chat_flutter/lib/scrollable_positioned_list/src/scrollable_positioned_list.dart @@ -439,7 +439,7 @@ class _ScrollablePositionedListState extends State } if (_isTransitioning) { _stopScroll(canceled: true); - SchedulerBinding.instance!.addPostFrameCallback((_) { + SchedulerBinding.instance.addPostFrameCallback((_) { _startScroll( index: index, alignment: alignment, @@ -488,7 +488,7 @@ class _ScrollablePositionedListState extends State final startCompleter = Completer(); final endCompleter = Completer(); startAnimationCallback = () { - SchedulerBinding.instance!.addPostFrameCallback((_) { + SchedulerBinding.instance.addPostFrameCallback((_) { startAnimationCallback = () {}; opacity.parent = _opacityAnimation(opacityAnimationWeights).animate( diff --git a/packages/stream_chat_flutter/lib/src/attachment/attachment_title.dart b/packages/stream_chat_flutter/lib/src/attachment/attachment_title.dart index 6852cdb63..831053b3f 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/attachment_title.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/attachment_title.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart b/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart index a1aa60bc0..822e7e797 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/attachment_upload_state_builder.dart @@ -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), diff --git a/packages/stream_chat_flutter/lib/src/attachment/attachment_widget.dart b/packages/stream_chat_flutter/lib/src/attachment/attachment_widget.dart index 0021fc763..f3ff22c6f 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/attachment_widget.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/attachment_widget.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart index 6bac62e94..3d0c3314d 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/file_attachment.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart index dc354432e..f788b351c 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/attachment/image_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/image_attachment.dart index bb4d81612..c022ee481 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/image_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/image_attachment.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart index 00f29c029..68500d82e 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart @@ -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), diff --git a/packages/stream_chat_flutter/lib/src/attachment/video_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/video_attachment.dart index 620ae66b7..31f236e18 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/video_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/video_attachment.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart index cf8e65caa..a3d60483e 100644 --- a/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/attachment_actions_modal.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/back_button.dart b/packages/stream_chat_flutter/lib/src/back_button.dart index b7cd45523..6d54695dd 100644 --- a/packages/stream_chat_flutter/lib/src/back_button.dart +++ b/packages/stream_chat_flutter/lib/src/back_button.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/channel_avatar.dart b/packages/stream_chat_flutter/lib/src/channel_avatar.dart index cf0c74b13..fcd20e688 100644 --- a/packages/stream_chat_flutter/lib/src/channel_avatar.dart +++ b/packages/stream_chat_flutter/lib/src/channel_avatar.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart b/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart index 8b273fe25..a4275f88b 100644 --- a/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart +++ b/packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/channel_header.dart b/packages/stream_chat_flutter/lib/src/channel_header.dart index 12f84e1f4..8d9205d2e 100644 --- a/packages/stream_chat_flutter/lib/src/channel_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel_header.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/channel_info.dart b/packages/stream_chat_flutter/lib/src/channel_info.dart index 9dcfb9b4b..2d45d3271 100644 --- a/packages/stream_chat_flutter/lib/src/channel_info.dart +++ b/packages/stream_chat_flutter/lib/src/channel_info.dart @@ -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, diff --git a/packages/stream_chat_flutter/lib/src/channel_list_header.dart b/packages/stream_chat_flutter/lib/src/channel_list_header.dart index 4835cad01..0701c08de 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_header.dart @@ -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 diff --git a/packages/stream_chat_flutter/lib/src/channel_list_view.dart b/packages/stream_chat_flutter/lib/src/channel_list_view.dart index f70badc12..3f504331d 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_view.dart @@ -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 { 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), diff --git a/packages/stream_chat_flutter/lib/src/channel_name.dart b/packages/stream_chat_flutter/lib/src/channel_name.dart index f496b28a0..546524c3f 100644 --- a/packages/stream_chat_flutter/lib/src/channel_name.dart +++ b/packages/stream_chat_flutter/lib/src/channel_name.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/channel_preview.dart b/packages/stream_chat_flutter/lib/src/channel_preview.dart index ed5fe9f85..b84979cb3 100644 --- a/packages/stream_chat_flutter/lib/src/channel_preview.dart +++ b/packages/stream_chat_flutter/lib/src/channel_preview.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/commands_overlay.dart b/packages/stream_chat_flutter/lib/src/commands_overlay.dart index 6234f6969..64121e31b 100644 --- a/packages/stream_chat_flutter/lib/src/commands_overlay.dart +++ b/packages/stream_chat_flutter/lib/src/commands_overlay.dart @@ -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) diff --git a/packages/stream_chat_flutter/lib/src/connection_status_builder.dart b/packages/stream_chat_flutter/lib/src/connection_status_builder.dart index 6f234547f..dd47a626b 100644 --- a/packages/stream_chat_flutter/lib/src/connection_status_builder.dart +++ b/packages/stream_chat_flutter/lib/src/connection_status_builder.dart @@ -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? connectionStatusStream; diff --git a/packages/stream_chat_flutter/lib/src/date_divider.dart b/packages/stream_chat_flutter/lib/src/date_divider.dart index 64396ceb3..6cdb034d2 100644 --- a/packages/stream_chat_flutter/lib/src/date_divider.dart +++ b/packages/stream_chat_flutter/lib/src/date_divider.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/deleted_message.dart b/packages/stream_chat_flutter/lib/src/deleted_message.dart index 667d101df..0e47f903f 100644 --- a/packages/stream_chat_flutter/lib/src/deleted_message.dart +++ b/packages/stream_chat_flutter/lib/src/deleted_message.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/emoji_overlay.dart b/packages/stream_chat_flutter/lib/src/emoji_overlay.dart index b4e50974c..04af41798 100644 --- a/packages/stream_chat_flutter/lib/src/emoji_overlay.dart +++ b/packages/stream_chat_flutter/lib/src/emoji_overlay.dart @@ -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) { diff --git a/packages/stream_chat_flutter/lib/src/full_screen_media.dart b/packages/stream_chat_flutter/lib/src/full_screen_media.dart index 340392b78..cb54c4642 100644 --- a/packages/stream_chat_flutter/lib/src/full_screen_media.dart +++ b/packages/stream_chat_flutter/lib/src/full_screen_media.dart @@ -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 mediaAttachmentPackages; diff --git a/packages/stream_chat_flutter/lib/src/gallery_footer.dart b/packages/stream_chat_flutter/lib/src/gallery_footer.dart index 24cea1f20..1b78f2623 100644 --- a/packages/stream_chat_flutter/lib/src/gallery_footer.dart +++ b/packages/stream_chat_flutter/lib/src/gallery_footer.dart @@ -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] diff --git a/packages/stream_chat_flutter/lib/src/gallery_header.dart b/packages/stream_chat_flutter/lib/src/gallery_header.dart index 4f9b83dc9..3b25f969e 100644 --- a/packages/stream_chat_flutter/lib/src/gallery_header.dart +++ b/packages/stream_chat_flutter/lib/src/gallery_header.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/gradient_avatar.dart b/packages/stream_chat_flutter/lib/src/gradient_avatar.dart index aca07c92e..53249ec47 100644 --- a/packages/stream_chat_flutter/lib/src/gradient_avatar.dart +++ b/packages/stream_chat_flutter/lib/src/gradient_avatar.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/group_avatar.dart b/packages/stream_chat_flutter/lib/src/group_avatar.dart index f7efa32d9..a07d60d8d 100644 --- a/packages/stream_chat_flutter/lib/src/group_avatar.dart +++ b/packages/stream_chat_flutter/lib/src/group_avatar.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/image_group.dart b/packages/stream_chat_flutter/lib/src/image_group.dart index 9a803c882..cb8f6edd4 100644 --- a/packages/stream_chat_flutter/lib/src/image_group.dart +++ b/packages/stream_chat_flutter/lib/src/image_group.dart @@ -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 images; diff --git a/packages/stream_chat_flutter/lib/src/info_tile.dart b/packages/stream_chat_flutter/lib/src/info_tile.dart index fee76d5cb..a100f7e37 100644 --- a/packages/stream_chat_flutter/lib/src/info_tile.dart +++ b/packages/stream_chat_flutter/lib/src/info_tile.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 3d12b73ba..3f29704f7 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -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'; diff --git a/packages/stream_chat_flutter/lib/src/media_list_view.dart b/packages/stream_chat_flutter/lib/src/media_list_view.dart index 72378c1ca..34b512c43 100644 --- a/packages/stream_chat_flutter/lib/src/media_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/media_list_view.dart @@ -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 selectedIds; @@ -67,11 +67,9 @@ class _StreamMediaListViewState extends State { 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( diff --git a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart index ffd8f3865..ec9b8a2e9 100644 --- a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart @@ -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 { sigmaX: 10, sigmaY: 10, ), - child: Container( + child: ColoredBox( color: streamChatThemeData.colorTheme.overlay, ), ), @@ -406,9 +406,7 @@ class _StreamMessageActionsModalState extends State { 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 { 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), diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index b830ab37e..921a54dd1 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -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 customOverlays; @@ -628,7 +627,7 @@ class MessageInputState extends State { 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 { 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 { 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 { }, ), IconButton( - padding: const EdgeInsets.all(0), + padding: EdgeInsets.zero, icon: StreamSvgIcon.record( color: _getIconColor(3), ), @@ -1436,9 +1435,9 @@ class MessageInputState extends State { ], ); 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 { ? _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 { ? _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 { 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 { 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; diff --git a/packages/stream_chat_flutter/lib/src/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view.dart index 7d77b2eae..b22561902 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view.dart @@ -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 { StreamMessageListViewTheme.of(context).backgroundImage; if (backgroundColor != null || backgroundImage != null) { - return Container( + return DecoratedBox( decoration: BoxDecoration( color: backgroundColor, image: backgroundImage, @@ -889,7 +889,7 @@ class _StreamMessageListViewState extends State { initialIndex = 0; await streamChannel!.reloadChannel(); - WidgetsBinding.instance?.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _scrollController!.jumpTo(index: 0); }); } else { @@ -1039,9 +1039,7 @@ class _StreamMessageListViewState extends State { } }, 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 { 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 { } }, 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 { ), duration: const Duration(seconds: 3), onEnd: () => initialMessageHighlightComplete = true, - builder: (_, color, child) => Container( - color: color, + builder: (_, color, child) => ColoredBox( + color: color!, child: child, ), child: Padding( @@ -1341,7 +1335,7 @@ class _StreamMessageListViewState extends State { if (event.message?.parentId == widget.parentMessage?.id && event.message!.user!.id == streamChannel!.channel.client.state.currentUser!.id) { - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _scrollController?.scrollTo( index: 0, duration: const Duration(seconds: 1), @@ -1389,11 +1383,10 @@ class _StreamMessageListViewState extends State { 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 { 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), diff --git a/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart b/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart index f862048b9..e4317b014 100644 --- a/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_reactions_modal.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/message_search_item.dart b/packages/stream_chat_flutter/lib/src/message_search_item.dart index f8721d131..824c96a19 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_item.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_item.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart index 4cc436f44..665b23d03 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart @@ -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 { initialData: false, builder: (context, snapshot) { if (snapshot.hasError) { - return Container( + return ColoredBox( color: StreamChatTheme.of(context) .colorTheme .accentError diff --git a/packages/stream_chat_flutter/lib/src/message_text.dart b/packages/stream_chat_flutter/lib/src/message_text.dart index b6fee8018..bb45aaa1c 100644 --- a/packages/stream_chat_flutter/lib/src/message_text.dart +++ b/packages/stream_chat_flutter/lib/src/message_text.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget.dart index 03020a5bb..8ed230a81 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget.dart @@ -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 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), @@ -1137,7 +1136,7 @@ class _StreamMessageWidgetState extends State 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 +1400,9 @@ class _StreamMessageWidgetState extends State 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 threadParticipants; diff --git a/packages/stream_chat_flutter/lib/src/multi_overlay.dart b/packages/stream_chat_flutter/lib/src/multi_overlay.dart index 71ed18d26..ef3757c85 100644 --- a/packages/stream_chat_flutter/lib/src/multi_overlay.dart +++ b/packages/stream_chat_flutter/lib/src/multi_overlay.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/option_list_tile.dart b/packages/stream_chat_flutter/lib/src/option_list_tile.dart index 185d40f89..c7e8bec09 100644 --- a/packages/stream_chat_flutter/lib/src/option_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/option_list_tile.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/quoted_message_widget.dart b/packages/stream_chat_flutter/lib/src/quoted_message_widget.dart index 1a7bb2d08..44122b655 100644 --- a/packages/stream_chat_flutter/lib/src/quoted_message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/quoted_message_widget.dart @@ -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(), diff --git a/packages/stream_chat_flutter/lib/src/reaction_bubble.dart b/packages/stream_chat_flutter/lib/src/reaction_bubble.dart index 995850011..2944482ce 100644 --- a/packages/stream_chat_flutter/lib/src/reaction_bubble.dart +++ b/packages/stream_chat_flutter/lib/src/reaction_bubble.dart @@ -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 reactions; diff --git a/packages/stream_chat_flutter/lib/src/reaction_picker.dart b/packages/stream_chat_flutter/lib/src/reaction_picker.dart index 28053c01a..a6eaab392 100644 --- a/packages/stream_chat_flutter/lib/src/reaction_picker.dart +++ b/packages/stream_chat_flutter/lib/src/reaction_picker.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/sending_indicator.dart b/packages/stream_chat_flutter/lib/src/sending_indicator.dart index 908c734d0..0d4d7dec6 100644 --- a/packages/stream_chat_flutter/lib/src/sending_indicator.dart +++ b/packages/stream_chat_flutter/lib/src/sending_indicator.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/stream_chat.dart b/packages/stream_chat_flutter/lib/src/stream_chat.dart index acc829e28..801769113 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart b/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart index 32b4830f4..e3f44d223 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart @@ -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) { diff --git a/packages/stream_chat_flutter/lib/src/stream_neumorphic_button.dart b/packages/stream_chat_flutter/lib/src/stream_neumorphic_button.dart index 5867a4a10..b967f7e4b 100644 --- a/packages/stream_chat_flutter/lib/src/stream_neumorphic_button.dart +++ b/packages/stream_chat_flutter/lib/src/stream_neumorphic_button.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart b/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart index 06b3b9a4d..efe5a33e8 100644 --- a/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart +++ b/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart @@ -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({ diff --git a/packages/stream_chat_flutter/lib/src/swipeable.dart b/packages/stream_chat_flutter/lib/src/swipeable.dart index 041111e4d..8d36f36c4 100644 --- a/packages/stream_chat_flutter/lib/src/swipeable.dart +++ b/packages/stream_chat_flutter/lib/src/swipeable.dart @@ -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 with TickerProviderStateMixin { } void _handleDragStart(DragStartDetails details) { - if (widget.onSwipeStart != null) { - widget.onSwipeStart!(); - } + widget.onSwipeStart?.call(); } void _handleDragUpdate(DragUpdateDetails details) { diff --git a/packages/stream_chat_flutter/lib/src/system_message.dart b/packages/stream_chat_flutter/lib/src/system_message.dart index 4ec10aa46..1f720db25 100644 --- a/packages/stream_chat_flutter/lib/src/system_message.dart +++ b/packages/stream_chat_flutter/lib/src/system_message.dart @@ -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, diff --git a/packages/stream_chat_flutter/lib/src/theme/channel_header_theme.dart b/packages/stream_chat_flutter/lib/src/theme/channel_header_theme.dart index aa988c0f4..8a7b6d113 100644 --- a/packages/stream_chat_flutter/lib/src/theme/channel_header_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/channel_header_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/channel_list_header_theme.dart b/packages/stream_chat_flutter/lib/src/theme/channel_list_header_theme.dart index 87ba01276..265b2626c 100644 --- a/packages/stream_chat_flutter/lib/src/theme/channel_list_header_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/channel_list_header_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/channel_list_view_theme.dart b/packages/stream_chat_flutter/lib/src/theme/channel_list_view_theme.dart index d3ed33eb0..683f1d0df 100644 --- a/packages/stream_chat_flutter/lib/src/theme/channel_list_view_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/channel_list_view_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/channel_preview_theme.dart b/packages/stream_chat_flutter/lib/src/theme/channel_preview_theme.dart index e89ce4a6e..0a041b671 100644 --- a/packages/stream_chat_flutter/lib/src/theme/channel_preview_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/channel_preview_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/gallery_footer_theme.dart b/packages/stream_chat_flutter/lib/src/theme/gallery_footer_theme.dart index f68ceb450..f23bb3171 100644 --- a/packages/stream_chat_flutter/lib/src/theme/gallery_footer_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/gallery_footer_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/gallery_header_theme.dart b/packages/stream_chat_flutter/lib/src/theme/gallery_header_theme.dart index f03ebe9aa..c190ebfe2 100644 --- a/packages/stream_chat_flutter/lib/src/theme/gallery_header_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/gallery_header_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/message_input_theme.dart b/packages/stream_chat_flutter/lib/src/theme/message_input_theme.dart index bd78bd1b1..f99831a02 100644 --- a/packages/stream_chat_flutter/lib/src/theme/message_input_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/message_input_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/message_list_view_theme.dart b/packages/stream_chat_flutter/lib/src/theme/message_list_view_theme.dart index e882a9f69..a8cda568c 100644 --- a/packages/stream_chat_flutter/lib/src/theme/message_list_view_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/message_list_view_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/message_search_list_view_theme.dart b/packages/stream_chat_flutter/lib/src/theme/message_search_list_view_theme.dart index 535846aef..e88cb96c2 100644 --- a/packages/stream_chat_flutter/lib/src/theme/message_search_list_view_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/message_search_list_view_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/theme/user_list_view_theme.dart b/packages/stream_chat_flutter/lib/src/theme/user_list_view_theme.dart index fb57438bb..325f9d885 100644 --- a/packages/stream_chat_flutter/lib/src/theme/user_list_view_theme.dart +++ b/packages/stream_chat_flutter/lib/src/theme/user_list_view_theme.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/thread_header.dart b/packages/stream_chat_flutter/lib/src/thread_header.dart index 2767b76bf..85554eff3 100644 --- a/packages/stream_chat_flutter/lib/src/thread_header.dart +++ b/packages/stream_chat_flutter/lib/src/thread_header.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/typing_indicator.dart b/packages/stream_chat_flutter/lib/src/typing_indicator.dart index 1ac99785a..dfbceaff0 100644 --- a/packages/stream_chat_flutter/lib/src/typing_indicator.dart +++ b/packages/stream_chat_flutter/lib/src/typing_indicator.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/unread_indicator.dart b/packages/stream_chat_flutter/lib/src/unread_indicator.dart index bf23db1ad..2e5c2ed62 100644 --- a/packages/stream_chat_flutter/lib/src/unread_indicator.dart +++ b/packages/stream_chat_flutter/lib/src/unread_indicator.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/upload_progress_indicator.dart b/packages/stream_chat_flutter/lib/src/upload_progress_indicator.dart index d11e9609e..b6e2f97ad 100644 --- a/packages/stream_chat_flutter/lib/src/upload_progress_indicator.dart +++ b/packages/stream_chat_flutter/lib/src/upload_progress_indicator.dart @@ -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), diff --git a/packages/stream_chat_flutter/lib/src/user_avatar.dart b/packages/stream_chat_flutter/lib/src/user_avatar.dart index 8d6340396..406f966fe 100644 --- a/packages/stream_chat_flutter/lib/src/user_avatar.dart +++ b/packages/stream_chat_flutter/lib/src/user_avatar.dart @@ -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 diff --git a/packages/stream_chat_flutter/lib/src/user_item.dart b/packages/stream_chat_flutter/lib/src/user_item.dart index 74ccacc28..e537f5d49 100644 --- a/packages/stream_chat_flutter/lib/src/user_item.dart +++ b/packages/stream_chat_flutter/lib/src/user_item.dart @@ -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, diff --git a/packages/stream_chat_flutter/lib/src/user_list_view.dart b/packages/stream_chat_flutter/lib/src/user_list_view.dart index 2b5b868e8..55a77322c 100644 --- a/packages/stream_chat_flutter/lib/src/user_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/user_list_view.dart @@ -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 return item.when( headerItem: (header) { final chatThemeData = StreamChatTheme.of(context); - return Container( + return ColoredBox( key: ValueKey('HEADER-$header'), color: chatThemeData.colorTheme.textHighEmphasis.withOpacity(0.05), child: Padding( @@ -414,7 +414,7 @@ class _UserListViewState extends State initialData: false, builder: (context, snapshot) { if (snapshot.hasError) { - return Container( + return ColoredBox( color: StreamChatTheme.of(context) .colorTheme .accentError diff --git a/packages/stream_chat_flutter/lib/src/user_mention_tile.dart b/packages/stream_chat_flutter/lib/src/user_mention_tile.dart index b944d912a..fd62d0139 100644 --- a/packages/stream_chat_flutter/lib/src/user_mention_tile.dart +++ b/packages/stream_chat_flutter/lib/src/user_mention_tile.dart @@ -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; diff --git a/packages/stream_chat_flutter/lib/src/user_mentions_overlay.dart b/packages/stream_chat_flutter/lib/src/user_mentions_overlay.dart index 59c867910..6a94a4764 100644 --- a/packages/stream_chat_flutter/lib/src/user_mentions_overlay.dart +++ b/packages/stream_chat_flutter/lib/src/user_mentions_overlay.dart @@ -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 { 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) { diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/countdown_button.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/countdown_button.dart index aaf016a34..754167900 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/countdown_button.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/countdown_button.dart @@ -5,9 +5,9 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamCountdownButton extends StatelessWidget { /// Constructor for creating [StreamCountdownButton]. const StreamCountdownButton({ - Key? key, + super.key, required this.count, - }) : super(key: key); + }); /// Count of time remaining to show to the user. final int count; diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/simple_safe_area.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/simple_safe_area.dart index 5f3d7391f..013cf0846 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/simple_safe_area.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/simple_safe_area.dart @@ -4,10 +4,10 @@ import 'package:flutter/material.dart'; class SimpleSafeArea extends StatelessWidget { /// Constructor for [SimpleSafeArea] const SimpleSafeArea({ - Key? key, + super.key, this.enabled = true, required this.child, - }) : super(key: key); + }); /// Wrap [child] with [SafeArea] final bool enabled; diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_attachment_picker.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_attachment_picker.dart index 98762302f..d34ba2f98 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_attachment_picker.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_attachment_picker.dart @@ -25,7 +25,7 @@ class StreamAttachmentPicker extends StatefulWidget { /// Default constructor for [StreamAttachmentPicker] which creates the Stream /// attachment picker widget. const StreamAttachmentPicker({ - Key? key, + super.key, required this.messageInputController, required this.onFilePicked, this.isOpen = false, @@ -40,7 +40,7 @@ class StreamAttachmentPicker extends StatefulWidget { DefaultAttachmentTypes.video, ], this.customAttachmentTypes = const [], - }) : super(key: key); + }); /// True if the picker is open. final bool isOpen; @@ -179,7 +179,7 @@ class _StreamAttachmentPickerState extends State { return AnimatedContainer( duration: - widget.isOpen ? const Duration(milliseconds: 300) : const Duration(), + widget.isOpen ? const Duration(milliseconds: 300) : Duration.zero, curve: Curves.easeOut, height: widget.isOpen ? widget.pickerSize : 0, child: SingleChildScrollView( @@ -245,7 +245,7 @@ class _StreamAttachmentPickerState extends State { if (widget.allowedAttachmentTypes .contains(DefaultAttachmentTypes.video)) IconButton( - padding: const EdgeInsets.all(0), + padding: EdgeInsets.zero, icon: StreamSvgIcon.record( color: _getIconColor(3), ), @@ -424,7 +424,6 @@ class _StreamAttachmentPickerState extends State { class _PickerWidget extends StatefulWidget { const _PickerWidget({ - Key? key, required this.filePickerIndex, required this.containsFile, required this.selectedMedias, @@ -434,7 +433,7 @@ class _PickerWidget extends StatefulWidget { required this.allowedAttachmentTypes, required this.customAttachmentTypes, required this.mediaListViewController, - }) : super(key: key); + }); final int filePickerIndex; final bool containsFile; @@ -506,7 +505,7 @@ class _PickerWidgetState extends State<_PickerWidget> { onTap: () async { PhotoManager.openSetting(); }, - child: Container( + child: ColoredBox( color: widget.streamChatTheme.colorTheme.inputBg, child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart index 808760c7e..1260ce94f 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart @@ -173,7 +173,7 @@ const _kDefaultMaxAttachmentSize = 20971520; // 20MB in Bytes class StreamMessageInput extends StatefulWidget { /// Instantiate a new MessageInput const StreamMessageInput({ - Key? key, + super.key, this.onMessageSent, this.preMessageSending, this.maxHeight = 150, @@ -208,10 +208,11 @@ class StreamMessageInput extends StatefulWidget { this.elevation, this.shadow, this.autoCorrect = true, - this.disableEmojiSuggestionsOverlay = false, + @Deprecated('Please use enableEmojiSuggestionsOverlay') + this.disableEmojiSuggestionsOverlay = false, this.enableEmojiSuggestionsOverlay = true, this.enableMentionsOverlay = true, - }) : super(key: key); + }); /// List of options for showing overlays. final List customOverlays; @@ -605,6 +606,7 @@ class StreamMessageInputState extends State widget: _buildCommandsOverlayEntry(), ), if (widget.enableEmojiSuggestionsOverlay && + // ignore: deprecated_member_use_from_same_package !widget.disableEmojiSuggestionsOverlay) OverlayOptions( visible: _focusNode.hasFocus && @@ -744,7 +746,7 @@ class StreamMessageInputState extends State color: _messageInputTheme.expandButtonColor, ), ), - padding: const EdgeInsets.all(0), + padding: EdgeInsets.zero, constraints: const BoxConstraints.tightFor( height: 24, width: 24, @@ -916,7 +918,7 @@ class StreamMessageInputState extends State child: IconButton( icon: StreamSvgIcon.closeSmall(), splashRadius: 24, - padding: const EdgeInsets.all(0), + padding: EdgeInsets.zero, constraints: const BoxConstraints.tightFor( height: 24, width: 24, @@ -1402,9 +1404,9 @@ class StreamMessageInputState extends State ], ); default: - return Container( + return const ColoredBox( color: Colors.black26, - child: const Icon(Icons.insert_drive_file), + child: Icon(Icons.insert_drive_file), ); } } @@ -1419,7 +1421,7 @@ class StreamMessageInputState extends State ? _messageInputTheme.actionButtonColor : _messageInputTheme.actionButtonIdleColor), ), - padding: const EdgeInsets.all(0), + padding: EdgeInsets.zero, constraints: const BoxConstraints.tightFor( height: 24, width: 24, @@ -1448,7 +1450,7 @@ class StreamMessageInputState extends State ? _messageInputTheme.actionButtonColor : _messageInputTheme.actionButtonIdleColor, ), - padding: const EdgeInsets.all(0), + padding: EdgeInsets.zero, constraints: const BoxConstraints.tightFor( height: 24, width: 24, @@ -1809,10 +1811,10 @@ class StreamMessageInputState extends State class OGAttachmentPreview extends StatelessWidget { /// Returns a new instance of [OGAttachmentPreview] const OGAttachmentPreview({ - Key? key, + super.key, required this.attachment, this.onDismissPreviewPressed, - }) : super(key: key); + }); /// The attachment to be rendered. final Attachment attachment; diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_send_button.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_send_button.dart index 67a06f670..6aa2650c7 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_send_button.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_send_button.dart @@ -7,7 +7,7 @@ class StreamMessageSendButton extends StatelessWidget { /// [isCommandEnabled], [isEditEnabled], [idleSendButton], [activeSendButton], /// [onSendMessage]. const StreamMessageSendButton({ - Key? key, + super.key, this.timeOut = 0, this.isIdle = true, this.isCommandEnabled = false, @@ -15,7 +15,7 @@ class StreamMessageSendButton extends StatelessWidget { this.idleSendButton, this.activeSendButton, required this.onSendMessage, - }) : super(key: key); + }); /// Time out related to slow mode. final int timeOut; @@ -81,7 +81,7 @@ class StreamMessageSendButton extends StatelessWidget { padding: const EdgeInsets.all(8), child: IconButton( onPressed: onSendMessage, - padding: const EdgeInsets.all(0), + padding: EdgeInsets.zero, splashRadius: 24, constraints: const BoxConstraints.tightFor( height: 24, diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_text_field.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_text_field.dart index 0aaccd0aa..b9aa5df67 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_text_field.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_text_field.dart @@ -67,7 +67,7 @@ class StreamMessageTextField extends StatefulWidget { /// * [maxLength], which discusses the precise meaning of "number of /// characters" and how it may differ from the intuitive meaning. const StreamMessageTextField({ - Key? key, + super.key, this.controller, this.focusNode, this.decoration = const InputDecoration(), @@ -176,8 +176,7 @@ class StreamMessageTextField extends StatefulWidget { cut: true, selectAll: true, paste: true, - )), - super(key: key); + )); /// Controls the message being edited. /// diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_tile.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_tile.dart index b8e2cf24d..dc685d09a 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_tile.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_tile.dart @@ -14,13 +14,13 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamChannelGridTile extends StatelessWidget { /// Creates a new instance of [StreamChannelGridTile] widget. const StreamChannelGridTile({ - Key? key, + super.key, required this.channel, this.child, this.footer, this.onTap, this.onLongPress, - }) : super(key: key); + }); /// The channel to display. final Channel channel; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_view.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_view.dart index d1969fa40..ab3089d82 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_view.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_grid_view.dart @@ -44,7 +44,7 @@ typedef StreamChannelGridViewIndexedWidgetBuilder class StreamChannelGridView extends StatelessWidget { /// Creates a new instance of [StreamChannelGridView]. const StreamChannelGridView({ - Key? key, + super.key, required this.controller, this.gridDelegate = defaultChannelGridViewDelegate, this.itemBuilder, @@ -72,7 +72,7 @@ class StreamChannelGridView extends StatelessWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [StreamUserListController] used to control the grid of users. final StreamChannelListController controller; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_tile.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_tile.dart index 8a180fca8..129875cf8 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_tile.dart @@ -17,7 +17,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamChannelListTile extends StatelessWidget { /// Creates a new instance of [StreamChannelListTile] widget. StreamChannelListTile({ - Key? key, + super.key, required this.channel, this.leading, this.title, @@ -30,11 +30,10 @@ class StreamChannelListTile extends StatelessWidget { this.contentPadding = const EdgeInsets.symmetric(horizontal: 8), this.unreadIndicatorBuilder, this.sendingIndicatorBuilder, - }) : assert( + }) : assert( channel.state != null, 'Channel ${channel.id} is not initialized', - ), - super(key: key); + ); /// The channel to display. final Channel channel; @@ -228,14 +227,13 @@ class StreamChannelListTile extends StatelessWidget { class ChannelLastMessageDate extends StatelessWidget { /// Creates a new instance of the [ChannelLastMessageDate] widget. ChannelLastMessageDate({ - Key? key, + super.key, required this.channel, this.textStyle, - }) : assert( + }) : assert( channel.state != null, 'Channel ${channel.id} is not initialized', - ), - super(key: key); + ); /// The channel to display the last message date for. final Channel channel; @@ -281,14 +279,13 @@ class ChannelLastMessageDate extends StatelessWidget { class ChannelListTileSubtitle extends StatelessWidget { /// Creates a new instance of [StreamChannelListTileSubtitle] widget. ChannelListTileSubtitle({ - Key? key, + super.key, required this.channel, this.textStyle, - }) : assert( + }) : assert( channel.state != null, 'Channel ${channel.id} is not initialized', - ), - super(key: key); + ); /// The channel to create the subtitle from. final Channel channel; @@ -325,14 +322,13 @@ class ChannelListTileSubtitle extends StatelessWidget { class ChannelLastMessageText extends StatelessWidget { /// Creates a new instance of [ChannelLastMessageText] widget. ChannelLastMessageText({ - Key? key, + super.key, required this.channel, this.textStyle, - }) : assert( + }) : assert( channel.state != null, 'Channel ${channel.id} is not initialized', - ), - super(key: key); + ); /// The channel to display the last message of. final Channel channel; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_view.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_view.dart index 2a5118358..a45ae28b6 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/channel_scroll_view/stream_channel_list_view.dart @@ -52,7 +52,7 @@ typedef StreamChannelListViewIndexedWidgetBuilder class StreamChannelListView extends StatelessWidget { /// Creates a new instance of [StreamChannelListView]. const StreamChannelListView({ - Key? key, + super.key, required this.controller, this.itemBuilder, this.separatorBuilder = defaultChannelListViewSeparatorBuilder, @@ -77,7 +77,7 @@ class StreamChannelListView extends StatelessWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [StreamChannelListController] used to control the list of channels. final StreamChannelListController controller; @@ -375,7 +375,7 @@ class StreamChannelListView extends StatelessWidget { /// [StreamChannelListTile] items. class StreamChannelListSeparator extends StatelessWidget { /// Creates a new instance of [StreamChannelListSeparator]. - const StreamChannelListSeparator({Key? key}) : super(key: key); + const StreamChannelListSeparator({super.key}); @override Widget build(BuildContext context) { @@ -392,9 +392,9 @@ class StreamChannelListSeparator extends StatelessWidget { class StreamChannelListErrorWidget extends StatelessWidget { /// Creates a new instance of [StreamChannelListErrorWidget] widget. const StreamChannelListErrorWidget({ - Key? key, + super.key, this.onPressed, - }) : super(key: key); + }); /// The callback to invoke when the user taps on the retry button. final VoidCallback? onPressed; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_grid_view.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_grid_view.dart index 488148b56..355e3a324 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_grid_view.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_grid_view.dart @@ -37,7 +37,7 @@ typedef StreamMessageSearchGridViewIndexedWidgetBuilder class StreamMessageSearchGridView extends StatelessWidget { /// Creates a new instance of [StreamMessageSearchGridView]. const StreamMessageSearchGridView({ - Key? key, + super.key, required this.controller, required this.itemBuilder, this.gridDelegate = defaultMessageSearchGridViewDelegate, @@ -63,7 +63,7 @@ class StreamMessageSearchGridView extends StatelessWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [StreamUserListController] used to control the grid of users. final StreamMessageSearchListController controller; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart index c303add05..a380c1365 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart @@ -15,7 +15,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamMessageSearchListTile extends StatelessWidget { /// Creates a new instance of [StreamMessageSearchListTile]. const StreamMessageSearchListTile({ - Key? key, + super.key, required this.messageResponse, this.leading, this.title, @@ -26,7 +26,7 @@ class StreamMessageSearchListTile extends StatelessWidget { this.tileColor, this.visualDensity = VisualDensity.compact, this.contentPadding = const EdgeInsets.symmetric(horizontal: 8), - }) : super(key: key); + }); /// The message response to display. final GetMessageResponse messageResponse; @@ -161,10 +161,10 @@ class StreamMessageSearchListTile extends StatelessWidget { class MessageSearchListTileTitle extends StatelessWidget { /// Creates a new [MessageSearchListTileTitle] instance. const MessageSearchListTileTitle({ - Key? key, + super.key, required this.messageResponse, this.textStyle, - }) : super(key: key); + }); /// The message response for the tile. final GetMessageResponse messageResponse; @@ -207,10 +207,10 @@ class MessageSearchListTileTitle extends StatelessWidget { class MessageSearchTileMessageDate extends StatelessWidget { /// Creates a new instance of [MessageSearchTileMessageDate]. const MessageSearchTileMessageDate({ - Key? key, + super.key, required this.message, this.textStyle, - }) : super(key: key); + }); /// The searched message response. final Message message; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_view.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_view.dart index 9c3f165d1..b1a184cad 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/message_search_scroll_view/stream_message_search_list_view.dart @@ -49,7 +49,7 @@ typedef StreamMessageSearchListViewIndexedWidgetBuilder class StreamMessageSearchListView extends StatelessWidget { /// Creates a new instance of [StreamMessageSearchListView]. const StreamMessageSearchListView({ - Key? key, + super.key, required this.controller, this.itemBuilder, this.separatorBuilder = defaultMessageSearchListViewSeparatorBuilder, @@ -74,7 +74,7 @@ class StreamMessageSearchListView extends StatelessWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [StreamUserListController] used to control the list of /// searched messages. @@ -373,7 +373,7 @@ class StreamMessageSearchListView extends StatelessWidget { /// [StreamMessageSearchListTile] items. class StreamMessageSearchListSeparator extends StatelessWidget { /// Creates a new instance of [StreamMessageSearchListSeparator]. - const StreamMessageSearchListSeparator({Key? key}) : super(key: key); + const StreamMessageSearchListSeparator({super.key}); @override Widget build(BuildContext context) { diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_empty_widget.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_empty_widget.dart index 531eac79b..f931dbbbb 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_empty_widget.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_empty_widget.dart @@ -6,14 +6,14 @@ import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; class StreamScrollViewEmptyWidget extends StatelessWidget { /// Creates a new instance of the [StreamScrollViewEmptyWidget]. const StreamScrollViewEmptyWidget({ - Key? key, + super.key, required this.emptyIcon, required this.emptyTitle, this.emptyTitleStyle, this.mainAxisSize = MainAxisSize.max, this.mainAxisAlignment = MainAxisAlignment.center, this.crossAxisAlignment = CrossAxisAlignment.center, - }) : super(key: key); + }); /// The title of the empty view. final Widget emptyTitle; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_error_widget.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_error_widget.dart index 9d6af29c5..bb14d8dd6 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_error_widget.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_error_widget.dart @@ -7,7 +7,7 @@ import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; class StreamScrollViewErrorWidget extends StatelessWidget { /// Creates a new instance of the [StreamScrollViewErrorWidget]. const StreamScrollViewErrorWidget({ - Key? key, + super.key, this.errorTitle, this.errorTitleStyle, this.errorIcon, @@ -17,7 +17,7 @@ class StreamScrollViewErrorWidget extends StatelessWidget { this.mainAxisSize = MainAxisSize.max, this.mainAxisAlignment = MainAxisAlignment.center, this.crossAxisAlignment = CrossAxisAlignment.center, - }) : super(key: key); + }); /// The title of the error. final Widget? errorTitle; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_error.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_error.dart index 03575b1f9..feec6f4e0 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_error.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_error.dart @@ -7,7 +7,7 @@ import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; class StreamScrollViewLoadMoreError extends StatelessWidget { /// Creates a new instance of [StreamScrollViewLoadMoreError.list]. const StreamScrollViewLoadMoreError.list({ - Key? key, + super.key, this.error, this.errorStyle, this.errorIcon, @@ -17,12 +17,11 @@ class StreamScrollViewLoadMoreError extends StatelessWidget { this.mainAxisSize = MainAxisSize.max, this.mainAxisAlignment = MainAxisAlignment.spaceBetween, this.crossAxisAlignment = CrossAxisAlignment.center, - }) : _isList = true, - super(key: key); + }) : _isList = true; /// Creates a new instance of [StreamScrollViewLoadMoreError.grid]. const StreamScrollViewLoadMoreError.grid({ - Key? key, + super.key, this.error, this.errorStyle, this.errorIcon, @@ -32,8 +31,7 @@ class StreamScrollViewLoadMoreError extends StatelessWidget { this.mainAxisSize = MainAxisSize.max, this.mainAxisAlignment = MainAxisAlignment.spaceEvenly, this.crossAxisAlignment = CrossAxisAlignment.center, - }) : _isList = false, - super(key: key); + }) : _isList = false; /// The error message to display. final Widget? error; @@ -86,7 +84,7 @@ class StreamScrollViewLoadMoreError extends StatelessWidget { return InkWell( onTap: onTap, - child: Container( + child: ColoredBox( color: backgroundColor, child: Padding( padding: padding, diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart index 93bf8d064..725852259 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart @@ -5,10 +5,10 @@ import 'package:flutter/material.dart'; class StreamScrollViewLoadMoreIndicator extends StatelessWidget { /// Creates a new instance of [StreamScrollViewLoadMoreIndicator]. const StreamScrollViewLoadMoreIndicator({ - Key? key, + super.key, this.height = 16, this.width = 16, - }) : super(key: key); + }); /// The height of the indicator. final double height; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_loading_widget.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_loading_widget.dart index ae47b152f..958eb80dc 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_loading_widget.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/stream_scroll_view_loading_widget.dart @@ -4,10 +4,10 @@ import 'package:flutter/material.dart'; class StreamScrollViewLoadingWidget extends StatelessWidget { /// Creates a new instance of [StreamScrollViewLoadingWidget]. const StreamScrollViewLoadingWidget({ - Key? key, + super.key, this.height = 42, this.width = 42, - }) : super(key: key); + }); /// The height of the indicator. final double height; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_tile.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_tile.dart index 6d904086a..4d512f05e 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_tile.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_tile.dart @@ -13,13 +13,13 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamUserGridTile extends StatelessWidget { /// Creates a new instance of [StreamUserGridTile] widget. const StreamUserGridTile({ - Key? key, + super.key, required this.user, this.child, this.footer, this.onTap, this.onLongPress, - }) : super(key: key); + }); /// The user to display. final User user; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_view.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_view.dart index 08cc4a50a..13a12100b 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_view.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_grid_view.dart @@ -39,7 +39,7 @@ typedef StreamUserGridViewIndexedWidgetBuilder class StreamUserGridView extends StatelessWidget { /// Creates a new instance of [StreamUserGridView]. const StreamUserGridView({ - Key? key, + super.key, required this.controller, this.gridDelegate = defaultUserGridViewDelegate, this.itemBuilder, @@ -67,7 +67,7 @@ class StreamUserGridView extends StatelessWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [StreamUserListController] used to control the grid of users. final StreamUserListController controller; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_tile.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_tile.dart index c88862fa0..00471855c 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_tile.dart @@ -19,7 +19,7 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart' class StreamUserListTile extends StatelessWidget { /// Creates a new instance of [StreamUserListTile]. const StreamUserListTile({ - Key? key, + super.key, required this.user, this.leading, this.title, @@ -31,7 +31,7 @@ class StreamUserListTile extends StatelessWidget { this.tileColor, this.visualDensity = VisualDensity.compact, this.contentPadding = const EdgeInsets.symmetric(horizontal: 8), - }) : super(key: key); + }); /// The user to display. final User user; @@ -171,9 +171,9 @@ class StreamUserListTile extends StatelessWidget { class UserLastActive extends StatelessWidget { /// Creates a new instance of the [UserLastActive] widget. const UserLastActive({ - Key? key, + super.key, required this.user, - }) : super(key: key); + }); /// The user whose last active time is displayed. final User user; diff --git a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_view.dart b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_view.dart index d87f8ab95..f54ce7959 100644 --- a/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/v4/scroll_view/user_scroll_view/stream_user_list_view.dart @@ -48,7 +48,7 @@ typedef StreamUserListViewIndexedWidgetBuilder class StreamUserListView extends StatelessWidget { /// Creates a new instance of [StreamUserListView]. const StreamUserListView({ - Key? key, + super.key, required this.controller, this.itemBuilder, this.separatorBuilder = defaultUserListViewSeparatorBuilder, @@ -73,7 +73,7 @@ class StreamUserListView extends StatelessWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [StreamUserListController] used to control the list of users. final StreamUserListController controller; @@ -368,7 +368,7 @@ class StreamUserListView extends StatelessWidget { /// [StreamUserListTile] items. class StreamUserListSeparator extends StatelessWidget { /// Creates a new instance of [StreamUserListSeparator]. - const StreamUserListSeparator({Key? key}) : super(key: key); + const StreamUserListSeparator({super.key}); @override Widget build(BuildContext context) { diff --git a/packages/stream_chat_flutter/lib/src/v4/stream_channel_avatar.dart b/packages/stream_chat_flutter/lib/src/v4/stream_channel_avatar.dart index 448e39d8e..452e19a31 100644 --- a/packages/stream_chat_flutter/lib/src/v4/stream_channel_avatar.dart +++ b/packages/stream_chat_flutter/lib/src/v4/stream_channel_avatar.dart @@ -47,7 +47,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamChannelAvatar extends StatelessWidget { /// Instantiate a new ChannelImage StreamChannelAvatar({ - Key? key, + super.key, required this.channel, this.constraints, this.onTap, @@ -55,11 +55,10 @@ class StreamChannelAvatar extends StatelessWidget { this.selected = false, this.selectionColor, this.selectionThickness = 4, - }) : assert( + }) : assert( channel.state != null, 'Channel ${channel.id} is not initialized', - ), - super(key: key); + ); /// [BorderRadius] to display the widget final BorderRadius? borderRadius; diff --git a/packages/stream_chat_flutter/lib/src/v4/stream_channel_info_bottom_sheet.dart b/packages/stream_chat_flutter/lib/src/v4/stream_channel_info_bottom_sheet.dart index 19c2349be..6827c431f 100644 --- a/packages/stream_chat_flutter/lib/src/v4/stream_channel_info_bottom_sheet.dart +++ b/packages/stream_chat_flutter/lib/src/v4/stream_channel_info_bottom_sheet.dart @@ -13,18 +13,17 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; class StreamChannelInfoBottomSheet extends StatelessWidget { /// Creates a new instance [StreamChannelInfoBottomSheet] widget. StreamChannelInfoBottomSheet({ - Key? key, + super.key, required this.channel, this.onMemberTap, this.onViewInfoTap, this.onLeaveChannelTap, this.onDeleteConversationTap, this.onCancelTap, - }) : assert( + }) : assert( channel.state != null, 'Channel ${channel.id} is not initialized', - ), - super(key: key); + ); /// The [Channel] to show information about. final Channel channel; diff --git a/packages/stream_chat_flutter/lib/src/v4/stream_channel_name.dart b/packages/stream_chat_flutter/lib/src/v4/stream_channel_name.dart index c6070e0f1..b7536df37 100644 --- a/packages/stream_chat_flutter/lib/src/v4/stream_channel_name.dart +++ b/packages/stream_chat_flutter/lib/src/v4/stream_channel_name.dart @@ -10,15 +10,14 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; class StreamChannelName extends StatelessWidget { /// Instantiate a new ChannelName StreamChannelName({ - Key? key, + super.key, required this.channel, this.textStyle, this.textOverflow = TextOverflow.ellipsis, - }) : assert( + }) : assert( channel.state != null, 'Channel ${channel.id} is not initialized', - ), - super(key: key); + ); /// The [Channel] to show the name for. final Channel channel; diff --git a/packages/stream_chat_flutter/lib/src/v4/stream_message_preview_text.dart b/packages/stream_chat_flutter/lib/src/v4/stream_message_preview_text.dart index 53d260a29..4e036c5c3 100644 --- a/packages/stream_chat_flutter/lib/src/v4/stream_message_preview_text.dart +++ b/packages/stream_chat_flutter/lib/src/v4/stream_message_preview_text.dart @@ -6,11 +6,11 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class StreamMessagePreviewText extends StatelessWidget { /// Creates a new instance of [StreamMessagePreviewText]. const StreamMessagePreviewText({ - Key? key, + super.key, required this.message, this.language, this.textStyle, - }) : super(key: key); + }); /// The message to display. final Message message; diff --git a/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart b/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart index 4d253da0a..9f778278f 100644 --- a/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart +++ b/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart @@ -16,7 +16,7 @@ typedef VideoThumbnailImage = StreamVideoThumbnailImage; class StreamVideoThumbnailImage extends StatefulWidget { /// Constructor for creating [StreamVideoThumbnailImage] const StreamVideoThumbnailImage({ - Key? key, + super.key, required this.video, this.width, this.height, @@ -24,7 +24,7 @@ class StreamVideoThumbnailImage extends StatefulWidget { this.format = ImageFormat.PNG, this.errorBuilder, this.placeholderBuilder, - }) : super(key: key); + }); /// Video path final String video; diff --git a/packages/stream_chat_flutter/lib/src/visible_footnote.dart b/packages/stream_chat_flutter/lib/src/visible_footnote.dart index 1456de3a1..80fac2e09 100644 --- a/packages/stream_chat_flutter/lib/src/visible_footnote.dart +++ b/packages/stream_chat_flutter/lib/src/visible_footnote.dart @@ -11,7 +11,7 @@ typedef VisibleFootnote = StreamVisibleFootnote; /// {@endtemplate} class StreamVisibleFootnote extends StatelessWidget { /// Constructor for creating a [StreamVisibleFootnote] - const StreamVisibleFootnote({Key? key}) : super(key: key); + const StreamVisibleFootnote({super.key}); @override Widget build(BuildContext context) { diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 7df5cc834..e92328b28 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.17.0 <3.0.0' flutter: ">=1.17.0" dependencies: diff --git a/packages/stream_chat_flutter/test/flutter_test_config.dart b/packages/stream_chat_flutter/test/flutter_test_config.dart index bfda23d06..07b2da98f 100644 --- a/packages/stream_chat_flutter/test/flutter_test_config.dart +++ b/packages/stream_chat_flutter/test/flutter_test_config.dart @@ -13,7 +13,7 @@ Future testExecutable(FutureOr Function() testMain) async { } class CustomGoldenFileComparator extends LocalFileComparator { - CustomGoldenFileComparator(Uri testFile) : super(testFile); + CustomGoldenFileComparator(super.testFile); @override Future compare(Uint8List imageBytes, Uri golden) async { @@ -28,8 +28,4 @@ class CustomGoldenFileComparator extends LocalFileComparator { } return true; } - - @override - Future update(Uri golden, Uint8List imageBytes) => - super.update(golden, imageBytes); } diff --git a/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart b/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart index 798452156..ef7157438 100644 --- a/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart +++ b/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart @@ -933,6 +933,11 @@ void main() { await tester.pumpAndSettle(); }); + final fadeTransitionFinder = find.descendant( + of: find.byType(ScrollablePositionedList), + matching: find.byType(FadeTransition), + ); + testWidgets('Scroll to 0 stop before half way', (WidgetTester tester) async { final itemScrollController = ItemScrollController(); await setUpWidgetTest(tester, itemScrollController: itemScrollController); @@ -951,7 +956,7 @@ void main() { await tester.pump(); expect(tester.getTopLeft(find.text('Item 91')).dy, 0); - expect(find.byType(FadeTransition), findsNWidgets(2)); + expect(fadeTransitionFinder, findsNWidgets(1)); await tester.pumpAndSettle(); }); @@ -976,7 +981,7 @@ void main() { expect(tester.getBottomLeft(find.text('Item 100')).dy, closeTo(screenHeight, tolerance)); expect(find.text('Item 9', skipOffstage: false), findsNothing); - expect(find.byType(FadeTransition), findsNWidgets(2)); + expect(fadeTransitionFinder, findsNWidgets(1)); await tester.pumpAndSettle(); }); @@ -999,11 +1004,7 @@ void main() { await tester.pump(); expect(tester.getTopLeft(find.text('Item 9')).dy, closeTo(0, tolerance)); - final fadeTransition = tester.widget(find - .descendant( - of: find.byType(ScrollablePositionedList), - matching: find.byType(FadeTransition)) - .last); + final fadeTransition = tester.widget(fadeTransitionFinder); expect(fadeTransition.opacity.value, 1.0); await tester.pumpAndSettle(); @@ -1021,13 +1022,14 @@ void main() { itemScrollController.scrollTo(index: 0, duration: scrollDuration)); await tester.pump(); await tester.pump(); - await tester.pump(scrollDuration ~/ 2); + await tester.pump(scrollDuration ~/ 2 + scrollDuration ~/ 20); await tester.tap(find.byType(ScrollablePositionedList)); await tester.pump(); - expect(tester.getTopLeft(find.text('Item 90')).dy, 0); - expect(find.byType(FadeTransition), findsNWidgets(2)); + expect(tester.getTopLeft(find.text('Item 9')).dy, closeTo(0, tolerance)); + final fadeTransition = tester.widget(fadeTransitionFinder); + expect(fadeTransition.opacity.value, 1.0); await tester.pumpAndSettle(); }); @@ -1317,7 +1319,7 @@ void main() { await setUpWidgetTest(tester, itemPositionsListener: itemPositionsListener); final root = WidgetsBinding - .instance!.pipelineOwner.semanticsOwner!.rootSemanticsNode!; + .instance.pipelineOwner.semanticsOwner!.rootSemanticsNode!; final semanticNodes = [root]; diff --git a/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart b/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart index d59b80028..244eace56 100644 --- a/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart +++ b/packages/stream_chat_flutter/test/src/attachment_actions_modal_test.dart @@ -75,7 +75,7 @@ void main() { ); testWidgets( - 'it should hide delete if it\'s not my message', + "it should hide delete if it's not my message", (WidgetTester tester) async { final client = MockClient(); final clientState = MockClientState(); @@ -364,7 +364,7 @@ void main() { testWidgets( // ignore: lines_longer_than_80_chars - 'tapping on delete in chat should remove the message if that\'s the only attachment and there is no text', + "tapping on delete in chat should remove the message if that's the only attachment and there is no text", (WidgetTester tester) async { final client = MockClient(); final clientState = MockClientState(); diff --git a/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart b/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart index 073adc555..a4388a2e3 100644 --- a/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart +++ b/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart @@ -92,7 +92,7 @@ void main() { width: 100, height: 100, child: StreamGradientAvatar( - name: 'd123@/d de:\$as', + name: r'd123@/d de:$as', userId: 'demo123', ), ), @@ -116,7 +116,7 @@ void main() { width: 100, height: 100, child: StreamGradientAvatar( - name: '123@/d \$as', userId: 'demo123'), + name: r'123@/d $as', userId: 'demo123'), ), ), ), diff --git a/packages/stream_chat_flutter/test/src/message_list_view_test.dart b/packages/stream_chat_flutter/test/src/message_list_view_test.dart index 08e238207..240dda849 100644 --- a/packages/stream_chat_flutter/test/src/message_list_view_test.dart +++ b/packages/stream_chat_flutter/test/src/message_list_view_test.dart @@ -114,9 +114,9 @@ void main() { }); bool findBackground(Widget widget) => - widget is Container && + widget is DecoratedBox && widget.decoration is BoxDecoration && - (widget.decoration! as BoxDecoration).image != null; + (widget.decoration as BoxDecoration).image != null; expect(find.byType(StreamMessageListView), findsOneWidget); expect(find.byKey(nonEmptyWidgetKey), findsOneWidget); diff --git a/packages/stream_chat_flutter/test/src/reaction_bubble_test.dart b/packages/stream_chat_flutter/test/src/reaction_bubble_test.dart index 50719b171..e5234a6d5 100644 --- a/packages/stream_chat_flutter/test/src/reaction_bubble_test.dart +++ b/packages/stream_chat_flutter/test/src/reaction_bubble_test.dart @@ -60,7 +60,7 @@ void main() { client: client, streamChatThemeData: StreamChatThemeData.fromTheme(themeData), connectivityStream: Stream.value(ConnectivityResult.mobile), - child: Container( + child: ColoredBox( color: Colors.black, child: StreamReactionBubble( reactions: [ @@ -97,7 +97,7 @@ void main() { client: client, streamChatThemeData: StreamChatThemeData.fromTheme(themeData), connectivityStream: Stream.value(ConnectivityResult.mobile), - child: Container( + child: ColoredBox( color: Colors.black, child: StreamReactionBubble( reactions: [ @@ -142,7 +142,7 @@ void main() { client: client, streamChatThemeData: StreamChatThemeData.fromTheme(themeData), connectivityStream: Stream.value(ConnectivityResult.mobile), - child: Container( + child: ColoredBox( color: Colors.black, child: StreamReactionBubble( reactions: [ diff --git a/packages/stream_chat_flutter/test/src/simple_frame.dart b/packages/stream_chat_flutter/test/src/simple_frame.dart index 0633a3b87..aad15b63f 100644 --- a/packages/stream_chat_flutter/test/src/simple_frame.dart +++ b/packages/stream_chat_flutter/test/src/simple_frame.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class SimpleFrame extends StatelessWidget { - const SimpleFrame({Key? key, required this.child}) : super(key: key); + const SimpleFrame({super.key, required this.child}); final Widget child; diff --git a/packages/stream_chat_flutter/test/utils/golden.dart b/packages/stream_chat_flutter/test/utils/golden.dart index 574306efb..436f10f2c 100644 --- a/packages/stream_chat_flutter/test/utils/golden.dart +++ b/packages/stream_chat_flutter/test/utils/golden.dart @@ -38,7 +38,7 @@ This method level parameter will be removed in an upcoming release. This can be } class CustomGoldenFileComparator extends LocalFileComparator { - CustomGoldenFileComparator(Uri testFile) : super(testFile); + CustomGoldenFileComparator(super.testFile); @override Future compare(Uint8List imageBytes, Uri golden) async { diff --git a/packages/stream_chat_flutter_core/example/pubspec.yaml b/packages/stream_chat_flutter_core/example/pubspec.yaml index 4b0e27fbb..562d07615 100644 --- a/packages/stream_chat_flutter_core/example/pubspec.yaml +++ b/packages/stream_chat_flutter_core/example/pubspec.yaml @@ -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. diff --git a/packages/stream_chat_flutter_core/lib/src/better_stream_builder.dart b/packages/stream_chat_flutter_core/lib/src/better_stream_builder.dart index 2a2a5ab74..6305224b6 100644 --- a/packages/stream_chat_flutter_core/lib/src/better_stream_builder.dart +++ b/packages/stream_chat_flutter_core/lib/src/better_stream_builder.dart @@ -15,8 +15,8 @@ class BetterStreamBuilder extends StatefulWidget { this.noDataBuilder, this.errorBuilder, this.comparator, - Key? key, - }) : super(key: key); + super.key, + }); /// The stream to listen to final Stream? stream; diff --git a/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart b/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart index 51be28e71..556b44cc6 100644 --- a/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart @@ -64,7 +64,7 @@ More details here https://getstream.io/chat/docs/sdk/flutter/stream_chat_flutter class ChannelListCore extends StatefulWidget { /// Instantiate a new ChannelListView const ChannelListCore({ - Key? key, + super.key, required this.errorBuilder, required this.emptyBuilder, required this.loadingBuilder, @@ -78,7 +78,7 @@ class ChannelListCore extends StatefulWidget { this.sort, this.channelListController, this.limit = 25, - }) : super(key: key); + }); /// A [ChannelListController] allows reloading and pagination. /// Use [ChannelListController.loadData] and diff --git a/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart b/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart index 2f8838b5d..df791d525 100644 --- a/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart +++ b/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart @@ -23,12 +23,12 @@ class ChannelsBloc extends StatefulWidget { /// Creates a new [ChannelsBloc]. The parameter [child] must be supplied and /// not null. const ChannelsBloc({ - Key? key, + super.key, required this.child, this.lockChannelsOrder = false, this.channelsComparator, this.shouldAddChannel, - }) : super(key: key); + }); /// The widget child final Widget child; diff --git a/packages/stream_chat_flutter_core/lib/src/lazy_load_scroll_view.dart b/packages/stream_chat_flutter_core/lib/src/lazy_load_scroll_view.dart index fb503bcd2..e086ab554 100644 --- a/packages/stream_chat_flutter_core/lib/src/lazy_load_scroll_view.dart +++ b/packages/stream_chat_flutter_core/lib/src/lazy_load_scroll_view.dart @@ -9,7 +9,7 @@ class LazyLoadScrollView extends StatefulWidget { /// Creates a new instance of [LazyLoadScrollView]. The parameter [child] /// must be supplied and not null. const LazyLoadScrollView({ - Key? key, + super.key, required this.child, this.onStartOfPage, this.onEndOfPage, @@ -17,7 +17,7 @@ class LazyLoadScrollView extends StatefulWidget { this.onPageScrollEnd, this.onInBetweenOfPage, this.scrollOffset = 100, - }) : super(key: key); + }); /// The [Widget] that this widget watches for changes on final Widget child; diff --git a/packages/stream_chat_flutter_core/lib/src/message_list_core.dart b/packages/stream_chat_flutter_core/lib/src/message_list_core.dart index a28d6d73e..042c2eca4 100644 --- a/packages/stream_chat_flutter_core/lib/src/message_list_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/message_list_core.dart @@ -70,7 +70,7 @@ bool Function(Message) defaultMessageFilter(String currentUserId) => class MessageListCore extends StatefulWidget { /// Instantiate a new [MessageListView]. const MessageListCore({ - Key? key, + super.key, required this.loadingBuilder, required this.emptyBuilder, required this.messageListBuilder, @@ -79,7 +79,7 @@ class MessageListCore extends StatefulWidget { this.messageListController, this.messageFilter, this.paginationLimit = 20, - }) : super(key: key); + }); /// A [MessageListController] allows pagination. /// Use [ChannelListController.paginateData] pagination. diff --git a/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart b/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart index 0c302c728..0ba47fd2e 100644 --- a/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart +++ b/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart @@ -17,9 +17,9 @@ import 'package:stream_chat_flutter_core/src/stream_controller_extension.dart'; class MessageSearchBloc extends StatefulWidget { /// Instantiate a new MessageSearchBloc const MessageSearchBloc({ - Key? key, + super.key, required this.child, - }) : super(key: key); + }); /// The widget child final Widget child; diff --git a/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart b/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart index e86d020b2..f528a4da0 100644 --- a/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart @@ -46,7 +46,7 @@ class MessageSearchListCore extends StatefulWidget { /// * [loadingBuilder] /// * [childBuilder] MessageSearchListCore({ - Key? key, + super.key, required this.emptyBuilder, required this.errorBuilder, required this.loadingBuilder, @@ -76,8 +76,7 @@ class MessageSearchListCore extends StatefulWidget { sortOptions == null, 'Cannot specify `offset` with `sortOptions` parameter', ), - limit = limit ?? paginationParams?.limit ?? 30, - super(key: key); + limit = limit ?? paginationParams?.limit ?? 30; /// A [MessageSearchListController] allows reloading and pagination. /// Use [MessageSearchListController.loadData] and diff --git a/packages/stream_chat_flutter_core/lib/src/message_text_field_controller.dart b/packages/stream_chat_flutter_core/lib/src/message_text_field_controller.dart index 0f9f75c65..ff5c03a48 100644 --- a/packages/stream_chat_flutter_core/lib/src/message_text_field_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/message_text_field_controller.dart @@ -10,15 +10,15 @@ typedef TextStyleBuilder = TextStyle? Function( class MessageTextFieldController extends TextEditingController { /// Returns a new MessageTextFieldController MessageTextFieldController({ - String? text, + super.text, this.textPatternStyle, - }) : super(text: text); + }); /// Returns a new MessageTextFieldController with the given text [value]. MessageTextFieldController.fromValue( - TextEditingValue? value, { + super.value, { this.textPatternStyle, - }) : super.fromValue(value); + }) : super.fromValue(); /// A map of style to apply to the text matching the RegExp patterns. final Map? textPatternStyle; diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart index 00d96f562..a078f471c 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart @@ -26,7 +26,7 @@ typedef PagedValueScrollViewLoadMoreErrorBuilder = Widget Function( class PagedValueListView extends StatefulWidget { /// Creates a new instance of [PagedValueListView] widget. const PagedValueListView({ - Key? key, + super.key, required this.controller, required this.itemBuilder, required this.separatorBuilder, @@ -51,7 +51,7 @@ class PagedValueListView extends StatefulWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [PagedValueNotifier] used to control the list of items. final PagedValueNotifier controller; @@ -322,7 +322,7 @@ class _PagedValueListViewState extends State> { index == newPageRequestTriggerIndex; if (nextPageKey != null && isBuildingTriggerIndexItem) { // Schedules the request for the end of this frame. - WidgetsBinding.instance?.addPostFrameCallback((_) async { + WidgetsBinding.instance.addPostFrameCallback((_) async { if (error == null) { await _controller.loadMore(nextPageKey); } @@ -357,7 +357,7 @@ class _PagedValueListViewState extends State> { class PagedValueGridView extends StatefulWidget { /// Creates a new instance of [PagedValueGridView] widget. const PagedValueGridView({ - Key? key, + super.key, required this.controller, required this.gridDelegate, required this.itemBuilder, @@ -383,7 +383,7 @@ class PagedValueGridView extends StatefulWidget { this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, this.restorationId, this.clipBehavior = Clip.hardEdge, - }) : super(key: key); + }); /// The [PagedValueNotifier] used to control the list of items. final PagedValueNotifier controller; @@ -678,7 +678,7 @@ class _PagedValueGridViewState extends State> { index == newPageRequestTriggerIndex; if (nextPageKey != null && isBuildingTriggerIndexItem) { // Schedules the request for the end of this frame. - WidgetsBinding.instance?.addPostFrameCallback((_) async { + WidgetsBinding.instance.addPostFrameCallback((_) async { if (error == null) { await _controller.loadMore(nextPageKey); } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart index 478227916..7a9420bed 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart @@ -22,12 +22,12 @@ class StreamChannel extends StatefulWidget { /// Creates a new instance of [StreamChannel]. Both [child] and [client] must /// be supplied and not null. const StreamChannel({ - Key? key, + super.key, required this.child, required this.channel, this.showLoading = true, this.initialMessageId, - }) : super(key: key); + }); /// The child of the widget final Widget child; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart index 9fe5594c9..61193ac23 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart @@ -55,7 +55,7 @@ class StreamChannelListController extends PagedValueNotifier { /// Creates a [StreamChannelListController] from the passed [value]. StreamChannelListController.fromValue( - PagedValue value, { + super.value, { required this.client, StreamChannelListEventHandler? eventHandler, this.filter, @@ -64,8 +64,7 @@ class StreamChannelListController extends PagedValueNotifier { this.limit = defaultChannelPagedLimit, this.messageLimit, this.memberLimit, - }) : _eventHandler = eventHandler ?? StreamChannelListEventHandler(), - super(value); + }) : _eventHandler = eventHandler ?? StreamChannelListEventHandler(); /// The client to use for the channels list. final StreamChatClient client; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart index 82f0a5d68..9b5f5dce3 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart @@ -38,13 +38,13 @@ class StreamChatCore extends StatefulWidget { /// [StreamChatCore] is a stateful widget which reacts to system events and /// updates Stream's connection status accordingly. const StreamChatCore({ - Key? key, + super.key, required this.client, required this.child, this.onBackgroundEventReceived, this.backgroundKeepAlive = const Duration(minutes: 1), this.connectivityStream, - }) : super(key: key); + }); /// Instance of Stream Chat Client containing information about the current /// application. @@ -115,7 +115,7 @@ class StreamChatCoreState extends State @override void initState() { super.initState(); - WidgetsBinding.instance?.addObserver(this); + WidgetsBinding.instance.addObserver(this); _subscribeToConnectivityChange(widget.connectivityStream); } @@ -207,7 +207,7 @@ class StreamChatCoreState extends State @override void dispose() { - WidgetsBinding.instance?.removeObserver(this); + WidgetsBinding.instance.removeObserver(this); _unsubscribeFromConnectivityChange(); _eventSubscription?.cancel(); _disconnectTimer?.cancel(); diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_input_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_input_controller.dart index b8f9107d0..9e1586de2 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_input_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_input_controller.dart @@ -52,7 +52,7 @@ class StreamMessageInputController extends ValueNotifier { Map? textPatternStyle, }) : _textEditingController = MessageTextFieldController.fromValue( initialMessage.text == null - ? const TextEditingValue() + ? TextEditingValue.empty : TextEditingValue( text: initialMessage.text!, composing: TextRange.collapsed(initialMessage.text!.length), diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart index d5b8a2f30..b41a99f04 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart @@ -52,7 +52,7 @@ class StreamMessageSearchListController /// Creates a [StreamUserListController] from the passed [value]. StreamMessageSearchListController.fromValue( - PagedValue value, { + super.value, { required this.client, required this.filter, this.messageFilter, @@ -70,8 +70,7 @@ class StreamMessageSearchListController _activeFilter = filter, _activeMessageFilter = messageFilter, _activeSearchQuery = searchQuery, - _activeSort = sort, - super(value); + _activeSort = sort; /// The client to use for the channels list. final StreamChatClient client; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart index 1881e8683..3e1b2892e 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart @@ -40,15 +40,14 @@ class StreamUserListController extends PagedValueNotifier { /// Creates a [StreamUserListController] from the passed [value]. StreamUserListController.fromValue( - PagedValue value, { + super.value, { required this.client, this.filter, this.sort, this.presence = true, this.limit = defaultUserPagedLimit, }) : _activeFilter = filter, - _activeSort = sort, - super(value); + _activeSort = sort; /// The client to use for the channels list. final StreamChatClient client; diff --git a/packages/stream_chat_flutter_core/lib/src/user_list_core.dart b/packages/stream_chat_flutter_core/lib/src/user_list_core.dart index 03159afb9..678415690 100644 --- a/packages/stream_chat_flutter_core/lib/src/user_list_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/user_list_core.dart @@ -67,14 +67,14 @@ class UserListCore extends StatefulWidget { required this.emptyBuilder, required this.loadingBuilder, required this.listBuilder, - Key? key, + super.key, this.filter = const Filter.empty(), this.sort, this.presence, this.groupAlphabetically = false, this.userListController, this.limit = 30, - }) : super(key: key); + }); /// A [UserListController] allows reloading and pagination. /// Use [UserListController.loadData] and [UserListController.paginateData] @@ -170,11 +170,11 @@ class UserListCoreState extends State for (final key in groupedUsers.keys) { items ..add(ListHeaderItem(key)) - ..addAll(groupedUsers[key]!.map((e) => ListUserItem(e))); + ..addAll(groupedUsers[key]!.map(ListUserItem.new)); } return items; } - return users.map((e) => ListUserItem(e)).toList(); + return users.map(ListUserItem.new).toList(); }, ); diff --git a/packages/stream_chat_flutter_core/lib/src/users_bloc.dart b/packages/stream_chat_flutter_core/lib/src/users_bloc.dart index c01242ec4..5db4f5f5d 100644 --- a/packages/stream_chat_flutter_core/lib/src/users_bloc.dart +++ b/packages/stream_chat_flutter_core/lib/src/users_bloc.dart @@ -17,8 +17,8 @@ class UsersBloc extends StatefulWidget { /// not null. const UsersBloc({ required this.child, - Key? key, - }) : super(key: key); + super.key, + }); /// The widget child final Widget child; diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 07d5f842d..e8e299245 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.17.0 <3.0.0' flutter: ">=1.17.0" dependencies: @@ -14,7 +14,7 @@ dependencies: connectivity_plus: ^2.1.0 flutter: sdk: flutter - freezed_annotation: ^1.0.0 + freezed_annotation: ^2.0.3 meta: ^1.3.0 rxdart: ^0.27.0 stream_chat: ^4.1.0 @@ -25,6 +25,6 @@ dev_dependencies: fake_async: ^1.2.0 flutter_test: sdk: flutter - freezed: ^1.0.0 + freezed: ^2.0.3 mocktail: ^0.3.0 diff --git a/packages/stream_chat_flutter_core/test/user_list_core_test.dart b/packages/stream_chat_flutter_core/test/user_list_core_test.dart index 86ae601da..89d0cdbda 100644 --- a/packages/stream_chat_flutter_core/test/user_list_core_test.dart +++ b/packages/stream_chat_flutter_core/test/user_list_core_test.dart @@ -265,7 +265,7 @@ void main() { .map((e) => Container( key: Key(e.key ?? ''), child: e.when( - headerItem: (heading) => Text(heading), + headerItem: Text.new, userItem: (user) => Text(user.id), ), )) @@ -333,7 +333,7 @@ void main() { .map((e) => Container( key: Key(e.key ?? ''), child: e.when( - headerItem: (heading) => Text(heading), + headerItem: Text.new, userItem: (user) => Text(user.id), ), )) @@ -438,7 +438,7 @@ void main() { .map((e) => Container( key: Key(e.key ?? ''), child: e.when( - headerItem: (heading) => Text(heading), + headerItem: Text.new, userItem: (user) => Text(user.id), ), )) diff --git a/packages/stream_chat_localizations/example/lib/add_new_lang.dart b/packages/stream_chat_localizations/example/lib/add_new_lang.dart index d0eca8e81..9becad2da 100644 --- a/packages/stream_chat_localizations/example/lib/add_new_lang.dart +++ b/packages/stream_chat_localizations/example/lib/add_new_lang.dart @@ -24,8 +24,7 @@ class _NnStreamChatLocalizationsDelegate /// and formatting. class NnStreamChatLocalizations extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for English. - const NnStreamChatLocalizations({String localeName = 'nn'}) - : super(localeName: localeName); + const NnStreamChatLocalizations({super.localeName = 'nn'}); /// A [LocalizationsDelegate] for [NnStreamChatLocalizations]. static const delegate = _NnStreamChatLocalizationsDelegate(); @@ -86,7 +85,7 @@ class NnStreamChatLocalizations extends GlobalStreamChatLocalizations { @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'; @@ -223,7 +222,7 @@ class NnStreamChatLocalizations extends GlobalStreamChatLocalizations { @override String get operationCouldNotBeCompletedText => - 'The operation couldn\'t be completed.'; + "The operation couldn't be completed."; @override String get replyLabel => 'Reply'; @@ -453,10 +452,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. /// @@ -510,8 +509,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( diff --git a/packages/stream_chat_localizations/example/lib/main.dart b/packages/stream_chat_localizations/example/lib/main.dart index 55354e50b..a212c82c4 100644 --- a/packages/stream_chat_localizations/example/lib/main.dart +++ b/packages/stream_chat_localizations/example/lib/main.dart @@ -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. /// @@ -101,8 +101,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( diff --git a/packages/stream_chat_localizations/example/lib/override_lang.dart b/packages/stream_chat_localizations/example/lib/override_lang.dart index 33ebaa99b..f36219150 100644 --- a/packages/stream_chat_localizations/example/lib/override_lang.dart +++ b/packages/stream_chat_localizations/example/lib/override_lang.dart @@ -72,10 +72,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. /// @@ -128,8 +128,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( diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index db4476181..5fcac8de3 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -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.3 diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart index 35b283ecb..aa65e81d4 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for German (`de`). class StreamChatLocalizationsDe extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for German. - const StreamChatLocalizationsDe({String localeName = 'de'}) - : super(localeName: localeName); + const StreamChatLocalizationsDe({super.localeName = 'de'}); @override String get launchUrlError => 'Die Url kann nicht geöffnet werden'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index 1d1d82b38..ead459fa8 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for English (`en`). class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for English. - const StreamChatLocalizationsEn({String localeName = 'en'}) - : super(localeName: localeName); + const StreamChatLocalizationsEn({super.localeName = 'en'}); @override String get launchUrlError => 'Cannot launch the url'; @@ -62,7 +61,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { @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'; @@ -199,7 +198,7 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { @override String get operationCouldNotBeCompletedText => - 'The operation couldn\'t be completed.'; + "The operation couldn't be completed."; @override String get replyLabel => 'Reply'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart index b906843f1..d26e033a7 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for Spanish (`es`). class StreamChatLocalizationsEs extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for Spanish. - const StreamChatLocalizationsEs({String localeName = 'es'}) - : super(localeName: localeName); + const StreamChatLocalizationsEs({super.localeName = 'es'}); @override String get launchUrlError => 'No se pudo abrir la url'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index b5a44a51d..5521ef570 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for French (`fr`). class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for French. - const StreamChatLocalizationsFr({String localeName = 'fr'}) - : super(localeName: localeName); + const StreamChatLocalizationsFr({super.localeName = 'fr'}); @override String get launchUrlError => "Impossible de lancer l'url"; @@ -63,7 +62,7 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { @override String get sendMessagePermissionError => - 'Vous n\'êtes pas autorisé à envoyer des messages'; + "Vous n'êtes pas autorisé à envoyer des messages"; @override String get emptyMessagesText => "Il n'y a pas de messages actuellement"; @@ -383,7 +382,7 @@ Limite de pièces jointes dépassée : il n'est pas possible d'ajouter plus de $ @override String get linkDisabledDetails => - 'L\'envoi de liens n\'est pas autorisé dans cette conversation.'; + "L'envoi de liens n'est pas autorisé dans cette conversation."; @override String get linkDisabledError => 'Les liens sont désactivés'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index e07566bd4..20ae9db25 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for Hindi (`hi`). class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for Hindi. - const StreamChatLocalizationsHi({String localeName = 'hi'}) - : super(localeName: localeName); + const StreamChatLocalizationsHi({super.localeName = 'hi'}); @override String get launchUrlError => 'यूआरएल लॉन्च नहीं कर सकते'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart index ffbdde94b..f8b21ed44 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -3,17 +3,16 @@ part of 'stream_chat_localizations.dart'; /// The translations for Italian (`it`). class StreamChatLocalizationsIt extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for Italian. - const StreamChatLocalizationsIt({String localeName = 'it'}) - : super(localeName: localeName); + const StreamChatLocalizationsIt({super.localeName = 'it'}); @override - String get launchUrlError => 'Impossibile aprire l\'url'; + String get launchUrlError => "Impossibile aprire l'url"; @override String get loadingUsersError => 'Errore durante il carimento degli utenti'; @override - String get noUsersLabel => 'Non c\'é nessun utente al momento'; + String get noUsersLabel => "Non c'é nessun utente al momento"; @override String get retryLabel => 'Riprova'; @@ -62,10 +61,10 @@ class StreamChatLocalizationsIt extends GlobalStreamChatLocalizations { @override String get sendMessagePermissionError => - 'Non hai l\'autorizzazione per inviare messaggi'; + "Non hai l'autorizzazione per inviare messaggi"; @override - String get emptyMessagesText => 'Non c\'é nessun messaggio al momento'; + String get emptyMessagesText => "Non c'é nessun messaggio al momento"; @override String get genericErrorText => 'Qualcosa è andato storto'; @@ -162,11 +161,11 @@ Il file è troppo grande per essere caricato. Il limite è di $limitInMB MB.'''; @override String get enablePhotoAndVideoAccessMessage => - 'Per favore attiva l\'accesso alle foto' + "Per favore attiva l'accesso alle foto" '\ne ai video cosí potrai condividerli con i tuoi amici.'; @override - String get allowGalleryAccessMessage => 'Permetti l\'accesso alla galleria'; + String get allowGalleryAccessMessage => "Permetti l'accesso alla galleria"; @override String get flagMessageLabel => 'Segnala messaggio'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart index 7729a6ca2..2faae6c43 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for Japanese (`ja`). class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for Japanese. - const StreamChatLocalizationsJa({String localeName = 'ja'}) - : super(localeName: localeName); + const StreamChatLocalizationsJa({super.localeName = 'ja'}); @override String get launchUrlError => 'URLの起動ができません'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart index c7c858f1c..e541e5297 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for Korean (`ko`). class StreamChatLocalizationsKo extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for Korean. - const StreamChatLocalizationsKo({String localeName = 'ko'}) - : super(localeName: localeName); + const StreamChatLocalizationsKo({super.localeName = 'ko'}); @override String get launchUrlError => 'URL을 시작할 수 없습니다'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart index 3a1a7696d..74e9a1f43 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart @@ -3,8 +3,7 @@ part of 'stream_chat_localizations.dart'; /// The translations for Portuguese (`pt`). class StreamChatLocalizationsPt extends GlobalStreamChatLocalizations { /// Create an instance of the translation bundle for Portuguese. - const StreamChatLocalizationsPt({String localeName = 'pt'}) - : super(localeName: localeName); + const StreamChatLocalizationsPt({super.localeName = 'pt'}); @override String get launchUrlError => 'O URL não pôde ser aberto'; diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index e9ffb1c8b..b0c4a96ea 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -6,7 +6,7 @@ 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' flutter: ">=1.17.0" dependencies: diff --git a/packages/stream_chat_localizations/test/basics_test.dart b/packages/stream_chat_localizations/test/basics_test.dart index 8491a3321..ae52a1af2 100644 --- a/packages/stream_chat_localizations/test/basics_test.dart +++ b/packages/stream_chat_localizations/test/basics_test.dart @@ -92,7 +92,7 @@ class DummyLocalizations { } class LocalizationTracker extends StatefulWidget { - const LocalizationTracker({Key? key}) : super(key: key); + const LocalizationTracker({super.key}); @override State createState() => LocalizationTrackerState(); diff --git a/packages/stream_chat_persistence/example/lib/main.dart b/packages/stream_chat_persistence/example/lib/main.dart index 049868fa1..5771d716a 100644 --- a/packages/stream_chat_persistence/example/lib/main.dart +++ b/packages/stream_chat_persistence/example/lib/main.dart @@ -52,10 +52,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. @@ -76,9 +76,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; @@ -129,10 +129,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 messages; diff --git a/packages/stream_chat_persistence/example/pubspec.yaml b/packages/stream_chat_persistence/example/pubspec.yaml index 6c6e8c6df..34f569893 100644 --- a/packages/stream_chat_persistence/example/pubspec.yaml +++ b/packages/stream_chat_persistence/example/pubspec.yaml @@ -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.3 diff --git a/packages/stream_chat_persistence/lib/src/dao/channel_dao.dart b/packages/stream_chat_persistence/lib/src/dao/channel_dao.dart index 50f3b2a60..f3a3de415 100644 --- a/packages/stream_chat_persistence/lib/src/dao/channel_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/channel_dao.dart @@ -12,7 +12,7 @@ part 'channel_dao.g.dart'; class ChannelDao extends DatabaseAccessor with _$ChannelDaoMixin { /// Creates a new channel dao instance - ChannelDao(DriftChatDatabase db) : super(db); + ChannelDao(super.db); /// Get channel by cid Future getChannelByCid(String cid) async => diff --git a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart index 75a5db13c..acac4993f 100644 --- a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart @@ -15,7 +15,7 @@ part 'channel_query_dao.g.dart'; class ChannelQueryDao extends DatabaseAccessor with _$ChannelQueryDaoMixin { /// Creates a new channel query dao instance - ChannelQueryDao(DriftChatDatabase db) : super(db); + ChannelQueryDao(super.db); String _computeHash(Filter? filter) { if (filter == null) { diff --git a/packages/stream_chat_persistence/lib/src/dao/connection_event_dao.dart b/packages/stream_chat_persistence/lib/src/dao/connection_event_dao.dart index b9b4a52d5..fa7ff9829 100644 --- a/packages/stream_chat_persistence/lib/src/dao/connection_event_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/connection_event_dao.dart @@ -12,7 +12,7 @@ part 'connection_event_dao.g.dart'; class ConnectionEventDao extends DatabaseAccessor with _$ConnectionEventDaoMixin { /// Creates a new connection event dao instance - ConnectionEventDao(DriftChatDatabase db) : super(db); + ConnectionEventDao(super.db); /// Get the latest stored connection event Future get connectionEvent => select(connectionEvents) diff --git a/packages/stream_chat_persistence/lib/src/dao/member_dao.dart b/packages/stream_chat_persistence/lib/src/dao/member_dao.dart index 9f81879c1..ccf843fb4 100644 --- a/packages/stream_chat_persistence/lib/src/dao/member_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/member_dao.dart @@ -14,7 +14,7 @@ part 'member_dao.g.dart'; class MemberDao extends DatabaseAccessor with _$MemberDaoMixin { /// Creates a new member dao instance - MemberDao(DriftChatDatabase db) : super(db); + MemberDao(super.db); /// Get all members where [Members.channelCid] matches [cid] Future> getMembersByCid(String cid) async => diff --git a/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.dart b/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.dart index 4a37984a8..c5c5a6d45 100644 --- a/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.dart @@ -12,7 +12,7 @@ part 'pinned_message_reaction_dao.g.dart'; class PinnedMessageReactionDao extends DatabaseAccessor with _$PinnedMessageReactionDaoMixin { /// Creates a new reaction dao instance - PinnedMessageReactionDao(DriftChatDatabase db) : super(db); + PinnedMessageReactionDao(super.db); /// Returns all the reactions of a particular message by matching /// [Reactions.messageId] with [messageId] diff --git a/packages/stream_chat_persistence/lib/src/dao/reaction_dao.dart b/packages/stream_chat_persistence/lib/src/dao/reaction_dao.dart index 7b0b5b8c8..d6dae9bd9 100644 --- a/packages/stream_chat_persistence/lib/src/dao/reaction_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/reaction_dao.dart @@ -12,7 +12,7 @@ part 'reaction_dao.g.dart'; class ReactionDao extends DatabaseAccessor with _$ReactionDaoMixin { /// Creates a new reaction dao instance - ReactionDao(DriftChatDatabase db) : super(db); + ReactionDao(super.db); /// Returns all the reactions of a particular message by matching /// [Reactions.messageId] with [messageId] diff --git a/packages/stream_chat_persistence/lib/src/dao/read_dao.dart b/packages/stream_chat_persistence/lib/src/dao/read_dao.dart index 9e46f818d..4e2024f1f 100644 --- a/packages/stream_chat_persistence/lib/src/dao/read_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/read_dao.dart @@ -11,7 +11,7 @@ part 'read_dao.g.dart'; @DriftAccessor(tables: [Reads, Users]) class ReadDao extends DatabaseAccessor with _$ReadDaoMixin { /// Creates a new read dao instance - ReadDao(DriftChatDatabase db) : super(db); + ReadDao(super.db); /// Get all reads where [Reads.channelCid] matches [cid] Future> getReadsByCid(String cid) async => (select(reads).join([ diff --git a/packages/stream_chat_persistence/lib/src/dao/user_dao.dart b/packages/stream_chat_persistence/lib/src/dao/user_dao.dart index a53a41311..1366dd254 100644 --- a/packages/stream_chat_persistence/lib/src/dao/user_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/user_dao.dart @@ -10,7 +10,7 @@ part 'user_dao.g.dart'; @DriftAccessor(tables: [Users]) class UserDao extends DatabaseAccessor with _$UserDaoMixin { /// Creates a new user dao instance - UserDao(DriftChatDatabase db) : super(db); + UserDao(super.db); /// Updates the users data with the new [userList] data Future updateUsers(List userList) => batch( diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index 4d3ed908a..6c517f3f7 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -6,7 +6,7 @@ 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' flutter: ">=1.17.0" dependencies: