-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new JWK Thumbprint P-256 key in the DID Manage Decebtralize…
…d ID menu #2619
- Loading branch information
Showing
5 changed files
with
157 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export 'view/did/did_private_key_page.dart'; | ||
export 'view/did/manage_did_page.dart'; | ||
export 'view/did_polygon_id/manage_did_polygon_id_page.dart'; | ||
export 'view/jwk_thumbprint_p256_key/jwk_thumbprint_p256_key_page.dart'; | ||
export 'widgets/widgets.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
...oard/drawer/ssi/manage_did/view/jwk_thumbprint_p256_key/jwk_thumbprint_p256_key_page.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import 'package:altme/app/app.dart'; | ||
import 'package:altme/dashboard/dashboard.dart'; | ||
import 'package:altme/l10n/l10n.dart'; | ||
import 'package:altme/theme/theme.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
class JWKThumbprintP256KeyPage extends StatefulWidget { | ||
const JWKThumbprintP256KeyPage({ | ||
super.key, | ||
}); | ||
|
||
static Route<dynamic> route() { | ||
return MaterialPageRoute<void>( | ||
builder: (_) => const JWKThumbprintP256KeyPage(), | ||
settings: const RouteSettings(name: '/JWKThumbprintP256KeyPage'), | ||
); | ||
} | ||
|
||
@override | ||
State<JWKThumbprintP256KeyPage> createState() => | ||
_JWKThumbprintP256KeyPageState(); | ||
} | ||
|
||
class _JWKThumbprintP256KeyPageState extends State<JWKThumbprintP256KeyPage> | ||
with SingleTickerProviderStateMixin { | ||
late Animation<double> animation; | ||
late AnimationController animationController; | ||
|
||
Future<String> getKey() async { | ||
final privateKey = await getP256KeyToGetAndPresentVC( | ||
context.read<ProfileCubit>().secureStorageProvider, | ||
); | ||
return privateKey; | ||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
animationController = AnimationController( | ||
vsync: this, | ||
duration: const Duration(seconds: 20), | ||
); | ||
|
||
final Tween<double> rotationTween = Tween(begin: 20, end: 0); | ||
|
||
animation = rotationTween.animate(animationController) | ||
..addStatusListener((status) { | ||
if (status == AnimationStatus.completed) { | ||
Navigator.pop(context); | ||
} | ||
}); | ||
animationController.forward(); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
animationController.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
return BasePage( | ||
scrollView: false, | ||
title: l10n.jwkThumbprintP256Key, | ||
titleAlignment: Alignment.topCenter, | ||
titleLeading: const BackLeadingButton(), | ||
secureScreen: true, | ||
body: BackgroundCard( | ||
width: double.infinity, | ||
height: double.infinity, | ||
child: Column( | ||
mainAxisSize: MainAxisSize.max, | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: [ | ||
Text( | ||
l10n.jwkThumbprintP256Key, | ||
style: Theme.of(context).textTheme.title, | ||
), | ||
const SizedBox( | ||
height: Sizes.spaceNormal, | ||
), | ||
FutureBuilder<String>( | ||
future: getKey(), | ||
builder: (context, snapshot) { | ||
switch (snapshot.connectionState) { | ||
case ConnectionState.done: | ||
return Column( | ||
children: [ | ||
Text( | ||
snapshot.data!, | ||
textAlign: TextAlign.center, | ||
style: Theme.of(context).textTheme.titleMedium, | ||
), | ||
const SizedBox(height: Sizes.spaceXLarge), | ||
CopyButton( | ||
onTap: () async { | ||
await Clipboard.setData( | ||
ClipboardData(text: snapshot.data!), | ||
); | ||
AlertMessage.showStateMessage( | ||
context: context, | ||
stateMessage: StateMessage.success( | ||
stringMessage: l10n.copiedToClipboard, | ||
), | ||
); | ||
}, | ||
), | ||
], | ||
); | ||
case ConnectionState.waiting: | ||
case ConnectionState.none: | ||
case ConnectionState.active: | ||
return const Text(''); | ||
} | ||
}, | ||
), | ||
Expanded( | ||
child: Center( | ||
child: AnimatedBuilder( | ||
animation: animation, | ||
builder: (BuildContext context, Widget? child) { | ||
return Text( | ||
timeFormatter(timeInSecond: animation.value.toInt()), | ||
textAlign: TextAlign.center, | ||
style: Theme.of(context).textTheme.displayMedium, | ||
); | ||
}, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters