Files
social-app/apps/lib/shared/widgets/back_title_page_header.dart
T

67 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/theme/design_tokens.dart';
import 'page_header.dart' as widgets;
class BackTitlePageHeader extends StatelessWidget {
const BackTitlePageHeader({
super.key,
required this.title,
this.onBack,
this.showBackButton = true,
this.trailing,
this.height = 64,
});
final String title;
final VoidCallback? onBack;
final bool showBackButton;
final Widget? trailing;
final double height;
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return SizedBox(
height: height,
child: Stack(
alignment: Alignment.center,
children: [
widgets.PageHeader(
leading: showBackButton
? widgets.BackButton(onPressed: onBack)
: const SizedBox(
width: AppSpacing.xl * 2,
height: AppSpacing.xl * 2,
),
trailing:
trailing ??
const SizedBox(
width: AppSpacing.xl * 2,
height: AppSpacing.xl * 2,
),
height: height,
),
IgnorePointer(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.xxl * 2,
),
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
color: colorScheme.onSurface,
),
),
),
),
],
),
);
}
}