feat(bloc_layout): add grid content implementations
This commit is contained in:
parent
abb5f0c735
commit
89ce553fa2
@ -15,3 +15,4 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export './crud_cubit_consumer_screen_mixin.dart';
|
||||
export './mixins/mixins.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 <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(),
|
||||
);
|
||||
}
|
17
packages/wyatt_bloc_layout/lib/src/core/mixins/mixins.dart
Normal file
17
packages/wyatt_bloc_layout/lib/src/core/mixins/mixins.dart
Normal 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';
|
@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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';
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
|
||||
|
||||
abstract class BottomNavigationBarLayoutCubitScreenCrud<
|
||||
Cubit extends bloc_base.Cubit<CrudState>,
|
||||
CrudSuccessType extends CrudSuccess>
|
||||
CrudSuccessState extends CrudSuccess>
|
||||
extends BottomNavigationBarLayoutCubitScreen<Cubit, CrudState>
|
||||
with CrudMixin<Cubit, CrudSuccessType> {
|
||||
with CrudMixin<Cubit, CrudSuccessState> {
|
||||
const BottomNavigationBarLayoutCubitScreenCrud({
|
||||
super.custom,
|
||||
super.height,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends BottomNavigationBarLayoutCubitScreenCrud<Cubit,
|
||||
CrudLoaded<SuccessItem>> {
|
||||
CrudLoaded<SuccessType>> {
|
||||
const BottomNavigationBarLayoutCubitScreenCrudItem({
|
||||
super.custom,
|
||||
super.height = 60,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends BottomNavigationBarLayoutCubitScreenCrud<Cubit,
|
||||
CrudLoaded<SuccessItem>> {
|
||||
CrudListLoaded<SuccessType>> {
|
||||
const BottomNavigationBarLayoutCubitScreenCrudList({
|
||||
super.custom,
|
||||
super.height = 60,
|
||||
|
@ -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<Cubit extends bloc_base.Cubit<CrudState>,
|
||||
CrudSuccessType extends CrudSuccess>
|
||||
CrudSuccessState extends CrudSuccess>
|
||||
extends CubitScreenBase<Cubit, CrudState>
|
||||
with CrudMixin<Cubit, CrudSuccessType> {
|
||||
with CrudMixin<Cubit, CrudSuccessState> {
|
||||
const CubitScreenCrudBase({super.key});
|
||||
|
||||
@override
|
||||
|
@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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';
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
|
||||
|
||||
abstract class FrameLayoutCubitScreenCrud<
|
||||
Cubit extends bloc_base.Cubit<CrudState>,
|
||||
CrudSuccessType extends CrudSuccess>
|
||||
CrudSuccessState extends CrudSuccess>
|
||||
extends FrameLayoutCubitScreen<Cubit, CrudState>
|
||||
with CrudMixin<Cubit, CrudSuccessType> {
|
||||
with CrudMixin<Cubit, CrudSuccessState> {
|
||||
const FrameLayoutCubitScreenCrud({
|
||||
super.customAppBar,
|
||||
super.customBottomNavBar,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
extends FrameLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessItem>> {
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends FrameLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessType>> {
|
||||
const FrameLayoutCubitScreenCrudItem({
|
||||
super.customAppBar,
|
||||
super.customBottomNavBar,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
extends FrameLayoutCubitScreenCrud<Cubit, CrudListLoaded<SuccessItem>> {
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends FrameLayoutCubitScreenCrud<Cubit, CrudListLoaded<SuccessType>> {
|
||||
const FrameLayoutCubitScreenCrudList({
|
||||
super.customAppBar,
|
||||
super.customBottomNavBar,
|
||||
|
@ -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});
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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';
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
|
||||
|
||||
abstract class TopAppBarLayoutCubitScreenCrud<
|
||||
Cubit extends bloc_base.Cubit<CrudState>,
|
||||
CrudSuccessType extends CrudSuccess>
|
||||
CrudSuccessState extends CrudSuccess>
|
||||
extends TopAppBarLayoutCubitScreen<Cubit, CrudState>
|
||||
with CrudMixin<Cubit, CrudSuccessType> {
|
||||
with CrudMixin<Cubit, CrudSuccessState> {
|
||||
const TopAppBarLayoutCubitScreenCrud({
|
||||
super.custom,
|
||||
super.height,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessItem>> {
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessType>> {
|
||||
const TopAppBarLayoutCubitScreenCrudItem({
|
||||
super.custom,
|
||||
super.height = 60,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudLoaded<SuccessItem>> {
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends TopAppBarLayoutCubitScreenCrud<Cubit, CrudListLoaded<SuccessType>> {
|
||||
const TopAppBarLayoutCubitScreenCrudList({
|
||||
super.custom,
|
||||
super.height = 60,
|
||||
|
@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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';
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
@ -20,9 +20,9 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
|
||||
|
||||
abstract class TopNavigationBarLayoutCubitScreenCrud<
|
||||
Cubit extends bloc_base.Cubit<CrudState>,
|
||||
CrudSuccessType extends CrudSuccess>
|
||||
CrudSuccessState extends CrudSuccess>
|
||||
extends TopNavigationBarLayoutCubitScreen<Cubit, CrudState>
|
||||
with CrudMixin<Cubit, CrudSuccessType> {
|
||||
with CrudMixin<Cubit, CrudSuccessState> {
|
||||
const TopNavigationBarLayoutCubitScreenCrud({
|
||||
super.custom,
|
||||
super.height,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends TopNavigationBarLayoutCubitScreenCrud<Cubit,
|
||||
CrudLoaded<SuccessItem>> {
|
||||
CrudLoaded<SuccessType>> {
|
||||
const TopNavigationBarLayoutCubitScreenCrudItem({
|
||||
super.custom,
|
||||
super.height = 60,
|
||||
|
@ -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<CrudState>, SuccessItem extends Object?>
|
||||
Cubit extends bloc_base.Cubit<CrudState>, SuccessType extends Object?>
|
||||
extends TopNavigationBarLayoutCubitScreenCrud<Cubit,
|
||||
CrudLoaded<SuccessItem>> {
|
||||
CrudListLoaded<SuccessType>> {
|
||||
const TopNavigationBarLayoutCubitScreenCrudList({
|
||||
super.custom,
|
||||
super.height = 60,
|
||||
|
@ -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';
|
@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -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});
|
||||
}
|
||||
|
@ -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';
|
@ -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.
|
@ -13,6 +13,7 @@
|
||||
//
|
||||
// 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_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.
|
@ -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';
|
@ -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<T extends TopBarComponent> extends Layout {
|
||||
abstract class TopBarLayout<T extends TopBarComponent>
|
||||
extends StructuralLayout {
|
||||
/// Creates a [TopBarLayout] instance.
|
||||
///
|
||||
/// [body] represents the main content of the layout.
|
@ -14,6 +14,4 @@
|
||||
// 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 'layouts/bottom_navigation_bar_layout.dart';
|
||||
export 'layouts/frame_layout.dart';
|
||||
export 'layouts/top_app_bar_layout.dart';
|
||||
export './layouts/layouts.dart';
|
||||
|
@ -11,6 +11,7 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
gap: ^2.0.1
|
||||
|
||||
wyatt_ui_components:
|
||||
git:
|
||||
|
Loading…
x
Reference in New Issue
Block a user