mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00: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:
parent
a89397651f
commit
3ed867aba3
4 changed files with 33 additions and 10 deletions
|
@ -20,6 +20,5 @@ Future<String> generateName() async {
|
|||
final chosenNoun = nouns[randomThing.nextInt(nouns.length)];
|
||||
final returnString =
|
||||
chosenAdjective.capitalized() + ' ' + chosenNoun.capitalized();
|
||||
|
||||
return returnString;
|
||||
}
|
||||
|
|
|
@ -116,9 +116,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
|||
decoration: InputDecoration(
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () async {
|
||||
final String rName = await generateName();
|
||||
|
||||
print(rName);
|
||||
final rName = await generateName();
|
||||
setState(() {
|
||||
_controller.text = 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/generated/i18n.dart';
|
||||
import 'package:cake_wallet/core/validator.dart';
|
||||
import 'package:cake_wallet/entities/generate_name.dart';
|
||||
|
||||
class WalletRestoreFromKeysFrom extends StatefulWidget {
|
||||
WalletRestoreFromKeysFrom({Key key, this.onHeightOrDateEntered})
|
||||
: super(key: key);
|
||||
|
||||
final Function (bool) onHeightOrDateEntered;
|
||||
final Function(bool) onHeightOrDateEntered;
|
||||
|
||||
@override
|
||||
WalletRestoreFromKeysFromState createState() =>
|
||||
|
@ -56,7 +57,34 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
|
|||
BaseTextFormField(
|
||||
controller: nameTextEditingController,
|
||||
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),
|
||||
BaseTextFormField(
|
||||
controller: addressController,
|
||||
|
|
|
@ -64,12 +64,10 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
|||
suffixIcon: Container(
|
||||
width: 12,
|
||||
height: 14,
|
||||
margin: const EdgeInsets.only( bottom: 15, left: 13),
|
||||
margin: const EdgeInsets.only(bottom: 15, left: 13),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final String rName = await generateName();
|
||||
|
||||
print(rName);
|
||||
final rName = await generateName();
|
||||
setState(() {
|
||||
nameTextEditingController.text = rName;
|
||||
nameTextEditingController.selection =
|
||||
|
|
Loading…
Reference in a new issue