Skip to content

Commit

Permalink
display tos-violation
Browse files Browse the repository at this point in the history
  • Loading branch information
HaonRekcef committed Feb 8, 2024
1 parent 6735fb1 commit 52db464
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/src/model/user/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class User with _$User {
String? flair,
bool? isPatron,
bool? disabled,
bool? tosViolation,
DateTime? createdAt,
DateTime? seenAt,
required IMap<Perf, UserPerf> perfs,
Expand Down Expand Up @@ -99,6 +100,7 @@ class User with _$User {
flair: pick('flair').asStringOrNull(),
isPatron: pick('patron').asBoolOrNull(),
disabled: pick('disabled').asBoolOrNull(),
tosViolation: pick('tosViolation').asBoolOrNull(),
createdAt: pick('createdAt').asDateTimeFromMillisecondsOrNull(),
seenAt: pick('seenAt').asDateTimeFromMillisecondsOrNull(),
playTime: pick('playTime').letOrNull(PlayTime.fromPick),
Expand Down
20 changes: 20 additions & 0 deletions lib/src/view/user/user_profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:lichess_mobile/src/constants.dart';
import 'package:lichess_mobile/src/model/common/id.dart';
import 'package:lichess_mobile/src/model/user/profile.dart';
import 'package:lichess_mobile/src/model/user/user.dart';
import 'package:lichess_mobile/src/styles/lichess_colors.dart';
import 'package:lichess_mobile/src/styles/styles.dart';
import 'package:lichess_mobile/src/utils/duration.dart';
import 'package:lichess_mobile/src/utils/l10n_context.dart';
Expand Down Expand Up @@ -48,6 +49,25 @@ class UserProfile extends ConsumerWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (user.tosViolation == true)
Padding(
padding: const EdgeInsets.only(bottom: 5),
child: Row(
children: [
const Icon(Icons.error, color: LichessColors.error),
const SizedBox(
width: 5,
),
Text(
context.l10n.thisAccountViolatedTos,
style: const TextStyle(
color: LichessColors.error,
fontWeight: FontWeight.bold,
),
),
],
),
),
if (userFullName != null)
Padding(
padding: const EdgeInsets.only(bottom: 5),
Expand Down

0 comments on commit 52db464

Please sign in to comment.