bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
673 stars 313 forks source link

Buttons in Dialog [Help] #660

Closed eprivacy-org closed 1 year ago

eprivacy-org commented 1 year ago

Hi, I'm not sure how to add or set buttons in the dialog.

image

The reason I need it is that I have several seniors working with my app. On Desktop and Mobile. I have a lot of requests for "Save", "Undo" and a "Reset" Buttons.

Thanks in advance.

bosskmk commented 1 year ago

That's a feature that doesn't exist yet. Are the types of each button determined? Will the behavior change? If you let me know more details, I will consider it in the next update.

eprivacy-org commented 1 year ago

Hi @bosskmk , thanks for considering this!

Are the types of each button determined?

For our behaviour we only need three buttons Ok/Accept Reset/Revoke Cancel/Abort

Will the behaviour change?

Displayed button names could (in the respective language), methods per DialogType.

If you let me know more details, I will consider it in the next update.

As an example, here is a "dialog with buttons" screenshot:

image

I can imagine an implementation similar to AlertDialog: AlertDialog( title: const Text('DialogName'), content: const Text('DialogContent'), actions: [ ElevatedButton( onPressed: () => Navigator.of(context).pop(), child: const Text("Cancel")), ElevatedButton( onPressed: () => doStuff(), child: const Text("Revert")), ElevatedButton( onPressed: () => sendToBackendAndPop(), child: const Text("Save")), ], );

I don't know the exact layout regarding the individual screen sizes or architectures.

thegioiso commented 1 year ago

@eprivacy-org Pluto-grid use it's own DateTimePicker widget. If you want a custom dialog, change your cell to render mode:

PlutoColumn(renderer: renderer);

Next, on your renderer widget, you can use a onTap and call your Dialog showup. Use a DateTimePicker widget on that dialog like this one:

FormBuilderDateTimePicker(
        name: name,
        timePickerInitialEntryMode: TimePickerEntryMode.input,
        transitionBuilder: (BuildContext context, Widget? child) {
          return MediaQuery(
            data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
            child: child ?? Container(),
          );
        },
        initialTime:
            TimeOfDay(hour: DateTime.now().hour, minute: DateTime.now().minute),
            )

FormBuilder will have a Key to collect data when you call them.

Just reload your Pluto grid and load new data to the cell.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.