diff --git a/mobile-next/openim_common/lib/src/widgets/unread_count_view.dart b/mobile-next/openim_common/lib/src/widgets/unread_count_view.dart index 43ce09b..337cfc2 100644 --- a/mobile-next/openim_common/lib/src/widgets/unread_count_view.dart +++ b/mobile-next/openim_common/lib/src/widgets/unread_count_view.dart @@ -1,12 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:openim_common/openim_common.dart'; class UnreadCountView extends StatelessWidget { const UnreadCountView({ Key? key, this.count = 0, - this.size = 13, + this.size = 18, this.margin, }) : super(key: key); final int count; @@ -20,43 +19,25 @@ class UnreadCountView extends StatelessWidget { child: Container( alignment: Alignment.center, margin: margin, - padding: count > 99 ? EdgeInsets.symmetric(horizontal: 4.w) : null, - constraints: BoxConstraints(maxHeight: size, minWidth: size), - decoration: _decoration, - child: _text, + padding: count > 99 ? const EdgeInsets.symmetric(horizontal: 4) : null, + constraints: BoxConstraints( + minWidth: size, + minHeight: size, + maxHeight: size, + ), + decoration: BoxDecoration( + color: Styles.c_FF381F, + borderRadius: BorderRadius.circular(9), + ), + child: Text( + '${count > 99 ? '99+' : count}', + style: const TextStyle( + fontSize: 12, + color: Color(0xFFFFFFFF), + ), + textAlign: TextAlign.center, + ), ), ); } - - Text get _text => Text( - '${count > 99 ? '99+' : count}', - style: TextStyle( - fontSize: 8.sp, - color: const Color(0xFFFFFFFF), - ), - textAlign: TextAlign.center, - ); - - Decoration get _decoration => BoxDecoration( - color: Styles.c_FF381F, - shape: count > 99 ? BoxShape.rectangle : BoxShape.circle, - borderRadius: count > 99 ? BorderRadius.circular(10.r) : null, - boxShadow: [ - BoxShadow( - color: const Color(0x26C61B4A), - offset: Offset(1.15.w, 1.15.h), - blurRadius: 57.58.r, - ), - BoxShadow( - color: const Color(0x1AC61B4A), - offset: Offset(2.3.w, 2.3.h), - blurRadius: 11.52.r, - ), - BoxShadow( - color: const Color(0x0DC61B4A), - offset: Offset(4.61.w, 4.61.h), - blurRadius: 17.28.r, - ), - ], - ); }