ui_components/feat/make-data-fields-nullable #93
@ -18,7 +18,7 @@ class CustomAppBar extends AppBarComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AppBarComponent configure(
|
AppBarComponent? configure(
|
||||||
{String? title, Widget? leading, List<Widget>? actions}) =>
|
{String? title, Widget? leading, List<Widget>? actions}) =>
|
||||||
CustomAppBar(
|
CustomAppBar(
|
||||||
title: title ?? this.title,
|
title: title ?? this.title,
|
||||||
@ -44,7 +44,7 @@ class CustomBottomBar extends BottomNavigationBarComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
BottomNavigationBarComponent configure(
|
BottomNavigationBarComponent? configure(
|
||||||
{void Function(BuildContext p1, int p2)? onTap,
|
{void Function(BuildContext p1, int p2)? onTap,
|
||||||
int currentIndex = 0}) =>
|
int currentIndex = 0}) =>
|
||||||
this;
|
this;
|
||||||
@ -58,7 +58,7 @@ class CustomLoadingWidget extends LoadingWidgetComponent {
|
|||||||
Center(child: CircularProgressIndicator(color: color));
|
Center(child: CircularProgressIndicator(color: color));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LoadingWidgetComponent configure({Color? color}) => CustomLoadingWidget(
|
LoadingWidgetComponent? configure({Color? color}) => CustomLoadingWidget(
|
||||||
color: color ?? this.color,
|
color: color ?? this.color,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ class CustomErrorWidget extends ErrorWidgetComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ErrorWidgetComponent configure({String? error}) => CustomErrorWidget(
|
ErrorWidgetComponent? configure({String? error}) => CustomErrorWidget(
|
||||||
error: error ?? this.error,
|
error: error ?? this.error,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,11 @@ abstract class CrudCubitConsumerScreenBase<
|
|||||||
const CrudCubitConsumerScreenBase({super.key});
|
const CrudCubitConsumerScreenBase({super.key});
|
||||||
|
|
||||||
Widget errorBuilder(BuildContext context, CrudError state) =>
|
Widget errorBuilder(BuildContext context, CrudError state) =>
|
||||||
context.components.errorWidget.configure(error: state.message);
|
context.components.errorWidget?.configure(error: state.message) ??
|
||||||
|
const SizedBox.shrink();
|
||||||
|
|
||||||
Widget loadingBuilder(BuildContext context, CrudLoading state) =>
|
Widget loadingBuilder(BuildContext context, CrudLoading state) =>
|
||||||
context.components.loadingWidget;
|
context.components.loadingWidget ?? const SizedBox.shrink();
|
||||||
|
|
||||||
Widget initialBuilder(BuildContext context, CrudInitial state) =>
|
Widget initialBuilder(BuildContext context, CrudInitial state) =>
|
||||||
const SizedBox.shrink();
|
const SizedBox.shrink();
|
||||||
|
@ -16,17 +16,17 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
|
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
|
||||||
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
|
|
||||||
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
|
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
|
||||||
|
|
||||||
abstract class CrudCubitScreenBase<Cubit extends bloc_base.Cubit<CrudState>,
|
abstract class CrudCubitScreenBase<Cubit extends bloc_base.Cubit<CrudState>,
|
||||||
SuccessState extends CrudSuccess> extends CubitScreen<Cubit, CrudState> {
|
SuccessState extends CrudSuccess> extends CubitScreen<Cubit, CrudState> {
|
||||||
const CrudCubitScreenBase();
|
const CrudCubitScreenBase();
|
||||||
Widget errorBuilder(BuildContext context, CrudError state) =>
|
Widget errorBuilder(BuildContext context, CrudError state) =>
|
||||||
context.components.errorWidget;
|
context.components.errorWidget?.configure(error: state.message) ??
|
||||||
|
const SizedBox.shrink();
|
||||||
|
|
||||||
Widget loadingBuilder(BuildContext context, CrudLoading state) =>
|
Widget loadingBuilder(BuildContext context, CrudLoading state) =>
|
||||||
context.components.loadingWidget;
|
context.components.loadingWidget ?? const SizedBox.shrink();
|
||||||
|
|
||||||
Widget initialBuilder(BuildContext context, CrudInitial state) =>
|
Widget initialBuilder(BuildContext context, CrudInitial state) =>
|
||||||
const SizedBox.shrink();
|
const SizedBox.shrink();
|
||||||
|
@ -10,7 +10,7 @@ class CustomAppBar extends AppBarComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AppBarComponent configure(
|
AppBarComponent? configure(
|
||||||
{String? title, Widget? leading, List<Widget>? actions}) =>
|
{String? title, Widget? leading, List<Widget>? actions}) =>
|
||||||
CustomAppBar(
|
CustomAppBar(
|
||||||
title: title ?? this.title,
|
title: title ?? this.title,
|
||||||
|
@ -29,7 +29,7 @@ class CustomBottomNavigationBar extends BottomNavigationBarComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
CustomBottomNavigationBar configure({
|
CustomBottomNavigationBar? configure({
|
||||||
void Function(BuildContext, int)? onTap,
|
void Function(BuildContext, int)? onTap,
|
||||||
int currentIndex = 0,
|
int currentIndex = 0,
|
||||||
}) =>
|
}) =>
|
||||||
|
@ -11,6 +11,6 @@ class CustomErrorWidget extends ErrorWidgetComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ErrorWidgetComponent configure({String? error}) =>
|
ErrorWidgetComponent? configure({String? error}) =>
|
||||||
CustomErrorWidget(error: error ?? this.error);
|
CustomErrorWidget(error: error ?? this.error);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class CustomLoadingWidget extends LoadingWidgetComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
CustomLoadingWidget configure({Color? color}) => CustomLoadingWidget(
|
CustomLoadingWidget? configure({Color? color}) => CustomLoadingWidget(
|
||||||
color: color ?? this.color,
|
color: color ?? this.color,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -50,20 +50,23 @@ class Home extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(60),
|
preferredSize: const Size.fromHeight(60),
|
||||||
child: context.components.appBar.configure(title: 'Example title'),
|
child: context.components.appBar?.configure(title: 'Example title') ??
|
||||||
|
const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: context.components.errorWidget
|
child: context.components.errorWidget
|
||||||
.configure(error: 'Example erreur'),
|
?.configure(error: 'Example erreur') ??
|
||||||
|
const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: context.components.loadingWidget
|
child: context.components.loadingWidget
|
||||||
.configure(color: Colors.green),
|
?.configure(color: Colors.green) ??
|
||||||
|
const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -19,5 +19,5 @@ import 'package:flutter/material.dart';
|
|||||||
abstract class Component extends StatelessWidget {
|
abstract class Component extends StatelessWidget {
|
||||||
const Component({super.key});
|
const Component({super.key});
|
||||||
|
|
||||||
Component configure();
|
Component? configure();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ abstract class AppBarComponent extends Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AppBarComponent configure({
|
AppBarComponent? configure({
|
||||||
String? title,
|
String? title,
|
||||||
Widget? leading,
|
Widget? leading,
|
||||||
List<Widget>? actions,
|
List<Widget>? actions,
|
||||||
@ -46,7 +46,7 @@ abstract class BottomNavigationBarComponent extends Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
BottomNavigationBarComponent configure({
|
BottomNavigationBarComponent? configure({
|
||||||
void Function(BuildContext, int)? onTap,
|
void Function(BuildContext, int)? onTap,
|
||||||
int currentIndex = 0,
|
int currentIndex = 0,
|
||||||
});
|
});
|
||||||
@ -57,7 +57,7 @@ abstract class ErrorWidgetComponent extends Component {
|
|||||||
const ErrorWidgetComponent({required this.error, super.key});
|
const ErrorWidgetComponent({required this.error, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ErrorWidgetComponent configure({String? error});
|
ErrorWidgetComponent? configure({String? error});
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class LoadingWidgetComponent extends Component {
|
abstract class LoadingWidgetComponent extends Component {
|
||||||
@ -65,5 +65,5 @@ abstract class LoadingWidgetComponent extends Component {
|
|||||||
const LoadingWidgetComponent({required this.color, super.key});
|
const LoadingWidgetComponent({required this.color, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LoadingWidgetComponent configure({Color? color});
|
LoadingWidgetComponent? configure({Color? color});
|
||||||
}
|
}
|
||||||
|
@ -17,15 +17,15 @@
|
|||||||
import 'package:wyatt_ui_components/src/domain/entities/components.dart';
|
import 'package:wyatt_ui_components/src/domain/entities/components.dart';
|
||||||
|
|
||||||
class ComponentThemeData {
|
class ComponentThemeData {
|
||||||
final AppBarComponent appBar;
|
final AppBarComponent? appBar;
|
||||||
final BottomNavigationBarComponent bottomNavigationBar;
|
final BottomNavigationBarComponent? bottomNavigationBar;
|
||||||
final ErrorWidgetComponent errorWidget;
|
final ErrorWidgetComponent? errorWidget;
|
||||||
final LoadingWidgetComponent loadingWidget;
|
final LoadingWidgetComponent? loadingWidget;
|
||||||
|
|
||||||
const ComponentThemeData.raw({
|
const ComponentThemeData.raw({
|
||||||
required this.appBar,
|
this.appBar,
|
||||||
required this.bottomNavigationBar,
|
this.bottomNavigationBar,
|
||||||
required this.errorWidget,
|
this.errorWidget,
|
||||||
required this.loadingWidget,
|
this.loadingWidget,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class CustomAppBar extends AppBarComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AppBarComponent configure({
|
AppBarComponent? configure({
|
||||||
String? title,
|
String? title,
|
||||||
Widget? leading,
|
Widget? leading,
|
||||||
List<Widget>? actions,
|
List<Widget>? actions,
|
||||||
|
@ -29,7 +29,7 @@ class CustomBottomNavigationBar extends BottomNavigationBarComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
CustomBottomNavigationBar configure({
|
CustomBottomNavigationBar? configure({
|
||||||
void Function(BuildContext, int)? onTap,
|
void Function(BuildContext, int)? onTap,
|
||||||
int currentIndex = 0,
|
int currentIndex = 0,
|
||||||
}) =>
|
}) =>
|
||||||
|
@ -31,7 +31,8 @@ class AppBarLayout extends Layout {
|
|||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(60),
|
preferredSize: const Size.fromHeight(60),
|
||||||
child: context.components.appBar.configure(title: title),
|
child: context.components.appBar?.configure(title: title) ??
|
||||||
|
const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
body: body,
|
body: body,
|
||||||
);
|
);
|
||||||
|
@ -14,7 +14,7 @@ class BottomNavigationBarLayout extends Layout {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
body: body,
|
body: body,
|
||||||
bottomNavigationBar: context.components.bottomNavigationBar.configure(
|
bottomNavigationBar: context.components.bottomNavigationBar?.configure(
|
||||||
currentIndex: currentIndex,
|
currentIndex: currentIndex,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -34,10 +34,11 @@ class FrameLayout extends Layout {
|
|||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(60),
|
preferredSize: const Size.fromHeight(60),
|
||||||
child: context.components.appBar.configure(title: title),
|
child: context.components.appBar?.configure(title: title) ??
|
||||||
|
const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
body: body,
|
body: body,
|
||||||
bottomNavigationBar: context.components.bottomNavigationBar.configure(
|
bottomNavigationBar: context.components.bottomNavigationBar?.configure(
|
||||||
currentIndex: currentIndex,
|
currentIndex: currentIndex,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user