note tile color and size fix

This commit is contained in:
Kima 2024-01-02 22:23:26 +01:00
parent ec5880290a
commit 4a6fabd47d
3 changed files with 31 additions and 21 deletions

View File

@ -1,6 +1,5 @@
import 'package:filcnaplo/models/settings.dart'; import 'package:filcnaplo/models/settings.dart';
import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo/utils/color.dart';
import 'package:filcnaplo/utils/format.dart'; import 'package:filcnaplo/utils/format.dart';
import 'package:filcnaplo_kreta_api/models/message.dart'; import 'package:filcnaplo_kreta_api/models/message.dart';
import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart'; import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart';
@ -34,19 +33,23 @@ class MessageTile extends StatelessWidget {
onTap: onTap, onTap: onTap,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
contentPadding: const EdgeInsets.only(left: 8.0, right: 4.0), contentPadding: const EdgeInsets.only(left: 8.0, right: 4.0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)), shape:
leading: !Provider.of<SettingsProvider>(context, listen: false).presentationMode RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
leading: !Provider.of<SettingsProvider>(context, listen: false)
.presentationMode
? ProfileImage( ? ProfileImage(
name: message.author, name: message.author,
radius: 22.0, radius: 19.2,
backgroundColor: ColorUtils.stringToColor(message.author), backgroundColor: Theme.of(context).colorScheme.secondary,
censored: censored, censored: censored,
isNotePfp: true,
) )
: ProfileImage( : ProfileImage(
name: "Béla", name: "Béla",
radius: 22.0, radius: 19.2,
backgroundColor: Theme.of(context).colorScheme.secondary, backgroundColor: Theme.of(context).colorScheme.secondary,
censored: censored, censored: censored,
isNotePfp: true,
), ),
title: censored title: censored
? Wrap( ? Wrap(
@ -65,13 +68,18 @@ class MessageTile extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
!Provider.of<SettingsProvider>(context, listen: false).presentationMode ? message.author : "Béla", !Provider.of<SettingsProvider>(context, listen: false)
.presentationMode
? message.author
: "Béla",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 15.5), style: const TextStyle(
fontWeight: FontWeight.w600, fontSize: 15.5),
), ),
), ),
if (message.attachments.isNotEmpty) const Icon(FeatherIcons.paperclip, size: 16.0) if (message.attachments.isNotEmpty)
const Icon(FeatherIcons.paperclip, size: 16.0)
], ],
), ),
subtitle: censored subtitle: censored
@ -91,7 +99,8 @@ class MessageTile extends StatelessWidget {
message.subject, message.subject,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14.0), style: const TextStyle(
fontWeight: FontWeight.w500, fontSize: 14.0),
), ),
trailing: censored trailing: censored
? Wrap( ? Wrap(

View File

@ -20,6 +20,7 @@ class ProfileImage extends StatefulWidget {
this.role = Role.student, this.role = Role.student,
this.censored = false, this.censored = false,
this.profilePictureString = "", this.profilePictureString = "",
this.isNotePfp = false,
}); });
final void Function()? onTap; final void Function()? onTap;
@ -33,6 +34,7 @@ class ProfileImage extends StatefulWidget {
final Role? role; final Role? role;
final bool censored; final bool censored;
final String profilePictureString; final String profilePictureString;
final bool isNotePfp;
@override @override
State<ProfileImage> createState() => _ProfileImageState(); State<ProfileImage> createState() => _ProfileImageState();
@ -86,8 +88,11 @@ class _ProfileImageState extends State<ProfileImage> {
Material( Material(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: const CircleBorder(), shape: const CircleBorder(),
color: widget.backgroundColor ?? color: widget.name != null && widget.name! == 'Rendszerüzenet'
AppColors.of(context).text.withOpacity(.15), ? widget.backgroundColor?.withOpacity(0.5) ??
AppColors.of(context).text.withOpacity(0.5)
: widget.backgroundColor ??
AppColors.of(context).text.withOpacity(.15),
child: InkWell( child: InkWell(
onTap: widget.onTap, onTap: widget.onTap,
onDoubleTap: widget.onDoubleTap, onDoubleTap: widget.onDoubleTap,
@ -119,7 +124,8 @@ class _ProfileImageState extends State<ProfileImage> {
style: TextStyle( style: TextStyle(
color: color, color: color,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 18.0 * (widget.radius / 20.0), fontSize: (widget.isNotePfp ? 20 : 18.0) *
(widget.radius / 20.0),
), ),
), ),
) )

View File

@ -1,4 +1,3 @@
import 'package:filcnaplo/utils/color.dart';
import 'package:filcnaplo_kreta_api/models/note.dart'; import 'package:filcnaplo_kreta_api/models/note.dart';
import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart'; import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -23,17 +22,13 @@ class NoteTile extends StatelessWidget {
shape: shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)), RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
leading: ProfileImage( leading: ProfileImage(
isNotePfp: true,
name: (note.teacher.isRenamed name: (note.teacher.isRenamed
? note.teacher.renamedTo ? note.teacher.renamedTo
: note.teacher.name) ?? : note.teacher.name) ??
'', '',
radius: 22.0, radius: 19.2,
backgroundColor: ColorUtils.stringToColor( backgroundColor: Theme.of(context).colorScheme.secondary,
(note.teacher.isRenamed
? note.teacher.renamedTo
: note.teacher.name) ??
'',
),
), ),
title: Text( title: Text(
note.title, note.title,