feat: rework account management page, add tooltip to settings

This commit is contained in:
Anton Stubenbord
2023-04-21 18:56:36 +02:00
parent 95dd0a2405
commit 1b9e4fbb81
14 changed files with 246 additions and 196 deletions

View File

@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
import 'package:paperless_mobile/features/login/model/user_account.dart';
class UserAvatar extends StatelessWidget {
final String userId;
final UserAccount account;
const UserAvatar({
super.key,
required this.userId,
required this.account,
});
@override
Widget build(BuildContext context) {
final backgroundColor = Colors.primaries[userId.hashCode % Colors.primaries.length];
final foregroundColor = backgroundColor.computeLuminance() > 0.5 ? Colors.black : Colors.white;
return CircleAvatar(
child: Text((account.fullName ?? account.username)
.split(" ")
.take(2)
.map((e) => e.substring(0, 1))
.map((e) => e.toUpperCase())
.join("")),
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
);
}
}