Skip to content

Commit

Permalink
polish 4.0.0 and prepare 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
imtoori committed May 3, 2022
1 parent 9c05625 commit 41f2d55
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 95 deletions.
6 changes: 3 additions & 3 deletions docusaurus/docs/Flutter/guides/migration_guide_4_0.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: migration_guide_4_0
sidebar_position: 14
title: Migration Guide For The Stream Chat Flutter SDK v4.0
title: Migration Guide v4.0
---

**Version 4.0.0** of the Stream Chat Flutter SDK carries significant architectural changes to improve the developer experience by giving you more control and flexibility in how you use our core components and UI widgets.
Expand Down Expand Up @@ -44,7 +44,7 @@ See the sections below on “deprecated classes” for a complete list of change

This section highlights functionality removed.

## Removed methods and classes
### Removed Methods And Classes

In version 4 we removed the following deprecated methods and classes:

Expand Down Expand Up @@ -733,7 +733,7 @@ The controller makes it much simpler to dynamically modify the message input.

## Stream Chat Flutter Core

Various changes have been made to the Core package, most notably, the indroduction of all of the controllers mentioned above:
Various changes have been made to the Core package, most notably, the indroduction of all of the controllers mentioned above.

These controllers replace the business logic implementations (Bloc). Please note that this is not related to the well-known Flutter Bloc package, but instead refers to the naming we used for our business logic components.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ part of 'attachment_file.dart';
T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');

