diff --git a/filcnaplo/lib/ui/widgets/grade/grade_tile.dart b/filcnaplo/lib/ui/widgets/grade/grade_tile.dart index 75dd971..392a4ce 100644 --- a/filcnaplo/lib/ui/widgets/grade/grade_tile.dart +++ b/filcnaplo/lib/ui/widgets/grade/grade_tile.dart @@ -10,11 +10,12 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:provider/provider.dart'; class GradeTile extends StatelessWidget { - const GradeTile(this.grade, {Key? key, this.onTap, this.padding}) : super(key: key); + const GradeTile(this.grade, {Key? key, this.onTap, this.padding, this.censored = false}) : super(key: key); final Grade grade; final void Function()? onTap; final EdgeInsetsGeometry? padding; + final bool censored; @override Widget build(BuildContext context) { @@ -76,30 +77,63 @@ class GradeTile extends StatelessWidget { : SizedBox( width: 44, height: 44, - child: Center( - child: Padding( - padding: leadingPadding, - child: Icon( - SubjectIcon.resolveVariant(subject: grade.subject, context: context), - size: 28.0, - color: AppColors.of(context).text.withOpacity(.75), + child: censored + ? Container( + decoration: BoxDecoration( + color: AppColors.of(context).text.withOpacity(.55), + borderRadius: BorderRadius.circular(60.0), + ), + ) + : Center( + child: Padding( + padding: leadingPadding, + child: Icon( + SubjectIcon.resolveVariant(subject: grade.subject, context: context), + size: 28.0, + color: AppColors.of(context).text.withOpacity(.75), + ), + ), + ), + ), + title: censored + ? Wrap( + children: [ + Container( + width: 110, + height: 15, + decoration: BoxDecoration( + color: AppColors.of(context).text.withOpacity(.85), + borderRadius: BorderRadius.circular(8.0), ), ), - ), - ), - title: Text( - title, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontWeight: FontWeight.w600), - ), - subtitle: subtitle != "" - ? Text( - subtitle, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontWeight: FontWeight.w500), + ], ) + : Text( + title, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontWeight: FontWeight.w600), + ), + subtitle: subtitle != "" + ? censored + ? Wrap( + children: [ + Container( + width: 50, + height: 10, + decoration: BoxDecoration( + color: AppColors.of(context).text.withOpacity(.45), + borderRadius: BorderRadius.circular(8.0), + ), + ), + ], + ) + : Text( + subtitle, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontWeight: FontWeight.w500), + ) : null, trailing: isSubjectView ? grade.type != GradeType.ghost @@ -111,7 +145,16 @@ class GradeTile extends StatelessWidget { calculatorProvider.removeGrade(grade); }, ) - : GradeValueWidget(grade.value), + : censored + ? Container( + width: 15, + height: 15, + decoration: BoxDecoration( + color: AppColors.of(context).text.withOpacity(.45), + borderRadius: BorderRadius.circular(8.0), + ), + ) + : GradeValueWidget(grade.value), minLeadingWidth: isSubjectView ? 32.0 : 0, ), ), diff --git a/filcnaplo/lib/ui/widgets/message/message_tile.dart b/filcnaplo/lib/ui/widgets/message/message_tile.dart index 18ed315..5101825 100644 --- a/filcnaplo/lib/ui/widgets/message/message_tile.dart +++ b/filcnaplo/lib/ui/widgets/message/message_tile.dart @@ -15,12 +15,14 @@ class MessageTile extends StatelessWidget { this.messages, this.padding, this.onTap, + this.censored = false, }) : super(key: key); final Message message; final List? messages; final EdgeInsetsGeometry? padding; final Function()? onTap; + final bool censored; @override Widget build(BuildContext context) { @@ -38,39 +40,80 @@ class MessageTile extends StatelessWidget { name: message.author, radius: 22.0, backgroundColor: ColorUtils.stringToColor(message.author), + censored: censored, ) : ProfileImage( name: "Béla", radius: 22.0, backgroundColor: Theme.of(context).colorScheme.secondary, + censored: censored, ), - title: Row( - children: [ - Expanded( - child: Text( - !Provider.of(context, listen: false).presentationMode ? message.author : "Béla", - maxLines: 2, + title: censored + ? Wrap( + children: [ + Container( + width: 105, + height: 15, + decoration: BoxDecoration( + color: AppColors.of(context).text.withOpacity(.85), + borderRadius: BorderRadius.circular(8.0), + ), + ), + ], + ) + : Row( + children: [ + Expanded( + child: Text( + !Provider.of(context, listen: false).presentationMode ? message.author : "Béla", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 15.5), + ), + ), + if (message.attachments.isNotEmpty) const Icon(FeatherIcons.paperclip, size: 16.0) + ], + ), + subtitle: censored + ? Wrap( + children: [ + Container( + width: 150, + height: 10, + decoration: BoxDecoration( + color: AppColors.of(context).text.withOpacity(.45), + borderRadius: BorderRadius.circular(8.0), + ), + ), + ], + ) + : Text( + message.subject, + maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 15.5), + style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14.0), + ), + trailing: censored + ? Wrap( + children: [ + Container( + width: 35, + height: 15, + decoration: BoxDecoration( + color: AppColors.of(context).text.withOpacity(.45), + borderRadius: BorderRadius.circular(8.0), + ), + ), + ], + ) + : Text( + message.date.format(context), + style: TextStyle( + fontWeight: FontWeight.w500, + fontSize: 14.0, + color: AppColors.of(context).text.withOpacity(.75), + ), ), - ), - if (message.attachments.isNotEmpty) const Icon(FeatherIcons.paperclip, size: 16.0) - ], - ), - subtitle: Text( - message.subject, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14.0), - ), - trailing: Text( - message.date.format(context), - style: TextStyle( - fontWeight: FontWeight.w500, - fontSize: 14.0, - color: AppColors.of(context).text.withOpacity(.75), - ), - ), ), ), );