From dd275460f6a81447475ae52544a094e9ded4f85c Mon Sep 17 00:00:00 2001 From: AN12345 Date: Mon, 12 Dec 2022 12:34:02 -0500 Subject: [PATCH] feat(ui_components): make app bar leading & actions customizable --- .../example/lib/components/custom_app_bar.dart | 4 +++- .../lib/src/domain/entities/component.dart | 16 ++++++++++++++++ .../lib/src/domain/entities/components.dart | 15 +++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart b/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart index 8bac84a7..384fdf8e 100644 --- a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart +++ b/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart @@ -10,7 +10,9 @@ class CustomAppBar extends AppBarComponent { ); @override - AppBarComponent configure({String? title}) => CustomAppBar( + AppBarComponent configure( + {String? title, Widget? leading, List? actions}) => + CustomAppBar( title: title ?? this.title, ); } diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/component.dart index 04e60ebc..ca2d18dc 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/component.dart @@ -1,3 +1,19 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import 'package:flutter/material.dart'; abstract class Component extends StatelessWidget { diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/components.dart b/packages/wyatt_ui_components/lib/src/domain/entities/components.dart index be6d79e2..a758ae6b 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/components.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/components.dart @@ -19,10 +19,21 @@ import 'package:wyatt_ui_components/src/domain/entities/component.dart'; abstract class AppBarComponent extends Component { final String? title; - const AppBarComponent({this.title, super.key}); + final Widget? leading; + final List? actions; + const AppBarComponent({ + this.title, + this.leading, + this.actions, + super.key, + }); @override - AppBarComponent configure({String? title}); + AppBarComponent configure({ + String? title, + Widget? leading, + List? actions, + }); } abstract class BottomNavigationBarComponent extends Component {