feat(bloc_layout): add all layout avalaible with crud bloc

This commit is contained in:
AN12345
2022-12-11 23:38:54 +00:00
committed by Gitea
parent a561cbff23
commit 9d0aac7894
8 changed files with 289 additions and 3 deletions
@@ -0,0 +1,54 @@
// 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:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
import 'package:wyatt_ui_layout/wyatt_wyatt_ui_layout.dart';
abstract class AppBarLayoutCrudConsumerScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudCubitConsumerScreen<Cubit, T> {
final String? title;
const AppBarLayoutCrudConsumerScreen({
this.title,
});
@override
Widget parent(BuildContext context, Widget child) => AppBarLayout(
title: title ?? 'Title',
body: child,
);
}
abstract class AppBarLayoutCrudListConsumerScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudListCubitConsumerScreen<Cubit, T> {
final String? title;
final int? currentIndex;
const AppBarLayoutCrudListConsumerScreen({
this.title,
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) => AppBarLayout(
title: title ?? 'Title',
body: child,
);
}
@@ -0,0 +1,56 @@
// 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:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
import 'package:wyatt_ui_layout/wyatt_wyatt_ui_layout.dart';
abstract class BottomNavigationBarLayoutCrudConsumerScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudCubitConsumerScreen<Cubit, T> {
final int? currentIndex;
const BottomNavigationBarLayoutCrudConsumerScreen({
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) =>
BottomNavigationBarLayout(
body: child,
currentIndex: currentIndex ?? 0,
);
}
abstract class BottomNavigationBarLayoutCrudListConsumerScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudListCubitConsumerScreen<Cubit, T> {
final String? title;
final int? currentIndex;
const BottomNavigationBarLayoutCrudListConsumerScreen({
this.title,
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) =>
BottomNavigationBarLayout(
body: child,
currentIndex: currentIndex ?? 0,
);
}