mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-03 12:24:19 +01:00
Added a generate-name button for restore-from-key page and removed empty lines, types for final variables, and print statements
This commit is contained in:
@@ -20,6 +20,5 @@ Future<String> generateName() async {
|
|||||||
final chosenNoun = nouns[randomThing.nextInt(nouns.length)];
|
final chosenNoun = nouns[randomThing.nextInt(nouns.length)];
|
||||||
final returnString =
|
final returnString =
|
||||||
chosenAdjective.capitalized() + ' ' + chosenNoun.capitalized();
|
chosenAdjective.capitalized() + ' ' + chosenNoun.capitalized();
|
||||||
|
|
||||||
return returnString;
|
return returnString;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,9 +116,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final String rName = await generateName();
|
final rName = await generateName();
|
||||||
|
|
||||||
print(rName);
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_controller.text = rName;
|
_controller.text = rName;
|
||||||
_walletNewVM.name = rName;
|
_walletNewVM.name = rName;
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
|||||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/core/validator.dart';
|
import 'package:cake_wallet/core/validator.dart';
|
||||||
|
import 'package:cake_wallet/entities/generate_name.dart';
|
||||||
|
|
||||||
class WalletRestoreFromKeysFrom extends StatefulWidget {
|
class WalletRestoreFromKeysFrom extends StatefulWidget {
|
||||||
WalletRestoreFromKeysFrom({Key key, this.onHeightOrDateEntered})
|
WalletRestoreFromKeysFrom({Key key, this.onHeightOrDateEntered})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
final Function (bool) onHeightOrDateEntered;
|
final Function(bool) onHeightOrDateEntered;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
WalletRestoreFromKeysFromState createState() =>
|
WalletRestoreFromKeysFromState createState() =>
|
||||||
@@ -56,7 +57,34 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
|
|||||||
BaseTextFormField(
|
BaseTextFormField(
|
||||||
controller: nameTextEditingController,
|
controller: nameTextEditingController,
|
||||||
hintText: S.of(context).wallet_name,
|
hintText: S.of(context).wallet_name,
|
||||||
validator: WalletNameValidator()),
|
validator: WalletNameValidator(),
|
||||||
|
suffixIcon: Container(
|
||||||
|
width: 12,
|
||||||
|
height: 14,
|
||||||
|
margin: const EdgeInsets.only(bottom: 15, left: 13),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
final rName = await generateName();
|
||||||
|
setState(() {
|
||||||
|
nameTextEditingController.text = rName;
|
||||||
|
nameTextEditingController.selection =
|
||||||
|
TextSelection.fromPosition(TextPosition(
|
||||||
|
offset: nameTextEditingController.text.length));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).hintColor,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(6))),
|
||||||
|
child: Image.asset('assets/images/refresh_icon.png',
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.decorationColor)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Container(height: 20),
|
Container(height: 20),
|
||||||
BaseTextFormField(
|
BaseTextFormField(
|
||||||
controller: addressController,
|
controller: addressController,
|
||||||
|
|||||||
@@ -64,12 +64,10 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
|||||||
suffixIcon: Container(
|
suffixIcon: Container(
|
||||||
width: 12,
|
width: 12,
|
||||||
height: 14,
|
height: 14,
|
||||||
margin: const EdgeInsets.only( bottom: 15, left: 13),
|
margin: const EdgeInsets.only(bottom: 15, left: 13),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final String rName = await generateName();
|
final rName = await generateName();
|
||||||
|
|
||||||
print(rName);
|
|
||||||
setState(() {
|
setState(() {
|
||||||
nameTextEditingController.text = rName;
|
nameTextEditingController.text = rName;
|
||||||
nameTextEditingController.selection =
|
nameTextEditingController.selection =
|
||||||
|
|||||||
Reference in New Issue
Block a user