From 71efacd7f5c8be9187898fe26585f22a6e7dd82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Tue, 28 Feb 2023 13:57:27 +0100 Subject: [PATCH] feat(bloc_layout): rework on structure using new components and layouts --- .../wyatt_bloc_layout/example/lib/main.dart | 38 ++++++++----- .../bottom_navigation_bar_bloc_layout.dart | 21 ++++++++ ...m_navigation_bar_layout_cubit_screen.dart} | 16 +++--- ...igation_bar_layout_cubit_screen_crud.dart} | 24 ++++----- ...ion_bar_layout_cubit_screen_crud_item.dart | 30 +++++++++++ ...ion_bar_layout_cubit_screen_crud_list.dart | 30 +++++++++++ ...bar_layout_crud_cubit_consumer_screen.dart | 51 ------------------ ...bar_layout_crud_cubit_consumer_screen.dart | 47 ---------------- ...ame_layout_crud_cubit_consumer_screen.dart | 53 ------------------- .../bases.dart => cubit_screen_base.dart} | 10 ++-- ...creen.dart => cubit_screen_crud_base.dart} | 21 +++----- .../cubit_screen_crud_item_base.dart | 23 ++++++++ .../cubit_screen_crud_list_base.dart | 23 ++++++++ .../frame_bloc_layout.dart} | 9 ++-- .../frame_layout_cubit_screen.dart | 23 ++++---- .../frame_layout_cubit_screen_crud.dart} | 26 +++++---- .../frame_layout_cubit_screen_crud_item.dart | 29 ++++++++++ .../frame_layout_cubit_screen_crud_list.dart | 29 ++++++++++ .../lib/src/presentation/presentation.dart | 10 +++- .../app_bar_layout_crud_cubit_screen.dart | 51 ------------------ .../bottom_bar_layout_crud_cubit_screen.dart | 47 ---------------- .../src/presentation/screens/crud/crud.dart | 20 ------- .../crud/frame_layout_crud_cubit_screen.dart | 53 ------------------- .../lib/src/presentation/screens/screens.dart | 18 ------- .../top_app_bar_bloc_layout.dart} | 8 +-- .../top_app_bar_layout_cubit_screen.dart} | 26 ++++----- .../top_app_bar_layout_cubit_screen_crud.dart | 36 +++++++++++++ ...app_bar_layout_cubit_screen_crud_item.dart | 29 ++++++++++ ...app_bar_layout_cubit_screen_crud_list.dart | 29 ++++++++++ .../top_navigation_bar_bloc_layout.dart} | 7 ++- ...p_navigation_bar_layout_cubit_screen.dart} | 22 ++++---- ...igation_bar_layout_cubit_screen_crud.dart} | 25 ++++----- ...ion_bar_layout_cubit_screen_crud_item.dart | 30 +++++++++++ ...ion_bar_layout_cubit_screen_crud_list.dart | 30 +++++++++++ .../lib/src/domain/entities/bars/bars.dart | 2 +- .../bars/top_navigation_bar_component.dart | 1 - 36 files changed, 479 insertions(+), 468 deletions(-) create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_bloc_layout.dart rename packages/wyatt_bloc_layout/lib/src/presentation/{consumers/bases/bottom_bar_layout_cubit_consumer_screen.dart => bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart} (71%) rename packages/wyatt_bloc_layout/lib/src/presentation/{consumers/crud/crud_cubit_consumer_screen.dart => bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart} (64%) create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/app_bar_layout_crud_cubit_consumer_screen.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/bottom_bar_layout_crud_cubit_consumer_screen.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/frame_layout_crud_cubit_consumer_screen.dart rename packages/wyatt_bloc_layout/lib/src/presentation/{screens/bases/bases.dart => cubit_screen_base.dart} (70%) rename packages/wyatt_bloc_layout/lib/src/presentation/{screens/bases/bottom_bar_layout_cubit_screen.dart => cubit_screen_crud_base.dart} (68%) create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_list_base.dart rename packages/wyatt_bloc_layout/lib/src/presentation/{consumers/crud/crud.dart => frame_bloc_layout/frame_bloc_layout.dart} (75%) rename packages/wyatt_bloc_layout/lib/src/presentation/{screens/bases => frame_bloc_layout}/frame_layout_cubit_screen.dart (68%) rename packages/wyatt_bloc_layout/lib/src/presentation/{screens/crud/crud_cubit_screen.dart => frame_bloc_layout/frame_layout_cubit_screen_crud.dart} (63%) create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/app_bar_layout_crud_cubit_screen.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/bottom_bar_layout_crud_cubit_screen.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/crud.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/frame_layout_crud_cubit_screen.dart delete mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/screens/screens.dart rename packages/wyatt_bloc_layout/lib/src/presentation/{consumers/bases/bases.dart => top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart} (73%) rename packages/wyatt_bloc_layout/lib/src/presentation/{consumers/bases/frame_layout_cubit_consumer_screen.dart => top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart} (64%) create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart rename packages/wyatt_bloc_layout/lib/src/presentation/{consumers/consumers.dart => top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart} (70%) rename packages/wyatt_bloc_layout/lib/src/presentation/{consumers/bases/app_bar_layout_cubit_consumer_screen.dart => top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart} (65%) rename packages/wyatt_bloc_layout/lib/src/presentation/{screens/bases/app_bar_layout_cubit_screen.dart => top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart} (67%) create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart diff --git a/packages/wyatt_bloc_layout/example/lib/main.dart b/packages/wyatt_bloc_layout/example/lib/main.dart index e5f0207a..4542215e 100644 --- a/packages/wyatt_bloc_layout/example/lib/main.dart +++ b/packages/wyatt_bloc_layout/example/lib/main.dart @@ -62,13 +62,13 @@ class MyApp extends StatelessWidget { Expanded( child: BlocProvider( create: (_) => ExampleCubit()..run(), - child: const ExampleFrameLayoutCrudConsumer(), + child: ExampleFrameLayoutCrudConsumer(), ), ), Expanded( child: BlocProvider( create: (_) => ExampleCubit()..runList(), - child: const ExampleFrameLayoutCrudListConsumer(), + child: ExampleFrameLayoutCrudListConsumer(), ), ), ], @@ -82,7 +82,7 @@ class MyApp extends StatelessWidget { } class ExampleCrudStateManagement - extends CrudCubitConsumerScreen { + extends CubitScreenCrudItemBase { const ExampleCrudStateManagement({super.key}); @override @@ -91,10 +91,13 @@ class ExampleCrudStateManagement @override Widget successBuilder(BuildContext context, CrudLoaded state) => Center(child: Text(state.data ?? 'errors')); + + @override + ExampleCubit create(BuildContext context) => ExampleCubit()..run(); } class ExampleListCrudStateManagement - extends CrudListCubitConsumerScreen { + extends CubitScreenCrudListBase { const ExampleListCrudStateManagement({super.key}); @override @@ -106,27 +109,35 @@ class ExampleListCrudStateManagement mainAxisAlignment: MainAxisAlignment.center, children: state.data.map((e) => Text(e ?? 'error')).toList(), ); + + @override + ExampleCubit create(BuildContext context) => ExampleCubit()..run(); } class ExampleFrameLayoutCrudConsumer - extends FrameLayoutCrudCubitConsumerScreen { - const ExampleFrameLayoutCrudConsumer({super.key}) + extends FrameLayoutCubitScreenCrudItem { + ExampleFrameLayoutCrudConsumer({super.key}) : super( - title: 'Example Title', - currentIndex: 0, + customAppBar: (bar) => bar?.copyWith.title( + 'Example Title'.wrap(), + ), ); @override Widget successBuilder(BuildContext context, CrudLoaded state) => Center(child: Text(state.data ?? 'errors')); + + @override + ExampleCubit create(BuildContext context) => ExampleCubit()..run(); } class ExampleFrameLayoutCrudListConsumer - extends FrameLayoutCrudListCubitConsumerScreen { - const ExampleFrameLayoutCrudListConsumer({super.key}) + extends FrameLayoutCubitScreenCrudList { + ExampleFrameLayoutCrudListConsumer({super.key}) : super( - title: 'Example Title', - currentIndex: 0, + customAppBar: (bar) => bar?.copyWith.title( + 'Example Title'.wrap(), + ), ); @override @@ -135,4 +146,7 @@ class ExampleFrameLayoutCrudListConsumer mainAxisAlignment: MainAxisAlignment.center, children: state.data.map((e) => Text(e ?? 'error')).toList(), ); + + @override + ExampleCubit create(BuildContext context) => ExampleCubit()..run(); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_bloc_layout.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_bloc_layout.dart new file mode 100644 index 00000000..407aafb3 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_bloc_layout.dart @@ -0,0 +1,21 @@ +// 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 . + +export './bottom_navigation_bar_bloc_layout.dart'; +export './bottom_navigation_bar_layout_cubit_screen.dart'; +export './bottom_navigation_bar_layout_cubit_screen_crud.dart'; +export './bottom_navigation_bar_layout_cubit_screen_crud_item.dart'; +export './bottom_navigation_bar_layout_cubit_screen_crud_list.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/bottom_bar_layout_cubit_consumer_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart similarity index 71% rename from packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/bottom_bar_layout_cubit_consumer_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart index 0b2cab99..32d1eb93 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/bottom_bar_layout_cubit_consumer_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart @@ -16,23 +16,27 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/cubit_screen_base.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; -abstract class BottomBarLayoutCubitConsumerScreen< +abstract class BottomNavigationBarLayoutCubitScreen< Cubit extends bloc_base.Cubit, - State extends Object> extends CubitConsumerScreen { - const BottomBarLayoutCubitConsumerScreen({ - this.currentIndex, + State extends Object> extends CubitScreenBase { + const BottomNavigationBarLayoutCubitScreen({ + this.custom, + this.height = 60, super.key, }); - final int? currentIndex; + final double height; + final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? + custom; @override Widget parent(BuildContext context, Widget child) => BottomNavigationBarLayout( - currentIndex: currentIndex, + custom: custom, body: child, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/crud_cubit_consumer_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart similarity index 64% rename from packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/crud_cubit_consumer_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart index 9a36e4a8..ee7c347c 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/crud_cubit_consumer_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart @@ -16,23 +16,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; -abstract class CrudCubitConsumerScreen, - T extends Object?> extends CubitConsumerScreen - with CrudMixin> { - const CrudCubitConsumerScreen({super.key}); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class CrudListCubitConsumerScreen< +abstract class BottomNavigationBarLayoutCubitScreenCrud< Cubit extends bloc_base.Cubit, - T extends Object?> extends CubitConsumerScreen - with CrudMixin> { - const CrudListCubitConsumerScreen({super.key}); + CrudSuccessType extends CrudSuccess> + extends BottomNavigationBarLayoutCubitScreen + with CrudMixin { + const BottomNavigationBarLayoutCubitScreenCrud({ + super.custom, + super.height, + super.key, + }); @override Widget onBuild(BuildContext context, CrudState state) => diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart new file mode 100644 index 00000000..719b977a --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart @@ -0,0 +1,30 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class BottomNavigationBarLayoutCubitScreenCrudItem< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends BottomNavigationBarLayoutCubitScreenCrud> { + const BottomNavigationBarLayoutCubitScreenCrudItem({ + super.custom, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..f946bb1b --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart @@ -0,0 +1,30 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class BottomNavigationBarLayoutCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends BottomNavigationBarLayoutCubitScreenCrud> { + const BottomNavigationBarLayoutCubitScreenCrudList({ + super.custom, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/app_bar_layout_crud_cubit_consumer_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/app_bar_layout_crud_cubit_consumer_screen.dart deleted file mode 100644 index 5e16c8b9..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/app_bar_layout_crud_cubit_consumer_screen.dart +++ /dev/null @@ -1,51 +0,0 @@ -// 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/widgets.dart'; -import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; -import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; - -abstract class AppBarLayoutCrudCubitConsumerScreen< - Cubit extends bloc_base.Cubit, T extends Object?> - extends AppBarLayoutCubitConsumerScreen - with CrudMixin> { - const AppBarLayoutCrudCubitConsumerScreen({ - super.title, - super.leading, - super.actions, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class AppBarLayoutCrudListCubitConsumerScreen< - Cubit extends bloc_base.Cubit, T extends Object?> - extends AppBarLayoutCubitConsumerScreen - with CrudMixin> { - const AppBarLayoutCrudListCubitConsumerScreen({ - super.title, - super.leading, - super.actions, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/bottom_bar_layout_crud_cubit_consumer_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/bottom_bar_layout_crud_cubit_consumer_screen.dart deleted file mode 100644 index 2cfd586b..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/bottom_bar_layout_crud_cubit_consumer_screen.dart +++ /dev/null @@ -1,47 +0,0 @@ -// 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'; -import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; -import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; - -abstract class BottomBarLayoutCrudCubitConsumerScreen< - Cubit extends bloc_base.Cubit, T extends Object?> - extends BottomBarLayoutCubitConsumerScreen - with CrudMixin> { - const BottomBarLayoutCrudCubitConsumerScreen({ - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class BottomBarLayoutCrudListCubitConsumerScreen< - Cubit extends bloc_base.Cubit, T extends Object?> - extends BottomBarLayoutCubitConsumerScreen - with CrudMixin> { - const BottomBarLayoutCrudListCubitConsumerScreen({ - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/frame_layout_crud_cubit_consumer_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/frame_layout_crud_cubit_consumer_screen.dart deleted file mode 100644 index 48d5c73d..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/frame_layout_crud_cubit_consumer_screen.dart +++ /dev/null @@ -1,53 +0,0 @@ -// 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'; -import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; -import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; - -abstract class FrameLayoutCrudCubitConsumerScreen< - Cubit extends bloc_base.Cubit, T extends Object?> - extends FrameLayoutCubitConsumerScreen - with CrudMixin> { - const FrameLayoutCrudCubitConsumerScreen({ - super.title, - super.leading, - super.actions, - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class FrameLayoutCrudListCubitConsumerScreen< - Cubit extends bloc_base.Cubit, T extends Object?> - extends FrameLayoutCubitConsumerScreen - with CrudMixin> { - const FrameLayoutCrudListCubitConsumerScreen({ - super.title, - super.leading, - super.actions, - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/bases.dart b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_base.dart similarity index 70% rename from packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/bases.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_base.dart index 1b44493c..b4848316 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/bases.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_base.dart @@ -14,6 +14,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export 'app_bar_layout_cubit_screen.dart'; -export 'bottom_bar_layout_cubit_screen.dart'; -export 'frame_layout_cubit_screen.dart'; +import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class CubitScreenBase, + State extends Object> extends CubitScreen { + const CubitScreenBase({super.key}); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/bottom_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_base.dart similarity index 68% rename from packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/bottom_bar_layout_cubit_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_base.dart index d864dbab..598bdb16 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/bottom_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_base.dart @@ -16,22 +16,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; - import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; -abstract class BottomBarLayoutCubitScreen, - State extends Object> extends CubitScreen { - const BottomBarLayoutCubitScreen({ - this.currentIndex, - super.key, - }); - - final int? currentIndex; +abstract class CubitScreenCrudBase, + CrudSuccessType extends CrudSuccess> + extends CubitScreenBase + with CrudMixin { + const CubitScreenCrudBase({super.key}); @override - Widget parent(BuildContext context, Widget child) => - BottomNavigationBarLayout( - currentIndex: currentIndex, - body: child, - ); + Widget onBuild(BuildContext context, CrudState state) => + crudBuilder(context, state); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart new file mode 100644 index 00000000..5e81a799 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart @@ -0,0 +1,23 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class CubitScreenCrudItemBase, + T extends Object?> extends CubitScreenCrudBase> { + const CubitScreenCrudItemBase({super.key}); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_list_base.dart b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_list_base.dart new file mode 100644 index 00000000..d641b6b5 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_list_base.dart @@ -0,0 +1,23 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class CubitScreenCrudListBase, + T extends Object?> extends CubitScreenCrudBase> { + const CubitScreenCrudListBase({super.key}); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_bloc_layout.dart similarity index 75% rename from packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/crud.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_bloc_layout.dart index a444cf2b..1f36b42e 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/crud/crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_bloc_layout.dart @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export './app_bar_layout_crud_cubit_consumer_screen.dart'; -export './bottom_bar_layout_crud_cubit_consumer_screen.dart'; -export './crud_cubit_consumer_screen.dart'; -export './frame_layout_crud_cubit_consumer_screen.dart'; +export './frame_bloc_layout.dart'; +export './frame_layout_cubit_screen.dart'; +export './frame_layout_cubit_screen_crud.dart'; +export './frame_layout_cubit_screen_crud_item.dart'; +export './frame_layout_cubit_screen_crud_list.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/frame_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart similarity index 68% rename from packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/frame_layout_cubit_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart index 769664a2..10248fdc 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/frame_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart @@ -16,28 +16,29 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/cubit_screen_base.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class FrameLayoutCubitScreen, - State extends Object> extends CubitScreen { + State extends Object> extends CubitScreenBase { const FrameLayoutCubitScreen({ - this.title, - this.leading, - this.actions, - this.currentIndex, + this.customAppBar, + this.customBottomNavBar, + this.height = 60, super.key, }); - final int? currentIndex; - final String? title; - final Widget? leading; - final List? actions; + final TopAppBarComponent? Function(TopAppBarComponent?)? customAppBar; + final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? + customBottomNavBar; + final double height; @override Widget parent(BuildContext context, Widget child) => FrameLayout( - title: title, - currentIndex: currentIndex, + customAppBar: customAppBar, + customBottomNavBar: customBottomNavBar, + height: height, body: child, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/crud_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart similarity index 63% rename from packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/crud_cubit_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart index b256af58..45333c20 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/crud_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart @@ -16,22 +16,20 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; -abstract class CrudCubitScreen, - T extends Object?> extends CubitScreen - with CrudMixin> { - const CrudCubitScreen({super.key}); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class CrudListCubitScreen, - T extends Object?> extends CubitScreen - with CrudMixin> { - const CrudListCubitScreen({super.key}); +abstract class FrameLayoutCubitScreenCrud< + Cubit extends bloc_base.Cubit, + CrudSuccessType extends CrudSuccess> + extends FrameLayoutCubitScreen + with CrudMixin { + const FrameLayoutCubitScreenCrud({ + super.customAppBar, + super.customBottomNavBar, + super.height, + super.key, + }); @override Widget onBuild(BuildContext context, CrudState state) => diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart new file mode 100644 index 00000000..ab414fae --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart @@ -0,0 +1,29 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class FrameLayoutCubitScreenCrudItem< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends FrameLayoutCubitScreenCrud> { + const FrameLayoutCubitScreenCrudItem({ + super.customAppBar, + super.customBottomNavBar, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..b6114ea4 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart @@ -0,0 +1,29 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class FrameLayoutCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends FrameLayoutCubitScreenCrud> { + const FrameLayoutCubitScreenCrudList({ + super.customAppBar, + super.customBottomNavBar, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/presentation.dart b/packages/wyatt_bloc_layout/lib/src/presentation/presentation.dart index f5c14cde..61e6c26b 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/presentation.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/presentation.dart @@ -14,5 +14,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export 'consumers/consumers.dart'; -export 'screens/screens.dart'; +export './bottom_navigation_bar_bloc_layout/bottom_navigation_bar_bloc_layout.dart'; +export './cubit_screen_base.dart'; +export './cubit_screen_crud_base.dart'; +export './cubit_screen_crud_item_base.dart'; +export './cubit_screen_crud_list_base.dart'; +export './frame_bloc_layout/frame_bloc_layout.dart'; +export './top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart'; +export './top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/app_bar_layout_crud_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/app_bar_layout_crud_cubit_screen.dart deleted file mode 100644 index 4cda2415..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/app_bar_layout_crud_cubit_screen.dart +++ /dev/null @@ -1,51 +0,0 @@ -// 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'; -import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; -import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; - -abstract class AppBarLayoutCrudCubitScreen< - Cubit extends bloc_base.Cubit, - T extends Object?> extends AppBarLayoutCubitScreen - with CrudMixin> { - const AppBarLayoutCrudCubitScreen({ - super.title, - super.leading, - super.actions, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class AppBarLayoutCrudListCubitScreen< - Cubit extends bloc_base.Cubit, - T extends Object?> extends AppBarLayoutCubitScreen - with CrudMixin> { - const AppBarLayoutCrudListCubitScreen({ - super.title, - super.leading, - super.actions, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/bottom_bar_layout_crud_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/bottom_bar_layout_crud_cubit_screen.dart deleted file mode 100644 index 5e79311d..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/bottom_bar_layout_crud_cubit_screen.dart +++ /dev/null @@ -1,47 +0,0 @@ -// 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'; -import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; -import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; - -abstract class BottomBarLayoutCrudCubitScreen< - Cubit extends bloc_base.Cubit, - T extends Object?> extends BottomBarLayoutCubitScreen - with CrudMixin> { - const BottomBarLayoutCrudCubitScreen({ - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class BottomBarLayoutCrudListCubitScreen< - Cubit extends bloc_base.Cubit, - T extends Object?> extends BottomBarLayoutCubitScreen - with CrudMixin> { - const BottomBarLayoutCrudListCubitScreen({ - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/crud.dart deleted file mode 100644 index 40e3aca4..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/crud.dart +++ /dev/null @@ -1,20 +0,0 @@ -// 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 . - -export './crud_cubit_screen.dart'; -export 'app_bar_layout_crud_cubit_screen.dart'; -export 'bottom_bar_layout_crud_cubit_screen.dart'; -export 'frame_layout_crud_cubit_screen.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/frame_layout_crud_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/frame_layout_crud_cubit_screen.dart deleted file mode 100644 index 2f738e5d..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/crud/frame_layout_crud_cubit_screen.dart +++ /dev/null @@ -1,53 +0,0 @@ -// 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'; -import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; -import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; - -abstract class FrameLayoutCrudCubitScreen< - Cubit extends bloc_base.Cubit, - T extends Object?> extends FrameLayoutCubitScreen - with CrudMixin> { - const FrameLayoutCrudCubitScreen({ - super.title, - super.leading, - super.actions, - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} - -abstract class FrameLayoutCrudListCubitScreen< - Cubit extends bloc_base.Cubit, - T extends Object?> extends FrameLayoutCubitScreen - with CrudMixin> { - const FrameLayoutCrudListCubitScreen({ - super.title, - super.leading, - super.actions, - super.currentIndex, - super.key, - }); - - @override - Widget onBuild(BuildContext context, CrudState state) => - crudBuilder(context, state); -} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/screens.dart b/packages/wyatt_bloc_layout/lib/src/presentation/screens/screens.dart deleted file mode 100644 index 57ee4935..00000000 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/screens.dart +++ /dev/null @@ -1,18 +0,0 @@ -// 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 . - -export './bases/bases.dart'; -export './crud/crud.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/bases.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart similarity index 73% rename from packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/bases.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart index 08af9be8..23cd177c 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/bases.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export './app_bar_layout_cubit_consumer_screen.dart'; -export './bottom_bar_layout_cubit_consumer_screen.dart'; -export './frame_layout_cubit_consumer_screen.dart'; +export './top_app_bar_bloc_layout.dart'; +export './top_app_bar_layout_cubit_screen.dart'; +export './top_app_bar_layout_cubit_screen_crud.dart'; +export './top_app_bar_layout_cubit_screen_crud_item.dart'; +export './top_app_bar_layout_cubit_screen_crud_list.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/frame_layout_cubit_consumer_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart similarity index 64% rename from packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/frame_layout_cubit_consumer_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart index 71a5e661..d15032ad 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/frame_layout_cubit_consumer_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart @@ -16,29 +16,25 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/cubit_screen_base.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; -abstract class FrameLayoutCubitConsumerScreen< - Cubit extends bloc_base.Cubit, - State extends Object> extends CubitConsumerScreen { - const FrameLayoutCubitConsumerScreen({ - this.title, - this.leading, - this.actions, - this.currentIndex, +abstract class TopAppBarLayoutCubitScreen, + State extends Object> extends CubitScreenBase { + const TopAppBarLayoutCubitScreen({ + this.custom, + this.height = 60, super.key, }); - final int? currentIndex; - final String? title; - final Widget? leading; - final List? actions; + final double height; + final TopAppBarComponent? Function(TopAppBarComponent?)? custom; @override - Widget parent(BuildContext context, Widget child) => FrameLayout( - title: title, - currentIndex: currentIndex, + Widget parent(BuildContext context, Widget child) => TopAppBarLayout( + height: height, + custom: custom, body: child, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart new file mode 100644 index 00000000..8fe9e332 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart @@ -0,0 +1,36 @@ +// 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'; +import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class TopAppBarLayoutCubitScreenCrud< + Cubit extends bloc_base.Cubit, + CrudSuccessType extends CrudSuccess> + extends TopAppBarLayoutCubitScreen + with CrudMixin { + const TopAppBarLayoutCubitScreenCrud({ + super.custom, + super.height, + super.key, + }); + + @override + Widget onBuild(BuildContext context, CrudState state) => + crudBuilder(context, state); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart new file mode 100644 index 00000000..9c3e7b45 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart @@ -0,0 +1,29 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class TopAppBarLayoutCubitScreenCrudItem< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends TopAppBarLayoutCubitScreenCrud> { + const TopAppBarLayoutCubitScreenCrudItem({ + super.custom, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..433f8060 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart @@ -0,0 +1,29 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class TopAppBarLayoutCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends TopAppBarLayoutCubitScreenCrud> { + const TopAppBarLayoutCubitScreenCrudList({ + super.custom, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/consumers.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart similarity index 70% rename from packages/wyatt_bloc_layout/lib/src/presentation/consumers/consumers.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart index 7cac2b7f..c1677fbb 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/consumers.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart @@ -14,5 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export 'bases/bases.dart'; -export 'crud/crud.dart'; +export './top_navigation_bar_bloc_layout.dart'; +export './top_navigation_bar_layout_cubit_screen.dart'; +export './top_navigation_bar_layout_cubit_screen_crud.dart'; +export './top_navigation_bar_layout_cubit_screen_crud_item.dart'; +export './top_navigation_bar_layout_cubit_screen_crud_list.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/app_bar_layout_cubit_consumer_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart similarity index 65% rename from packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/app_bar_layout_cubit_consumer_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart index d12706cd..5ab3ca10 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/consumers/bases/app_bar_layout_cubit_consumer_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart @@ -16,26 +16,26 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/cubit_screen_base.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; -abstract class AppBarLayoutCubitConsumerScreen< +abstract class TopNavigationBarLayoutCubitScreen< Cubit extends bloc_base.Cubit, - State extends Object> extends CubitConsumerScreen { - const AppBarLayoutCubitConsumerScreen({ - this.title, - this.leading, - this.actions, + State extends Object> extends CubitScreenBase { + const TopNavigationBarLayoutCubitScreen({ + this.custom, + this.height = 60, super.key, }); - final String? title; - final Widget? leading; - final List? actions; + final double height; + final TopNavigationBarComponent? Function(TopNavigationBarComponent?)? custom; @override - Widget parent(BuildContext context, Widget child) => AppBarLayout( - title: title, + Widget parent(BuildContext context, Widget child) => TopNavigationBarLayout( + height: height, + custom: custom, body: child, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/app_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart similarity index 67% rename from packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/app_bar_layout_cubit_screen.dart rename to packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart index ce82fccb..3c07fa5b 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/screens/bases/app_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart @@ -16,25 +16,20 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; - import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; -abstract class AppBarLayoutCubitScreen, - State extends Object> extends CubitScreen { - const AppBarLayoutCubitScreen({ - this.title, - this.leading, - this.actions, +abstract class TopNavigationBarLayoutCubitScreenCrud< + Cubit extends bloc_base.Cubit, + CrudSuccessType extends CrudSuccess> + extends TopNavigationBarLayoutCubitScreen + with CrudMixin { + const TopNavigationBarLayoutCubitScreenCrud({ + super.custom, + super.height, super.key, }); - final String? title; - final Widget? leading; - final List? actions; - @override - Widget parent(BuildContext context, Widget child) => AppBarLayout( - title: title, - body: child, - ); + Widget onBuild(BuildContext context, CrudState state) => + crudBuilder(context, state); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart new file mode 100644 index 00000000..368a90bd --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart @@ -0,0 +1,30 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class TopNavigationBarLayoutCubitScreenCrudItem< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends TopNavigationBarLayoutCubitScreenCrud> { + const TopNavigationBarLayoutCubitScreenCrudItem({ + super.custom, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..3e50b826 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart @@ -0,0 +1,30 @@ +// 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_bloc/flutter_bloc.dart' as bloc_base; +import 'package:wyatt_bloc_layout/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +abstract class TopNavigationBarLayoutCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + extends TopNavigationBarLayoutCubitScreenCrud> { + const TopNavigationBarLayoutCubitScreenCrudList({ + super.custom, + super.height = 60, + super.key, + }); +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/bars/bars.dart b/packages/wyatt_ui_components/lib/src/domain/entities/bars/bars.dart index 9f391172..a09ee312 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/bars/bars.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/bars/bars.dart @@ -15,6 +15,6 @@ // along with this program. If not, see . export './bottom_navigation_bar_component.dart'; -export './top_navigation_bar_component.dart'; export './top_app_bar_component.dart'; export './top_bar_component.dart'; +export './top_navigation_bar_component.dart'; diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/bars/top_navigation_bar_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/bars/top_navigation_bar_component.dart index 3f9304ec..4d6a2e05 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/bars/top_navigation_bar_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/bars/top_navigation_bar_component.dart @@ -17,7 +17,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; -import 'package:wyatt_ui_components/src/domain/entities/bars/top_bar_component.dart'; import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; part 'top_navigation_bar_component.g.dart';