some changes
This commit is contained in:
@@ -6,7 +6,6 @@ import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/data/services/model/notification_data/notification_data.dart';
|
||||
import 'package:tm_app/view_models/notification_view_model.dart';
|
||||
import 'package:tm_app/views/notification/strings/notification_strings.dart';
|
||||
|
||||
class NotificationCard extends StatelessWidget {
|
||||
final NotificationItem notification;
|
||||
@@ -20,72 +19,96 @@ class NotificationCard extends StatelessWidget {
|
||||
margin: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
notification.type == NotificationStrings.reject
|
||||
? AppColors.orange10
|
||||
: notification.type == NotificationStrings.info
|
||||
? AppColors.primary10Light
|
||||
: AppColors.green0,
|
||||
color: AppColors.primary10Light,
|
||||
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(
|
||||
color:
|
||||
notification.type! == NotificationStrings.reject
|
||||
? AppColors.warningColor
|
||||
: notification.type == NotificationStrings.info ? AppColors.primary20 : AppColors.green20,
|
||||
),
|
||||
border: Border.all(color: AppColors.primary20),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 3.0.h()),
|
||||
child: SvgPicture.asset(
|
||||
notification.type! == NotificationStrings.info
|
||||
? AssetsManager.notification
|
||||
: notification.type! == NotificationStrings.reject
|
||||
? AssetsManager.danger
|
||||
: AssetsManager.tickCircle,
|
||||
),
|
||||
child: SvgPicture.asset(AssetsManager.notification),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
notification.title!,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Text(
|
||||
notification.message!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset(AssetsManager.calendar),
|
||||
SizedBox(width: 4.0.w()),
|
||||
Text(
|
||||
viewModel.timeAgo(notification.createdAt!),
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
notification.title!,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Visibility(
|
||||
visible: notification.priority == 'important',
|
||||
child: Container(
|
||||
width: 86.0.w(),
|
||||
height: 24.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.blue0,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Important',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.cyanTeal,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: !notification.seen! ? 8.0.w() : 0),
|
||||
!notification.seen!
|
||||
? Container(
|
||||
width: 12.0.w(),
|
||||
height: 12.0.w(),
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Text(
|
||||
notification.message!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset(AssetsManager.calendar),
|
||||
SizedBox(width: 4.0.w()),
|
||||
Text(
|
||||
viewModel.timeAgo(notification.createdAt!),
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user