feat(bloc_layout): add new package to combine bloc_helper, crud_bloc, ui_components, and ui_layout #84

Merged
hugo merged 6 commits from bloc_layout/feat/new_package into master 2022-12-11 23:39:08 +00:00
8 changed files with 289 additions and 3 deletions
Showing only changes of commit 9d0aac7894 - Show all commits

View File

@ -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,
);
}

View File

@ -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,
);
}

View File

@ -15,8 +15,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'consumers/crud_cubit_consumer_screen_bases.dart';
export 'consumers/frame_layout_crud_consumer_screen.dart';
export 'consumers/bottom_navigation_bar_layout_crud_consumer_screen.dart';
export 'consumers/app_bar_cubit_consumer_screen.dart';
export 'consumers/frame_layout_crud_consumer_screen copy.dart';
export 'screens/crud_cubit_screen_base.dart';
export 'screens/app_bar_cubit_screen.dart';
export 'screens/bottom_navigation_bar_layout_crud_screen.dart';
export 'screens/frame_layout_crud_screen.dart';
export 'package:flutter_bloc/flutter_bloc.dart';
export 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';

View File

@ -0,0 +1,53 @@
// 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 AppBarLayoutCrudScreen<Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudCubitScreen<Cubit, T> {
final String? title;
const AppBarLayoutCrudScreen({
this.title,
});
@override
Widget parent(BuildContext context, Widget child) => AppBarLayout(
title: title ?? 'Title',
body: child,
);
}
abstract class AppBarLayoutCrudListScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudListCubitScreen<Cubit, T> {
final String? title;
final int? currentIndex;
const AppBarLayoutCrudListScreen({
this.title,
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) => AppBarLayout(
title: title ?? 'Title',
body: child,
);
}

View File

@ -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 BottomNavigationBarLayoutCrudScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudCubitScreen<Cubit, T> {
final int? currentIndex;
const BottomNavigationBarLayoutCrudScreen({
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) =>
BottomNavigationBarLayout(
body: child,
currentIndex: currentIndex ?? 0,
);
}
abstract class BottomNavigationBarLayoutCrudListScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudListCubitScreen<Cubit, T> {
final String? title;
final int? currentIndex;
const BottomNavigationBarLayoutCrudListScreen({
this.title,
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) =>
BottomNavigationBarLayout(
body: child,
currentIndex: currentIndex ?? 0,
);
}

View File

@ -21,6 +21,7 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
abstract class CrudCubitScreenBase<Cubit extends bloc_base.Cubit<CrudState>,
SuccessState extends CrudSuccess> extends CubitScreen<Cubit, CrudState> {
const CrudCubitScreenBase();
Widget errorBuilder(BuildContext context, CrudError state) =>
context.components.errorWidget;
@ -44,7 +45,11 @@ abstract class CrudCubitScreenBase<Cubit extends bloc_base.Cubit<CrudState>,
}
abstract class CrudCubitScreen<Cubit extends bloc_base.Cubit<CrudState>, T>
extends CrudCubitScreenBase<Cubit, CrudLoaded<T>> {}
extends CrudCubitScreenBase<Cubit, CrudLoaded<T>> {
const CrudCubitScreen();
}
abstract class CrudListCubitScreen<Cubit extends bloc_base.Cubit<CrudState>, T>
extends CrudCubitScreenBase<Cubit, CrudListLoaded<T>> {}
extends CrudCubitScreenBase<Cubit, CrudListLoaded<T>> {
const CrudListCubitScreen();
}

View File

@ -0,0 +1,57 @@
// 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/src/widgets/framework.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 FrameLayoutCrudScreen<Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudCubitScreen<Cubit, T> {
final String? title;
final int? currentIndex;
const FrameLayoutCrudScreen({
this.title,
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) => FrameLayout(
title: title ?? 'Title',
body: child,
currentIndex: currentIndex ?? 0,
);
}
abstract class FrameLayoutCrudListScreen<
Cubit extends bloc_base.Cubit<CrudState>,
T> extends CrudListCubitScreen<Cubit, T> {
final String? title;
final int? currentIndex;
const FrameLayoutCrudListScreen({
this.title,
this.currentIndex,
});
@override
Widget parent(BuildContext context, Widget child) => FrameLayout(
title: title ?? 'Title',
body: child,
currentIndex: currentIndex ?? 0,
);
}