Skip to content

Conversation

@deepraj02
Copy link

@deepraj02 deepraj02 commented Feb 11, 2024

closes #89

Added MUICollapsibleButton on top of existing MUIPrimaryButton class keeping all it's parameters accessible

Video (Demo):

muicollapse

Example

MUICollapsibleButton(
            actionIcon:
                isCollapsible ? Icons.arrow_drop_up : Icons.arrow_drop_down,
            collapsibleChild: const CollapsibleUnit(),
            text: 'Collapsible Button',
            onPressed: () {
              isCollapsible = !isCollapsible;
            },
          ),

Copy link
Member

@Utkarsh4517 Utkarsh4517 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is exactly what we wanted a collapse button to behave like but I just realized that wouldn't it be much butter if we had options to chose the type of MUIButton using enums ? so instead of just MUIPrimaryButton an user can choose any kind of MUIButton. Wdyt over this?

),
const SizedBox(height: 16.0),

// Collapsible Button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have a CollapsibleButton comment over a Secondary Outlined Button?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh, maybe by mistake

collapsibleChild: const CollapsibleUnit(),
text: 'Collapsible Button',
onPressed: () {
isCollapsible = !isCollapsible;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call this isCollapsible = !isCollapsible; inside setState

final Color iconColor;

/// On Pressed Function.
final void Function() onPressed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please make this onPressed function optional for the user.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

@Utkarsh4517
Copy link
Member

Please change the target branch to development from main

@deepraj02 deepraj02 changed the base branch from main to development February 13, 2024 08:08
@deepraj02
Copy link
Author

so do you want me to add a isCollapsible parameter to all the existing buttons which if true then we can perform the collapsible stuff

@Utkarsh4517
Copy link
Member

Yeah I guess that would also work.

@deepraj02
Copy link
Author

how about creating a named constructor for collapsible part

eg:

AnyButton.collapsible()

something like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Collapse

3 participants