From 18aeb0eba3414ca3e100612bf9462a454683c79b Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 18 May 2020 10:55:27 +0200 Subject: [PATCH] version bump --- CHANGELOG.md | 6 ++ analysis_options.yaml | 122 ++++++++++++++++----------------- lib/src/channel_list_view.dart | 2 +- lib/src/date_divider.dart | 3 +- lib/src/full_screen_video.dart | 6 +- lib/src/giphy_attachment.dart | 4 +- lib/src/image_attachment.dart | 3 +- lib/src/message_input.dart | 2 +- lib/src/message_widget.dart | 14 ++-- lib/src/utils.dart | 5 ++ lib/src/video_attachment.dart | 4 +- pubspec.yaml | 4 +- 12 files changed, 94 insertions(+), 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34d41786..40bbaa39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.2.1-alpha+3 + +- Update llc dependency + +- Fix hero tag generation for attachment + ## 0.2.1-alpha+2 - Fixed reactions bubble going below other messages diff --git a/analysis_options.yaml b/analysis_options.yaml index fa8ecab2..7feb4342 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,61 +1,61 @@ -#include: package:pedantic/analysis_options.yaml -# -#analyzer: -# exclude: -# - lib/**/*.g.dart -# - example/* -# -#linter: -# rules: -# # these rules are documented on and in the same order as -# # the Dart Lint rules page to make maintenance easier -# # https://github.com/dart-lang/linter/blob/master/example/all.yaml -# # - always_declare_return_types -# # - always_specify_types -# # - annotate_overrides -# # - avoid_as -# - avoid_empty_else -# - avoid_init_to_null -# - avoid_return_types_on_setters -# - avoid_web_libraries_in_flutter -# - await_only_futures -# - camel_case_types -# - cancel_subscriptions -# - close_sinks -# # - comment_references # we do not presume as to what people want to reference in their dartdocs -# # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 -# - control_flow_in_finally -# - empty_constructor_bodies -# - empty_statements -# - hash_and_equals -# - implementation_imports -# # - invariant_booleans -# # - iterable_contains_unrelated_type -# - library_names -# # - library_prefixes -# # - list_remove_unrelated_type -# # - literal_only_boolean_expressions -# - non_constant_identifier_names -# # - one_member_abstracts -# # - only_throw_errors -# # - overridden_fields -## - package_api_docs -# - package_names -# - package_prefixed_library_names -# - prefer_is_not_empty -# # - prefer_mixin # https://github.com/dart-lang/language/issues/32 -# - public_member_api_docs -# - slash_for_doc_comments -# # - sort_constructors_first -# # - sort_unnamed_constructors_first -# # - super_goes_last # no longer needed w/ Dart 2 -# - test_types_in_equals -# - throw_in_finally -# # - type_annotate_public_apis # subset of always_specify_types -# - type_init_formals -# # - unawaited_futures -# - unnecessary_brace_in_string_interps -# - unnecessary_getters_setters -# - unnecessary_statements -# - unrelated_type_equality_checks -# - valid_regexps +include: package:pedantic/analysis_options.yaml + +analyzer: + exclude: + - lib/**/*.g.dart + - example/* + +linter: + rules: + # these rules are documented on and in the same order as + # the Dart Lint rules page to make maintenance easier + # https://github.com/dart-lang/linter/blob/master/example/all.yaml + # - always_declare_return_types + # - always_specify_types + # - annotate_overrides + # - avoid_as + - avoid_empty_else + - avoid_init_to_null + - avoid_return_types_on_setters + - avoid_web_libraries_in_flutter + - await_only_futures + - camel_case_types + - cancel_subscriptions + - close_sinks + # - comment_references # we do not presume as to what people want to reference in their dartdocs + # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 + - control_flow_in_finally + - empty_constructor_bodies + - empty_statements + - hash_and_equals + - implementation_imports + # - invariant_booleans + # - iterable_contains_unrelated_type + - library_names + # - library_prefixes + # - list_remove_unrelated_type + # - literal_only_boolean_expressions + - non_constant_identifier_names + # - one_member_abstracts + # - only_throw_errors + # - overridden_fields +# - package_api_docs + - package_names + - package_prefixed_library_names + - prefer_is_not_empty + # - prefer_mixin # https://github.com/dart-lang/language/issues/32 + - public_member_api_docs + - slash_for_doc_comments + # - sort_constructors_first + # - sort_unnamed_constructors_first + # - super_goes_last # no longer needed w/ Dart 2 + - test_types_in_equals + - throw_in_finally + # - type_annotate_public_apis # subset of always_specify_types + - type_init_formals + # - unawaited_futures + - unnecessary_brace_in_string_interps + - unnecessary_getters_setters + - unnecessary_statements + - unrelated_type_equality_checks + - valid_regexps diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index 7b6a78a0..d94bf3c8 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -165,7 +165,7 @@ class _ChannelListViewState extends State TextSpan(text: 'Error loading channels'), ], ), - style: Theme.of(context).textTheme.title, + style: Theme.of(context).textTheme.headline6, ), Padding( padding: const EdgeInsets.only( diff --git a/lib/src/date_divider.dart b/lib/src/date_divider.dart index fdf73049..102c6e14 100644 --- a/lib/src/date_divider.dart +++ b/lib/src/date_divider.dart @@ -67,7 +67,8 @@ class DateDivider extends StatelessWidget { ), style: TextStyle( fontSize: 10, - color: Theme.of(context).textTheme.title.color.withOpacity(.5), + color: + Theme.of(context).textTheme.headline6.color.withOpacity(.5), ), ), ), diff --git a/lib/src/full_screen_video.dart b/lib/src/full_screen_video.dart index c30bcfd1..46325b07 100644 --- a/lib/src/full_screen_video.dart +++ b/lib/src/full_screen_video.dart @@ -21,7 +21,7 @@ class _FullScreenVideoState extends State { ChewieController _chewieController; VideoPlayerController _videoPlayerController; bool initialized = false; - GlobalKey _scaffoldKey = GlobalKey(); + final GlobalKey _scaffoldKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -71,8 +71,8 @@ class _FullScreenVideoState extends State { @override void dispose() { - _videoPlayerController.dispose(); - _chewieController.dispose(); + _videoPlayerController?.dispose(); + _chewieController?.dispose(); super.dispose(); } } diff --git a/lib/src/giphy_attachment.dart b/lib/src/giphy_attachment.dart index e097efab..d5e6bb78 100644 --- a/lib/src/giphy_attachment.dart +++ b/lib/src/giphy_attachment.dart @@ -6,6 +6,7 @@ import '../stream_chat_flutter.dart'; import 'attachment_error.dart'; import 'attachment_title.dart'; import 'full_screen_image.dart'; +import 'utils.dart'; class GiphyAttachment extends StatelessWidget { final Attachment attachment; @@ -48,8 +49,7 @@ class GiphyAttachment extends StatelessWidget { })); }, child: Hero( - tag: - '${message.id} - ${attachment.imageUrl ?? attachment.assetUrl ?? attachment.thumbUrl}', + tag: getAttachmentHeroTag(message, attachment), child: CachedNetworkImage( height: size?.height, width: size?.width, diff --git a/lib/src/image_attachment.dart b/lib/src/image_attachment.dart index 6a983ee9..f8ac69af 100644 --- a/lib/src/image_attachment.dart +++ b/lib/src/image_attachment.dart @@ -38,8 +38,7 @@ class ImageAttachment extends StatelessWidget { children: [ Expanded( child: Hero( - tag: - '${message.id} - ${attachment.imageUrl ?? attachment.assetUrl ?? attachment.thumbUrl}', + tag: getAttachmentHeroTag(message, attachment), child: GestureDetector( onTap: () { Navigator.push(context, MaterialPageRoute(builder: (_) { diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 09c890a7..e00cad54 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -275,7 +275,7 @@ class MessageInputState extends State { _typingStarted = true; }); }, - style: Theme.of(context).textTheme.body1, + style: Theme.of(context).textTheme.bodyText2, autofocus: false, decoration: InputDecoration( hintText: 'Write a message', diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 29812f97..942bec1c 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -339,9 +339,8 @@ class _MessageWidgetState extends State { if (_reactionPickerKey.currentContext != null && widget.message.reactionCounts != null && widget.message.reactionCounts.values - .where((element) => element > 0) - .length > - 0) { + .where((element) => element > 0) + .isNotEmpty) { setState(() { _reactionPadding = _reactionPickerKey.currentContext.size.height; }); @@ -624,7 +623,7 @@ class _MessageWidgetState extends State { EdgeInsetsGeometry padding, }) { Widget failedWidget; - if (widget.message.status == MessageSendingStatus.FAILED) + if (widget.message.status == MessageSendingStatus.FAILED) { failedWidget = Text( 'MESSAGE FAILED · CLICK TO TRY AGAIN', style: widget.messageTheme.messageText.copyWith( @@ -634,7 +633,8 @@ class _MessageWidgetState extends State { fontSize: 11, ), ); - if (widget.message.status == MessageSendingStatus.FAILED_UPDATE) + } + if (widget.message.status == MessageSendingStatus.FAILED_UPDATE) { failedWidget = Text( 'MESSAGE UPDATE FAILED · CLICK TO TRY AGAIN', style: widget.messageTheme.messageText.copyWith( @@ -644,7 +644,8 @@ class _MessageWidgetState extends State { fontSize: 11, ), ); - if (widget.message.status == MessageSendingStatus.FAILED_DELETE) + } + if (widget.message.status == MessageSendingStatus.FAILED_DELETE) { failedWidget = Text( 'MESSAGE DELETE FAILED · CLICK TO TRY AGAIN', style: widget.messageTheme.messageText.copyWith( @@ -654,6 +655,7 @@ class _MessageWidgetState extends State { fontSize: 11, ), ); + } if (failedWidget != null) { return Padding( diff --git a/lib/src/utils.dart b/lib/src/utils.dart index c427099b..0b9af1e3 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:url_launcher/url_launcher.dart'; Future launchURL(BuildContext context, String url) async { @@ -12,3 +13,7 @@ Future launchURL(BuildContext context, String url) async { ); } } + +String getAttachmentHeroTag(Message message, Attachment attachment) { + return '${message.id}-${attachment.imageUrl ?? attachment.assetUrl ?? attachment.thumbUrl ?? attachment.ogScrapeUrl}'; +} diff --git a/lib/src/video_attachment.dart b/lib/src/video_attachment.dart index 4f8cb712..a903147b 100644 --- a/lib/src/video_attachment.dart +++ b/lib/src/video_attachment.dart @@ -148,8 +148,8 @@ class _VideoAttachmentState extends State { @override void dispose() { - _videoPlayerController.dispose(); - _chewieController.dispose(); + _videoPlayerController?.dispose(); + _chewieController?.dispose(); super.dispose(); } } diff --git a/pubspec.yaml b/pubspec.yaml index 570a7159..45b87120 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: 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. -version: 0.2.1-alpha+2 +version: 0.2.1-alpha+3 environment: sdk: ">=2.3.0 <3.0.0" @@ -21,7 +21,7 @@ dependencies: file_picker: ^1.9.0+1 image_picker: ^0.6.6+1 flutter_keyboard_visibility: ^2.0.0 - stream_chat: ^0.2.0-alpha+11 + stream_chat: ^0.2.0-alpha+15 mime: ^0.9.6+3 visibility_detector: ^0.1.5 http_parser: ^3.1.4