GotJimmy / accordion

Other
47 stars 44 forks source link

How to change background color of content to transparent #67

Closed benedict1986 closed 5 months ago

benedict1986 commented 6 months ago

Hi, I am having an issue to set the background of content to transparent. I saw some questions already discussed this , such as https://github.com/GotJimmy/accordion/issues/55, However, the solution seems like does not work for me. Can I please get some help? Thank you.

Here is my version information:

accordion: ^2.6.0 Flutter 3.19.5 Dart 3.3.3

Here is my code

Accordion(
              headerBackgroundColorOpened: Colors.transparent,
              headerBackgroundColor: Colors.transparent,
              contentBackgroundColor: Colors.transparent,
              contentBorderColor: Colors.transparent,
              contentBorderRadius: 0,
              contentBorderWidth: 1,
              contentHorizontalPadding: 20,
              scaleWhenAnimating: true,
              openAndCloseAnimation: true,
              headerPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
              paddingListTop: 0,
              paddingListBottom: 0,
              paddingListHorizontal: 0,
              headerBorderRadius: 5,
              sectionOpeningHapticFeedback: SectionHapticFeedback.heavy,
              sectionClosingHapticFeedback: SectionHapticFeedback.light,
              rightIcon: const Icon(Icons.arrow_circle_down),
              children: [
                AccordionSection(
                  contentBackgroundColor: Colors.transparent,
                  contentBorderColor: Colors.transparent,
                  contentVerticalPadding: 10,
                  header: Row(
                    children: [Text('hello')],
                  ),
                  content: Text('hello2'),
                ),
              ],
            ),

Here is the screenshot

image

GotJimmy commented 6 months ago

Currently, setting the content background to transparent is not going to work. However, try setting the contentBackgroundColor and contentBorderColor to the same color as your apps background color.