fix: brand_header now extends preferred_size_widget

This commit is contained in:
Aliaksei Tratseuski 2024-05-15 20:01:27 +04:00
parent 70b2fc28ab
commit 71bd5e5ad2
5 changed files with 12 additions and 21 deletions

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
class BrandHeader extends StatelessWidget {
class BrandHeader extends StatelessWidget implements PreferredSizeWidget {
const BrandHeader({
super.key,
this.title = '',
@ -8,6 +8,9 @@ class BrandHeader extends StatelessWidget {
this.onBackButtonPressed,
});
@override
Size get preferredSize => const Size.fromHeight(52.0);
final String title;
final bool hasBackButton;
final VoidCallback? onBackButtonPressed;

View file

@ -21,11 +21,8 @@ class MorePage extends StatelessWidget {
return Scaffold(
appBar: Breakpoints.small.isActive(context)
? PreferredSize(
preferredSize: const Size.fromHeight(52),
child: BrandHeader(
title: 'basis.more'.tr(),
),
? BrandHeader(
title: 'basis.more'.tr(),
)
: null,
body: ListView(

View file

@ -65,11 +65,8 @@ class _ProvidersPageState extends State<ProvidersPage> {
return Scaffold(
appBar: Breakpoints.small.isActive(context)
? PreferredSize(
preferredSize: const Size.fromHeight(52),
child: BrandHeader(
title: 'basis.providers_title'.tr(),
),
? BrandHeader(
title: 'basis.providers_title'.tr(),
)
: null,
body: ListView(

View file

@ -37,11 +37,8 @@ class _ServicesPageState extends State<ServicesPage> {
return Scaffold(
appBar: Breakpoints.small.isActive(context)
? PreferredSize(
preferredSize: const Size.fromHeight(52),
child: BrandHeader(
title: 'basis.services'.tr(),
),
? BrandHeader(
title: 'basis.services'.tr(),
)
: null,
body: !isReady

View file

@ -129,11 +129,8 @@ class UsersPage extends StatelessWidget {
return Scaffold(
appBar: Breakpoints.small.isActive(context)
? PreferredSize(
preferredSize: const Size.fromHeight(52),
child: BrandHeader(
title: 'basis.users'.tr(),
),
? BrandHeader(
title: 'basis.users'.tr(),
)
: null,
body: child,