diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml new file mode 100644 index 00000000..e698349c --- /dev/null +++ b/.github/workflows/pana.yml @@ -0,0 +1,102 @@ +name: pana + +env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + +on: + pull_request: + branches: + - master + paths-ignore: + - 'docs/**' + push: + branches: + - master + paths-ignore: + - 'docs/**' + +jobs: + stream_chat: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: axel-op/dart-package-analyzer@v3 + id: analysis + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + relativePath: packages/stream_chat + - name: Check scores + env: + # NB: "analysis" is the id set above. Replace it with the one you used if different. + TOTAL: ${{ steps.analysis.outputs.total }} + TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} + run: | + PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX )) + if (( $PERCENTAGE < 100 )) + then + echo Score too low! + exit 1 + fi + stream_chat_persistence: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: axel-op/dart-package-analyzer@v3 + id: analysis + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + relativePath: packages/stream_chat_persistence + - name: Check scores + env: + # NB: "analysis" is the id set above. Replace it with the one you used if different. + TOTAL: ${{ steps.analysis.outputs.total }} + TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} + run: | + PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX )) + if (( $PERCENTAGE < 90 )) + then + echo Score too low! + exit 1 + fi + stream_chat_flutter_core: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: axel-op/dart-package-analyzer@v3 + id: analysis + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + relativePath: packages/stream_chat_flutter_core + - name: Check scores + env: + # NB: "analysis" is the id set above. Replace it with the one you used if different. + TOTAL: ${{ steps.analysis.outputs.total }} + TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} + run: | + PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX )) + if (( $PERCENTAGE < 100 )) + then + echo Score too low! + exit 1 + fi + stream_chat_flutter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: axel-op/dart-package-analyzer@v3 + id: analysis + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + relativePath: packages/stream_chat_flutter + - name: Check scores + env: + # NB: "analysis" is the id set above. Replace it with the one you used if different. + TOTAL: ${{ steps.analysis.outputs.total }} + TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} + run: | + PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX )) + if (( $PERCENTAGE < 90 )) + then + echo Score too low! + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 9e898eda..ce6d2c63 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 15 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: 'Install Flutter' @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: 'Install Flutter' @@ -73,7 +73,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: 'Install Flutter' @@ -89,7 +89,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 0 - name: 'Install Flutter' diff --git a/packages/stream_chat/lib/version.dart b/packages/stream_chat/lib/version.dart index 2c9c2639..27294084 100644 --- a/packages/stream_chat/lib/version.dart +++ b/packages/stream_chat/lib/version.dart @@ -2,4 +2,4 @@ import 'package:stream_chat/src/client.dart'; /// Current package version /// Used in [StreamChatClient] to build the `x-stream-client` header -const PACKAGE_VERSION = '1.3.2-beta'; +const PACKAGE_VERSION = '1.3.2+1-beta'; diff --git a/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart index ed5a5750..8247661c 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/giphy_attachment.dart @@ -202,24 +202,26 @@ class GiphyAttachment extends AttachmentWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( - child: FlatButton( + child: Container( height: 50, - onPressed: () { - streamChannel.channel.sendAction(message, { - 'image_action': 'cancel', - }); - }, - child: Text( - 'Cancel', - style: StreamChatTheme.of(context) - .textTheme - .bodyBold - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - ), + child: TextButton( + onPressed: () { + streamChannel.channel.sendAction(message, { + 'image_action': 'cancel', + }); + }, + child: Text( + 'Cancel', + style: StreamChatTheme.of(context) + .textTheme + .bodyBold + .copyWith( + color: StreamChatTheme.of(context) + .colorTheme + .black + .withOpacity(0.5), + ), + ), ), ), ), @@ -232,20 +234,22 @@ class GiphyAttachment extends AttachmentWidget { height: 50.0, ), Expanded( - child: FlatButton( + child: Container( height: 50, - onPressed: () { - streamChannel.channel.sendAction(message, { - 'image_action': 'send', - }); - }, - child: Text( - 'Send', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .accentBlue, - fontWeight: FontWeight.bold), + child: TextButton( + onPressed: () { + streamChannel.channel.sendAction(message, { + 'image_action': 'send', + }); + }, + child: Text( + 'Send', + style: TextStyle( + color: StreamChatTheme.of(context) + .colorTheme + .accentBlue, + fontWeight: FontWeight.bold), + ), ), ), ), diff --git a/packages/stream_chat_flutter/lib/src/channel_list_view.dart b/packages/stream_chat_flutter/lib/src/channel_list_view.dart index 3bab76b2..1fb9885a 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_view.dart @@ -284,7 +284,7 @@ class _ChannelListViewState extends State { left: 0, bottom: 32, child: Center( - child: FlatButton( + child: TextButton( onPressed: widget.onStartChatPressed, child: Text( 'Start a chat', @@ -445,7 +445,7 @@ class _ChannelListViewState extends State { ), style: Theme.of(context).textTheme.headline6, ), - FlatButton( + TextButton( onPressed: () => _channelListController.loadData(), child: Text('Retry'), ), diff --git a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart index d914afba..1546e66b 100644 --- a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart @@ -348,7 +348,7 @@ class _MessageActionsModalState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - FlatButton( + TextButton( child: Text( 'OK', style: StreamChatTheme.of(context) @@ -413,7 +413,7 @@ class _MessageActionsModalState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - FlatButton( + TextButton( child: Text( 'OK', style: StreamChatTheme.of(context) diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index ec6b9574..21424c2e 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -2139,7 +2139,7 @@ class MessageInputState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - FlatButton( + TextButton( child: Text( 'OK', style: StreamChatTheme.of(context) diff --git a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart index da1144b8..165ed47b 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart @@ -195,7 +195,7 @@ class _MessageSearchListViewState extends State { padding: const EdgeInsets.only(top: 16.0), child: Text(message), ), - RaisedButton( + ElevatedButton( onPressed: () { _messageSearchListController.loadData(); }, diff --git a/packages/stream_chat_flutter/lib/src/user_list_view.dart b/packages/stream_chat_flutter/lib/src/user_list_view.dart index 4b50559b..77537e59 100644 --- a/packages/stream_chat_flutter/lib/src/user_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/user_list_view.dart @@ -242,7 +242,7 @@ class _UserListViewState extends State ), child: Text(message), ), - FlatButton( + TextButton( onPressed: () { _userListController.loadData(); }, diff --git a/packages/stream_chat_flutter/lib/src/utils.dart b/packages/stream_chat_flutter/lib/src/utils.dart index 424f1880..7a88ee6c 100644 --- a/packages/stream_chat_flutter/lib/src/utils.dart +++ b/packages/stream_chat_flutter/lib/src/utils.dart @@ -59,7 +59,7 @@ Future showConfirmationDialog( Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - FlatButton( + TextButton( child: Text( cancelText, style: StreamChatTheme.of(context) @@ -75,7 +75,7 @@ Future showConfirmationDialog( Navigator.of(context).pop(false); }, ), - FlatButton( + TextButton( child: Text( okText, style: StreamChatTheme.of(context) @@ -145,7 +145,7 @@ Future showInfoDialog( Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - FlatButton( + TextButton( child: Text( okText, style: TextStyle( diff --git a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart index 7d4af560..3f27cfd5 100644 --- a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart @@ -94,7 +94,7 @@ class ChannelQueryDao extends DatabaseAccessor ?.where((s) => possibleSortingFields.contains(s.field)) ?.toList(growable: false); - Comparator chainedComparator = (a, b) { + var chainedComparator = (ChannelModel a, ChannelModel b) { final dateA = a.lastMessageAt ?? a.createdAt; final dateB = b.lastMessageAt ?? b.createdAt; return dateB.compareTo(dateA); diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index bd32d8f3..6923e927 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -9,6 +9,8 @@ environment: sdk: ">=2.7.0 <3.0.0" dependencies: + flutter: + sdk: flutter moor: ^3.4.0 path: ^1.7.0 path_provider: ^1.6.27