feat: add copy buttons to user id and email display fields

This commit is contained in:
Garrett Watson 2024-03-08 23:03:46 -05:00
parent 77d1ddf458
commit 7ecc3140c6
2 changed files with 45 additions and 18 deletions

View file

@ -1,10 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:recon/apis/user_api.dart'; import 'package:recon/apis/user_api.dart';
import 'package:recon/auxiliary.dart'; import 'package:recon/auxiliary.dart';
import 'package:recon/blend_mask.dart';
import 'package:recon/client_holder.dart'; import 'package:recon/client_holder.dart';
import 'package:recon/models/personal_profile.dart'; import 'package:recon/models/personal_profile.dart';
import 'package:recon/widgets/blend_mask.dart';
import 'package:recon/widgets/default_error_widget.dart'; import 'package:recon/widgets/default_error_widget.dart';
import 'package:recon/widgets/generic_avatar.dart'; import 'package:recon/widgets/generic_avatar.dart';
@ -106,31 +107,57 @@ class _MyProfileDialogState extends State<MyProfileDialog> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Column( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Column(
"User ID", mainAxisAlignment: MainAxisAlignment.center,
style: textTheme.titleSmall, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"User ID",
style: textTheme.titleSmall,
),
Text(profile.id,
style: textTheme.bodySmall?.copyWith(color: const Color(0xFFE1E1E0)))
],
), ),
Text(profile.id, IconButton(
style: textTheme.bodySmall?.copyWith(color: const Color(0xFFE1E1E0))) onPressed: () {
Clipboard.setData(ClipboardData(text: profile.id));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text("User ID copied to clipboard"),
behavior: SnackBarBehavior.floating));
},
icon: const Icon(Icons.copy_outlined))
], ],
), ),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
Column( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Column(
"Email", mainAxisAlignment: MainAxisAlignment.center,
style: textTheme.titleSmall, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Email",
style: textTheme.titleSmall,
),
Text(profile.email,
style: textTheme.bodySmall?.copyWith(color: const Color(0xFFE1E1E0)))
],
), ),
Text(profile.email, IconButton(
style: textTheme.bodySmall?.copyWith(color: const Color(0xFFE1E1E0))) onPressed: () {
Clipboard.setData(ClipboardData(text: profile.email));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text("Email copied to clipboard"),
behavior: SnackBarBehavior.floating));
},
icon: const Icon(Icons.copy_outlined))
], ],
), ),
const SizedBox( const SizedBox(
@ -257,7 +284,7 @@ class StorageIndicator extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
alignment: Alignment.center, alignment: Alignment.center,
child: BlendMask( child: BlendMask(
blendMode: BlendMode.colorDodge, blendMode: BlendMode.srcATop,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,