From 10e502f84a64072bafe8545f6f69672f27f24e68 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 12 Nov 2020 15:05:31 +0100 Subject: [PATCH 1/6] fix qa --- example/assets/icon_arrow_right.svg | 5 +++++ example/lib/choose_user_page.dart | 15 +++++++++------ example/lib/stream_version.dart | 1 - example/pubspec.yaml | 2 +- lib/src/stream_chat_theme.dart | 1 + lib/src/user_avatar.dart | 1 + 6 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 example/assets/icon_arrow_right.svg diff --git a/example/assets/icon_arrow_right.svg b/example/assets/icon_arrow_right.svg new file mode 100644 index 00000000..7cfa0c56 --- /dev/null +++ b/example/assets/icon_arrow_right.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/example/lib/choose_user_page.dart b/example/lib/choose_user_page.dart index b5296f8a..3a035f34 100644 --- a/example/lib/choose_user_page.dart +++ b/example/lib/choose_user_page.dart @@ -178,9 +178,10 @@ class ChooseUserPage extends StatelessWidget { style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text('Stream test account'), - trailing: Icon( - StreamIcons.arrow_right, - color: StreamChatTheme.of(context).accentColor, + trailing: SvgPicture.asset( + 'assets/icon_arrow_right.svg', + height: 24, + width: 24, ), ); }), @@ -206,9 +207,11 @@ class ChooseUserPage extends StatelessWidget { style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text('Custom settings'), - trailing: Icon( - StreamIcons.arrow_right, - color: StreamChatTheme.of(context).accentColor, + trailing: SvgPicture.asset( + 'assets/icon_arrow_right.svg', + height: 24, + width: 24, + clipBehavior: Clip.none, ), ), ][i]; diff --git a/example/lib/stream_version.dart b/example/lib/stream_version.dart index ee340f89..113e36c0 100644 --- a/example/lib/stream_version.dart +++ b/example/lib/stream_version.dart @@ -24,7 +24,6 @@ class StreamVersion extends StatelessWidget { final streamChatDep = yaml['packages']['stream_chat_flutter']['version']; - print('streamChatDep: ${streamChatDep}'); return Text( 'Stream SDK v ${streamChatDep}', style: TextStyle( diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c6743cd4..ce1ab622 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.53+55 +version: 1.0.54+56 environment: sdk: ">=2.2.2 <3.0.0" diff --git a/lib/src/stream_chat_theme.dart b/lib/src/stream_chat_theme.dart index 3b3725ed..967cbbbf 100644 --- a/lib/src/stream_chat_theme.dart +++ b/lib/src/stream_chat_theme.dart @@ -229,6 +229,7 @@ class StreamChatThemeData { backgroundColor: isDark ? Colors.black : Colors.white, defaultUserImage: (context, user) => Center( child: CachedNetworkImage( + filterQuality: FilterQuality.high, imageUrl: getRandomPicUrl(user), fit: BoxFit.cover, ), diff --git a/lib/src/user_avatar.dart b/lib/src/user_avatar.dart index 86bf7abd..66edba39 100644 --- a/lib/src/user_avatar.dart +++ b/lib/src/user_avatar.dart @@ -49,6 +49,7 @@ class UserAvatar extends StatelessWidget { ), child: hasImage ? CachedNetworkImage( + filterQuality: FilterQuality.high, imageUrl: user.extraData['image'], errorWidget: (_, __, ___) { return streamChatTheme.defaultUserImage(context, user); From 39a6861e4ceb5942a302948f4a44ff41f62c0e75 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 12 Nov 2020 18:26:13 +0100 Subject: [PATCH 2/6] remove waiting for keystorage --- example/lib/choose_user_page.dart | 26 ++++++++++++-------------- example/pubspec.yaml | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/example/lib/choose_user_page.dart b/example/lib/choose_user_page.dart index 3a035f34..fd7d2b6c 100644 --- a/example/lib/choose_user_page.dart +++ b/example/lib/choose_user_page.dart @@ -135,20 +135,18 @@ class ChooseUserPage extends StatelessWidget { token, ); - await Future.wait([ - secureStorage.write( - key: kStreamApiKey, - value: kDefaultStreamApiKey, - ), - secureStorage.write( - key: kStreamUserId, - value: user.id, - ), - secureStorage.write( - key: kStreamToken, - value: token, - ), - ]); + secureStorage.write( + key: kStreamApiKey, + value: kDefaultStreamApiKey, + ); + secureStorage.write( + key: kStreamUserId, + value: user.id, + ); + secureStorage.write( + key: kStreamToken, + value: token, + ); if (!kIsWeb) { initNotifications(client); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ce1ab622..f85127f0 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.54+56 +version: 1.0.55+57 environment: sdk: ">=2.2.2 <3.0.0" From 7eb9a9dfd9be8d10f9098a4bfa0f4d646d438493 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 12 Nov 2020 18:35:55 +0100 Subject: [PATCH 3/6] remoe editing from giphy messages --- lib/src/message_widget.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index f9871d69..fd6286a2 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -493,7 +493,10 @@ class _MessageWidgetState extends State { message: widget.message, editMessageInputBuilder: widget.editMessageInputBuilder, onThreadTap: widget.onThreadTap, - showEditMessage: widget.showEditMessage, + showEditMessage: widget.showEditMessage && + widget.message.attachments + ?.any((element) => element.type == 'giphy') != + true, showReactions: widget.showReactions, showReply: widget.showReplyIndicator && widget.onThreadTap != null, From 0eb3aee4212984d5e249951d6b476eefeb40070f Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 12 Nov 2020 18:52:10 +0100 Subject: [PATCH 4/6] fix group images --- lib/src/group_image.dart | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/src/group_image.dart b/lib/src/group_image.dart index 2385007d..96e25f74 100644 --- a/lib/src/group_image.dart +++ b/lib/src/group_image.dart @@ -46,9 +46,16 @@ class GroupImage extends StatelessWidget { .take(2) .map((url) => Flexible( fit: FlexFit.tight, - child: CachedNetworkImage( - imageUrl: url, + child: FittedBox( fit: BoxFit.cover, + clipBehavior: Clip.antiAlias, + child: Transform.scale( + scale: 1.2, + child: CachedNetworkImage( + imageUrl: url, + fit: BoxFit.cover, + ), + ), ), )) .toList(), @@ -64,9 +71,16 @@ class GroupImage extends StatelessWidget { .skip(2) .map((url) => Flexible( fit: FlexFit.tight, - child: CachedNetworkImage( - imageUrl: url, + child: FittedBox( fit: BoxFit.cover, + clipBehavior: Clip.antiAlias, + child: Transform.scale( + scale: 1.2, + child: CachedNetworkImage( + imageUrl: url, + fit: BoxFit.cover, + ), + ), ), )) .toList(), From 44dc5c24ae166a968c97ef91c48e30677c229c5d Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 13 Nov 2020 11:25:55 +0100 Subject: [PATCH 5/6] put error text inside textfield --- example/ios/Podfile.lock | 2 +- example/lib/advanced_options_page.dart | 85 +++++++++++++++++++++----- example/pubspec.yaml | 2 +- 3 files changed, 72 insertions(+), 17 deletions(-) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f23764fa..5b00ea2d 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -268,7 +268,7 @@ SPEC CHECKSUMS: SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e - wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 + wakelock: bfc7955c418d0db797614075aabbc58a39ab5107 PODFILE CHECKSUM: eb001256612a59f8f9e4d083ad8b9671e69dd184 diff --git a/example/lib/advanced_options_page.dart b/example/lib/advanced_options_page.dart index 8a4c79c0..59c59c26 100644 --- a/example/lib/advanced_options_page.dart +++ b/example/lib/advanced_options_page.dart @@ -17,10 +17,13 @@ class _AdvancedOptionsPageState extends State { final _formKey = GlobalKey(); final TextEditingController _apiKeyController = TextEditingController(); + String _apiKeyError; final TextEditingController _userIdController = TextEditingController(); + String _userIdError; final TextEditingController _userTokenController = TextEditingController(); + String _userTokenError; final TextEditingController _usernameController = TextEditingController(); @@ -65,17 +68,34 @@ class _AdvancedOptionsPageState extends State { children: [ TextFormField( controller: _apiKeyController, + onChanged: (_) { + if (_apiKeyError != null) { + setState(() { + _apiKeyError = null; + }); + } + }, validator: (value) { if (value.isEmpty) { - return 'Please enter the Chat API Key'; + setState(() { + _apiKeyError = 'Please enter the Chat API Key'; + }); + return _apiKeyError; } return null; }, + style: TextStyle( + fontSize: 14, + color: Colors.black, + ), decoration: InputDecoration( + errorStyle: TextStyle(fontSize: 0), labelStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.bold, - color: Colors.black.withOpacity(.5), + color: _apiKeyError != null + ? Color(0xffff3742) + : Colors.black.withOpacity(.5), ), border: UnderlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -83,7 +103,8 @@ class _AdvancedOptionsPageState extends State { ), fillColor: Color(0xffF5F5F5), filled: true, - labelText: 'Chat API Key', + labelText: + 'Chat API Key ${_apiKeyError != null ? ': $_apiKeyError' : ''}', ), textInputAction: TextInputAction.next, ), @@ -91,18 +112,35 @@ class _AdvancedOptionsPageState extends State { padding: const EdgeInsets.only(top: 8.0), child: TextFormField( controller: _userIdController, + onChanged: (_) { + if (_userIdError != null) { + setState(() { + _userIdError = null; + }); + } + }, validator: (value) { if (value.isEmpty) { - return 'Please enter the User ID'; + setState(() { + _userIdError = 'Please enter the User ID'; + }); + return _userIdError; } return null; }, + style: TextStyle( + fontSize: 14, + color: Colors.black, + ), textInputAction: TextInputAction.next, decoration: InputDecoration( + errorStyle: TextStyle(fontSize: 0), labelStyle: TextStyle( fontWeight: FontWeight.bold, fontSize: 14, - color: Colors.black.withOpacity(.5), + color: _userIdError != null + ? Color(0xffff3742) + : Colors.black.withOpacity(.5), ), border: UnderlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -110,26 +148,44 @@ class _AdvancedOptionsPageState extends State { ), fillColor: Color(0xffF5F5F5), filled: true, - labelText: 'User ID', + labelText: + 'User ID ${_userIdError != null ? ': $_userIdError' : ''}', ), ), ), Padding( padding: const EdgeInsets.only(top: 8.0), child: TextFormField( + onChanged: (_) { + if (_userTokenError != null) { + setState(() { + _userTokenError = null; + }); + } + }, controller: _userTokenController, validator: (value) { if (value.isEmpty) { - return 'Please enter the user token'; + setState(() { + _userTokenError = 'Please enter the user token'; + }); + return _userTokenError; } return null; }, + style: TextStyle( + fontSize: 14, + color: Colors.black, + ), textInputAction: TextInputAction.next, decoration: InputDecoration( + errorStyle: TextStyle(fontSize: 0), labelStyle: TextStyle( fontWeight: FontWeight.bold, fontSize: 14, - color: Colors.black.withOpacity(.5), + color: _userTokenError != null + ? Color(0xffff3742) + : Colors.black.withOpacity(.5), ), border: UnderlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -137,7 +193,8 @@ class _AdvancedOptionsPageState extends State { ), fillColor: Color(0xffF5F5F5), filled: true, - labelText: 'User Token', + labelText: + 'User Token ${_userTokenError != null ? ': $_userTokenError' : ''}', ), ), ), @@ -183,13 +240,13 @@ class _AdvancedOptionsPageState extends State { if (loading) { return; } - loading = true; if (_formKey.currentState.validate()) { final apiKey = _apiKeyController.text; final userId = _userIdController.text; final userToken = _userTokenController.text; final username = _usernameController.text; + loading = true; showDialog( barrierDismissible: false, context: context, @@ -232,11 +289,9 @@ class _AdvancedOptionsPageState extends State { errorText = e['message'] ?? errorText; } Navigator.pop(context); - Scaffold.of(context).showSnackBar( - SnackBar( - content: Text(errorText), - ), - ); + setState(() { + _apiKeyError = errorText; + }); loading = false; await client.disconnect(); return; diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f85127f0..d4da197e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.55+57 +version: 1.0.56+58 environment: sdk: ">=2.2.2 <3.0.0" From c113862005cf1f942edfae091d756d2ca504c938 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 13 Nov 2020 11:35:40 +0100 Subject: [PATCH 6/6] fix error label --- example/lib/advanced_options_page.dart | 7 +++---- example/pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/example/lib/advanced_options_page.dart b/example/lib/advanced_options_page.dart index 59c59c26..56c9dbf0 100644 --- a/example/lib/advanced_options_page.dart +++ b/example/lib/advanced_options_page.dart @@ -104,7 +104,7 @@ class _AdvancedOptionsPageState extends State { fillColor: Color(0xffF5F5F5), filled: true, labelText: - 'Chat API Key ${_apiKeyError != null ? ': $_apiKeyError' : ''}', + 'Chat API Key ${_apiKeyError != null ? ':$_apiKeyError' : ''}', ), textInputAction: TextInputAction.next, ), @@ -149,7 +149,7 @@ class _AdvancedOptionsPageState extends State { fillColor: Color(0xffF5F5F5), filled: true, labelText: - 'User ID ${_userIdError != null ? ': $_userIdError' : ''}', + 'User ID ${_userIdError != null ? ':$_userIdError' : ''}', ), ), ), @@ -194,7 +194,7 @@ class _AdvancedOptionsPageState extends State { fillColor: Color(0xffF5F5F5), filled: true, labelText: - 'User Token ${_userTokenError != null ? ': $_userTokenError' : ''}', + 'User Token ${_userTokenError != null ? ':$_userTokenError' : ''}', ), ), ), @@ -265,7 +265,6 @@ class _AdvancedOptionsPageState extends State { ), ); - print('CREATE CLIENT'); final client = Client( apiKey, logLevel: Level.INFO, diff --git a/example/pubspec.yaml b/example/pubspec.yaml index d4da197e..85fd549e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.56+58 +version: 1.0.57+59 environment: sdk: ">=2.2.2 <3.0.0"