11import 'package:bb_mobile/core/ark/ark.dart' ;
22import 'package:bb_mobile/core/themes/app_theme.dart' ;
3+ import 'package:bb_mobile/core/utils/build_context_x.dart' ;
34import 'package:bb_mobile/core/widgets/navbar/top_bar.dart' ;
45import 'package:bb_mobile/core/widgets/text/text.dart' ;
56import 'package:bb_mobile/features/ark/presentation/cubit.dart' ;
@@ -20,64 +21,64 @@ class ArkAboutPage extends StatelessWidget {
2021
2122 return Scaffold (
2223 appBar: AppBar (
23- flexibleSpace: TopBar (title: 'About' , onBack: () => context.pop ()),
24+ flexibleSpace: TopBar (title: context.loc.arkAboutTitle , onBack: () => context.pop ()),
2425 ),
2526 body: SafeArea (
2627 child: ListView (
2728 padding: const EdgeInsets .symmetric (horizontal: 20 , vertical: 24 ),
2829 children: [
29- const _CopyField (label: 'Server URL' , value: Ark .server),
30+ _CopyField (label: context.loc.arkAboutServerUrl , value: Ark .server),
3031 const SizedBox (height: 18 ),
31- _SecretKeyField (label: 'Secret Key' , value: wallet.secretHex),
32+ _SecretKeyField (label: context.loc.arkAboutSecretKey , value: wallet.secretHex),
3233 const SizedBox (height: 18 ),
33- _CopyField (label: 'Server pubkey' , value: serverInfo.signerPubkey),
34+ _CopyField (label: context.loc.arkAboutServerPubkey , value: serverInfo.signerPubkey),
3435 const SizedBox (height: 18 ),
3536 _CopyField (
36- label: 'Forfeit address' ,
37+ label: context.loc.arkAboutForfeitAddress ,
3738 value: serverInfo.forfeitAddress,
3839 ),
3940 const SizedBox (height: 18 ),
40- const _InfoField (label: 'Network' , value: Ark .network),
41+ _InfoField (label: context.loc.arkAboutNetwork , value: Ark .network),
4142 const SizedBox (height: 18 ),
42- _InfoField (label: 'Dust' , value: '${ serverInfo .dust } SATS' ),
43+ _InfoField (label: context.loc.arkAboutDust , value: context.loc. arkAboutDustValue ( serverInfo.dust) ),
4344 const SizedBox (height: 18 ),
4445 _InfoField (
45- label: 'Session duration' ,
46- value: _formatDuration (serverInfo.sessionDuration),
46+ label: context.loc.arkAboutSessionDuration ,
47+ value: _formatDuration (context, serverInfo.sessionDuration),
4748 ),
4849 const SizedBox (height: 18 ),
4950 _InfoField (
50- label: 'Boarding exit delay' ,
51- value: _formatDuration (serverInfo.boardingExitDelay),
51+ label: context.loc.arkAboutBoardingExitDelay ,
52+ value: _formatDuration (context, serverInfo.boardingExitDelay),
5253 ),
5354 const SizedBox (height: 18 ),
5455 _InfoField (
55- label: 'Unilateral exit delay' ,
56- value: _formatDuration (serverInfo.unilateralExitDelay),
56+ label: context.loc.arkAboutUnilateralExitDelay ,
57+ value: _formatDuration (context, serverInfo.unilateralExitDelay),
5758 ),
5859 const SizedBox (height: 18 ),
59- const _CopyField (label: 'Esplora URL' , value: Ark .esplora),
60+ _CopyField (label: context.loc.arkAboutEsploraUrl , value: Ark .esplora),
6061 ],
6162 ),
6263 ),
6364 );
6465 }
6566
66- static String _formatDuration (dynamic seconds) {
67+ static String _formatDuration (BuildContext context, dynamic seconds) {
6768 if (seconds == null ) return 'N/A' ;
6869 final int secs = seconds is int ? seconds : (seconds as BigInt ).toInt ();
6970
7071 if (secs < 60 ) {
71- return '$ secs seconds' ;
72+ return context.loc. arkAboutDurationSeconds ( secs) ;
7273 } else if (secs < 3600 ) {
7374 final minutes = (secs / 60 ).round ();
74- return '$ minutes ${ minutes == 1 ? 'minute' : ' minutes' }' ;
75+ return minutes == 1 ? context.loc. arkAboutDurationMinute (minutes) : context.loc. arkAboutDurationMinutes ( minutes) ;
7576 } else if (secs < 86400 ) {
7677 final hours = (secs / 3600 ).round ();
77- return '$ hours ${ hours == 1 ? 'hour' : ' hours' }' ;
78+ return hours == 1 ? context.loc. arkAboutDurationHour (hours) : context.loc. arkAboutDurationHours ( hours) ;
7879 } else {
7980 final days = (secs / 86400 ).round ();
80- return '$ days ${ days == 1 ? 'day' : ' days' }' ;
81+ return days == 1 ? context.loc. arkAboutDurationDay (days) : context.loc. arkAboutDurationDays ( days) ;
8182 }
8283 }
8384}
@@ -110,18 +111,24 @@ class _InfoField extends StatelessWidget {
110111 }
111112}
112113
113- class _CopyField extends StatelessWidget {
114+ class _CopyField extends StatefulWidget {
114115 final String label;
115116 final String value;
116117 const _CopyField ({required this .label, required this .value});
117118
119+ @override
120+ State <_CopyField > createState () => _CopyFieldState ();
121+ }
122+
123+ class _CopyFieldState extends State <_CopyField > {
124+
118125 @override
119126 Widget build (BuildContext context) {
120127 return Column (
121128 crossAxisAlignment: CrossAxisAlignment .start,
122129 children: [
123130 BBText (
124- label,
131+ widget. label,
125132 style: context.font.bodyLarge? .copyWith (
126133 color: context.colour.surfaceContainer,
127134 ),
@@ -132,18 +139,18 @@ class _CopyField extends StatelessWidget {
132139 runSpacing: 4 ,
133140 children: [
134141 BBText (
135- value,
142+ widget. value,
136143 style: context.font.bodyMedium? .copyWith (
137144 color: context.colour.outline,
138145 ),
139146 ),
140147
141148 InkWell (
142149 onTap: () {
143- Clipboard .setData (ClipboardData (text: value));
150+ Clipboard .setData (ClipboardData (text: widget. value));
144151 ScaffoldMessenger .of (context).showSnackBar (
145152 SnackBar (
146- content: Text ('$ label copied to clipboard' ),
153+ content: Text (context.loc. arkAboutCopiedMessage (widget. label) ),
147154 duration: const Duration (seconds: 2 ),
148155 ),
149156 );
@@ -152,7 +159,7 @@ class _CopyField extends StatelessWidget {
152159 mainAxisSize: MainAxisSize .min,
153160 children: [
154161 BBText (
155- 'Copy' ,
162+ context.loc.arkAboutCopy ,
156163 style: context.font.bodyMedium? .copyWith (
157164 color: context.colour.primary,
158165 fontSize: 14 ,
@@ -215,7 +222,7 @@ class _SecretKeyFieldState extends State<_SecretKeyField> {
215222 mainAxisSize: MainAxisSize .min,
216223 children: [
217224 BBText (
218- _isVisible ? 'Hide' : 'Show' ,
225+ _isVisible ? context.loc.arkAboutHide : context.loc.arkAboutShow ,
219226 style: context.font.bodyMedium? .copyWith (
220227 color: context.colour.primary,
221228 fontSize: 14 ,
@@ -235,7 +242,7 @@ class _SecretKeyFieldState extends State<_SecretKeyField> {
235242 Clipboard .setData (ClipboardData (text: widget.value));
236243 ScaffoldMessenger .of (context).showSnackBar (
237244 SnackBar (
238- content: Text ('${ widget .label } copied to clipboard' ),
245+ content: Text (context.loc. arkAboutCopiedMessage ( widget.label) ),
239246 duration: const Duration (seconds: 2 ),
240247 ),
241248 );
@@ -244,7 +251,7 @@ class _SecretKeyFieldState extends State<_SecretKeyField> {
244251 mainAxisSize: MainAxisSize .min,
245252 children: [
246253 BBText (
247- 'Copy' ,
254+ context.loc.arkAboutCopy ,
248255 style: context.font.bodyMedium? .copyWith (
249256 color: context.colour.primary,
250257 fontSize: 14 ,
0 commit comments