Merge branch 'feature/new-ui' into feature/reactions

This commit is contained in:
Salvatore Giordano
2020-10-23 16:29:37 +02:00
9 changed files with 68 additions and 37 deletions
+10
View File
@@ -1,3 +1,13 @@
## 0.2.11
- Update llc dependency
- Update widget to use `channel.state.unreadCountStream`
## 0.2.10
- Update llc dependency
- Add `separatorBuilder` to `ChannelListView`
## 0.2.9+1 ## 0.2.9+1
- Update llc dependency - Update llc dependency
+1 -1
View File
@@ -6,7 +6,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2' classpath 'com.google.gms:google-services:4.3.2'
} }
+2 -2
View File
@@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017 #Thu Oct 22 11:03:39 CEST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+9 -6
View File
@@ -52,12 +52,15 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
home: StreamChat( builder: (context, widget) {
client: client, return StreamChat(
child: StreamChannel( child: widget,
channel: channel, client: client,
child: ChannelPage(), );
), },
home: StreamChannel(
channel: channel,
child: ChannelPage(),
), ),
); );
} }
+1 -2
View File
@@ -1,7 +1,6 @@
name: example name: example
description: A new Flutter project. description: A new Flutter project.
version: 1.0.31+33
version: 1.0.30+32
environment: environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.2.2 <3.0.0"
+9 -4
View File
@@ -64,6 +64,7 @@ class ChannelListView extends StatefulWidget {
this.onChannelLongPress, this.onChannelLongPress,
this.channelWidget, this.channelWidget,
this.channelPreviewBuilder, this.channelPreviewBuilder,
this.separatorBuilder,
this.errorBuilder, this.errorBuilder,
this.onImageTap, this.onImageTap,
this.swipeToAction = false, this.swipeToAction = false,
@@ -113,6 +114,9 @@ class ChannelListView extends StatefulWidget {
/// Builder used to create a custom channel preview /// Builder used to create a custom channel preview
final ChannelPreviewBuilder channelPreviewBuilder; final ChannelPreviewBuilder channelPreviewBuilder;
/// Builder used to create a custom item separator
final Function(BuildContext, int) separatorBuilder;
/// The function called when the image is tapped /// The function called when the image is tapped
final Function(Channel) onImageTap; final Function(Channel) onImageTap;
@@ -273,6 +277,9 @@ class _ChannelListViewState extends State<ChannelListView>
Widget _itemBuilder(context, int i, List<Channel> channels) { Widget _itemBuilder(context, int i, List<Channel> channels) {
if (i % 2 != 0) { if (i % 2 != 0) {
if (widget.separatorBuilder != null) {
return widget.separatorBuilder(context, i);
}
return _separatorBuilder(context, i); return _separatorBuilder(context, i);
} }
@@ -304,10 +311,8 @@ class _ChannelListViewState extends State<ChannelListView>
return StreamChannel( return StreamChannel(
key: ValueKey<String>('CHANNEL-${channel.id}'), key: ValueKey<String>('CHANNEL-${channel.id}'),
channel: channel, channel: channel,
child: StreamBuilder<DateTime>( child: Builder(
initialData: channel.updatedAt, builder: (context) {
stream: channel.updatedAtStream,
builder: (context, snapshot) {
Widget child; Widget child;
if (widget.channelPreviewBuilder != null) { if (widget.channelPreviewBuilder != null) {
child = Stack( child = Stack(
+3 -5
View File
@@ -6,7 +6,6 @@ import 'package:stream_chat_flutter/src/unread_indicator.dart';
import '../stream_chat_flutter.dart'; import '../stream_chat_flutter.dart';
import 'channel_name.dart'; import 'channel_name.dart';
import 'typing_indicator.dart';
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_preview.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_preview.png)
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_preview_paint.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_preview_paint.png)
@@ -71,10 +70,9 @@ class ChannelPreview extends StatelessWidget {
StreamChatTheme.of(context).channelPreviewTheme.title, StreamChatTheme.of(context).channelPreviewTheme.title,
), ),
), ),
if (channel.state.unreadCount > 0) UnreadIndicator(
UnreadIndicator( channel: channel,
channel: channel, ),
),
], ],
), ),
subtitle: Row( subtitle: Row(
+31 -15
View File
@@ -12,20 +12,36 @@ class UnreadIndicator extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return StreamBuilder<int>(
padding: const EdgeInsets.only(left: 8.0), stream: channel.state.unreadCountStream,
child: CircleAvatar( initialData: channel.state.unreadCount,
backgroundColor: builder: (context, snapshot) {
StreamChatTheme.of(context).channelPreviewTheme.unreadCounterColor, if (!snapshot.hasData || snapshot.data == 0) {
radius: 8, return SizedBox();
child: Text( }
'${channel.state.unreadCount}', return Material(
style: TextStyle( borderRadius: BorderRadius.circular(8),
fontSize: 11, color: StreamChatTheme.of(context)
color: Colors.white, .channelPreviewTheme
), .unreadCounterColor,
), child: Padding(
), padding: const EdgeInsets.only(
); left: 5.0,
right: 5.0,
top: 2,
bottom: 1,
),
child: Center(
child: Text(
'${snapshot.data}',
style: TextStyle(
fontSize: 11,
color: Colors.white,
),
),
),
),
);
});
} }
} }
+2 -2
View File
@@ -1,7 +1,7 @@
name: stream_chat_flutter name: stream_chat_flutter
homepage: https://github.com/GetStream/stream-chat-flutter homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter. description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
version: 0.2.9+1 version: 0.2.11
repository: https://github.com/GetStream/stream-chat-flutter 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
@@ -23,7 +23,7 @@ dependencies:
file_picker: ^2.0.0 file_picker: ^2.0.0
image_picker: ^0.6.7+2 image_picker: ^0.6.7+2
flutter_keyboard_visibility: ^3.2.1 flutter_keyboard_visibility: ^3.2.1
stream_chat: ^0.2.8 stream_chat: ^0.2.10
mime: ^0.9.6+3 mime: ^0.9.6+3
visibility_detector: ^0.1.5 visibility_detector: ^0.1.5
http_parser: ^3.1.4 http_parser: ^3.1.4