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';
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 imageDark = Image.asset('assets/images/crypto_lock.png');
@ -29,8 +32,11 @@ class WalletSeedPage extends BasePage {
final bool isNewWalletCreated;
final WalletSeedViewModel walletSeedViewModel;
@override
void onClose(BuildContext context) async {
if (isNewWalletCreated) {
final confirmed = await showPopUp<bool>(
context: context,
@ -83,10 +89,27 @@ class WalletSeedPage extends BasePage {
: Offstage();
}
final TextEditingController nameController;
final TextEditingController seedController;
@override
Widget body(BuildContext context) {
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(
onWillPop: () async => false,
child: Container(
@ -105,8 +128,10 @@ class WalletSeedPage extends BasePage {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
walletSeedViewModel.name,
TextFormField(
//initialValue: walletSeedViewModel.name,
controller: nameController,
autofillHints: [AutofillHints.newUsername],
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
@ -114,8 +139,10 @@ class WalletSeedPage extends BasePage {
),
Padding(
padding: EdgeInsets.only(top: 20, left: 16, right: 16),
child: Text(
walletSeedViewModel.seed,
child: TextFormField(
//initialValue: walletSeedViewModel.seed,
controller: seedController,
autofillHints: [AutofillHints.password],
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
@ -171,6 +198,22 @@ class WalletSeedPage extends BasePage {
text: S.of(context).copy,
color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor,
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)),
))
],
)