mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
add stacked overlay center widget to ensure exact center in desktop appbar
This commit is contained in:
parent
6754c2ebdf
commit
f744fd10de
1 changed files with 27 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
|
|
||||||
const double kDesktopAppBarHeight = 96.0;
|
const double kDesktopAppBarHeight = 96.0;
|
||||||
const double kDesktopAppBarHeightCompact = 82.0;
|
const double kDesktopAppBarHeightCompact = 82.0;
|
||||||
|
@ -8,6 +9,7 @@ class DesktopAppBar extends StatelessWidget {
|
||||||
Key? key,
|
Key? key,
|
||||||
this.leading,
|
this.leading,
|
||||||
this.center,
|
this.center,
|
||||||
|
this.overlayCenter,
|
||||||
this.trailing,
|
this.trailing,
|
||||||
this.background = Colors.transparent,
|
this.background = Colors.transparent,
|
||||||
required this.isCompactHeight,
|
required this.isCompactHeight,
|
||||||
|
@ -16,6 +18,7 @@ class DesktopAppBar extends StatelessWidget {
|
||||||
|
|
||||||
final Widget? leading;
|
final Widget? leading;
|
||||||
final Widget? center;
|
final Widget? center;
|
||||||
|
final Widget? overlayCenter;
|
||||||
final Widget? trailing;
|
final Widget? trailing;
|
||||||
final Color background;
|
final Color background;
|
||||||
final bool isCompactHeight;
|
final bool isCompactHeight;
|
||||||
|
@ -43,16 +46,31 @@ class DesktopAppBar extends StatelessWidget {
|
||||||
items.add(trailing!);
|
items.add(trailing!);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container(
|
return ConditionalParent(
|
||||||
decoration: BoxDecoration(
|
condition: overlayCenter != null,
|
||||||
color: background,
|
builder: (child) => Stack(
|
||||||
|
children: [
|
||||||
|
child,
|
||||||
|
Positioned.fill(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [overlayCenter!],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
height:
|
child: Container(
|
||||||
isCompactHeight ? kDesktopAppBarHeightCompact : kDesktopAppBarHeight,
|
decoration: BoxDecoration(
|
||||||
child: Row(
|
color: background,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
height: isCompactHeight
|
||||||
children: items,
|
? kDesktopAppBarHeightCompact
|
||||||
|
: kDesktopAppBarHeight,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: items,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue