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

59 lines
1.6 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import '../../core/theme/design_tokens.dart';
class PageHeader extends StatelessWidget {
final Widget? leading;
final Widget? trailing;
final double height;
const PageHeader({super.key, this.leading, this.trailing, this.height = 64});
@override
Widget build(BuildContext context) {
return SizedBox(
height: height,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
leading ?? const SizedBox.shrink(),
trailing ?? const SizedBox.shrink(),
],
),
),
);
}
}
class BackButton extends StatelessWidget {
final VoidCallback? onPressed;
const BackButton({super.key, this.onPressed});
@override
Widget build(BuildContext context) {
return SizedBox(
width: AppSpacing.xxl * 2,
height: AppSpacing.xxl * 2,
child: TextButton(
onPressed: onPressed ?? () => Navigator.of(context).pop(),
style: TextButton.styleFrom(
padding: const EdgeInsets.all(AppSpacing.none),
backgroundColor: AppColors.surfaceTertiary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppRadius.full),
side: const BorderSide(color: AppColors.borderTertiary),
),
),
child: const Icon(
Icons.chevron_left,
size: AppSpacing.lg + AppSpacing.xs,
color: AppColors.slate700,
),
),
);
}
}