Accordion(- {int? maxOpenSections,
- List<AccordionSection>? children,
- int? initialOpeningSequenceDelay,
- Widget? leftIcon,
- Widget? rightIcon,
- bool? flipRightIconIfOpen,
- Color? contentBackgroundColor,
- Color? contentBorderColor,
- double? contentBorderWidth,
- double? contentBorderRadius,
- double? contentHorizontalPadding,
- double? contentVerticalPadding,
- double paddingListTop = 20.0,
- double paddingListBottom = 40.0,
- double paddingListHorizontal = 10.0,
- double? paddingBetweenOpenSections,
- double? paddingBetweenClosedSections,
- ScrollIntoViewOfItems? scrollIntoViewOfItems}
)
Implementation
Accordion({
int? maxOpenSections,
this.children,
int? initialOpeningSequenceDelay,
Color? headerBackgroundColor,
double? headerBorderRadius,
TextAlign? headerTextAlign,
TextStyle? headerTextStyle,
Widget? leftIcon,
Widget? rightIcon,
bool? flipRightIconIfOpen,
Color? contentBackgroundColor,
Color? contentBorderColor,
double? contentBorderWidth,
double? contentBorderRadius,
double? contentHorizontalPadding,
double? contentVerticalPadding,
this.paddingListTop = 20.0,
this.paddingListBottom = 40.0,
this.paddingListHorizontal = 10.0,
EdgeInsets? headerPadding,
double? paddingBetweenOpenSections,
double? paddingBetweenClosedSections,
ScrollIntoViewOfItems? scrollIntoViewOfItems,
}) {
listCtrl.initialOpeningSequenceDelay = initialOpeningSequenceDelay ?? 0;
this._headerBackgroundColor = headerBackgroundColor;
this._headerBorderRadius = headerBorderRadius ?? 30;
this._headerTextAlign = headerTextAlign ?? TextAlign.left;
this._headerTextStyle = headerTextStyle;
this._leftIcon = leftIcon;
this._rightIcon = rightIcon;
this._flipRightIconIfOpen = flipRightIconIfOpen;
this._contentBackgroundColor = contentBackgroundColor;
this._contentBorderColor = contentBorderColor;
this._contentBorderWidth = contentBorderWidth;
this._contentBorderRadius = contentBorderRadius ?? 20;
this._contentHorizontalPadding = contentHorizontalPadding;
this._contentVerticalPadding = contentVerticalPadding;
this._headerPadding = headerPadding ?? EdgeInsets.symmetric(horizontal: 20, vertical: 10);
this._paddingBetweenOpenSections = paddingBetweenOpenSections ?? 10;
this._paddingBetweenClosedSections = paddingBetweenClosedSections ?? 3;
this._scrollIntoViewOfItems = scrollIntoViewOfItems;
int count = 0;
listCtrl.maxOpenSections = maxOpenSections ?? 1;
children!.forEach((child) {
if (child._sectionCtrl.isSectionOpen.value == true) {
count++;
if (count > listCtrl.maxOpenSections) child._sectionCtrl.isSectionOpen.value = false;
}
});
}