66 lines
2.1 KiB
Dart
66 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../core/utils/responsive_utils.dart';
|
|
|
|
class PageHeader extends StatelessWidget {
|
|
const PageHeader({
|
|
super.key,
|
|
required this.title,
|
|
this.subtitle,
|
|
this.actions,
|
|
});
|
|
|
|
final String title;
|
|
final String? subtitle;
|
|
final List<Widget>? actions;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 24),
|
|
child: context.isMobile
|
|
? Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(title, style: Theme.of(context).textTheme.headlineSmall),
|
|
if (subtitle != null) ...[
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
subtitle!,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
if (actions != null && actions!.isNotEmpty) ...[
|
|
const SizedBox(height: 16),
|
|
Wrap(spacing: 8, runSpacing: 8, children: actions!),
|
|
],
|
|
],
|
|
)
|
|
: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(title, style: Theme.of(context).textTheme.headlineSmall),
|
|
if (subtitle != null) ...[
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
subtitle!,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
if (actions != null) ...actions!,
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|