build method
- BuildContext context
override
Build a Container with a Column containing:
- a Row with a bold Text of title and an AppDivider
- an optional Text with the given description
- an optional CupertinoButtonFilledComponent with the text AppLocalizations.seeMore
- the given child widget if useChild is true
The color property is used to set the background color of the Container. If color is null, the default color is CupertinoColors.white.
Implementation
@override
/// Build a [Container] with a [Column] containing:
///
/// - a [Row] with a bold [Text] of [title] and an [AppDivider]
/// - an optional [Text] with the given [description]
/// - an optional [CupertinoButtonFilledComponent] with the text
/// [AppLocalizations.seeMore]
/// - the given [child] widget if [useChild] is true
///
/// The [color] property is used to set the background color of the
/// [Container]. If [color] is null, the default color is
/// [CupertinoColors.white].
Widget build(BuildContext context) {
final tr = AppLocalizations.of(context)!;
return Container(
color: color ?? CupertinoColors.white,
child: Padding(
padding: const EdgeInsets.all(AppConstants.padding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
Row(
spacing: 8,
children: [
Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold),
),
const Expanded(child: AppDivider()),
],
),
if (description != null) Text(description!),
const SizedBox(height: 8),
useButton
? CupertinoButtonFilledComponent(
onPressed: () {
HapticFeedback.vibrate();
onPressed();
},
text: tr.seeMore,
)
: const SizedBox.shrink(),
if (useChild && child != null) child!,
],
),
),
);
}