chore: fix and format using melos
This commit is contained in:
@@ -10,9 +10,9 @@ class ExampleCubit extends Cubit<CrudState> {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudLoading());
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudError('Cubit Error'));
|
||||
emit(const CrudError('Cubit Error'));
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudLoaded<String>('DATA LOADED'));
|
||||
emit(const CrudLoaded<String>('DATA LOADED'));
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudInitial());
|
||||
}
|
||||
@@ -23,14 +23,16 @@ class ExampleCubit extends Cubit<CrudState> {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudLoading());
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudError('Cubit Error'));
|
||||
emit(const CrudError('Cubit Error'));
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudListLoaded<String>([
|
||||
'DATA LOADED 1',
|
||||
'DATA LOADED 2',
|
||||
'DATA LOADED 3',
|
||||
'DATA LOADED 4'
|
||||
]));
|
||||
emit(
|
||||
const CrudListLoaded<String>([
|
||||
'DATA LOADED 1',
|
||||
'DATA LOADED 2',
|
||||
'DATA LOADED 3',
|
||||
'DATA LOADED 4'
|
||||
]),
|
||||
);
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
emit(CrudInitial());
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ part 'custom_app_bar.g.dart';
|
||||
|
||||
@ComponentCopyWithExtension()
|
||||
class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin {
|
||||
const CustomAppBar({super.title});
|
||||
const CustomAppBar({super.key, super.title});
|
||||
@override
|
||||
Widget build(BuildContext context) => AppBar(
|
||||
title: Text(title?.data ?? 'Title'),
|
||||
|
||||
@@ -7,19 +7,23 @@ part 'custom_bottom_bar.g.dart';
|
||||
@ComponentCopyWithExtension()
|
||||
class CustomBottomBar extends BottomNavigationBarComponent
|
||||
with $CustomBottomBarCWMixin {
|
||||
const CustomBottomBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => BottomNavigationBar(
|
||||
items: [
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.e_mobiledata,
|
||||
),
|
||||
label: 'Icon 1'),
|
||||
icon: Icon(
|
||||
Icons.e_mobiledata,
|
||||
),
|
||||
label: 'Icon 1',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.do_not_disturb_off,
|
||||
),
|
||||
label: 'Icon 2'),
|
||||
icon: Icon(
|
||||
Icons.do_not_disturb_off,
|
||||
),
|
||||
label: 'Icon 2',
|
||||
),
|
||||
],
|
||||
backgroundColor: Colors.blue,
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@ part 'custom_error_widget.g.dart';
|
||||
@ComponentCopyWithExtension()
|
||||
class CustomErrorWidget extends ErrorWidgetComponent
|
||||
with $CustomErrorWidgetCWMixin {
|
||||
CustomErrorWidget({super.error});
|
||||
CustomErrorWidget({super.key, super.error});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ColoredBox(
|
||||
|
||||
@@ -7,7 +7,7 @@ part 'custom_loading_widget.g.dart';
|
||||
@ComponentCopyWithExtension()
|
||||
class CustomLoadingWidget extends LoadingWidgetComponent
|
||||
with $CustomLoadingWidgetCWMixin {
|
||||
CustomLoadingWidget({super.color});
|
||||
CustomLoadingWidget({super.key, super.color});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
|
||||
@@ -6,8 +6,8 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
|
||||
|
||||
class AppThemeComponent {
|
||||
static ComponentThemeData get components => ComponentThemeData.raw(
|
||||
appBar: CustomAppBar(),
|
||||
bottomNavigationBar: CustomBottomBar(),
|
||||
appBar: const CustomAppBar(),
|
||||
bottomNavigationBar: const CustomBottomBar(),
|
||||
loadingWidget: CustomLoadingWidget(),
|
||||
errorWidget: CustomErrorWidget(),
|
||||
);
|
||||
|
||||
@@ -28,61 +28,63 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ComponentTheme(
|
||||
componentThemeWidget: AppThemeComponent.components,
|
||||
child: MaterialApp(
|
||||
title: 'Bloc Layout Example',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
create: (_) => ExampleCubit()..run(),
|
||||
child: ExampleCrudStateManagement(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
create: (_) => ExampleCubit()..runList(),
|
||||
child: ExampleListCrudStateManagement(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
Widget build(BuildContext context) => ComponentTheme(
|
||||
componentThemeWidget: AppThemeComponent.components,
|
||||
child: MaterialApp(
|
||||
title: 'Bloc Layout Example',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
create: (_) => ExampleCubit()..run(),
|
||||
child: ExampleFrameLayoutCrudConsumer()),
|
||||
),
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
child: const ExampleCrudStateManagement(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
create: (_) => ExampleCubit()..runList(),
|
||||
child: ExampleFrameLayoutCrudListConsumer()),
|
||||
),
|
||||
],
|
||||
child: const ExampleListCrudStateManagement(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
create: (_) => ExampleCubit()..run(),
|
||||
child: const ExampleFrameLayoutCrudConsumer(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: BlocProvider(
|
||||
create: (_) => ExampleCubit()..runList(),
|
||||
child: const ExampleFrameLayoutCrudListConsumer(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
class ExampleCrudStateManagement
|
||||
extends CrudCubitConsumerScreen<ExampleCubit, String> {
|
||||
const ExampleCrudStateManagement({super.key});
|
||||
|
||||
@override
|
||||
Widget initialBuilder(BuildContext context, CrudInitial state) =>
|
||||
Container(color: Colors.yellow);
|
||||
@@ -93,6 +95,8 @@ class ExampleCrudStateManagement
|
||||
|
||||
class ExampleListCrudStateManagement
|
||||
extends CrudListCubitConsumerScreen<ExampleCubit, String> {
|
||||
const ExampleListCrudStateManagement({super.key});
|
||||
|
||||
@override
|
||||
Widget initialBuilder(BuildContext context, CrudInitial state) =>
|
||||
Container(color: Colors.green);
|
||||
@@ -106,7 +110,7 @@ class ExampleListCrudStateManagement
|
||||
|
||||
class ExampleFrameLayoutCrudConsumer
|
||||
extends FrameLayoutCrudCubitConsumerScreen<ExampleCubit, String> {
|
||||
const ExampleFrameLayoutCrudConsumer()
|
||||
const ExampleFrameLayoutCrudConsumer({super.key})
|
||||
: super(
|
||||
title: 'Example Title',
|
||||
currentIndex: 0,
|
||||
@@ -119,7 +123,7 @@ class ExampleFrameLayoutCrudConsumer
|
||||
|
||||
class ExampleFrameLayoutCrudListConsumer
|
||||
extends FrameLayoutCrudListCubitConsumerScreen<ExampleCubit, String> {
|
||||
const ExampleFrameLayoutCrudListConsumer()
|
||||
const ExampleFrameLayoutCrudListConsumer({super.key})
|
||||
: super(
|
||||
title: 'Example Title',
|
||||
currentIndex: 0,
|
||||
|
||||
Reference in New Issue
Block a user