mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
fix layout issues in ipad windowed mode (#3060)
This commit is contained in:
@@ -61,8 +61,6 @@ class _CardsViewState extends State<CardsView> {
|
||||
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<int, int> order, bool compactMode, double overlapAmount) {
|
||||
@@ -74,6 +72,9 @@ class _CardsViewState extends State<CardsView> {
|
||||
|
||||
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<CardsView> {
|
||||
}
|
||||
|
||||
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<CardsView> {
|
||||
|
||||
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<CardsView> {
|
||||
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),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user