141 lines
4.6 KiB
Dart
141 lines
4.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../core/theme/design_tokens.dart';
|
|
import '../../../../shared/widgets/page_header.dart' as widgets;
|
|
|
|
class AccountSurfaceScaffold extends StatelessWidget {
|
|
const AccountSurfaceScaffold({
|
|
super.key,
|
|
required this.title,
|
|
this.subtitle,
|
|
required this.body,
|
|
this.footer,
|
|
this.onBack,
|
|
this.compactHeaderTitle = false,
|
|
});
|
|
|
|
final String title;
|
|
final String? subtitle;
|
|
final Widget body;
|
|
final Widget? footer;
|
|
final VoidCallback? onBack;
|
|
final bool compactHeaderTitle;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.surfaceSecondary,
|
|
body: SafeArea(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
if (compactHeaderTitle)
|
|
SizedBox(
|
|
height: 64,
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
widgets.PageHeader(
|
|
leading: widgets.BackButton(onPressed: onBack),
|
|
trailing: const SizedBox(
|
|
width: AppSpacing.xl * 2,
|
|
height: AppSpacing.xl * 2,
|
|
),
|
|
),
|
|
IgnorePointer(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: AppSpacing.xxl * 2,
|
|
),
|
|
child: Text(
|
|
title,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w700,
|
|
color: AppColors.slate900,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
else
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
widgets.PageHeader(
|
|
leading: widgets.BackButton(onPressed: onBack),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(
|
|
AppSpacing.xl,
|
|
AppSpacing.none,
|
|
AppSpacing.xl,
|
|
AppSpacing.sm,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: const TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w700,
|
|
color: AppColors.slate900,
|
|
),
|
|
),
|
|
if (subtitle != null && subtitle!.isNotEmpty) ...[
|
|
const SizedBox(height: AppSpacing.xs),
|
|
Text(
|
|
subtitle!,
|
|
style: const TextStyle(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.slate500,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.fromLTRB(
|
|
AppSpacing.xl,
|
|
AppSpacing.sm,
|
|
AppSpacing.xl,
|
|
AppSpacing.xl,
|
|
),
|
|
child: body,
|
|
),
|
|
),
|
|
if (footer != null)
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(
|
|
AppSpacing.xl,
|
|
AppSpacing.none,
|
|
AppSpacing.xl,
|
|
AppSpacing.xl,
|
|
),
|
|
child: Container(
|
|
padding: const EdgeInsets.all(AppSpacing.md),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.surfaceInfoLight,
|
|
borderRadius: BorderRadius.circular(AppRadius.xl),
|
|
border: Border.all(color: AppColors.borderTertiary),
|
|
),
|
|
child: footer,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|