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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-09-16 16:23:42 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-05-23 00:37:06 +00:00
|
|
|
import '../conditional_parent.dart';
|
2022-09-16 16:23:42 +00:00
|
|
|
|
|
|
|
const double kDesktopAppBarHeight = 96.0;
|
|
|
|
const double kDesktopAppBarHeightCompact = 82.0;
|
|
|
|
|
2022-12-05 22:41:46 +00:00
|
|
|
class DesktopAppBar extends StatelessWidget {
|
2022-09-16 16:23:42 +00:00
|
|
|
const DesktopAppBar({
|
2024-05-27 23:56:22 +00:00
|
|
|
super.key,
|
2022-09-16 16:23:42 +00:00
|
|
|
this.leading,
|
|
|
|
this.center,
|
2023-04-07 21:36:34 +00:00
|
|
|
this.overlayCenter,
|
2022-09-16 16:23:42 +00:00
|
|
|
this.trailing,
|
|
|
|
this.background = Colors.transparent,
|
|
|
|
required this.isCompactHeight,
|
2022-10-30 17:13:32 +00:00
|
|
|
this.useSpacers = true,
|
2024-05-27 23:56:22 +00:00
|
|
|
});
|
2022-09-16 16:23:42 +00:00
|
|
|
|
|
|
|
final Widget? leading;
|
|
|
|
final Widget? center;
|
2023-04-07 21:36:34 +00:00
|
|
|
final Widget? overlayCenter;
|
2022-09-16 16:23:42 +00:00
|
|
|
final Widget? trailing;
|
|
|
|
final Color background;
|
|
|
|
final bool isCompactHeight;
|
2022-10-30 17:13:32 +00:00
|
|
|
final bool useSpacers;
|
2022-09-16 16:23:42 +00:00
|
|
|
|
|
|
|
@override
|
2022-12-05 22:41:46 +00:00
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final List<Widget> items = [];
|
|
|
|
if (leading != null) {
|
|
|
|
items.add(leading!);
|
2022-09-16 16:23:42 +00:00
|
|
|
}
|
|
|
|
|
2022-12-05 22:41:46 +00:00
|
|
|
if (useSpacers) {
|
2022-10-30 17:13:32 +00:00
|
|
|
items.add(const Spacer());
|
|
|
|
}
|
2022-09-16 16:23:42 +00:00
|
|
|
|
2022-12-05 22:41:46 +00:00
|
|
|
if (center != null) {
|
|
|
|
items.add(center!);
|
|
|
|
if (useSpacers) {
|
2022-10-30 17:13:32 +00:00
|
|
|
items.add(const Spacer());
|
|
|
|
}
|
2022-09-16 16:23:42 +00:00
|
|
|
}
|
|
|
|
|
2022-12-05 22:41:46 +00:00
|
|
|
if (trailing != null) {
|
|
|
|
items.add(trailing!);
|
2022-09-16 16:23:42 +00:00
|
|
|
}
|
|
|
|
|
2023-04-07 21:36:34 +00:00
|
|
|
return ConditionalParent(
|
|
|
|
condition: overlayCenter != null,
|
|
|
|
builder: (child) => Stack(
|
|
|
|
children: [
|
|
|
|
child,
|
|
|
|
Positioned.fill(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [overlayCenter!],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2022-09-16 16:23:42 +00:00
|
|
|
),
|
2023-04-07 21:36:34 +00:00
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: background,
|
|
|
|
),
|
|
|
|
height: isCompactHeight
|
|
|
|
? kDesktopAppBarHeightCompact
|
|
|
|
: kDesktopAppBarHeight,
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: items,
|
|
|
|
),
|
2022-09-16 16:23:42 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|