Skip to content

Commit

Permalink
changes for 8.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
deven98 committed Jul 10, 2024
1 parent f0b162f commit 9167892
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 100 deletions.
25 changes: 3 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,9 @@ This repository contains code for our [Dart](https://dart.dev/) and [Flutter](ht

Stream allows developers to rapidly deploy scalable feeds and chat messaging with an industry leading 99.999% uptime SLA guarantee.

**V4 Migration Guide**

> [!WARNING]
> Flutter `> = v3.16.x` uses material 3 by default which breaks the UI of some of the components.
> If you want to use these versions, you need to set the `useMaterial3` parameter to `false`
> in the `ThemeData`.
>
> eg.
>
> ```dart
> MaterialApp(
> theme: ThemeData(
> useMaterial3: false,
> ),
> ...
> );
> ```
>
> `StreamChat` widget overrides the `useMaterial3` parameter to `false` by default
> so if you are using `StreamChat` widget, you **don't** need to set it manually.
For upgrading from V6 to V7, please refer to the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_7_0/)
**V8 Migration Guide**

For upgrading from V7 to V8, please refer to the [V8 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_7_0/)

## Sample apps and demos
Our team maintains a dedicated repository for full fledged sample applications and demos. Consider checking out [GetStream/flutter-samples](https://github.com/GetStream/flutter-samples) to learn more or get started by looking at our latest [Stream Chat demo](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -342,7 +342,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -428,7 +428,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -477,7 +477,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class _StreamGalleryFooterState extends State<StreamGalleryFooter> {
context: context,
removeTop: true,
child: BottomAppBar(
surfaceTintColor:
widget.backgroundColor ?? galleryFooterThemeData.backgroundColor,
color:
widget.backgroundColor ?? galleryFooterThemeData.backgroundColor,
child: Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class StreamGalleryHeader extends StatelessWidget
onPressed: onBackPressed,
)
: const SizedBox(),
surfaceTintColor:
backgroundColor ?? galleryHeaderThemeData.backgroundColor,
backgroundColor:
backgroundColor ?? galleryHeaderThemeData.backgroundColor,
actions: <Widget>[
Expand Down
77 changes: 33 additions & 44 deletions packages/stream_chat_flutter/lib/src/stream_chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class StreamChat extends StatefulWidget {
this.onBackgroundEventReceived,
this.backgroundKeepAlive = const Duration(minutes: 1),
this.connectivityStream,
this.useMaterial3 = false,
});

/// Client to do chat operations with
Expand All @@ -66,11 +65,7 @@ class StreamChat extends StatefulWidget {
/// Stream of connectivity result
/// Visible for testing
@visibleForTesting
final Stream<ConnectivityResult>? connectivityStream;

/// Whether to use material 3 or not (default is false)
/// See our [docs](https://getstream.io/chat/docs/sdk/flutter/stream_chat_flutter/stream_chat_and_theming)
final bool useMaterial3;
final Stream<List<ConnectivityResult>>? connectivityStream;

@override
StreamChatState createState() => StreamChatState();
Expand Down Expand Up @@ -112,46 +107,40 @@ class StreamChatState extends State<StreamChat> {
@override
Widget build(BuildContext context) {
final theme = _getTheme(context, widget.streamChatThemeData);
return Theme(
data: Theme.of(context).copyWith(
// ignore: deprecated_member_use
useMaterial3: widget.useMaterial3,
),
child: Portal(
child: StreamChatConfiguration(
data: streamChatConfigData,
child: StreamChatTheme(
data: theme,
child: Builder(
builder: (context) {
final materialTheme = Theme.of(context);
final streamTheme = StreamChatTheme.of(context);
return Theme(
data: materialTheme.copyWith(
primaryIconTheme: streamTheme.primaryIconTheme,
colorScheme: materialTheme.colorScheme.copyWith(
secondary: streamTheme.colorTheme.accentPrimary,
),
return Portal(
child: StreamChatConfiguration(
data: streamChatConfigData,
child: StreamChatTheme(
data: theme,
child: Builder(
builder: (context) {
final materialTheme = Theme.of(context);
final streamTheme = StreamChatTheme.of(context);
return Theme(
data: materialTheme.copyWith(
primaryIconTheme: streamTheme.primaryIconTheme,
colorScheme: materialTheme.colorScheme.copyWith(
secondary: streamTheme.colorTheme.accentPrimary,
),
child: StreamChatCore(
client: client,
onBackgroundEventReceived: widget.onBackgroundEventReceived,
backgroundKeepAlive: widget.backgroundKeepAlive,
connectivityStream: widget.connectivityStream,
child: Builder(
builder: (context) {
StreamChatClient.additionalHeaders = {
'X-Stream-Client':
'${StreamChatClient.defaultUserAgent}-'
'ui-${StreamChatClient.packageVersion}',
};
return widget.child ?? const Offstage();
},
),
),
child: StreamChatCore(
client: client,
onBackgroundEventReceived: widget.onBackgroundEventReceived,
backgroundKeepAlive: widget.backgroundKeepAlive,
connectivityStream: widget.connectivityStream,
child: Builder(
builder: (context) {
StreamChatClient.additionalHeaders = {
'X-Stream-Client':
'${StreamChatClient.defaultUserAgent}-'
'ui-${StreamChatClient.packageVersion}',
};
return widget.child ?? const Offstage();
},
),
);
},
),
),
);
},
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions packages/stream_chat_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ dependencies:
image_size_getter: ^2.1.3
jiffy: ^6.2.1
just_audio: ^0.9.38
lottie: ">=2.6.0 <4.0.0"
lottie: ^3.1.2
media_kit: ^1.1.10+1
media_kit_video: ^1.2.4
meta: ^1.9.1
path_provider: ^2.1.3
photo_manager: ^3.2.0
photo_view: ^0.15.0
rxdart: ^0.27.7
share_plus: ">=8.0.2 <10.0.0"
share_plus: ^8.0.3
shimmer: ^3.0.0
stream_chat_flutter_core: ^7.3.0
synchronized: ^3.1.0+1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void main() {
StreamChat(
streamChatThemeData: theme,
client: client,
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: StreamChannel(
showLoading: false,
channel: channel,
Expand Down Expand Up @@ -136,7 +136,7 @@ void main() {
home: StreamChat(
streamChatThemeData: theme,
client: client,
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: StreamChannel(
showLoading: false,
channel: channel,
Expand Down Expand Up @@ -194,7 +194,7 @@ void main() {
home: StreamChat(
streamChatThemeData: theme,
client: client,
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: StreamChannel(
showLoading: false,
channel: channel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ cool.''';
home: SimpleFrame(
child: StreamChat(
client: client,
connectivityStream: Stream.value(ConnectivityResult.wifi),
connectivityStream: Stream.value([ConnectivityResult.wifi]),
child: StreamChannel(
channel: channel,
child: Scaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
StreamChat(
client: client,
streamChatThemeData: theme,
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: Scaffold(
body: Center(
child: StreamReactionBubble(
Expand Down Expand Up @@ -68,7 +68,7 @@ void main() {
StreamChat(
client: client,
streamChatThemeData: StreamChatThemeData.fromTheme(themeData),
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: ColoredBox(
color: Colors.black,
child: StreamReactionBubble(
Expand Down Expand Up @@ -105,7 +105,7 @@ void main() {
StreamChat(
client: client,
streamChatThemeData: StreamChatThemeData.fromTheme(themeData),
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: ColoredBox(
color: Colors.black,
child: StreamReactionBubble(
Expand Down Expand Up @@ -150,7 +150,7 @@ void main() {
StreamChat(
client: client,
streamChatThemeData: StreamChatThemeData.fromTheme(themeData),
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: ColoredBox(
color: Colors.black,
child: StreamReactionBubble(
Expand Down Expand Up @@ -195,7 +195,7 @@ void main() {
await tester.pumpWidgetBuilder(
StreamChat(
client: client,
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
streamChatThemeData: StreamChatThemeData.fromTheme(themeData),
child: Scaffold(
body: Center(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void main() {
await tester.pumpWidgetBuilder(
StreamChat(
client: client,
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: StreamChannel(
showLoading: false,
channel: channel,
Expand Down Expand Up @@ -146,7 +146,7 @@ void main() {
await tester.pumpWidgetBuilder(
StreamChat(
client: client,
connectivityStream: Stream.value(ConnectivityResult.mobile),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: StreamChannel(
showLoading: false,
channel: channel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class StreamChatCore extends StatefulWidget {
/// Stream of connectivity result
/// Visible for testing
@visibleForTesting
final Stream<ConnectivityResult>? connectivityStream;
final Stream<List<ConnectivityResult>>? connectivityStream;

@override
StreamChatCoreState createState() => StreamChatCoreState();
Expand Down Expand Up @@ -108,7 +108,7 @@ class StreamChatCoreState extends State<StreamChatCore>
/// The current user as a stream
Stream<User?> get currentUserStream => client.state.currentUserStream;

StreamSubscription<ConnectivityResult>? _connectivitySubscription;
StreamSubscription<List<ConnectivityResult>>? _connectivitySubscription;

var _isInForeground = true;
var _isConnectionAvailable = true;
Expand All @@ -121,7 +121,7 @@ class StreamChatCoreState extends State<StreamChatCore>
}

void _subscribeToConnectivityChange([
Stream<ConnectivityResult>? connectivityStream,
Stream<List<ConnectivityResult>>? connectivityStream,
]) {
if (_connectivitySubscription == null) {
connectivityStream ??= Connectivity().onConnectivityChanged;
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat_flutter_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:

dependencies:
collection: ^1.17.2
connectivity_plus: ">=4.0.2 <6.0.0"
connectivity_plus: ^6.0.3
flutter:
sdk: flutter
freezed_annotation: ^2.4.1
Expand Down
Loading

0 comments on commit 9167892

Please sign in to comment.