Initial commit

This commit is contained in:
tuxsudo 2024-04-12 11:09:37 -04:00
parent 2333949a81
commit af9ef76260

View file

@ -18,7 +18,10 @@ import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart'; import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
class WalletSeedPage extends BasePage { class WalletSeedPage extends BasePage {
WalletSeedPage(this.walletSeedViewModel, {required this.isNewWalletCreated}); WalletSeedPage(this.walletSeedViewModel, {required this.isNewWalletCreated})
: seedController = TextEditingController(),
nameController = TextEditingController();
final imageLight = Image.asset('assets/images/crypto_lock_light.png'); final imageLight = Image.asset('assets/images/crypto_lock_light.png');
final imageDark = Image.asset('assets/images/crypto_lock.png'); final imageDark = Image.asset('assets/images/crypto_lock.png');
@ -29,8 +32,11 @@ class WalletSeedPage extends BasePage {
final bool isNewWalletCreated; final bool isNewWalletCreated;
final WalletSeedViewModel walletSeedViewModel; final WalletSeedViewModel walletSeedViewModel;
@override @override
void onClose(BuildContext context) async { void onClose(BuildContext context) async {
if (isNewWalletCreated) { if (isNewWalletCreated) {
final confirmed = await showPopUp<bool>( final confirmed = await showPopUp<bool>(
context: context, context: context,
@ -83,10 +89,27 @@ class WalletSeedPage extends BasePage {
: Offstage(); : Offstage();
} }
final TextEditingController nameController;
final TextEditingController seedController;
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight; final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
TextFormField(
autofillHints: [AutofillHints.newUsername],
//initialValue: walletSeedViewModel.name,
controller: nameController,
);
TextFormField(
autofillHints: [AutofillHints.password],
//initialValue: walletSeedViewModel.seed,
controller: seedController
//walletSeedViewModel.seed,
);
return WillPopScope( return WillPopScope(
onWillPop: () async => false, onWillPop: () async => false,
child: Container( child: Container(
@ -105,8 +128,10 @@ class WalletSeedPage extends BasePage {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Text( TextFormField(
walletSeedViewModel.name, //initialValue: walletSeedViewModel.name,
controller: nameController,
autofillHints: [AutofillHints.newUsername],
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -114,8 +139,10 @@ class WalletSeedPage extends BasePage {
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 20, left: 16, right: 16), padding: EdgeInsets.only(top: 20, left: 16, right: 16),
child: Text( child: TextFormField(
walletSeedViewModel.seed, //initialValue: walletSeedViewModel.seed,
controller: seedController,
autofillHints: [AutofillHints.password],
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
@ -171,6 +198,22 @@ class WalletSeedPage extends BasePage {
text: S.of(context).copy, text: S.of(context).copy,
color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor, color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor,
textColor: Colors.white)), textColor: Colors.white)),
)),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
onPressed: () async {
nameController.text = walletSeedViewModel.name;
seedController.text = walletSeedViewModel.seed;
TextInput.finishAutofillContext();
},
text: "Save2",
color: Colors.blue,
textColor: Colors.white)),
)) ))
], ],
) )