dev
dart 50 lines 1.58 KB
Raw
1 import 'package:flutter/material.dart';
2
3 class TextInfoBox extends StatelessWidget {
4 const TextInfoBox({Key? key, required this.title, required this.value, this.onCopy})
5 : super(key: key);
6
7 final String title;
8 final String value;
9 final void Function(BuildContext context)? onCopy;
10
11 @override
12 Widget build(BuildContext context) {
13 return Container(
14 padding: const EdgeInsets.all(12),
15 decoration: BoxDecoration(
16 borderRadius: BorderRadius.circular(18),
17 color: Theme.of(context).colorScheme.surfaceContainer,
18 ),
19 child: Column(
20 crossAxisAlignment: CrossAxisAlignment.start,
21 children: [
22 Row(
23 mainAxisAlignment: MainAxisAlignment.spaceBetween,
24 children: [
25 Text(
26 title,
27 style: Theme.of(context).textTheme.bodyMedium!.copyWith(
28 fontWeight: FontWeight.w500,
29 color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
30 ),
31 ),
32 GestureDetector(
33 onTap: onCopy != null ? () => onCopy!(context) : null,
34 child: Icon(Icons.copy, size: 13, color: Theme.of(context).colorScheme.onSurface),
35 ),
36 ],
37 ),
38 const SizedBox(height: 4),
39 Text(
40 value,
41 style: Theme.of(context).textTheme.bodyMedium!.copyWith(
42 fontWeight: FontWeight.w500,
43 color: Theme.of(context).colorScheme.onSurface,
44 ),
45 ),
46 ],
47 ),
48 );
49 }
50 }