Files
.github
.vscode
android
assets
buildtools
ios
lib
database
models
pods
screens
services
widgets
account
account_name.dart
account_picker.dart
account_picker.g.dart
account_session_sheet.dart
account_session_sheet.g.dart
badge.dart
leveling_progress.dart
status.dart
status.g.dart
status_creation.dart
chat
content
post
realms
tour
alert.dart
app_scaffold.dart
check_in.dart
check_in.g.dart
context_menu.dart
response.dart
firebase_options.dart
main.dart
route.dart
route.gr.dart
linux
macos
web
windows
.gitignore
.metadata
README.md
analysis_options.yaml
build.yaml
devtools_options.yaml
firebase.json
pubspec.lock
pubspec.yaml
App/lib/widgets/account/account_name.dart
2025-06-11 00:09:19 +08:00

64 lines
1.6 KiB
Dart

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:island/models/user.dart';
import 'package:material_symbols_icons/symbols.dart';
const kVerificationMarkColors = [
Colors.teal,
Colors.blue,
Colors.amber,
Colors.blueGrey,
Colors.lightBlue,
];
class AccountName extends StatelessWidget {
final SnAccount account;
final TextStyle? style;
const AccountName({super.key, required this.account, this.style});
@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
spacing: 4,
children: [
Flexible(child: Text(account.nick, style: style)),
if (account.profile.verification != null)
VerificationMark(mark: account.profile.verification!),
],
);
}
}
class VerificationMark extends StatelessWidget {
final SnVerificationMark mark;
const VerificationMark({super.key, required this.mark});
@override
Widget build(BuildContext context) {
return Tooltip(
richMessage: TextSpan(
text: mark.title ?? 'No title',
children: [
TextSpan(text: '\n'),
TextSpan(
text: mark.description ?? 'descriptionNone'.tr(),
style: TextStyle(fontWeight: FontWeight.normal),
),
],
style: TextStyle(fontWeight: FontWeight.bold),
),
child: Icon(
mark.type == 4
? Symbols.play_circle
: mark.type == 0
? Symbols.build_circle
: Symbols.verified,
size: 16,
color: kVerificationMarkColors[mark.type],
fill: 1,
),
);
}
}