This commit is contained in:
M
2020-10-20 15:09:49 +03:00
parent 6b86cfbea2
commit aa120c33b1
9 changed files with 125 additions and 69 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class AnnotatedEditableText extends EditableText {
color: Colors.black,
backgroundColor: Colors.transparent,
fontWeight: FontWeight.normal,
fontSize: 20)))
fontSize: 16)))
.toList(),
super(
maxLines: null,
+14 -14
View File
@@ -6,10 +6,11 @@ import 'package:cake_wallet/monero/get_height_by_date.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
class BlockchainHeightWidget extends StatefulWidget {
BlockchainHeightWidget({GlobalKey key, this.onHeightChange})
BlockchainHeightWidget({GlobalKey key, this.onHeightChange, this.focusNode})
: super(key: key);
final Function(int) onHeightChange;
final FocusNode focusNode;
@override
State<StatefulWidget> createState() => BlockchainHeightState();
@@ -47,14 +48,14 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0, bottom: 10.0),
child: BaseTextFormField(
controller: restoreHeightController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: false),
hintText: S.of(context).widgets_restore_from_blockheight,
)
))
padding: EdgeInsets.only(top: 20.0, bottom: 10.0),
child: BaseTextFormField(
focusNode: widget.focusNode,
controller: restoreHeightController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: false),
hintText: S.of(context).widgets_restore_from_blockheight,
)))
],
),
Padding(
@@ -74,11 +75,10 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
child: InkWell(
onTap: () => _selectDate(context),
child: IgnorePointer(
child: BaseTextFormField(
controller: dateController,
hintText: S.of(context).widgets_restore_from_date,
)
),
child: BaseTextFormField(
controller: dateController,
hintText: S.of(context).widgets_restore_from_date,
)),
),
))
],
+46 -21
View File
@@ -12,22 +12,36 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter/widgets.dart';
class SeedWidget extends StatefulWidget {
SeedWidget({Key key}) : super(key: key);
SeedWidget({Key key, this.language}) : super(key: key);
final String language;
@override
SeedWidgetState createState() => SeedWidgetState();
SeedWidgetState createState() => SeedWidgetState(language);
}
class SeedWidgetState extends State<SeedWidget> {
SeedWidgetState()
SeedWidgetState(String language)
: controller = TextEditingController(),
focusNode = FocusNode(),
words =
SeedValidator.getWordList(type: WalletType.monero, language: 'en');
words = SeedValidator.getWordList(
type: WalletType.monero, language: language) {
focusNode.addListener(() {
setState(() {
if (!focusNode.hasFocus && controller.text.isEmpty) {
_showPlaceholder = true;
}
if (focusNode.hasFocus) {
_showPlaceholder = false;
}
});
});
}
final TextEditingController controller;
final FocusNode focusNode;
final List<String> words;
List<String> words;
bool _showPlaceholder;
String get text => controller.text;
@@ -38,12 +52,11 @@ class SeedWidgetState extends State<SeedWidget> {
_showPlaceholder = true;
}
Future<void> _pasteAddress() async {
final value = await Clipboard.getData('text/plain');
if (value?.text?.isNotEmpty ?? false) {
controller.text = value.text;
}
void changeSeedLanguage(String language) {
setState(() {
words = SeedValidator.getWordList(
type: WalletType.monero, language: language);
});
}
@override
@@ -84,15 +97,16 @@ class SeedWidgetState extends State<SeedWidget> {
child: InkWell(
onTap: () async => _pasteAddress(),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).hintColor,
borderRadius: BorderRadius.all(Radius.circular(6))),
// child: Image.asset('assets/images/duplicate.png',
// color: Theme.of(context)
// .primaryTextTheme
// .display1
// .decorationColor)
),
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Theme.of(context).hintColor,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset('assets/images/paste_ios.png',
color: Theme.of(context)
.primaryTextTheme
.display1
.decorationColor)),
)))
]),
Container(
@@ -101,4 +115,15 @@ class SeedWidgetState extends State<SeedWidget> {
color: Theme.of(context).primaryTextTheme.title.backgroundColor),
]));
}
Future<void> _pasteAddress() async {
final value = await Clipboard.getData('text/plain');
if (value?.text?.isNotEmpty ?? false) {
setState(() {
_showPlaceholder = false;
controller.text = value.text;
});
}
}
}