Merge branch '4.0.8' into CAKE-158-transaction-and-balance-displaying-between-accounts

# Conflicts:
#	lib/src/screens/receive/receive_page.dart
This commit is contained in:
OleksandrSobol
2020-11-18 18:19:43 +02:00
17 changed files with 187 additions and 93 deletions
+2 -1
View File
@@ -40,13 +40,14 @@ class AuthPageState extends State<AuthPage> {
reaction((_) => widget.authViewModel.state, (ExecutionState state) {
if (state is ExecutedSuccessfullyState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_authBar?.dismiss();
if (widget.onAuthenticationFinished != null) {
widget.onAuthenticationFinished(true, this);
} else {
_authBar?.dismiss();
showBar<void>(context, S.of(context).authenticated);
}
});
setState(() {});
}
if (state is IsExecutingState) {
+76 -58
View File
@@ -15,9 +15,10 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_h
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_item.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
class ReceivePage extends BasePage {
ReceivePage({this.addressListViewModel});
ReceivePage({this.addressListViewModel}) : _cryptoAmountFocus = FocusNode();
final WalletAddressListViewModel addressListViewModel;
@@ -33,6 +34,8 @@ class ReceivePage extends BasePage {
@override
Color get titleColor => Colors.white;
final FocusNode _cryptoAmountFocus;
@override
Widget Function(BuildContext, Widget) get rootWrapper =>
(BuildContext context, Widget scaffold) => Container(
@@ -67,53 +70,68 @@ class ReceivePage extends BasePage {
@override
Widget body(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(24, 80, 24, 40),
child: QRWidget(
addressListViewModel: addressListViewModel,
isAmountFieldShow: true,
),
),
Observer(
builder: (_) => ListView.separated(
padding: EdgeInsets.all(0),
separatorBuilder: (context, _) => Container(
height: 1, color: Theme.of(context).dividerColor),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: addressListViewModel.items.length,
itemBuilder: (context, index) {
final item = addressListViewModel.items[index];
Widget cell = Container();
return KeyboardActions(
config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: isDarkTheme
? Color.fromRGBO(48, 51, 60, 1.0)
: Color.fromRGBO(98, 98, 98, 1.0),
nextFocus: false,
actions: [
KeyboardActionsItem(
focusNode: _cryptoAmountFocus,
toolbarButtons: [(_) => KeyboardDoneButton()],
)
]),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(24, 80, 24, 40),
child: QRWidget(
addressListViewModel: addressListViewModel,
isAmountFieldShow: true,
amountTextFieldFocusNode: _cryptoAmountFocus),
),
Observer(
builder: (_) => ListView.separated(
padding: EdgeInsets.all(0),
separatorBuilder: (context, _) => Container(
height: 1, color: Theme.of(context).dividerColor),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: addressListViewModel.items.length,
itemBuilder: (context, index) {
final item = addressListViewModel.items[index];
Widget cell = Container();
if (item is WalletAccountListHeader) {
cell = HeaderTile(
onTap: () async => await showPopUp<void>(
context: context,
builder: (_) =>
getIt.get<MoneroAccountListPage>()),
title: S.of(context).accounts,
icon: Icon(
Icons.arrow_forward_ios,
size: 14,
color: Theme.of(context).textTheme.display1.color,
));
}
if (item is WalletAccountListHeader) {
cell = HeaderTile(
onTap: () async => await showPopUp<void>(
context: context,
builder: (_) =>
getIt.get<MoneroAccountListPage>()),
title: S.of(context).accounts,
icon: Icon(
Icons.arrow_forward_ios,
size: 14,
color:
Theme.of(context).textTheme.display1.color,
));
}
if (item is WalletAddressListHeader) {
cell = HeaderTile(
onTap: () => Navigator.of(context)
.pushNamed(Routes.newSubaddress),
title: S.of(context).addresses,
icon: Icon(
Icons.add,
size: 20,
color: Theme.of(context).textTheme.display1.color,
));
}
if (item is WalletAddressListHeader) {
cell = HeaderTile(
onTap: () => Navigator.of(context)
.pushNamed(Routes.newSubaddress),
title: S.of(context).addresses,
icon: Icon(
Icons.add,
size: 20,
color:
Theme.of(context).textTheme.display1.color,
));
}
if (item is WalletAddressListItem) {
final isFirst = addressListViewModel.isFirstAddress;
@@ -146,17 +164,17 @@ class ReceivePage extends BasePage {
});
}
return index != 0
? cell
: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30)),
child: cell,
);
})),
],
),
);
return index != 0
? cell
: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30)),
child: cell,
);
})),
],
),
));
}
}
@@ -11,7 +11,9 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_v
class QRWidget extends StatelessWidget {
QRWidget(
{@required this.addressListViewModel, this.isAmountFieldShow = false})
{@required this.addressListViewModel,
this.isAmountFieldShow = false,
this.amountTextFieldFocusNode})
: amountController = TextEditingController(),
_formKey = GlobalKey<FormState>() {
amountController.addListener(() => addressListViewModel.amount =
@@ -21,6 +23,7 @@ class QRWidget extends StatelessWidget {
final WalletAddressListViewModel addressListViewModel;
final bool isAmountFieldShow;
final TextEditingController amountController;
final FocusNode amountTextFieldFocusNode;
final GlobalKey<FormState> _formKey;
@override
@@ -45,7 +48,7 @@ class QRWidget extends StatelessWidget {
data: addressListViewModel.uri.toString(),
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
//Theme.of(context).textTheme.headline.color,
//Theme.of(context).textTheme.headline.color,
))))),
Spacer(flex: 3)
]),
@@ -68,6 +71,7 @@ class QRWidget extends StatelessWidget {
child: Form(
key: _formKey,
child: BaseTextFormField(
focusNode: amountTextFieldFocusNode,
controller: amountController,
keyboardType: TextInputType.numberWithOptions(
decimal: true),
+1 -1
View File
@@ -77,7 +77,7 @@ class SeedWidgetState extends State<SeedWidget> {
fontSize: 16.0, color: Theme.of(context).hintColor))),
Padding(
padding: EdgeInsets.only(right: 40, top: 10),
child: ValidableAnnotatedEditableText(
child: ValidatableAnnotatedEditableText(
cursorColor: Colors.blue,
backgroundCursorColor: Colors.blue,
validStyle: TextStyle(
@@ -22,8 +22,8 @@ class TextAnnotation extends Comparable<TextAnnotation> {
int compareTo(TextAnnotation other) => text.compareTo(other.text);
}
class ValidableAnnotatedEditableText extends EditableText {
ValidableAnnotatedEditableText({
class ValidatableAnnotatedEditableText extends EditableText {
ValidatableAnnotatedEditableText({
Key key,
FocusNode focusNode,
TextEditingController controller,
@@ -49,7 +49,7 @@ class ValidableAnnotatedEditableText extends EditableText {
controller: controller,
cursorColor: cursorColor,
style: validStyle,
keyboardType: TextInputType.text,
keyboardType: TextInputType.visiblePassword,
autocorrect: false,
autofocus: false,
selectionColor: selectionColor,
@@ -73,14 +73,14 @@ class ValidableAnnotatedEditableText extends EditableText {
final TextStyle invalidStyle;
@override
ValidableAnnotatedEditableTextState createState() =>
ValidableAnnotatedEditableTextState();
ValidatableAnnotatedEditableTextState createState() =>
ValidatableAnnotatedEditableTextState();
}
class ValidableAnnotatedEditableTextState extends EditableTextState {
class ValidatableAnnotatedEditableTextState extends EditableTextState {
@override
ValidableAnnotatedEditableText get widget =>
super.widget as ValidableAnnotatedEditableText;
ValidatableAnnotatedEditableText get widget =>
super.widget as ValidatableAnnotatedEditableText;
List<Annotation> getRanges() {
final result = List<Annotation>();