TF-438 Apply new design for push notification

This commit is contained in:
dab246
2022-11-24 19:21:32 +07:00
committed by Dat H. Pham
parent 44bf37a246
commit f3f2c19f20
17 changed files with 86 additions and 70 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

+35 -22
View File
@@ -3,39 +3,26 @@ import 'package:core/presentation/extensions/color_extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
ThemeData appTheme() {
class ThemeUtils {
static ThemeData get appTheme {
return ThemeData(
scaffoldBackgroundColor: Colors.white,
fontFamily: ConstantsUI.fontApp,
appBarTheme: appBarTheme(),
textTheme: textTheme(),
appBarTheme: _appBarTheme,
textTheme: _textTheme,
visualDensity: VisualDensity.adaptivePlatformDensity,
);
}
}
InputDecorationTheme inputDecorationTheme() {
OutlineInputBorder outlineInputBorder = OutlineInputBorder(
borderRadius: BorderRadius.circular(28),
borderSide: const BorderSide(color: AppColor.baseTextColor),
gapPadding: 10,
);
return InputDecorationTheme(
floatingLabelBehavior: FloatingLabelBehavior.always,
contentPadding: const EdgeInsets.symmetric(horizontal: 42, vertical: 20),
enabledBorder: outlineInputBorder,
focusedBorder: outlineInputBorder,
border: outlineInputBorder,
);
}
TextTheme textTheme() {
static TextTheme get _textTheme {
return const TextTheme(
bodyText1: TextStyle(color: AppColor.baseTextColor),
bodyText2: TextStyle(color: AppColor.baseTextColor),
);
}
}
AppBarTheme appBarTheme() {
static AppBarTheme get _appBarTheme {
return const AppBarTheme(
color: Colors.white,
elevation: 0,
@@ -43,4 +30,30 @@ AppBarTheme appBarTheme() {
iconTheme: IconThemeData(color: Colors.black),
titleTextStyle: TextStyle(color: Color(0XFF8B8B8B), fontSize: 18),
);
}
static void setSystemLightUIStyle() {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black,
systemNavigationBarIconBrightness: Brightness.light,
statusBarColor: Colors.black,
statusBarIconBrightness: Brightness.light,
));
}
static void setSystemDarkUIStyle() {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.dark,
statusBarColor: Colors.white,
statusBarIconBrightness: Brightness.dark,
));
}
static void setStatusBarTransparentColor() {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.dark,
));
}
}
@@ -1,7 +1,6 @@
import 'package:core/core.dart';
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/utils/theme_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/home/presentation/home_controller.dart';
@@ -10,12 +9,7 @@ class HomeView extends GetWidget<HomeController> {
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.dark,
statusBarColor: Colors.white,
statusBarIconBrightness: Brightness.dark,
));
ThemeUtils.setSystemDarkUIStyle();
return Container(
color: AppColor.primaryLightColor,
@@ -1,7 +1,6 @@
import 'package:core/core.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:model/model.dart';
@@ -26,9 +25,7 @@ class MailboxView extends GetWidget<MailboxController> {
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
));
ThemeUtils.setStatusBarTransparentColor();
return SafeArea(bottom: false, left: false, right: false,
top: _responsiveUtils.isMobile(context),
@@ -1,4 +1,5 @@
import 'package:core/presentation/utils/responsive_utils.dart';
import 'package:core/presentation/utils/theme_utils.dart';
import 'package:core/presentation/views/responsive/responsive_widget.dart';
import 'package:flutter/material.dart';
import 'package:focus_detector/focus_detector.dart';
@@ -27,7 +28,13 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
);
return FocusDetector(
onFocusGained: controller.refreshActionWhenBackToApp,
onFocusGained: () {
ThemeUtils.setSystemDarkUIStyle();
if (controller.isDrawerOpen) {
ThemeUtils.setStatusBarTransparentColor();
}
controller.refreshActionWhenBackToApp();
},
child: Scaffold(
drawerEnableOpenDragGesture: responsiveUtils.hasLeftMenuDrawerActive(context),
body: Stack(children: [
@@ -44,7 +44,10 @@ class LocalNotificationConfig {
importance: Importance.max,
priority: Priority.high,
setAsGroupSummary: setAsGroup,
styleInformation: styleInformation
styleInformation: styleInformation,
channelShowBadge: true,
showWhen: true,
largeIcon: const DrawableResourceAndroidBitmap('@mipmap/ic_large_notification')
),
iOS: const DarwinNotificationDetails(
presentSound: true,
@@ -99,19 +99,18 @@ class LocalNotificationManager {
String? payload
}) async {
final inboxStyleInformation = InboxStyleInformation(
[title, message ?? ''],
contentTitle: (emailAddress?.asString() ?? '').addBlockTag('b'),
summaryText: (emailAddress?.asString() ?? '').addBlockTag('b'),
htmlFormatTitle: true,
htmlFormatContent: true,
[message?.addBlockTag('p', attribute: 'style="color:#6D7885;"') ?? ''],
htmlFormatLines: true,
contentTitle: title,
htmlFormatContentTitle: true,
summaryText: (emailAddress?.asString() ?? '').addBlockTag('b'),
htmlFormatSummaryText: true,
);
await _localNotificationsPlugin.show(
id.hashCode,
title.addBlockTag('b'),
message ?? '',
null,
null,
LocalNotificationConfig.instance.generateNotificationDetails(styleInformation: inboxStyleInformation),
payload: payload
);
@@ -123,11 +122,20 @@ class LocalNotificationManager {
?.getActiveNotifications();
if (activeNotifications != null && activeNotifications.isNotEmpty) {
final inboxStyleInformation = InboxStyleInformation(
[''],
summaryText: '${activeNotifications.length - 1} new emails'.addBlockTag('b'),
htmlFormatSummaryText: true,
);
await _localNotificationsPlugin.show(
1995,
'',
'',
LocalNotificationConfig.instance.generateNotificationDetails(setAsGroup: true)
null,
null,
LocalNotificationConfig.instance.generateNotificationDetails(
setAsGroup: true,
styleInformation: inboxStyleInformation
),
);
}
}
+2 -8
View File
@@ -1,6 +1,5 @@
import 'package:core/core.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/caching/config/hive_cache_config.dart';
@@ -16,12 +15,7 @@ import 'package:worker_manager/worker_manager.dart';
void main() async {
initLogger(() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black,
systemNavigationBarIconBrightness: Brightness.light,
statusBarColor: Colors.black,
statusBarIconBrightness: Brightness.light,
));
ThemeUtils.setSystemLightUIStyle();
await MainBindings().dependencies();
await HiveCacheConfig().setUp();
await HiveCacheConfig.initializeEncryptionKey();
@@ -38,7 +32,7 @@ class TMailApp extends StatelessWidget {
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
theme: appTheme(),
theme: ThemeUtils.appTheme,
supportedLocales: LocalizationService.supportedLocales,
localizationsDelegates: const [
AppLocalizationsDelegate(),