AdaptiveConversationDesk<T> constructor

const AdaptiveConversationDesk<T>({
  1. Key? key,
  2. required List<T> conversations,
  3. required Widget itemBuilder(
    1. BuildContext context,
    2. T conversation,
    3. bool selected,
    4. VoidCallback onTap,
    ),
  4. required Widget threadBuilder(
    1. BuildContext context,
    2. T conversation
    ),
  5. required Widget contextBuilder(
    1. BuildContext context,
    2. T conversation
    ),
  6. required String listTitle,
  7. required String contextTitle,
  8. Widget? header,
  9. Widget? emptyState,
  10. String? listDescription,
  11. Widget? listLeading,
  12. String? contextDescription,
  13. Widget? contextLeading,
  14. String modalListLabel = 'Open conversations',
  15. Widget modalListIcon = const Icon(Icons.chat_bubble_outline),
  16. String modalContextLabel = 'Open context',
  17. Widget modalContextIcon = const Icon(Icons.info_outline),
  18. AdaptiveSize listDockedAt = AdaptiveSize.medium,
  19. AdaptiveSize contextDockedAt = AdaptiveSize.expanded,
  20. AdaptiveHeight minimumListDockedHeight = AdaptiveHeight.compact,
  21. AdaptiveHeight minimumContextDockedHeight = AdaptiveHeight.medium,
  22. bool useContainerConstraints = true,
  23. bool considerOrientation = false,
  24. int? selectedIndex,
  25. int initialIndex = 0,
  26. ValueChanged<int>? onSelectedIndexChanged,
  27. double spacing = 16,
  28. double itemSpacing = 12,
  29. int listFlex = 2,
  30. int threadFlex = 4,
  31. int contextFlex = 2,
  32. EdgeInsetsGeometry listPadding = const EdgeInsets.all(16),
  33. EdgeInsetsGeometry threadPadding = const EdgeInsets.all(16),
  34. EdgeInsetsGeometry contextPadding = const EdgeInsets.all(16),
  35. double modalHeightFactor = 0.72,
  36. bool showModalDragHandle = true,
  37. bool animateSize = true,
  38. Duration animationDuration = const Duration(milliseconds: 250),
  39. Curve animationCurve = Curves.easeInOutCubic,
})

Creates an adaptive conversation desk.

Implementation

const AdaptiveConversationDesk({
  super.key,
  required this.conversations,
  required this.itemBuilder,
  required this.threadBuilder,
  required this.contextBuilder,
  required this.listTitle,
  required this.contextTitle,
  this.header,
  this.emptyState,
  this.listDescription,
  this.listLeading,
  this.contextDescription,
  this.contextLeading,
  this.modalListLabel = 'Open conversations',
  this.modalListIcon = const Icon(Icons.chat_bubble_outline),
  this.modalContextLabel = 'Open context',
  this.modalContextIcon = const Icon(Icons.info_outline),
  this.listDockedAt = AdaptiveSize.medium,
  this.contextDockedAt = AdaptiveSize.expanded,
  this.minimumListDockedHeight = AdaptiveHeight.compact,
  this.minimumContextDockedHeight = AdaptiveHeight.medium,
  this.useContainerConstraints = true,
  this.considerOrientation = false,
  this.selectedIndex,
  this.initialIndex = 0,
  this.onSelectedIndexChanged,
  this.spacing = 16,
  this.itemSpacing = 12,
  this.listFlex = 2,
  this.threadFlex = 4,
  this.contextFlex = 2,
  this.listPadding = const EdgeInsets.all(16),
  this.threadPadding = const EdgeInsets.all(16),
  this.contextPadding = const EdgeInsets.all(16),
  this.modalHeightFactor = 0.72,
  this.showModalDragHandle = true,
  this.animateSize = true,
  this.animationDuration = const Duration(milliseconds: 250),
  this.animationCurve = Curves.easeInOutCubic,
})  : assert(spacing >= 0, 'spacing must be zero or greater.'),
      assert(itemSpacing >= 0, 'itemSpacing must be zero or greater.'),
      assert(listFlex > 0, 'listFlex must be greater than zero.'),
      assert(threadFlex > 0, 'threadFlex must be greater than zero.'),
      assert(contextFlex > 0, 'contextFlex must be greater than zero.'),
      assert(
        modalHeightFactor > 0 && modalHeightFactor <= 1,
        'modalHeightFactor must be between 0 and 1.',
      );