detailsContent method

  1. @override
Widget detailsContent(
  1. BuildContext context, {
  2. Key? key,
  3. Set<MaterialState>? materialStates,
  4. String title = '',
  5. String subtitle = '',
  6. String value = '',
  7. Widget? leadingWidget,
  8. AccessoryType accessoryType = AccessoryType.None,
  9. Map<String, dynamic>? extraInfo,
})
override

Details Content This generates the internal contents of a standard details cell with an optional icon/image, title, subtitle, value and accessory

  • context the current BuildContext
  • materialStates a set of the current states this cell is in (pressed, selected, disabled, etc)
  • title main text description
  • subtitle secondary text description
  • value current value for this setting/cell
  • leadingWidget an optional leading image/icon
  • accessoryType can indicate if a disclosure arrow, checkmark, or other symbol should be on the trailing side of cell
  • extraInfo a map where you can pass additional info through to your subclasses to be used however you need

Implementation

@override
Widget detailsContent(BuildContext context, {Key? key, Set<MaterialState>? materialStates, String title = '', String subtitle = '', String value = '', Widget? leadingWidget, AccessoryType accessoryType = AccessoryType.None, Map<String, dynamic>? extraInfo}) {
  var accessoryWidget = this.accessoryWidget(context, accessoryType: accessoryType, materialStates: materialStates, extraInfo: extraInfo);

  return Container(
    key: key,
    color: Colors.transparent,
    height: rowHeight(context, extraInfo: extraInfo),
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      mainAxisSize: MainAxisSize.max,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        leadingCellPadding(context, extraInfo: extraInfo),
        if (leadingWidget != null) wrappedLeadingWidget(context, extraInfo: extraInfo, child: leadingWidget),
        if (leadingWidget != null) horizontalPadding(context, extraInfo: extraInfo),
        Flexible(
          flex: 1,
          fit: FlexFit.tight,
          child: Align(
            alignment: AlignmentDirectional.centerStart,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              mainAxisSize: MainAxisSize.max,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                if (title.isNotEmpty) Text('$title', style: titleTextStyle(context, materialStates: materialStates, extraInfo: extraInfo), overflow: TextOverflow.ellipsis),
                if (subtitle.isNotEmpty) Text('$subtitle', style: subtitleTextStyle(context, materialStates: materialStates, extraInfo: extraInfo), overflow: TextOverflow.ellipsis),
              ],
            ),
          ),
        ),
        if (value.isNotEmpty) horizontalPadding(context, extraInfo: extraInfo),
        if (value.isNotEmpty)
          Flexible(
            flex: 0,
            fit: FlexFit.loose,
            child: Align(
              alignment: AlignmentDirectional.centerEnd,
              child: Text('$value', style: valueTextStyle(context, extraInfo: extraInfo), overflow: TextOverflow.ellipsis),
            ),
          ),
        if (accessoryWidget != null) horizontalPadding(context, extraInfo: extraInfo),
        if (accessoryWidget != null) accessoryWidget,
        trailingCellPadding(context, extraInfo: extraInfo),
      ],
    ),
  );
}