master #81

Closed
malo wants to merge 322 commits from master into feat/bloc_layout/new-package
35 changed files with 364 additions and 32 deletions
Showing only changes of commit 89ce553fa2 - Show all commits

View File

@ -15,3 +15,4 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './crud_cubit_consumer_screen_mixin.dart'; export './crud_cubit_consumer_screen_mixin.dart';
export './mixins/mixins.dart';

View File

@ -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 <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
mixin GridLayoutMixin<SuccessType extends Object?> {
Widget gridChild(BuildContext context, SuccessType? successType);
Widget successBuilder(
BuildContext context,
CrudListLoaded<SuccessType> state,
) =>
GridLayout(
children: state.data.map((e) => gridChild(context, e)).toList(),
);
}

View File

@ -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 <https://www.gnu.org/licenses/>.
export './gird_view_mixin.dart';

View File

@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './bottom_navigation_bar_bloc_layout.dart'; 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.dart';
export './bottom_navigation_bar_layout_cubit_screen_crud.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_item.dart';

View File

@ -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 <https://www.gnu.org/licenses/>.
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<CrudState>, SuccessType extends Object?>
extends BottomNavigationBarLayoutCubitScreenCrudList<Cubit, SuccessType>
with GridLayoutMixin<SuccessType> {
const BottomNavigationBarGridLayoutCubitScreenCrudList({
super.custom,
super.height = 60,
super.key,
});
}

View File

