diff --git a/packages/wyatt_bloc_layout/lib/src/core/core.dart b/packages/wyatt_bloc_layout/lib/src/core/core.dart index e215b540..2916446f 100644 --- a/packages/wyatt_bloc_layout/lib/src/core/core.dart +++ b/packages/wyatt_bloc_layout/lib/src/core/core.dart @@ -15,3 +15,4 @@ // along with this program. If not, see . export './crud_cubit_consumer_screen_mixin.dart'; +export './mixins/mixins.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/core/mixins/gird_view_mixin.dart b/packages/wyatt_bloc_layout/lib/src/core/mixins/gird_view_mixin.dart new file mode 100644 index 00000000..c43cdbd2 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/core/mixins/gird_view_mixin.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/material.dart'; +import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; + +mixin GridLayoutMixin { + Widget gridChild(BuildContext context, SuccessType? successType); + + Widget successBuilder( + BuildContext context, + CrudListLoaded state, + ) => + GridLayout( + children: state.data.map((e) => gridChild(context, e)).toList(), + ); +} diff --git a/packages/wyatt_bloc_layout/lib/src/core/mixins/mixins.dart b/packages/wyatt_bloc_layout/lib/src/core/mixins/mixins.dart new file mode 100644 index 00000000..d5b9315f --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/core/mixins/mixins.dart @@ -0,0 +1,17 @@ +// 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 './gird_view_mixin.dart'; 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 index 407aafb3..24940e8a 100644 --- 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 @@ -15,6 +15,7 @@ // along with this program. If not, see . export './bottom_navigation_bar_bloc_layout.dart'; +export './bottom_navigation_bar_grid_layout_cubit_screen_crud_list.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'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..099d6b79 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_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 BottomNavigationBarGridLayoutCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends BottomNavigationBarLayoutCubitScreenCrudList + with GridLayoutMixin { + const BottomNavigationBarGridLayoutCubitScreenCrudList({ + 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.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart index b78b04f6..16cc1abf 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart @@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class BottomNavigationBarLayoutCubitScreenCrud< Cubit extends bloc_base.Cubit, - CrudSuccessType extends CrudSuccess> + CrudSuccessState extends CrudSuccess> extends BottomNavigationBarLayoutCubitScreen - with CrudMixin { + with CrudMixin { const BottomNavigationBarLayoutCubitScreenCrud({ super.custom, super.height, 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 index 8dd8c331..f2bbdb07 100644 --- 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 @@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class BottomNavigationBarLayoutCubitScreenCrudItem< - Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + Cubit extends bloc_base.Cubit, SuccessType extends Object?> extends BottomNavigationBarLayoutCubitScreenCrud> { + CrudLoaded> { const BottomNavigationBarLayoutCubitScreenCrudItem({ super.custom, super.height = 60, 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 index a59e2383..cce7f2a4 100644 --- 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 @@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class BottomNavigationBarLayoutCubitScreenCrudList< - Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + Cubit extends bloc_base.Cubit, SuccessType extends Object?> extends BottomNavigationBarLayoutCubitScreenCrud> { + CrudListLoaded> { const BottomNavigationBarLayoutCubitScreenCrudList({ super.custom, super.height = 60, diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_base.dart b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_base.dart index 598bdb16..a113c5ad 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_base.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_base.dart @@ -19,9 +19,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class CubitScreenCrudBase, - CrudSuccessType extends CrudSuccess> + CrudSuccessState extends CrudSuccess> extends CubitScreenBase - with CrudMixin { + with CrudMixin { const CubitScreenCrudBase({super.key}); @override diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_bloc_layout.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_bloc_layout.dart index 1f36b42e..3233fe28 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_bloc_layout.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_bloc_layout.dart @@ -15,6 +15,7 @@ // along with this program. If not, see . export './frame_bloc_layout.dart'; +export './frame_grid_layout_cubit_screen_crud_list.dart'; export './frame_layout_cubit_screen.dart'; export './frame_layout_cubit_screen_crud.dart'; export './frame_layout_cubit_screen_crud_item.dart'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..e62fea8c --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_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/wyatt_bloc_layout.dart'; + +abstract class FrameLayoutGridCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends FrameLayoutCubitScreenCrudList + with GridLayoutMixin { + const FrameLayoutGridCubitScreenCrudList({ + 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.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart index 5b51a842..a498490b 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart @@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class FrameLayoutCubitScreenCrud< Cubit extends bloc_base.Cubit, - CrudSuccessType extends CrudSuccess> + CrudSuccessState extends CrudSuccess> extends FrameLayoutCubitScreen - with CrudMixin { + with CrudMixin { const FrameLayoutCubitScreenCrud({ super.customAppBar, super.customBottomNavBar, 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 index ab414fae..92db37fa 100644 --- 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 @@ -18,8 +18,8 @@ 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> { + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends FrameLayoutCubitScreenCrud> { const FrameLayoutCubitScreenCrudItem({ super.customAppBar, super.customBottomNavBar, 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 index b6114ea4..8c38994a 100644 --- 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 @@ -18,8 +18,8 @@ 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> { + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends FrameLayoutCubitScreenCrud> { const FrameLayoutCubitScreenCrudList({ super.customAppBar, super.customBottomNavBar, diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/grid_cubit_screen_crud_list_base.dart b/packages/wyatt_bloc_layout/lib/src/presentation/grid_cubit_screen_crud_list_base.dart new file mode 100644 index 00000000..28931c40 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/grid_cubit_screen_crud_list_base.dart @@ -0,0 +1,24 @@ +// 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 GridCubitScreenCrudListBase< + Cubit extends bloc_base.Cubit, T extends Object?> + extends CubitScreenCrudListBase with GridLayoutMixin { + const GridCubitScreenCrudListBase({super.key}); +} diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart index 23cd177c..6cc49ed5 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_bloc_layout.dart @@ -15,6 +15,7 @@ // along with this program. If not, see . export './top_app_bar_bloc_layout.dart'; +export './top_app_bar_grid_layout_cubit_screen_crud_list.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'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..efc7ecdc --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_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 TopAppBarGridLayoutCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends TopAppBarLayoutCubitScreenCrudList + with GridLayoutMixin { + const TopAppBarGridLayoutCubitScreenCrudList({ + 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.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart index d106f397..1de4081a 100644 --- 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 @@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class TopAppBarLayoutCubitScreenCrud< Cubit extends bloc_base.Cubit, - CrudSuccessType extends CrudSuccess> + CrudSuccessState extends CrudSuccess> extends TopAppBarLayoutCubitScreen - with CrudMixin { + with CrudMixin { const TopAppBarLayoutCubitScreenCrud({ super.custom, super.height, 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 index efb19b6f..9e90c286 100644 --- 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 @@ -18,8 +18,8 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class TopAppBarLayoutCubitScreenCrudItem< - Cubit extends bloc_base.Cubit, SuccessItem extends Object?> - extends TopAppBarLayoutCubitScreenCrud> { + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends TopAppBarLayoutCubitScreenCrud> { const TopAppBarLayoutCubitScreenCrudItem({ super.custom, super.height = 60, 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 index 6640800a..9bc6047d 100644 --- 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 @@ -18,8 +18,8 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class TopAppBarLayoutCubitScreenCrudList< - Cubit extends bloc_base.Cubit, SuccessItem extends Object?> - extends TopAppBarLayoutCubitScreenCrud> { + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends TopAppBarLayoutCubitScreenCrud> { const TopAppBarLayoutCubitScreenCrudList({ super.custom, super.height = 60, diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart index c1677fbb..7697dd49 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_bloc_layout.dart @@ -15,6 +15,7 @@ // along with this program. If not, see . export './top_navigation_bar_bloc_layout.dart'; +export './top_navigation_bar_grid_layout_cubit_screen_crud_list.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'; diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart new file mode 100644 index 00000000..238079ba --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_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 TopNavigationBarGridLayoutCubitScreenCrudList< + Cubit extends bloc_base.Cubit, SuccessType extends Object?> + extends TopNavigationBarLayoutCubitScreenCrudList + with GridLayoutMixin { + const TopNavigationBarGridLayoutCubitScreenCrudList({ + 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.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart index 3c07fa5b..65bd7bff 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart @@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class TopNavigationBarLayoutCubitScreenCrud< Cubit extends bloc_base.Cubit, - CrudSuccessType extends CrudSuccess> + CrudSuccessState extends CrudSuccess> extends TopNavigationBarLayoutCubitScreen - with CrudMixin { + with CrudMixin { const TopNavigationBarLayoutCubitScreenCrud({ super.custom, super.height, 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 index 34cdc9ea..6b4c022b 100644 --- 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 @@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class TopNavigationBarLayoutCubitScreenCrudItem< - Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + Cubit extends bloc_base.Cubit, SuccessType extends Object?> extends TopNavigationBarLayoutCubitScreenCrud> { + CrudLoaded> { const TopNavigationBarLayoutCubitScreenCrudItem({ super.custom, super.height = 60, 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 index 5c4d0df7..0b04c6f2 100644 --- 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 @@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; abstract class TopNavigationBarLayoutCubitScreenCrudList< - Cubit extends bloc_base.Cubit, SuccessItem extends Object?> + Cubit extends bloc_base.Cubit, SuccessType extends Object?> extends TopNavigationBarLayoutCubitScreenCrud> { + CrudListLoaded> { const TopNavigationBarLayoutCubitScreenCrudList({ super.custom, super.height = 60, diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart new file mode 100644 index 00000000..e5215b69 --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart @@ -0,0 +1,17 @@ +// 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 './grid_layout.dart'; diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart new file mode 100644 index 00000000..891c649b --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart @@ -0,0 +1,76 @@ +// 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:gap/gap.dart'; + +class GridLayout extends StatelessWidget { + const GridLayout({ + required this.children, + this.verticalGap = 30, + this.horizontalGap = 30, + super.key, + }); + + final List children; + final double verticalGap; + final double horizontalGap; + + @override + Widget build(BuildContext context) { + if (children.isEmpty) { + return const SizedBox.shrink(); + } + + final childrenLeft = []; + final childrenRight = []; + + int i = 0; + for (final child in children) { + if (i.isEven) { + childrenLeft + ..add(child) + ..add(Gap(verticalGap)); + } else { + childrenRight + ..add(child) + ..add(Gap(verticalGap)); + } + i++; + } + + return Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + children: childrenLeft, + ), + ), + Gap(horizontalGap), + Expanded( + child: Column( + children: childrenRight, + ), + ), + ], + ), + ], + ); + } +} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart index 2edd15d5..41f839a8 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart @@ -31,3 +31,11 @@ abstract class Layout extends StatelessWidget { /// for the widget. const Layout({super.key}); } + +abstract class StructuralLayout extends Layout { + const StructuralLayout({super.key}); +} + +abstract class ContentLayout extends Layout { + const ContentLayout({super.key}); +} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/layouts.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layouts.dart new file mode 100644 index 00000000..09574c7b --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layouts.dart @@ -0,0 +1,18 @@ +// 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 './content_layouts/content_layouts.dart'; +export './structural_layouts/structural_layouts.dart'; diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/bottom_navigation_bar_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart similarity index 97% rename from packages/wyatt_ui_layout/lib/src/presentation/layouts/bottom_navigation_bar_layout.dart rename to packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart index 0f0bf02d..9b04b955 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/bottom_navigation_bar_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart @@ -29,7 +29,7 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; /// A concrete implementation of the [Layout] abstract class for a layout with /// a bottom navigation bar component. -class BottomNavigationBarLayout extends Layout { +class BottomNavigationBarLayout extends StructuralLayout { /// Creates a [BottomNavigationBarLayout] instance. /// /// [body] represents the main content of the layout. diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/frame_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart similarity index 98% rename from packages/wyatt_ui_layout/lib/src/presentation/layouts/frame_layout.dart rename to packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart index 8b5e3ce6..6c989cc0 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/frame_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart @@ -13,6 +13,7 @@ // // 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:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; @@ -24,7 +25,7 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; /// You can customize the app bar and the bottom navigation bar by passing /// a [customAppBar] and a [customBottomNavBar] functions that take /// the corresponding components and return the customized ones. -class FrameLayout extends Layout { +class FrameLayout extends StructuralLayout { /// Creates a [FrameLayout] instance. /// /// [body] represents the main content of the layout. diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart new file mode 100644 index 00000000..e22f407c --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart @@ -0,0 +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 . + +export './bottom_navigation_bar_layout.dart'; +export './frame_layout.dart'; +export './top_app_bar_layout.dart'; diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/top_app_bar_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart similarity index 97% rename from packages/wyatt_ui_layout/lib/src/presentation/layouts/top_app_bar_layout.dart rename to packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart index 2f3c781a..b9acfbdc 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/top_app_bar_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart @@ -34,7 +34,8 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; /// given [BuildContext]. /// /// [T] represents the type of the top bar component. -abstract class TopBarLayout extends Layout { +abstract class TopBarLayout + extends StructuralLayout { /// Creates a [TopBarLayout] instance. /// /// [body] represents the main content of the layout. diff --git a/packages/wyatt_ui_layout/lib/src/presentation/presentation.dart b/packages/wyatt_ui_layout/lib/src/presentation/presentation.dart index c1787ad7..8756e56f 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/presentation.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/presentation.dart @@ -14,6 +14,4 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export 'layouts/bottom_navigation_bar_layout.dart'; -export 'layouts/frame_layout.dart'; -export 'layouts/top_app_bar_layout.dart'; +export './layouts/layouts.dart'; diff --git a/packages/wyatt_ui_layout/pubspec.yaml b/packages/wyatt_ui_layout/pubspec.yaml index f62e4219..7c8703ed 100644 --- a/packages/wyatt_ui_layout/pubspec.yaml +++ b/packages/wyatt_ui_layout/pubspec.yaml @@ -11,6 +11,7 @@ environment: dependencies: flutter: sdk: flutter + gap: ^2.0.1 wyatt_ui_components: git: