diff --git a/example/ios/Flutter/.last_build_id b/example/ios/Flutter/.last_build_id
index 171fde31..661f8167 100644
--- a/example/ios/Flutter/.last_build_id
+++ b/example/ios/Flutter/.last_build_id
@@ -1 +1 @@
-0289cdadbd29bab804f275e3c5907d07
\ No newline at end of file
+89eb023669fee58472de747080d78b5a
\ No newline at end of file
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index d22f1e0d..1e268608 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -80,6 +80,8 @@ PODS:
- Flutter (1.0.0)
- flutter_apns (0.0.1):
- Flutter
+ - flutter_app_badger (0.0.1):
+ - Flutter
- flutter_keyboard_visibility (0.0.1):
- Flutter
- flutter_local_notifications (0.0.1):
@@ -160,6 +162,7 @@ DEPENDENCIES:
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- flutter_apns (from `.symlinks/plugins/flutter_apns/ios`)
+ - flutter_app_badger (from `.symlinks/plugins/flutter_app_badger/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
@@ -207,6 +210,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_apns:
:path: ".symlinks/plugins/flutter_apns/ios"
+ flutter_app_badger:
+ :path: ".symlinks/plugins/flutter_app_badger/ios"
flutter_keyboard_visibility:
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
flutter_local_notifications:
@@ -244,6 +249,7 @@ SPEC CHECKSUMS:
FirebaseMessaging: 29543feb343b09546ab3aa04d008ee8595b43c44
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_apns: f516b118e423fe7c0a38771180549c4d6cb67c2f
+ flutter_app_badger: 65de4d6f0c34a891df49e6cfb8a1c0496426fa68
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index db80aaed..6d377561 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -322,6 +322,7 @@
"${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework",
"${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework",
"${BUILT_PRODUCTS_DIR}/flutter_apns/flutter_apns.framework",
+ "${BUILT_PRODUCTS_DIR}/flutter_app_badger/flutter_app_badger.framework",
"${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework",
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
@@ -350,6 +351,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_apns.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_badger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index ea713691..6c2c8e27 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -54,5 +54,9 @@
UIViewControllerBasedStatusBarAppearance
+ UIBackgroundModes
+
+ remote-notification
+
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 9a6554e6..fc96b07a 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -1,6 +1,6 @@
name: example
description: A new Flutter project.
-version: 1.0.31+33
+version: 1.0.33+35
environment:
sdk: ">=2.2.2 <3.0.0"
diff --git a/lib/src/message_actions_modal.dart b/lib/src/message_actions_modal.dart
index 7ee4311c..ce680d34 100644
--- a/lib/src/message_actions_modal.dart
+++ b/lib/src/message_actions_modal.dart
@@ -218,13 +218,16 @@ class MessageActionsModal extends StatelessWidget {
StreamIcons.edit,
size: 22,
color:
- StreamChatTheme.of(context).primaryIconTheme.color,
+ StreamChatTheme.of(context).primaryIconTheme.color,
),
onPressed: () {},
),
Text(
'Edit message',
- style: Theme.of(context).textTheme.headline6.copyWith(fontWeight: FontWeight.bold),
+ style: Theme.of(context)
+ .textTheme
+ .headline6
+ .copyWith(fontWeight: FontWeight.bold),
),
IconButton(
icon: Icon(
diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart
index 30910924..d03a61bc 100644
--- a/lib/src/message_input.dart
+++ b/lib/src/message_input.dart
@@ -192,7 +192,7 @@ class MessageInputState extends State {
padding: const EdgeInsets.all(8.0),
child: _buildTextField(context),
),
- if(widget.parentMessage != null)
+ if (widget.parentMessage != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: _buildDmCheckbox(),
@@ -222,7 +222,11 @@ class MessageInputState extends State {
Widget _buildDmCheckbox() {
return Row(
children: [
- Checkbox(value: _sendAsDm, onChanged: (val) => setState(() {_sendAsDm = val;})),
+ Checkbox(
+ value: _sendAsDm,
+ onChanged: (val) => setState(() {
+ _sendAsDm = val;
+ })),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text('Send also as direct message'),
@@ -316,9 +320,11 @@ class MessageInputState extends State {
var matchedCommandsList = StreamChannel.of(context)
.channel
.config
- .commands.where((element) => element.name == s.substring(1)).toList();
+ .commands
+ .where((element) => element.name == s.substring(1))
+ .toList();
- if(matchedCommandsList.length == 1) {
+ if (matchedCommandsList.length == 1) {
_chosenCommand = matchedCommandsList[0];
textEditingController.clear();
_messageIsPresent = false;
@@ -796,8 +802,8 @@ class MessageInputState extends State {
return Center(
child: InkWell(
child: Padding(
- padding: EdgeInsets.only(
- left: 8.0, right: padding, top: 8.0, bottom: 8.0),
+ padding:
+ EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0),
child: Icon(StreamIcons.attach),
),
onTap: () {
@@ -1053,7 +1059,9 @@ class MessageInputState extends State {
child: Transform.rotate(
angle: widget.editMessage == null ? -pi / 2 : 0,
child: Icon(
- widget.editMessage == null ? StreamIcons.send_message : StreamIcons.check_send,
+ widget.editMessage == null
+ ? StreamIcons.send_message
+ : StreamIcons.check_send,
color: StreamChatTheme.of(context).accentColor,
),
),
diff --git a/lib/src/stream_chat.dart b/lib/src/stream_chat.dart
index b22c257c..c3b971a7 100644
--- a/lib/src/stream_chat.dart
+++ b/lib/src/stream_chat.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_app_badger/flutter_app_badger.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
@@ -186,6 +187,13 @@ class StreamChatState extends State with WidgetsBindingObserver {
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
+ client.state.totalUnreadCountStream.listen((count) {
+ if (count > 0) {
+ FlutterAppBadger.updateBadgeCount(count);
+ } else {
+ FlutterAppBadger.removeBadge();
+ }
+ });
}
StreamSubscription _newMessageSubscription;
diff --git a/pubspec.yaml b/pubspec.yaml
index edd19589..7c92406d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -11,6 +11,7 @@ environment:
dependencies:
flutter:
sdk: flutter
+ flutter_app_badger: ^1.1.2
photo_view: ^0.10.1
rxdart: ^0.24.1
jiffy: ^3.0.1