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

View file

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

View file

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

View file

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

View file

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