Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,801 changes: 1,801 additions & 0 deletions lib/l10n/app_localizations.dart

Large diffs are not rendered by default.

998 changes: 998 additions & 0 deletions lib/l10n/app_localizations_en.dart

Large diffs are not rendered by default.

1,008 changes: 1,008 additions & 0 deletions lib/l10n/app_localizations_es.dart

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions lib/util/panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ class PanelUtils {
}

Future<void> toggle() async {
if (panelController.isPanelClosed) {
await open();
} else {
await close();
if (isAttached()) {
if (panelController.isPanelClosed) {
await open();
} else {
await close();
}
}
}

Expand Down Expand Up @@ -57,7 +59,7 @@ class PanelUtils {
}

Future<void> close() async {
if (isAttached() && panelController.isPanelOpen) {
if (isAttached() && isOpen()) {
Widget defaultContent = Text('');
setContent(defaultContent);
await panelController.close();
Expand Down
28 changes: 17 additions & 11 deletions lib/widgets/layouts/dashboard_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,18 @@ class DashboardLayoutState extends State<DashboardLayout>
return BottomNavigation(
currentScreen: currentRoute(context),
onSendReceiveAction: () async => {
panel.setHeight(actionsHeight),
setState(() => panel.setContent(SendReceiveButtons())),
await panel.toggle(),
setState(() {
panel.setHeight(actionsHeight);
panel.setContent(SendReceiveButtons());
}),
await panel.toggle()
},
onStakeUnstakeAction: () async => {
panel.setHeight(actionsHeight),
setState(() => panel.setContent(StakeUnstakeButtons())),
await panel.toggle(),
setState(() {
panel.setHeight(actionsHeight);
panel.setContent(StakeUnstakeButtons());
}),
await panel.toggle()
});
}

Expand Down Expand Up @@ -161,11 +165,13 @@ class DashboardLayoutState extends State<DashboardLayout>
scrollController: widget.scrollController,
topNavigation: TopNavigation(
onShowWalletList: () async => {
// Sets panel height that shows the wallet list
panel.setHeight(walletListSize > maxSize
? maxSize
: walletListSize),
setState(() => panel.setContent(WalletList())),
setState(() {
// Sets panel height that shows the wallet list
panel.setHeight(walletListSize > maxSize
? maxSize
: walletListSize);
panel.setContent(WalletList());
}),
await panel.toggle(),
},
currentScreen: currentRoute(context),
Expand Down
8 changes: 6 additions & 2 deletions lib/widgets/layouts/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ class LayoutState extends State<Layout> with TickerProviderStateMixin {
),
child: widget.slidingPanel)),
onPanelClosed: () => {
Timer(Duration(milliseconds: 300),
() => setState(() => panel.setCloseState()))
Timer(Duration(milliseconds: 300), () {
if (mounted) {
setState(() => panel.setCloseState());
}
;
})
},
body: GestureDetector(
excludeFromSemantics: true,
Expand Down
13 changes: 10 additions & 3 deletions lib/widgets/send_receive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:my_wit_wallet/bloc/transactions/value_transfer/vtt_create/vtt_create_bloc.dart';
import 'package:my_wit_wallet/screens/receive_transaction/receive_tx_screen.dart';
import 'package:my_wit_wallet/screens/send_transaction/send_vtt_screen.dart';
import 'package:my_wit_wallet/shared/locator.dart';
import 'package:my_wit_wallet/theme/extended_theme.dart';
import 'package:my_wit_wallet/theme/wallet_theme.dart';
import 'package:my_wit_wallet/util/current_route.dart';
import 'package:my_wit_wallet/util/get_localization.dart';
import 'package:my_wit_wallet/util/panel.dart';
import 'package:my_wit_wallet/widgets/buttons/custom_btn.dart';
import 'package:my_wit_wallet/widgets/buttons/icon_btn.dart';
import 'package:my_wit_wallet/widgets/layouts/dashboard_layout.dart';
Expand All @@ -15,6 +17,7 @@ typedef void VoidCallback();

class SendReceiveButtons extends StatelessWidget {
SendReceiveButtons({Key? key}) : super(key: key);
final PanelUtils panel = Locator.instance.get<PanelUtils>();

Widget build(BuildContext context) {
final theme = Theme.of(context);
Expand Down Expand Up @@ -55,7 +58,9 @@ class SendReceiveButtons extends StatelessWidget {
text: localization.send,
onPressed: currentRoute(context) != CreateVttScreen.route
? _showCreateVTTDialog
: () {},
: () {
panel.close();
},
icon: Container(
height: 40,
child: svgThemeImage(theme, name: 'send-icon', height: 18)),
Expand All @@ -69,9 +74,11 @@ class SendReceiveButtons extends StatelessWidget {
color: extendedTheme.mediumPanelText!.color,
padding: EdgeInsets.only(left: 16, right: 16),
text: localization.receive,
onPressed: currentRoute != ReceiveTransactionScreen.route
onPressed: currentRoute(context) != ReceiveTransactionScreen.route
? _showReceiveDialog
: () {},
: () {
panel.close();
},
icon: Container(
height: 40,
child: svgThemeImage(theme, name: 'receive-icon', height: 18)),
Expand Down
12 changes: 9 additions & 3 deletions lib/widgets/stake_unstake.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:my_wit_wallet/theme/extended_theme.dart';
import 'package:my_wit_wallet/theme/wallet_theme.dart';
import 'package:my_wit_wallet/util/current_route.dart';
import 'package:my_wit_wallet/util/get_localization.dart';
import 'package:my_wit_wallet/util/panel.dart';
import 'package:my_wit_wallet/util/storage/database/balance_info.dart';
import 'package:my_wit_wallet/util/storage/database/wallet.dart';
import 'package:my_wit_wallet/widgets/buttons/custom_btn.dart';
Expand All @@ -31,6 +32,7 @@ class StakeUnstakeButtons extends StatelessWidget {
Wallet currentWallet = db.walletStorage.currentWallet;
bool allowStake = MIN_STAKING_AMOUNT_NANOWIT <=
currentWallet.balanceNanoWit().availableNanoWit;
final PanelUtils panel = Locator.instance.get<PanelUtils>();

Future<void> _goToStakeScreen() async {
if (allowStake) {
Expand Down Expand Up @@ -88,7 +90,9 @@ class StakeUnstakeButtons extends StatelessWidget {
text: localization.stake,
onPressed: currentRoute(context) != StakeScreen.route
? _goToStakeScreen
: () {},
: () {
panel.close();
},
icon: Container(
height: 40,
child: svgThemeImage(theme, name: 'stake-icon', height: 18)),
Expand All @@ -102,9 +106,11 @@ class StakeUnstakeButtons extends StatelessWidget {
color: extendedTheme.mediumPanelText!.color,
padding: EdgeInsets.only(left: 16, right: 16),
text: localization.unstake,
onPressed: currentRoute != UnstakeScreen.route
onPressed: currentRoute(context) != UnstakeScreen.route
? _goToUnstakeScreen
: () {},
: () {
panel.close();
},
icon: Container(
height: 40,
child: svgThemeImage(theme, name: 'unstake-icon', height: 24)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:my_wit_wallet/util/get_localization.dart';
import 'package:my_wit_wallet/theme/wallet_theme.dart';
import 'package:my_wit_wallet/widgets/alert_dialog.dart';
import 'package:my_wit_wallet/widgets/buttons/custom_btn.dart';
import 'package:my_wit_wallet/widgets/layouts/dashboard_layout.dart';

void buildDisableStakeModal({
required ThemeData theme,
Expand All @@ -21,9 +22,15 @@ void buildDisableStakeModal({
type: CustomBtnType.primary,
enabled: true,
onPressed: () => {
Navigator.popUntil(
context, ModalRoute.withName(originRouteName)),
ScaffoldMessenger.of(context).clearSnackBars(),
Navigator.push(
context,
CustomPageRoute(
builder: (BuildContext context) {
return originRoute;
},
maintainState: false,
settings: RouteSettings(name: originRouteName)))
}),
],
image: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ void buildEmptyStakeModal({
type: allowStake ? CustomBtnType.secondary : CustomBtnType.primary,
enabled: true,
onPressed: () => {
Navigator.popUntil(
context, ModalRoute.withName(originRouteName)),
ScaffoldMessenger.of(context).clearSnackBars(),
Navigator.push(
context,
CustomPageRoute(
builder: (BuildContext context) {
return originRoute;
},
maintainState: false,
settings: RouteSettings(name: originRouteName)))
}),
allowStake
? CustomButton(
Expand Down
Loading