@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class BottomNavigationBarLayoutCubitScreenCrud< abstract class BottomNavigationBarLayoutCubitScreenCrud<
Cubit extends bloc_base.Cubit<CrudState>, Cubit extends bloc_base.Cubit<CrudState>,
CrudSuccessType extends CrudSuccess> CrudSuccessState extends CrudSuccess>
extends BottomNavigationBarLayoutCubitScreen<Cubit, CrudState> extends BottomNavigationBarLayoutCubitScreen<Cubit, CrudState>
with CrudMixin<Cubit, CrudSuccessType> { with CrudMixin<Cubit, CrudSuccessState> {
const BottomNavigationBarLayoutCubitScreenCrud({ const BottomNavigationBarLayoutCubitScreenCrud({
super.custom, super.custom,
super.height, super.height,

View File

@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class BottomNavigationBarLayoutCubitScreenCrudItem< abstract class BottomNavigationBarLayoutCubitScreenCrudItem<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends BottomNavigationBarLayoutCubitScreenCrud<Cubit, extends BottomNavigationBarLayoutCubitScreenCrud<Cubit,
CrudLoaded<SuccessItem>> { CrudLoaded<SuccessType>> {
const BottomNavigationBarLayoutCubitScreenCrudItem({ const BottomNavigationBarLayoutCubitScreenCrudItem({
super.custom, super.custom,
super.height = 60, super.height = 60,

View File

@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class BottomNavigationBarLayoutCubitScreenCrudList< abstract class BottomNavigationBarLayoutCubitScreenCrudList<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends BottomNavigationBarLayoutCubitScreenCrud<Cubit, extends BottomNavigationBarLayoutCubitScreenCrud<Cubit,
CrudLoaded<SuccessItem>> { CrudListLoaded<SuccessType>> {
const BottomNavigationBarLayoutCubitScreenCrudList({ const BottomNavigationBarLayoutCubitScreenCrudList({
super.custom, super.custom,
super.height = 60, super.height = 60,

View File

@ -19,9 +19,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class CubitScreenCrudBase<Cubit extends bloc_base.Cubit<CrudState>, abstract class CubitScreenCrudBase<Cubit extends bloc_base.Cubit<CrudState>,
CrudSuccessType extends CrudSuccess> CrudSuccessState extends CrudSuccess>
extends CubitScreenBase<Cubit, CrudState> extends CubitScreenBase<Cubit, CrudState>
with CrudMixin<Cubit, CrudSuccessType> { with CrudMixin<Cubit, CrudSuccessState> {
const CubitScreenCrudBase({super.key}); const CubitScreenCrudBase({super.key});
@override @override

View File

@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './frame_bloc_layout.dart'; 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.dart';
export './frame_layout_cubit_screen_crud.dart'; export './frame_layout_cubit_screen_crud.dart';
export './frame_layout_cubit_screen_crud_item.dart'; export './frame_layout_cubit_screen_crud_item.dart';

View File

@ -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 <https://www.gnu.org/licenses/>.
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<CrudState>, SuccessType extends Object?>
extends FrameLayoutCubitScreenCrudList<Cubit, SuccessType>
with GridLayoutMixin<SuccessType> {
const FrameLayoutGridCubitScreenCrudList({
super.customAppBar,
super.customBottomNavBar,
super.height = 60,
super.key,
});
}

View File

@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class FrameLayoutCubitScreenCrud< abstract class FrameLayoutCubitScreenCrud<
Cubit extends bloc_base.Cubit<CrudState>, Cubit extends bloc_base.Cubit<CrudState>,
CrudSuccessType extends CrudSuccess> CrudSuccessState extends CrudSuccess>
extends FrameLayoutCubitScreen<Cubit, CrudState> extends FrameLayoutCubitScreen<Cubit, CrudState>
with CrudMixin<Cubit, CrudSuccessType> { with CrudMixin<Cubit, CrudSuccessState> {
const FrameLayoutCubitScreenCrud({ const FrameLayoutCubitScreenCrud({
super.customAppBar, super.customAppBar,
super.customBottomNavBar, super.customBottomNavBar,

View File

@ -18,8 +18,8 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class FrameLayoutCubitScreenCrudItem< abstract class FrameLayoutCubitScreenCrudItem<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends FrameLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessItem>> { extends FrameLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessType>> {
const FrameLayoutCubitScreenCrudItem({ const FrameLayoutCubitScreenCrudItem({
super.customAppBar, super.customAppBar,
super.customBottomNavBar, super.customBottomNavBar,

View File

@ -18,8 +18,8 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class FrameLayoutCubitScreenCrudList< abstract class FrameLayoutCubitScreenCrudList<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends FrameLayoutCubitScreenCrud<Cubit, CrudListLoaded<SuccessItem>> { extends FrameLayoutCubitScreenCrud<Cubit, CrudListLoaded<SuccessType>> {
const FrameLayoutCubitScreenCrudList({ const FrameLayoutCubitScreenCrudList({
super.customAppBar, super.customAppBar,
super.customBottomNavBar, super.customBottomNavBar,

View File

@ -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 <https://www.gnu.org/licenses/>.
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<CrudState>, T extends Object?>
extends CubitScreenCrudListBase<Cubit, T> with GridLayoutMixin<T> {
const GridCubitScreenCrudListBase({super.key});
}

View File

@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './top_app_bar_bloc_layout.dart'; 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.dart';
export './top_app_bar_layout_cubit_screen_crud.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_item.dart';

View File

@ -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 <https://www.gnu.org/licenses/>.
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<CrudState>, SuccessType extends Object?>
extends TopAppBarLayoutCubitScreenCrudList<Cubit, SuccessType>
with GridLayoutMixin<SuccessType> {
const TopAppBarGridLayoutCubitScreenCrudList({
super.custom,
super.height = 60,
super.key,
});
}

View File

@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class TopAppBarLayoutCubitScreenCrud< abstract class TopAppBarLayoutCubitScreenCrud<
Cubit extends bloc_base.Cubit<CrudState>, Cubit extends bloc_base.Cubit<CrudState>,
CrudSuccessType extends CrudSuccess> CrudSuccessState extends CrudSuccess>
extends TopAppBarLayoutCubitScreen<Cubit, CrudState> extends TopAppBarLayoutCubitScreen<Cubit, CrudState>
with CrudMixin<Cubit, CrudSuccessType> { with CrudMixin<Cubit, CrudSuccessState> {
const TopAppBarLayoutCubitScreenCrud({ const TopAppBarLayoutCubitScreenCrud({
super.custom, super.custom,
super.height, super.height,

View File

@ -18,8 +18,8 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class TopAppBarLayoutCubitScreenCrudItem< abstract class TopAppBarLayoutCubitScreenCrudItem<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessItem>> { extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessType>> {
const TopAppBarLayoutCubitScreenCrudItem({ const TopAppBarLayoutCubitScreenCrudItem({
super.custom, super.custom,
super.height = 60, super.height = 60,

View File

@ -18,8 +18,8 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class TopAppBarLayoutCubitScreenCrudList< abstract class TopAppBarLayoutCubitScreenCrudList<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessItem>> { extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudListLoaded<SuccessType>> {
const TopAppBarLayoutCubitScreenCrudList({ const TopAppBarLayoutCubitScreenCrudList({
super.custom, super.custom,
super.height = 60, super.height = 60,

View File

@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './top_navigation_bar_bloc_layout.dart'; 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.dart';
export './top_navigation_bar_layout_cubit_screen_crud.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_item.dart';

View File

@ -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 <https://www.gnu.org/licenses/>.
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<CrudState>, SuccessType extends Object?>
extends TopNavigationBarLayoutCubitScreenCrudList<Cubit, SuccessType>
with GridLayoutMixin<SuccessType> {
const TopNavigationBarGridLayoutCubitScreenCrudList({
super.custom,
super.height = 60,
super.key,
});
}

View File

@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class TopNavigationBarLayoutCubitScreenCrud< abstract class TopNavigationBarLayoutCubitScreenCrud<
Cubit extends bloc_base.Cubit<CrudState>, Cubit extends bloc_base.Cubit<CrudState>,
CrudSuccessType extends CrudSuccess> CrudSuccessState extends CrudSuccess>
extends TopNavigationBarLayoutCubitScreen<Cubit, CrudState> extends TopNavigationBarLayoutCubitScreen<Cubit, CrudState>
with CrudMixin<Cubit, CrudSuccessType> { with CrudMixin<Cubit, CrudSuccessState> {
const TopNavigationBarLayoutCubitScreenCrud({ const TopNavigationBarLayoutCubitScreenCrud({
super.custom, super.custom,
super.height, super.height,

View File

@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class TopNavigationBarLayoutCubitScreenCrudItem< abstract class TopNavigationBarLayoutCubitScreenCrudItem<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends TopNavigationBarLayoutCubitScreenCrud<Cubit, extends TopNavigationBarLayoutCubitScreenCrud<Cubit,
CrudLoaded<SuccessItem>> { CrudLoaded<SuccessType>> {
const TopNavigationBarLayoutCubitScreenCrudItem({ const TopNavigationBarLayoutCubitScreenCrudItem({
super.custom, super.custom,
super.height = 60, super.height = 60,

View File

@ -18,9 +18,9 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class TopNavigationBarLayoutCubitScreenCrudList< abstract class TopNavigationBarLayoutCubitScreenCrudList<
Cubit extends bloc_base.Cubit<CrudState>, SuccessItem extends Object?> Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
extends TopNavigationBarLayoutCubitScreenCrud<Cubit, extends TopNavigationBarLayoutCubitScreenCrud<Cubit,
CrudLoaded<SuccessItem>> { CrudListLoaded<SuccessType>> {
const TopNavigationBarLayoutCubitScreenCrudList({ const TopNavigationBarLayoutCubitScreenCrudList({
super.custom, super.custom,
super.height = 60, super.height = 60,

View File

@ -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 <https://www.gnu.org/licenses/>.
export './grid_layout.dart';

View File

@ -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 <https://www.gnu.org/licenses/>.
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<Widget> children;
final double verticalGap;
final double horizontalGap;
@override
Widget build(BuildContext context) {
if (children.isEmpty) {
return const SizedBox.shrink();
}
final childrenLeft = <Widget>[];
final childrenRight = <Widget>[];
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,
),
),
],
),
],
);
}
}

View File

@ -31,3 +31,11 @@ abstract class Layout extends StatelessWidget {
/// for the widget. /// for the widget.
const Layout({super.key}); const Layout({super.key});
} }
abstract class StructuralLayout extends Layout {
const StructuralLayout({super.key});
}
abstract class ContentLayout extends Layout {
const ContentLayout({super.key});
}

View File

@ -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 <https://www.gnu.org/licenses/>.
export './content_layouts/content_layouts.dart';
export './structural_layouts/structural_layouts.dart';

View File

@ -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 concrete implementation of the [Layout] abstract class for a layout with
/// a bottom navigation bar component. /// a bottom navigation bar component.
class BottomNavigationBarLayout extends Layout { class BottomNavigationBarLayout extends StructuralLayout {
/// Creates a [BottomNavigationBarLayout] instance. /// Creates a [BottomNavigationBarLayout] instance.
/// ///
/// [body] represents the main content of the layout. /// [body] represents the main content of the layout.

View File

@ -13,6 +13,7 @@
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
import 'package:wyatt_ui_layout/src/presentation/layouts/layout.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 /// You can customize the app bar and the bottom navigation bar by passing
/// a [customAppBar] and a [customBottomNavBar] functions that take /// a [customAppBar] and a [customBottomNavBar] functions that take
/// the corresponding components and return the customized ones. /// the corresponding components and return the customized ones.
class FrameLayout extends Layout { class FrameLayout extends StructuralLayout {
/// Creates a [FrameLayout] instance. /// Creates a [FrameLayout] instance.
/// ///
/// [body] represents the main content of the layout. /// [body] represents the main content of the layout.

View File

@ -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 <https://www.gnu.org/licenses/>.
export './bottom_navigation_bar_layout.dart';
export './frame_layout.dart';
export './top_app_bar_layout.dart';

View File

@ -34,7 +34,8 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart';
/// given [BuildContext]. /// given [BuildContext].
/// ///
/// [T] represents the type of the top bar component. /// [T] represents the type of the top bar component.
abstract class TopBarLayout<T extends TopBarComponent> extends Layout { abstract class TopBarLayout<T extends TopBarComponent>
extends StructuralLayout {
/// Creates a [TopBarLayout] instance. /// Creates a [TopBarLayout] instance.
/// ///
/// [body] represents the main content of the layout. /// [body] represents the main content of the layout.

View File

@ -14,6 +14,4 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'layouts/bottom_navigation_bar_layout.dart'; export './layouts/layouts.dart';
export 'layouts/frame_layout.dart';
export 'layouts/top_app_bar_layout.dart';

View File

@ -11,6 +11,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
gap: ^2.0.1
wyatt_ui_components: wyatt_ui_components:
git: git: