kirakira/lib/presentation/widgets/drawer/identity_header.dart

65 lines
1.8 KiB
Dart
Raw Normal View History

import "package:flutter/material.dart";
import "package:smol_mail/shared/utils/format.dart";
/// Identity summary in the drawer: the address is what gets shared, the
/// fingerprint is what gets verified.
class IdentityHeader extends StatelessWidget {
final String address;
final String fingerprint;
const IdentityHeader({
super.key,
required this.address,
required this.fingerprint,
});
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
CircleAvatar(
backgroundColor: Theme.of(context).primaryColor,
radius: 35,
child: Text(
address.isEmpty ? "?" : address[0].toUpperCase(),
style:
Theme.of(context).textTheme.bodyLarge!.copyWith(fontSize: 30),
),
),
const SizedBox(height: 20),
InkWell(
onTap: () => copyText(context, address),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
address.isEmpty ? "(not registered)" : address,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w900,
),
),
),
),
const SizedBox(height: 5),
InkWell(
onTap: () => copyText(context, fingerprint),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
"fp: $fingerprint",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant,
fontSize: 14,
fontWeight: FontWeight.w700,
),
),
),
),
],
);
}
}