mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
Merged 4.1.0
This commit is contained in:
@@ -2,8 +2,8 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/entities/contact_record.dart';
|
||||
import 'package:cake_wallet/entities/qr_scanner.dart';
|
||||
import 'package:cake_wallet/entities/contact_base.dart';
|
||||
|
||||
enum AddressTextFieldOption { paste, qrCode, addressBook }
|
||||
|
||||
@@ -42,7 +42,7 @@ class AddressTextField extends StatelessWidget {
|
||||
final Color iconColor;
|
||||
final TextStyle textStyle;
|
||||
final TextStyle hintStyle;
|
||||
FocusNode focusNode;
|
||||
final FocusNode focusNode;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -204,7 +204,7 @@ class AddressTextField extends StatelessWidget {
|
||||
onURIScanned(uri);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error $e');
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ class AddressTextField extends StatelessWidget {
|
||||
final contact = await Navigator.of(context, rootNavigator: true)
|
||||
.pushNamed(Routes.pickerAddressBook);
|
||||
|
||||
if (contact is ContactRecord && contact.address != null) {
|
||||
if (contact is ContactBase && contact.address != null) {
|
||||
controller.text = contact.address;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class AlertWithOneAction extends BaseAlertDialog {
|
||||
width: 300,
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 12, right: 12),
|
||||
color: Theme.of(context).accentTextTheme.body2.color,
|
||||
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
@@ -44,7 +44,8 @@ class AlertWithOneAction extends BaseAlertDialog {
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).primaryTextTheme.body1
|
||||
.backgroundColor,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
|
||||
@@ -7,6 +7,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
String get contentText => '';
|
||||
String get leftActionButtonText => '';
|
||||
String get rightActionButtonText => '';
|
||||
bool get isDividerExists => false;
|
||||
VoidCallback get actionLeft => () {};
|
||||
VoidCallback get actionRight => () {};
|
||||
bool get barrierDismissible => true;
|
||||
@@ -61,18 +62,24 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
fontSize: 15,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).primaryTextTheme.body2
|
||||
.backgroundColor,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
),
|
||||
)
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 52,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 6, right: 6),
|
||||
color: Theme.of(context).accentTextTheme.body2.color,
|
||||
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
@@ -86,7 +93,8 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
fontSize: 15,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).primaryTextTheme.body1
|
||||
.backgroundColor,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
@@ -120,18 +128,31 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(24, 20, 24, 0),
|
||||
child: title(context),
|
||||
),
|
||||
isDividerExists
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: 16, bottom: 8),
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 32),
|
||||
child: content(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 32, 24, 32),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
title(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: content(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
actionButtons(context)
|
||||
],
|
||||
|
||||
@@ -51,7 +51,7 @@ class BaseTextFormField extends StatelessWidget {
|
||||
final FocusNode focusNode;
|
||||
final bool readOnly;
|
||||
final bool enableInteractiveSelection;
|
||||
String initialValue;
|
||||
final String initialValue;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -15,7 +15,6 @@ class Picker<Item extends Object> extends StatefulWidget {
|
||||
this.description,
|
||||
@required this.onItemSelected,
|
||||
this.mainAxisAlignment = MainAxisAlignment.start,
|
||||
this.isAlwaysShowScrollThumb = false
|
||||
});
|
||||
|
||||
final int selectedAtIndex;
|
||||
@@ -25,7 +24,6 @@ class Picker<Item extends Object> extends StatefulWidget {
|
||||
final String description;
|
||||
final Function(Item) onItemSelected;
|
||||
final MainAxisAlignment mainAxisAlignment;
|
||||
final bool isAlwaysShowScrollThumb;
|
||||
|
||||
@override
|
||||
PickerState createState() => PickerState<Item>(items, images, onItemSelected);
|
||||
@@ -56,6 +54,8 @@ class PickerState<Item> extends State<Picker> {
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
final isShowScrollThumb = items != null ? items.length > 3 : false;
|
||||
|
||||
return AlertBackground(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
@@ -168,13 +168,13 @@ class PickerState<Item> extends State<Picker> {
|
||||
)
|
||||
)
|
||||
: Offstage(),
|
||||
widget.isAlwaysShowScrollThumb
|
||||
? CakeScrollbar(
|
||||
isShowScrollThumb
|
||||
? CakeScrollbar(
|
||||
backgroundHeight: backgroundHeight,
|
||||
thumbHeight: thumbHeight,
|
||||
fromTop: fromTop
|
||||
)
|
||||
: Offstage(),
|
||||
: Offstage(),
|
||||
],
|
||||
)
|
||||
),
|
||||
|
||||
@@ -12,20 +12,21 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class SeedWidget extends StatefulWidget {
|
||||
SeedWidget({Key key, this.language}) : super(key: key);
|
||||
SeedWidget({Key key, this.language, this.type}) : super(key: key);
|
||||
|
||||
final String language;
|
||||
final WalletType type;
|
||||
|
||||
@override
|
||||
SeedWidgetState createState() => SeedWidgetState(language);
|
||||
SeedWidgetState createState() => SeedWidgetState(language, type);
|
||||
}
|
||||
|
||||
class SeedWidgetState extends State<SeedWidget> {
|
||||
SeedWidgetState(String language)
|
||||
SeedWidgetState(String language, this.type)
|
||||
: controller = TextEditingController(),
|
||||
focusNode = FocusNode(),
|
||||
words = SeedValidator.getWordList(
|
||||
type: WalletType.monero, language: language) {
|
||||
type:type, language: language) {
|
||||
focusNode.addListener(() {
|
||||
setState(() {
|
||||
if (!focusNode.hasFocus && controller.text.isEmpty) {
|
||||
@@ -41,6 +42,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||
|
||||
final TextEditingController controller;
|
||||
final FocusNode focusNode;
|
||||
final WalletType type;
|
||||
List<String> words;
|
||||
bool _showPlaceholder;
|
||||
|
||||
@@ -55,7 +57,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||
void changeSeedLanguage(String language) {
|
||||
setState(() {
|
||||
words = SeedValidator.getWordList(
|
||||
type: WalletType.monero, language: language);
|
||||
type: type, language: language);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -113,16 +113,19 @@ class SectionStandardList extends StatelessWidget {
|
||||
{@required this.itemCounter,
|
||||
@required this.itemBuilder,
|
||||
@required this.sectionCount,
|
||||
this.sectionTitleBuilder,
|
||||
this.hasTopSeparator = false,
|
||||
BuildContext context})
|
||||
: totalRows = transform(hasTopSeparator, context, sectionCount,
|
||||
itemCounter, itemBuilder);
|
||||
itemCounter, itemBuilder, sectionTitleBuilder);
|
||||
|
||||
final int sectionCount;
|
||||
final bool hasTopSeparator;
|
||||
final int Function(int sectionIndex) itemCounter;
|
||||
final Widget Function(BuildContext context, int sectionIndex, int itemIndex)
|
||||
itemBuilder;
|
||||
final Widget Function(BuildContext context, int sectionIndex)
|
||||
sectionTitleBuilder;
|
||||
final List<Widget> totalRows;
|
||||
|
||||
static List<Widget> transform(
|
||||
@@ -131,14 +134,20 @@ class SectionStandardList extends StatelessWidget {
|
||||
int sectionCount,
|
||||
int Function(int sectionIndex) itemCounter,
|
||||
Widget Function(BuildContext context, int sectionIndex, int itemIndex)
|
||||
itemBuilder) {
|
||||
itemBuilder,
|
||||
Widget Function(BuildContext context, int sectionIndex)
|
||||
sectionTitleBuilder) {
|
||||
final items = <Widget>[];
|
||||
|
||||
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
|
||||
if ((sectionIndex == 0)&&(hasTopSeparator)) {
|
||||
if ((sectionIndex == 0) && (hasTopSeparator)) {
|
||||
items.add(StandardListSeparator(padding: EdgeInsets.only(left: 24)));
|
||||
}
|
||||
|
||||
if (sectionTitleBuilder != null) {
|
||||
items.add(sectionTitleBuilder(context, sectionIndex));
|
||||
}
|
||||
|
||||
final itemCount = itemCounter(sectionIndex);
|
||||
|
||||
for (var itemIndex = 0; itemIndex < itemCount; itemIndex++) {
|
||||
|
||||
@@ -7,77 +7,60 @@ class StandartListRow extends StatelessWidget {
|
||||
this.value,
|
||||
this.titleFontSize = 14,
|
||||
this.valueFontSize = 16,
|
||||
this.image,
|
||||
this.isDrawBottom = false});
|
||||
this.image});
|
||||
|
||||
final String title;
|
||||
final String value;
|
||||
final double titleFontSize;
|
||||
final double valueFontSize;
|
||||
final Image image;
|
||||
final bool isDrawBottom;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: titleFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).primaryTextTheme.overline.color),
|
||||
textAlign: TextAlign.left),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(value,
|
||||
style: TextStyle(
|
||||
fontSize: valueFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color)),
|
||||
),
|
||||
image != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
child: image,
|
||||
)
|
||||
: Offstage()
|
||||
],
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: titleFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).primaryTextTheme.overline.color),
|
||||
textAlign: TextAlign.left),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(value,
|
||||
style: TextStyle(
|
||||
fontSize: valueFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color)),
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
isDrawBottom
|
||||
? Container(
|
||||
height: 1,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
],
|
||||
image != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
child: image,
|
||||
)
|
||||
: Offstage()
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TrailButton extends StatelessWidget {
|
||||
TrailButton({
|
||||
@required this.caption,
|
||||
@required this.onPressed
|
||||
});
|
||||
TrailButton({@required this.caption, @required this.onPressed});
|
||||
|
||||
final String caption;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return ButtonTheme(
|
||||
minWidth: double.minPositive,
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
child: FlatButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Text(
|
||||
caption,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.display1.color,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
),
|
||||
onPressed: onPressed),
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Text(
|
||||
caption,
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).accentTextTheme.display4.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
),
|
||||
onPressed: onPressed),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user