Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add actionsBuilder #67

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

add actionsBuilder #67

wants to merge 3 commits into from

Conversation

IiemB
Copy link

@IiemB IiemB commented Aug 5, 2024

image

added actionsBuilder to customize the buttons and their actions before returning value from dialogue

example :

showOmniDateTimePicker(
                context: context,
                is24HourMode: true,
                isForce2Digits: true,
                initialDate: DateTime.now(),
                firstDate: DateTime(2020),
                lastDate: DateTime(2025),
                padding: const EdgeInsets.all(12),
                insetPadding: const EdgeInsets.all(12),
                borderRadius: BorderRadius.circular(12),
                actionsBuilder:
                    (onCancelPressed, cancelText, onSavePressed, saveText) => [
                  Expanded(
                    child: OutlinedButton(
                      onPressed: () {
                        // ... others actions
                        onCancelPressed.call();
                      },
                      child: Text(cancelText), // or Other text
                    ),
                  ),
                  const SizedBox(
                    height: 20,
                    child: VerticalDivider(),
                  ),
                  Expanded(
                    child: FilledButton(
                      onPressed: () {
                        // ... others actions
                        onSavePressed.call();
                      },
                      child: Text(saveText), // or Other text
                    ),
                  ),
                ],
              ),
showOmniDateTimeRangePicker(
                context: context,
                is24HourMode: true,
                isForce2Digits: true,
                padding: const EdgeInsets.all(12),
                insetPadding: const EdgeInsets.all(12),
                borderRadius: BorderRadius.circular(12),
                actionsBuilder:
                    (onCancelPressed, cancelText, onSavePressed, saveText) => [
                  Expanded(
                    child: OutlinedButton(
                      onPressed: () {
                        // ... others actions
                        onCancelPressed.call();
                      },
                      child: Text(cancelText), // or Other text
                    ),
                  ),
                  const SizedBox(
                    height: 20,
                    child: VerticalDivider(),
                  ),
                  Expanded(
                    child: FilledButton(
                      onPressed: () {
                        // ... others actions
                        onSavePressed.call();
                      },
                      child: Text(saveText), // or Other text
                    ),
                  ),
                ],
              ),

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.

2 participants