UploadState _$UploadStateFromJson(Map<String, dynamic> json) {
switch (json['runtimeType']) {
Expand All @@ -31,39 +31,6 @@ UploadState _$UploadStateFromJson(Map<String, dynamic> json) {
}
}

/// @nodoc
class _$UploadStateTearOff {
const _$UploadStateTearOff();

Preparing preparing() {
return const Preparing();
}

InProgress inProgress({required int uploaded, required int total}) {
return InProgress(
uploaded: uploaded,
total: total,
);
}

Success success() {
return const Success();
}

Failed failed({required String error}) {
return Failed(
error: error,
);
}

UploadState fromJson(Map<String, Object?> json) {
return UploadState.fromJson(json);
}
}

/// @nodoc
const $UploadState = _$UploadStateTearOff();

/// @nodoc
mixin _$UploadState {
@optionalTypeArgs
Expand Down Expand Up @@ -154,7 +121,7 @@ class _$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$Preparing implements Preparing {
const _$Preparing({String? $type}) : $type = $type ?? 'preparing';
const _$Preparing({final String? $type}) : $type = $type ?? 'preparing';

factory _$Preparing.fromJson(Map<String, dynamic> json) =>
_$$PreparingFromJson(json);
Expand All @@ -173,6 +140,7 @@ class _$Preparing implements Preparing {
(other.runtimeType == runtimeType && other is Preparing);
}

@JsonKey(ignore: true)
@override
int get hashCode => runtimeType.hashCode;

Expand Down Expand Up @@ -301,7 +269,7 @@ class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
@JsonSerializable()
class _$InProgress implements InProgress {
const _$InProgress(
{required this.uploaded, required this.total, String? $type})
{required this.uploaded, required this.total, final String? $type})
: $type = $type ?? 'inProgress';

factory _$InProgress.fromJson(Map<String, dynamic> json) =>
Expand Down Expand Up @@ -329,6 +297,7 @@ class _$InProgress implements InProgress {
const DeepCollectionEquality().equals(other.total, total));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
Expand Down Expand Up @@ -421,14 +390,14 @@ class _$InProgress implements InProgress {
}

abstract class InProgress implements UploadState {
const factory InProgress({required int uploaded, required int total}) =
_$InProgress;
const factory InProgress(
{required final int uploaded, required final int total}) = _$InProgress;

factory InProgress.fromJson(Map<String, dynamic> json) =
_$InProgress.fromJson;

int get uploaded;
int get total;
int get uploaded => throw _privateConstructorUsedError;
int get total => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$InProgressCopyWith<InProgress> get copyWith =>
throw _privateConstructorUsedError;
Expand All @@ -453,7 +422,7 @@ class _$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$Success implements Success {
const _$Success({String? $type}) : $type = $type ?? 'success';
const _$Success({final String? $type}) : $type = $type ?? 'success';

factory _$Success.fromJson(Map<String, dynamic> json) =>
_$$SuccessFromJson(json);
Expand All @@ -472,6 +441,7 @@ class _$Success implements Success {
(other.runtimeType == runtimeType && other is Success);
}

@JsonKey(ignore: true)
@override
int get hashCode => runtimeType.hashCode;

Expand Down Expand Up @@ -593,7 +563,7 @@ class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$Failed implements Failed {
const _$Failed({required this.error, String? $type})
const _$Failed({required this.error, final String? $type})
: $type = $type ?? 'failed';

factory _$Failed.fromJson(Map<String, dynamic> json) =>
Expand All @@ -618,6 +588,7 @@ class _$Failed implements Failed {
const DeepCollectionEquality().equals(other.error, error));
}

@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(error));
Expand Down Expand Up @@ -708,11 +679,11 @@ class _$Failed implements Failed {
}

abstract class Failed implements UploadState {
const factory Failed({required String error}) = _$Failed;
const factory Failed({required final String error}) = _$Failed;

factory Failed.fromJson(Map<String, dynamic> json) = _$Failed.fromJson;

String get error;
String get error => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$FailedCopyWith<Failed> get copyWith => throw _privateConstructorUsedError;
}
10 changes: 6 additions & 4 deletions packages/stream_chat_flutter/lib/src/info_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ class StreamInfoTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
final chatThemeData = StreamChatTheme.of(context);
return PortalEntry(
return PortalTarget(
visible: showMessage,
portalAnchor: tileAnchor ?? Alignment.topCenter,
childAnchor: childAnchor ?? Alignment.bottomCenter,
portal: Container(
anchor: Aligned(
follower: tileAnchor ?? Alignment.topCenter,
target: childAnchor ?? Alignment.bottomCenter,
),
portalFollower: Container(
height: 25,
color: backgroundColor ??
chatThemeData.colorTheme.textLowEmphasis.withOpacity(0.9),
Expand Down
18 changes: 12 additions & 6 deletions packages/stream_chat_flutter/lib/src/message_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,9 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
if (widget.showUserAvatar == DisplayWidget.hide)
SizedBox(width: avatarWidth + 4),
Flexible(
child: PortalEntry(
child: PortalTarget(
visible: showReactions,
portal: showReactions
portalFollower: showReactions
? Container(
transform:
Matrix4.translationValues(
Expand All @@ -677,10 +677,16 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
),
)
: null,
portalAnchor:
Alignment(widget.reverse ? 1 : -1, -1),
childAnchor:
Alignment(widget.reverse ? -1 : 1, -1),
anchor: Aligned(
follower: Alignment(
widget.reverse ? 1 : -1,
-1,
),
target: Alignment(
widget.reverse ? -1 : 1,
-1,
),
),
child: Stack(
clipBehavior: Clip.none,
children: [
Expand Down
10 changes: 6 additions & 4 deletions packages/stream_chat_flutter/lib/src/multi_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ class StreamMultiOverlay extends StatelessWidget {
final visibleOverlay =
overlayOptions.firstWhereOrNull((element) => element.visible);

return PortalEntry(
childAnchor: childAnchor,
portalAnchor: overlayAnchor,
return PortalTarget(
anchor: Aligned(
follower: overlayAnchor ?? Alignment.center,
target: childAnchor ?? Alignment.center,
),
visible: visibleOverlay != null,
portal: visibleOverlay?.widget,
portalFollower: visibleOverlay?.widget,
child: child,
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
flutter:
sdk: flutter
flutter_markdown: ^0.6.1
flutter_portal: ^0.4.0
flutter_portal: ^1.0.0
flutter_slidable: ^1.2.0
flutter_svg: ^1.0.1
http_parser: ^4.0.0
Expand Down
Loading

0 comments on commit 41f2d55

Please sign in to comment.