mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-09 09:31:13 +00:00
refactor(ui): Update users list to allow showing avatars in the future
This commit is contained in:
parent
8b811caa75
commit
9fda021c67
|
@ -1,6 +1,5 @@
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/config/brand_theme.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/hive/user.dart';
|
import 'package:selfprivacy/logic/models/hive/user.dart';
|
||||||
import 'package:selfprivacy/ui/router/router.dart';
|
import 'package:selfprivacy/ui/router/router.dart';
|
||||||
|
|
||||||
|
@ -14,39 +13,26 @@ class UserListItem extends StatelessWidget {
|
||||||
final User user;
|
final User user;
|
||||||
final bool isPrimaryUser;
|
final bool isPrimaryUser;
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => InkWell(
|
Widget build(final BuildContext context) => ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.pushRoute(UserDetailsRoute(login: user.login));
|
context.pushRoute(UserDetailsRoute(login: user.login));
|
||||||
},
|
},
|
||||||
child: Container(
|
leading: CircleAvatar(
|
||||||
padding: paddingH16V0,
|
backgroundColor: user.color,
|
||||||
height: 48,
|
child: Text(
|
||||||
child: Row(
|
user.login[0].toUpperCase(),
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 17,
|
|
||||||
height: 17,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: user.color,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 20),
|
|
||||||
Flexible(
|
|
||||||
child: Text(
|
|
||||||
user.login,
|
|
||||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
decoration: isPrimaryUser
|
|
||||||
? TextDecoration.underline
|
|
||||||
: user.isFoundOnServer
|
|
||||||
? TextDecoration.none
|
|
||||||
: TextDecoration.lineThrough,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
title: Text(
|
||||||
|
user.login,
|
||||||
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
decoration: isPrimaryUser
|
||||||
|
? TextDecoration.underline
|
||||||
|
: user.isFoundOnServer
|
||||||
|
? TextDecoration.none
|
||||||
|
: TextDecoration.lineThrough,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,12 @@ class UserDetailsPage extends StatelessWidget {
|
||||||
hasBackButton: true,
|
hasBackButton: true,
|
||||||
hasFlashButton: true,
|
hasFlashButton: true,
|
||||||
heroTitle: user.login,
|
heroTitle: user.login,
|
||||||
|
heroIconWidget: CircleAvatar(
|
||||||
|
backgroundColor: user.color,
|
||||||
|
child: Text(
|
||||||
|
user.login[0].toUpperCase(),
|
||||||
|
),
|
||||||
|
),
|
||||||
children: [
|
children: [
|
||||||
_UserLogins(user: user, domainName: domainName),
|
_UserLogins(user: user, domainName: domainName),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|
|
@ -92,7 +92,10 @@ class UsersPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16.0,
|
||||||
|
vertical: 8.0,
|
||||||
|
),
|
||||||
child: FilledButton.tonal(
|
child: FilledButton.tonal(
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
@ -111,6 +114,7 @@ class UsersPage extends StatelessWidget {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: users.length,
|
itemCount: users.length,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(final BuildContext context, final int index) =>
|
(final BuildContext context, final int index) =>
|
||||||
UserListItem(
|
UserListItem(
|
||||||
|
|
Loading…
Reference in a new issue