stack_wallet/lib/widgets/desktop/desktop_app_bar.dart

88 lines
2 KiB
Dart
Raw Normal View History

2023-05-26 21:21:16 +00:00
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'package:flutter/material.dart';
import '../conditional_parent.dart';
const double kDesktopAppBarHeight = 96.0;
const double kDesktopAppBarHeightCompact = 82.0;
class DesktopAppBar extends StatelessWidget {
const DesktopAppBar({
Key? key,
this.leading,
this.center,
this.overlayCenter,
this.trailing,
this.background = Colors.transparent,
required this.isCompactHeight,
2022-10-30 17:13:32 +00:00
this.useSpacers = true,
}) : super(key: key);
final Widget? leading;
final Widget? center;
final Widget? overlayCenter;
final Widget? trailing;
final Color background;
final bool isCompactHeight;
2022-10-30 17:13:32 +00:00
final bool useSpacers;
@override
Widget build(BuildContext context) {
final List<Widget> items = [];
if (leading != null) {
items.add(leading!);
}
if (useSpacers) {
2022-10-30 17:13:32 +00:00
items.add(const Spacer());
}
if (center != null) {
items.add(center!);
if (useSpacers) {
2022-10-30 17:13:32 +00:00
items.add(const Spacer());
}
}
if (trailing != null) {
items.add(trailing!);
}
return ConditionalParent(
condition: overlayCenter != null,
builder: (child) => Stack(
children: [
child,
Positioned.fill(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [overlayCenter!],
),
),
],
),
child: Container(
decoration: BoxDecoration(
color: background,
),
height: isCompactHeight
? kDesktopAppBarHeightCompact
: kDesktopAppBarHeight,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: items,
),
),
);
}
}