diff --git a/lib/new-ui/widgets/coins_page/cards/cards_view.dart b/lib/new-ui/widgets/coins_page/cards/cards_view.dart index b9ee02640..67066b41b 100644 --- a/lib/new-ui/widgets/coins_page/cards/cards_view.dart +++ b/lib/new-ui/widgets/coins_page/cards/cards_view.dart @@ -61,8 +61,6 @@ class _CardsViewState extends State { static const Duration animDuration = Duration(milliseconds: 200); static const int compactModeTreshold = 4; static const int maxCards = 5; - late final double cardWidth = MediaQuery.of(context).size.width * 0.878; - late final double effectiveCardWidth = min(cardWidth, 768); Widget _buildCard(int visualIndex, int realIndex, int numCards, double parentWidth, Map order, bool compactMode, double overlapAmount) { @@ -74,6 +72,9 @@ class _CardsViewState extends State { final top = baseTop - (howFarBehind * overlapAmount); + final double cardWidth = MediaQuery.of(context).size.width * 0.878; + final double effectiveCardWidth = min(cardWidth, 768); + final left = (parentWidth - effectiveCardWidth) / 2.0; return AnimatedPositioned( @@ -220,6 +221,8 @@ class _CardsViewState extends State { } double _getBoxHeight(int numCards, double overlapAmount) { + final double cardWidth = MediaQuery.of(context).size.width * 0.878; + final double effectiveCardWidth = min(cardWidth, 768); return /* height of initial card */ (2 / 3.2) * (effectiveCardWidth) + @@ -267,6 +270,7 @@ class _CardsViewState extends State { if (visualIndex == _selectedIndex && widget.accountListViewModel != null && + realIndex < widget.accountListViewModel!.accounts.length && widget.accountListViewModel?.selected.label != widget.accountListViewModel?.accounts[realIndex].label) { widget.accountListViewModel! @@ -282,15 +286,11 @@ class _CardsViewState extends State { curve: Curves.easeOut, width: double.infinity, height: _getBoxHeight(numCards, overlapAmount), - child: AnimatedSwitcher( - duration: Duration(milliseconds: 200), - transitionBuilder: (child, animation) => FadeTransition(opacity: animation, child: child), - child: SizedBox( - key: ValueKey(_getBoxHeight(numCards, overlapAmount)), - width: double.infinity, - height: _getBoxHeight(numCards, overlapAmount), - child: Stack(alignment: Alignment.center, children: children), - ), + child: SizedBox( + key: ValueKey(_getBoxHeight(numCards, overlapAmount)), + width: double.infinity, + height: _getBoxHeight(numCards, overlapAmount), + child: Stack(alignment: Alignment.center, children: children), ), ); }); diff --git a/lib/new-ui/widgets/coins_page/top_bar_widget/top_bar.dart b/lib/new-ui/widgets/coins_page/top_bar_widget/top_bar.dart index 3bc48c837..419c7d259 100644 --- a/lib/new-ui/widgets/coins_page/top_bar_widget/top_bar.dart +++ b/lib/new-ui/widgets/coins_page/top_bar_widget/top_bar.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:cake_wallet/new-ui/widgets/coins_page/top_bar_widget/chain_icon.dart'; import 'package:cake_wallet/new-ui/widgets/coins_page/top_bar_widget/lightning_switcher.dart'; import 'package:cake_wallet/new-ui/widgets/coins_page/top_bar_widget/sync_bar.dart'; @@ -23,37 +25,47 @@ class TopBar extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 10), - child: Observer( - builder: (_) => Row( - spacing: 12, - children: [ - (dashboardViewModel.hasLightning) - ? LightningSwitcher( - lightningMode: lightningMode, - onLightningSwitchPress: onLightningSwitchPress, - ) - : ChainIcon( - iconPath: dashboardViewModel.wallet.currency.flatIconPath ?? "", - dashboardViewModel: dashboardViewModel, - isSyncHeavy: dashboardViewModel.isSyncHeavy), - SyncBar( - dashboardViewModel: dashboardViewModel, - isSyncHeavy: dashboardViewModel.isSyncHeavy, - ), - ModernButton.svg( - iconColor: Theme.of(context).colorScheme.primary, - size: 36, - onPressed: () { - HapticFeedback.mediumImpact(); - onSettingsButtonPress(); - }, - svgPath: "assets/new-ui/top-settings.svg", - ), - ], + return SafeArea( + child: Padding( + padding: EdgeInsets.only(bottom: 10, left: 18, right:18, top: 10+_additionalTopPadding(context)), + child: Observer( + builder: (_) => Row( + spacing: 12, + children: [ + (dashboardViewModel.hasLightning) + ? LightningSwitcher( + lightningMode: lightningMode, + onLightningSwitchPress: onLightningSwitchPress, + ) + : ChainIcon( + iconPath: dashboardViewModel.wallet.currency.flatIconPath ?? "", + dashboardViewModel: dashboardViewModel, + isSyncHeavy: dashboardViewModel.isSyncHeavy), + SyncBar( + dashboardViewModel: dashboardViewModel, + isSyncHeavy: dashboardViewModel.isSyncHeavy, + ), + ModernButton.svg( + iconColor: Theme.of(context).colorScheme.primary, + size: 36, + onPressed: () { + HapticFeedback.mediumImpact(); + onSettingsButtonPress(); + }, + svgPath: "assets/new-ui/top-settings.svg", + ), + ], + ), ), ), ); } + + + //FIXME remove after this gets fixed flutter-side + double _additionalTopPadding(BuildContext context) { + if(Platform.isIOS && MediaQuery.of(context).viewPadding.top < 12) return 24; + + return 0; + } }