forked from firka/student-legacy
censor stuff
This commit is contained in:
parent
0f5bf5f66e
commit
c478380c04
@ -10,11 +10,12 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GradeTile extends StatelessWidget {
|
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 Grade grade;
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
final EdgeInsetsGeometry? padding;
|
final EdgeInsetsGeometry? padding;
|
||||||
|
final bool censored;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -76,30 +77,63 @@ class GradeTile extends StatelessWidget {
|
|||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: 44,
|
width: 44,
|
||||||
height: 44,
|
height: 44,
|
||||||
child: Center(
|
child: censored
|
||||||
child: Padding(
|
? Container(
|
||||||
padding: leadingPadding,
|
decoration: BoxDecoration(
|
||||||
child: Icon(
|
color: AppColors.of(context).text.withOpacity(.55),
|
||||||
SubjectIcon.resolveVariant(subject: grade.subject, context: context),
|
borderRadius: BorderRadius.circular(60.0),
|
||||||
size: 28.0,
|
),
|
||||||
color: AppColors.of(context).text.withOpacity(.75),
|
)
|
||||||
|
: 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,
|
: null,
|
||||||
trailing: isSubjectView
|
trailing: isSubjectView
|
||||||
? grade.type != GradeType.ghost
|
? grade.type != GradeType.ghost
|
||||||
@ -111,7 +145,16 @@ class GradeTile extends StatelessWidget {
|
|||||||
calculatorProvider.removeGrade(grade);
|
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,
|
minLeadingWidth: isSubjectView ? 32.0 : 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -15,12 +15,14 @@ class MessageTile extends StatelessWidget {
|
|||||||
this.messages,
|
this.messages,
|
||||||
this.padding,
|
this.padding,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
|
this.censored = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final Message message;
|
final Message message;
|
||||||
final List<Message>? messages;
|
final List<Message>? messages;
|
||||||
final EdgeInsetsGeometry? padding;
|
final EdgeInsetsGeometry? padding;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
|
final bool censored;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -38,39 +40,80 @@ class MessageTile extends StatelessWidget {
|
|||||||
name: message.author,
|
name: message.author,
|
||||||
radius: 22.0,
|
radius: 22.0,
|
||||||
backgroundColor: ColorUtils.stringToColor(message.author),
|
backgroundColor: ColorUtils.stringToColor(message.author),
|
||||||
|
censored: censored,
|
||||||
)
|
)
|
||||||
: ProfileImage(
|
: ProfileImage(
|
||||||
name: "Béla",
|
name: "Béla",
|
||||||
radius: 22.0,
|
radius: 22.0,
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||||
|
censored: censored,
|
||||||
),
|
),
|
||||||
title: Row(
|
title: censored
|
||||||
children: [
|
? Wrap(
|
||||||
Expanded(
|
children: [
|
||||||
child: Text(
|
Container(
|
||||||
!Provider.of<SettingsProvider>(context, listen: false).presentationMode ? message.author : "Béla",
|
width: 105,
|
||||||
maxLines: 2,
|
height: 15,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.of(context).text.withOpacity(.85),
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
!Provider.of<SettingsProvider>(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,
|
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user