Merge branch 'feature/new-ui' of github.com:GetStream/stream-chat-flutter into feat/messg-reply
Conflicts: lib/src/message_widget.dart
This commit is contained in:
@@ -13,41 +13,41 @@ import 'routes/routes.dart';
|
|||||||
const kStreamApiKey = 'STREAM_API_KEY';
|
const kStreamApiKey = 'STREAM_API_KEY';
|
||||||
const kStreamUserId = 'STREAM_USER_ID';
|
const kStreamUserId = 'STREAM_USER_ID';
|
||||||
const kStreamToken = 'STREAM_TOKEN';
|
const kStreamToken = 'STREAM_TOKEN';
|
||||||
const kDefaultStreamApiKey = 's2dxdhpxd94g';
|
const kDefaultStreamApiKey = 'uj7qrdbfrzvg';
|
||||||
|
|
||||||
class ChooseUserPage extends StatelessWidget {
|
class ChooseUserPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final users = <String, User>{
|
final users = <String, User>{
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidmlzaGFsIn0._JHWzo92fpTWZMZriJHXqOng6ShYVmWrdaIaPwEPKBg':
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidmlzaGFsIn0.lCz-idDgaZ-xszjnuB_hTfeIOhTFmJtTB2fEjhwrcCI':
|
||||||
User(
|
User(
|
||||||
id: 'vishal',
|
id: 'vishal',
|
||||||
extraData: {
|
extraData: {
|
||||||
'name': 'Vishal',
|
'name': 'Vishal',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A':
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.1AvvK2TvEsfcxAlfOK2iUMFACucnk6N-Q8f5bbfnjCM':
|
||||||
User(
|
User(
|
||||||
id: 'super-band-9',
|
id: 'super-band-9',
|
||||||
extraData: {
|
extraData: {
|
||||||
'name': 'John Doe',
|
'name': 'John Doe',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FsdmF0b3JlIn0.GMEKyEhONmFnqtkf1TR1A3oUOSIWhjfQv5RpI906dAM':
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FsdmF0b3JlIn0.uQ-pz8e1_C-Df2rIFpkkvWf7g4M0aW2Zkr7pHVhmU1Y':
|
||||||
User(
|
User(
|
||||||
id: 'salvatore',
|
id: 'salvatore',
|
||||||
extraData: {
|
extraData: {
|
||||||
'name': 'Salvatore',
|
'name': 'Salvatore',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidG9tbWFzbyJ9.GTalMeZHaBdpIM5w-KWrVIDSy-ODkHTRkf1GZbWAveM':
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidG9tbWFzbyJ9.feLvMytd5_3-eETKrRdwtO3jcA0HxD8woFUbFU7gQCg':
|
||||||
User(
|
User(
|
||||||
id: 'tommaso',
|
id: 'tommaso',
|
||||||
extraData: {
|
extraData: {
|
||||||
'name': 'Tommaso',
|
'name': 'Tommaso',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiamFhcCJ9.xpGE2lu4OoYS7-2yy6PbF0gJnxOaxeGO4EU6xo4EdMU':
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiamFhcCJ9.VLkLs6KH-jRRkPvhYMa4_lqN0R6WiK7JhJVmYvxcKz0':
|
||||||
User(
|
User(
|
||||||
id: 'jaap',
|
id: 'jaap',
|
||||||
extraData: {
|
extraData: {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
version: 1.0.87+89
|
version: 1.0.88+90
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|||||||
@@ -79,57 +79,60 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
child: CachedNetworkImage(
|
child: ClipRRect(
|
||||||
height: size?.height,
|
borderRadius: BorderRadius.only(
|
||||||
width: size?.width,
|
topLeft: Radius.circular(8),
|
||||||
placeholder: (_, __) {
|
topRight: Radius.circular(8),
|
||||||
return Container(
|
),
|
||||||
width: size?.width,
|
child: CachedNetworkImage(
|
||||||
height: size?.height,
|
height: size?.height,
|
||||||
child: Center(
|
width: size?.width,
|
||||||
child: CircularProgressIndicator(),
|
placeholder: (_, __) {
|
||||||
),
|
return Container(
|
||||||
);
|
width: size?.width,
|
||||||
},
|
height: size?.height,
|
||||||
imageUrl: attachment.thumbUrl ??
|
child: Center(
|
||||||
attachment.imageUrl ??
|
child: CircularProgressIndicator(),
|
||||||
attachment.assetUrl,
|
),
|
||||||
errorWidget: (context, url, error) => AttachmentError(
|
);
|
||||||
attachment: attachment,
|
},
|
||||||
size: size,
|
imageUrl: attachment.thumbUrl ??
|
||||||
|
attachment.imageUrl ??
|
||||||
|
attachment.assetUrl,
|
||||||
|
errorWidget: (context, url, error) => AttachmentError(
|
||||||
|
attachment: attachment,
|
||||||
|
size: size,
|
||||||
|
),
|
||||||
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
bottom: 16,
|
||||||
top: 0,
|
left: 16,
|
||||||
child: Container(
|
child: Material(
|
||||||
decoration: BoxDecoration(
|
color: Colors.black.withOpacity(.5),
|
||||||
color: Colors.white,
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.circular(12),
|
||||||
bottomRight: Radius.circular(16.0),
|
),
|
||||||
)),
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.symmetric(
|
||||||
left: 8.0,
|
horizontal: 8.0,
|
||||||
right: 8.0,
|
vertical: 4.0,
|
||||||
top: 8.0,
|
|
||||||
bottom: 4.0,
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
StreamSvgIcon.lightning(
|
StreamSvgIcon.lightning(
|
||||||
color: StreamChatTheme.of(context).accentColor,
|
color: Colors.white,
|
||||||
size: 16.0,
|
size: 16,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'GIPHY',
|
'GIPHY',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: StreamChatTheme.of(context).accentColor,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 11.0,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
widget.mediaSelectedCallBack(position);
|
widget.mediaSelectedCallBack(position);
|
||||||
},
|
},
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
|
fit: BoxFit.cover,
|
||||||
child: Chewie(
|
child: Chewie(
|
||||||
controller: controllerPackage.chewieController,
|
controller: controllerPackage.chewieController,
|
||||||
),
|
),
|
||||||
|
|||||||
+16
-12
@@ -198,9 +198,7 @@ class MessageWidget extends StatefulWidget {
|
|||||||
'giphy': (context, message, attachment) {
|
'giphy': (context, message, attachment) {
|
||||||
return GiphyAttachment(
|
return GiphyAttachment(
|
||||||
attachment: attachment,
|
attachment: attachment,
|
||||||
messageTheme: messageTheme.copyWith(
|
messageTheme: messageTheme,
|
||||||
messageBackgroundColor: Colors.white,
|
|
||||||
),
|
|
||||||
message: message,
|
message: message,
|
||||||
size: Size(
|
size: Size(
|
||||||
MediaQuery.of(context).size.width * 0.8,
|
MediaQuery.of(context).size.width * 0.8,
|
||||||
@@ -515,6 +513,10 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get isGiphy =>
|
||||||
|
widget.message.attachments?.any((element) => element.type == 'giphy') ==
|
||||||
|
true;
|
||||||
|
|
||||||
Widget _buildReadIndicator() {
|
Widget _buildReadIndicator() {
|
||||||
var padding = 0.0;
|
var padding = 0.0;
|
||||||
return Stack(
|
return Stack(
|
||||||
@@ -708,9 +710,8 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
onTap: () => retryMessage(context),
|
onTap: () => retryMessage(context),
|
||||||
onLongPress: () => onLongPress(context),
|
onLongPress: () => onLongPress(context),
|
||||||
child: Material(
|
child: Material(
|
||||||
color:
|
color: _getBackgroundColor(),
|
||||||
attachment?.type == 'giphy' ? Colors.white : _getBackgroundColor(),
|
clipBehavior: Clip.antiAlias,
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
shape: attachmentShape,
|
shape: attachmentShape,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: widget.attachmentPadding,
|
padding: widget.attachmentPadding,
|
||||||
@@ -861,9 +862,6 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTextBubble(BuildContext context) {
|
Widget _buildTextBubble(BuildContext context) {
|
||||||
final isOnlyEmoji =
|
|
||||||
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
|
||||||
|
|
||||||
Widget child = Transform(
|
Widget child = Transform(
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@@ -907,10 +905,11 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Color _getBackgroundColor() {
|
bool get isOnlyEmoji =>
|
||||||
final isOnlyEmoji =
|
widget.message.text.characters.isNotEmpty &&
|
||||||
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
||||||
|
|
||||||
|
Color _getBackgroundColor() {
|
||||||
if (_hasReplyMessage) {
|
if (_hasReplyMessage) {
|
||||||
return widget.messageTheme.messageBackgroundColor;
|
return widget.messageTheme.messageBackgroundColor;
|
||||||
}
|
}
|
||||||
@@ -930,6 +929,11 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
if (isOnlyEmoji) {
|
if (isOnlyEmoji) {
|
||||||
return Colors.transparent;
|
return Colors.transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isGiphy) {
|
||||||
|
return Colors.transparent;
|
||||||
|
}
|
||||||
|
|
||||||
return widget.messageTheme.messageBackgroundColor;
|
return widget.messageTheme.messageBackgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user