2020-12-02 11:16:23 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class BrandHeader extends StatelessWidget {
|
|
|
|
const BrandHeader({
|
2022-06-05 22:36:32 +03:00
|
|
|
final super.key,
|
2022-05-24 21:55:39 +03:00
|
|
|
this.title = '',
|
2020-12-02 11:16:23 +02:00
|
|
|
this.hasBackButton = false,
|
2022-05-19 17:26:57 +03:00
|
|
|
this.onBackButtonPressed,
|
2022-06-05 22:36:32 +03:00
|
|
|
});
|
2020-12-02 11:16:23 +02:00
|
|
|
|
|
|
|
final String title;
|
|
|
|
final bool hasBackButton;
|
2022-05-19 17:26:57 +03:00
|
|
|
final VoidCallback? onBackButtonPressed;
|
2020-12-02 11:16:23 +02:00
|
|
|
|
|
|
|
@override
|
2022-10-04 13:34:56 +03:00
|
|
|
Widget build(final BuildContext context) => AppBar(
|
|
|
|
title: Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 4.0),
|
|
|
|
child: Text(title),
|
2022-06-06 01:40:34 +03:00
|
|
|
),
|
2022-10-04 13:34:56 +03:00
|
|
|
leading: hasBackButton
|
|
|
|
? IconButton(
|
|
|
|
icon: const Icon(Icons.arrow_back),
|
2022-06-06 01:40:34 +03:00
|
|
|
onPressed:
|
|
|
|
onBackButtonPressed ?? () => Navigator.of(context).pop(),
|
2022-10-04 13:34:56 +03:00
|
|
|
)
|
|
|
|
: null,
|
2022-06-06 01:40:34 +03:00
|
|
|
);
|
2020-12-02 11:16:23 +02:00
|
|
|
}
|