mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +00:00
Merge branch 'CW-301-desktop-side-bar-ui' of https://github.com/cake-tech/cake_wallet into CW-318-desktop-marketplace
Conflicts: lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_actions.dart
This commit is contained in:
commit
3fb8be0053
3 changed files with 201 additions and 177 deletions
|
@ -3,6 +3,7 @@ import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_action
|
||||||
import 'package:cake_wallet/src/screens/dashboard/widgets/market_place_page.dart';
|
import 'package:cake_wallet/src/screens/dashboard/widgets/market_place_page.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
|
||||||
class DesktopDashboardActions extends StatelessWidget {
|
class DesktopDashboardActions extends StatelessWidget {
|
||||||
final DashboardViewModel dashboardViewModel;
|
final DashboardViewModel dashboardViewModel;
|
||||||
|
@ -11,65 +12,69 @@ class DesktopDashboardActions extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Observer(
|
||||||
children: [
|
builder: (_) {
|
||||||
const SizedBox(height: 16),
|
return Column(
|
||||||
DesktopActionButton(
|
|
||||||
title: MainActions.exchangeAction.name(context),
|
|
||||||
image: MainActions.exchangeAction.image,
|
|
||||||
canShow: MainActions.exchangeAction.canShow?.call(dashboardViewModel),
|
|
||||||
isEnabled: MainActions.exchangeAction.isEnabled?.call(dashboardViewModel),
|
|
||||||
onTap: () async => await MainActions.exchangeAction.onTap(context, dashboardViewModel),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
const SizedBox(height: 16),
|
||||||
child: DesktopActionButton(
|
DesktopActionButton(
|
||||||
title: MainActions.receiveAction.name(context),
|
title: MainActions.exchangeAction.name(context),
|
||||||
image: MainActions.receiveAction.image,
|
image: MainActions.exchangeAction.image,
|
||||||
canShow: MainActions.receiveAction.canShow?.call(dashboardViewModel),
|
canShow: MainActions.exchangeAction.canShow?.call(dashboardViewModel),
|
||||||
isEnabled: MainActions.receiveAction.isEnabled?.call(dashboardViewModel),
|
isEnabled: MainActions.exchangeAction.isEnabled?.call(dashboardViewModel),
|
||||||
onTap: () async =>
|
onTap: () async => await MainActions.exchangeAction.onTap(context, dashboardViewModel),
|
||||||
await MainActions.receiveAction.onTap(context, dashboardViewModel),
|
),
|
||||||
),
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: DesktopActionButton(
|
||||||
|
title: MainActions.receiveAction.name(context),
|
||||||
|
image: MainActions.receiveAction.image,
|
||||||
|
canShow: MainActions.receiveAction.canShow?.call(dashboardViewModel),
|
||||||
|
isEnabled: MainActions.receiveAction.isEnabled?.call(dashboardViewModel),
|
||||||
|
onTap: () async =>
|
||||||
|
await MainActions.receiveAction.onTap(context, dashboardViewModel),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: DesktopActionButton(
|
||||||
|
title: MainActions.sendAction.name(context),
|
||||||
|
image: MainActions.sendAction.image,
|
||||||
|
canShow: MainActions.sendAction.canShow?.call(dashboardViewModel),
|
||||||
|
isEnabled: MainActions.sendAction.isEnabled?.call(dashboardViewModel),
|
||||||
|
onTap: () async => await MainActions.sendAction.onTap(context, dashboardViewModel),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: DesktopActionButton(
|
||||||
|
title: MainActions.buyAction.name(context),
|
||||||
|
image: MainActions.buyAction.image,
|
||||||
|
canShow: MainActions.buyAction.canShow?.call(dashboardViewModel),
|
||||||
|
isEnabled: MainActions.buyAction.isEnabled?.call(dashboardViewModel),
|
||||||
|
onTap: () async => await MainActions.buyAction.onTap(context, dashboardViewModel),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: DesktopActionButton(
|
||||||
|
title: MainActions.sellAction.name(context),
|
||||||
|
image: MainActions.sellAction.image,
|
||||||
|
canShow: MainActions.sellAction.canShow?.call(dashboardViewModel),
|
||||||
|
isEnabled: MainActions.sellAction.isEnabled?.call(dashboardViewModel),
|
||||||
|
onTap: () async => await MainActions.sellAction.onTap(context, dashboardViewModel),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: DesktopActionButton(
|
child: MarketPlacePage(dashboardViewModel: dashboardViewModel),
|
||||||
title: MainActions.sendAction.name(context),
|
|
||||||
image: MainActions.sendAction.image,
|
|
||||||
canShow: MainActions.sendAction.canShow?.call(dashboardViewModel),
|
|
||||||
isEnabled: MainActions.sendAction.isEnabled?.call(dashboardViewModel),
|
|
||||||
onTap: () async => await MainActions.sendAction.onTap(context, dashboardViewModel),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
Row(
|
}
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: DesktopActionButton(
|
|
||||||
title: MainActions.buyAction.name(context),
|
|
||||||
image: MainActions.buyAction.image,
|
|
||||||
canShow: MainActions.buyAction.canShow?.call(dashboardViewModel),
|
|
||||||
isEnabled: MainActions.buyAction.isEnabled?.call(dashboardViewModel),
|
|
||||||
onTap: () async => await MainActions.buyAction.onTap(context, dashboardViewModel),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: DesktopActionButton(
|
|
||||||
title: MainActions.sellAction.name(context),
|
|
||||||
image: MainActions.sellAction.image,
|
|
||||||
canShow: MainActions.sellAction.canShow?.call(dashboardViewModel),
|
|
||||||
isEnabled: MainActions.sellAction.isEnabled?.call(dashboardViewModel),
|
|
||||||
onTap: () async => await MainActions.sellAction.onTap(context, dashboardViewModel),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: MarketPlacePage(dashboardViewModel: dashboardViewModel),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:cake_wallet/utils/show_bar.dart';
|
||||||
import 'package:another_flushbar/flushbar.dart';
|
import 'package:another_flushbar/flushbar.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
class PinCodeWidget extends StatefulWidget {
|
class PinCodeWidget extends StatefulWidget {
|
||||||
PinCodeWidget(
|
PinCodeWidget(
|
||||||
|
@ -117,87 +118,102 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||||
);
|
);
|
||||||
|
|
||||||
return Container(
|
return RawKeyboardListener(
|
||||||
color: Theme.of(context).backgroundColor,
|
focusNode: FocusNode(),
|
||||||
padding: EdgeInsets.only(left: 40.0, right: 40.0, bottom: 40.0),
|
autofocus: true,
|
||||||
child: Column(children: <Widget>[
|
onKey: (keyEvent) {
|
||||||
Spacer(flex: 2),
|
if (keyEvent is RawKeyDownEvent) {
|
||||||
Text(title,
|
if (keyEvent.logicalKey.keyLabel == "Backspace") {
|
||||||
style: TextStyle(
|
_pop();
|
||||||
fontSize: 20,
|
return;
|
||||||
fontWeight: FontWeight.w500,
|
}
|
||||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!)),
|
int? number = int.tryParse(keyEvent.character ?? '');
|
||||||
Spacer(flex: 3),
|
if (number != null) {
|
||||||
Container(
|
_push(number);
|
||||||
width: 180,
|
}
|
||||||
child: Row(
|
}
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
},
|
||||||
children: List.generate(pinLength, (index) {
|
child: Container(
|
||||||
const size = 10.0;
|
color: Theme.of(context).backgroundColor,
|
||||||
final isFilled = pin.length > index ? pin[index] != null : false;
|
padding: EdgeInsets.only(left: 40.0, right: 40.0, bottom: 40.0),
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
Spacer(flex: 2),
|
||||||
|
Text(title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Theme.of(context).primaryTextTheme!.headline6!.color!)),
|
||||||
|
Spacer(flex: 3),
|
||||||
|
Container(
|
||||||
|
width: 180,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: List.generate(pinLength, (index) {
|
||||||
|
const size = 10.0;
|
||||||
|
final isFilled = pin.length > index ? pin[index] != null : false;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: isFilled
|
color: isFilled
|
||||||
? Theme.of(context).primaryTextTheme!.headline6!.color!
|
? Theme.of(context).primaryTextTheme!.headline6!.color!
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.accentTextTheme!
|
.accentTextTheme!
|
||||||
.bodyText2!
|
.bodyText2!
|
||||||
.color!
|
.color!
|
||||||
.withOpacity(0.25),
|
.withOpacity(0.25),
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Spacer(flex: 2),
|
||||||
Spacer(flex: 2),
|
if (widget.hasLengthSwitcher) ...[
|
||||||
if (widget.hasLengthSwitcher) ...[
|
TextButton(
|
||||||
TextButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
changePinLength(pinLength == PinCodeState.fourPinLength
|
||||||
changePinLength(pinLength == PinCodeState.fourPinLength
|
? PinCodeState.sixPinLength
|
||||||
? PinCodeState.sixPinLength
|
: PinCodeState.fourPinLength);
|
||||||
: PinCodeState.fourPinLength);
|
},
|
||||||
},
|
child: Text(
|
||||||
child: Text(
|
_changePinLengthText(),
|
||||||
_changePinLengthText(),
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 14.0,
|
||||||
fontSize: 14.0,
|
fontWeight: FontWeight.normal,
|
||||||
fontWeight: FontWeight.normal,
|
color: Theme.of(context)
|
||||||
color: Theme.of(context)
|
.accentTextTheme!
|
||||||
.accentTextTheme!
|
.bodyText2!
|
||||||
.bodyText2!
|
.decorationColor!),
|
||||||
.decorationColor!),
|
))
|
||||||
))
|
],
|
||||||
],
|
Spacer(flex: 1),
|
||||||
Spacer(flex: 1),
|
Flexible(
|
||||||
Flexible(
|
flex: 24,
|
||||||
flex: 24,
|
child: Container(
|
||||||
child: Container(
|
key: _gridViewKey,
|
||||||
key: _gridViewKey,
|
child: _aspectRatio > 0
|
||||||
child: _aspectRatio > 0
|
? GridView.count(
|
||||||
? GridView.count(
|
shrinkWrap: true,
|
||||||
shrinkWrap: true,
|
crossAxisCount: 3,
|
||||||
crossAxisCount: 3,
|
childAspectRatio: _aspectRatio,
|
||||||
childAspectRatio: _aspectRatio,
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
children: List.generate(12, (index) {
|
||||||
children: List.generate(12, (index) {
|
const double marginRight = 15;
|
||||||
const double marginRight = 15;
|
const double marginLeft = 15;
|
||||||
const double marginLeft = 15;
|
|
||||||
|
|
||||||
if (index == 9) {
|
if (index == 9) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
left: marginLeft, right: marginRight),
|
left: marginLeft, right: marginRight),
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => null,
|
onPressed: () => null,
|
||||||
// (widget.hasLengthSwitcher ||
|
// (widget.hasLengthSwitcher ||
|
||||||
// !settingsStore
|
// !settingsStore
|
||||||
// .allowBiometricalAuthentication)
|
// .allowBiometricalAuthentication)
|
||||||
// ? null
|
// ? null
|
||||||
// : () {
|
// : () {
|
||||||
// FIXME
|
// FIXME
|
||||||
// if (authStore != null) {
|
// if (authStore != null) {
|
||||||
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
// final biometricAuth = BiometricAuth();
|
// final biometricAuth = BiometricAuth();
|
||||||
|
@ -217,57 +233,60 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
// FIX-ME: Style
|
// FIX-ME: Style
|
||||||
//color: Theme.of(context).backgroundColor,
|
//color: Theme.of(context).backgroundColor,
|
||||||
//shape: CircleBorder(),
|
//shape: CircleBorder(),
|
||||||
child: Container()
|
child: Container()
|
||||||
// (widget.hasLengthSwitcher ||
|
// (widget.hasLengthSwitcher ||
|
||||||
// !settingsStore
|
// !settingsStore
|
||||||
// .allowBiometricalAuthentication)
|
// .allowBiometricalAuthentication)
|
||||||
// ? Offstage()
|
// ? Offstage()
|
||||||
// : faceImage,
|
// : faceImage,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (index == 10) {
|
||||||
|
index = 0;
|
||||||
|
} else if (index == 11) {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: marginLeft, right: marginRight),
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () => _pop(),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context).backgroundColor,
|
||||||
|
shape: CircleBorder(),
|
||||||
),
|
),
|
||||||
);
|
child: deleteIconImage,
|
||||||
} else if (index == 10) {
|
),
|
||||||
index = 0;
|
);
|
||||||
} else if (index == 11) {
|
} else {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
left: marginLeft, right: marginRight),
|
left: marginLeft, right: marginRight),
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => _pop(),
|
onPressed: () => _push(index),
|
||||||
// FIX-ME: Style
|
style: TextButton.styleFrom(
|
||||||
//color: Theme.of(context).backgroundColor,
|
backgroundColor: Theme.of(context).backgroundColor,
|
||||||
//shape: CircleBorder(),
|
shape: CircleBorder(),
|
||||||
child: deleteIconImage,
|
),
|
||||||
|
child: Text('$index',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 30.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme!
|
||||||
|
.headline6!
|
||||||
|
.color!)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
}),
|
||||||
index++;
|
)
|
||||||
}
|
: null))
|
||||||
|
]),
|
||||||
return Container(
|
),
|
||||||
margin: EdgeInsets.only(
|
|
||||||
left: marginLeft, right: marginRight),
|
|
||||||
child: TextButton(
|
|
||||||
onPressed: () => _push(index),
|
|
||||||
// FIX-ME: Style
|
|
||||||
//color: Theme.of(context).backgroundColor,
|
|
||||||
//shape: CircleBorder(),
|
|
||||||
child: Text('$index',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 30.0,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme!
|
|
||||||
.headline6!
|
|
||||||
.color!)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
: null))
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||||
children: [
|
children: [
|
||||||
if (leading != null) Flexible(child: leading!),
|
if (leading != null) Flexible(child: leading!),
|
||||||
if (middle != null) middle!,
|
if (middle != null) middle!,
|
||||||
if (trailing != null) trailing!,
|
trailing ?? const SizedBox(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue