Merge pull request #1141 from GetStream/chore/flutter-3

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

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