TemplateBasePage constructor
const
TemplateBasePage({
- Key? key,
- required Widget header,
- Color? headerBackgroundColor,
- Widget? body,
- bool isList = false,
- List<
String> ? imageUrls, - List<
String> ? descriptions, - List<
VoidCallback?> ? onSeeMoreCallbacks, - Widget? bodyWhenEmpty,
- String? descriptiveTitle,
- String? descriptiveSubtitle,
- String? descriptiveImageUrl,
- String? descriptiveTextFieldHint,
- String? descriptiveButtonText,
- bool descriptiveButtonDependsOnText = false,
- void descriptiveOnButtonPressed(
- String text
Si se pasan los 3 parámetros de lista, el body se construye como lista de cards.
Si las listas están vacías, se muestra el body descriptivo.
Si no, se usa el widget body proporcionado.
Implementation
const TemplateBasePage({
super.key,
required this.header,
required this.footer,
this.headerBackgroundColor,
this.footerBackgroundColor,
// Body personalizado
this.body,
// Body con lista de elementos
this.isList = false,
this.imageUrls,
this.descriptions,
this.onSeeMoreCallbacks,
this.bodyWhenEmpty,
// Body descriptivo
this.descriptiveTitle,
this.descriptiveSubtitle,
this.descriptiveImageUrl,
this.descriptiveTextFieldHint,
this.descriptiveButtonText,
this.descriptiveButtonDependsOnText = false,
this.descriptiveOnButtonPressed,
}) : assert(
!isList || (
imageUrls != null &&
descriptions != null &&
onSeeMoreCallbacks != null &&
imageUrls.length == descriptions.length &&
descriptions.length == onSeeMoreCallbacks.length
),
'Si isList es true, los 3 parámetros deben estar presentes y tener el mismo tamaño.',
),
assert(
body != null ||
(imageUrls != null &&
descriptions != null &&
onSeeMoreCallbacks != null) ||
descriptiveTitle != null ||
descriptiveSubtitle != null ||
descriptiveImageUrl != null ||
descriptiveTextFieldHint != null ||
descriptiveButtonText != null ||
descriptiveOnButtonPressed != null,
'Debes proporcionar al menos un body, parámetros de lista o parámetros descriptivos.',
);