From 71bd5e5ad23307c0fe9d9329481f00014ac39fab Mon Sep 17 00:00:00 2001 From: Aliaksei Tratseuski Date: Wed, 15 May 2024 20:01:27 +0400 Subject: [PATCH] fix: brand_header now extends preferred_size_widget --- lib/ui/components/brand_header/brand_header.dart | 5 ++++- lib/ui/pages/more/more.dart | 7 ++----- lib/ui/pages/providers/providers.dart | 7 ++----- lib/ui/pages/services/services.dart | 7 ++----- lib/ui/pages/users/users.dart | 7 ++----- 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/lib/ui/components/brand_header/brand_header.dart b/lib/ui/components/brand_header/brand_header.dart index 56be04df..f2ba145f 100644 --- a/lib/ui/components/brand_header/brand_header.dart +++ b/lib/ui/components/brand_header/brand_header.dart @@ -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; diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 6e72bdd9..cf297328 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -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( diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index ec397805..8e70e609 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -65,11 +65,8 @@ class _ProvidersPageState extends State { 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( diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index 684af19a..15a1b3d9 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -37,11 +37,8 @@ class _ServicesPageState extends State { 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 diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index b7469a6e..ea282f95 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -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,