In Dart, is there an equivalent MessageBox functionality as in C# using WinForms

Issue

I know there is a MessageBox class in the isolate library but that is not what I need. I am looking for the pop-up style messagebox functionality found in desktop windows apps (i.e. WinForm apps) where you ask a simple confirmation question and the user can click a yes or no button in response. Is there an equivalent in Dart, if not can anyone suggest some alternatives?

Solution

You can display a message box easily with :

window.alert('test');

don’t forget this in the top of your file:

import 'dart:html';

This will behave like the alert function in JavaScript. If you want to add buttons (other then the default “ok” button) to your message window, then you will need to make a custom window, which would not be very hard. You create an element which you add to your document body. This element should be absolute positionned. Adding an overlay in front of your document will be useful to prevent user clicks on the page.

this is in javascript, but it is useful to know what to do with dom and css :

http://raventools.com/blog/create-a-modal-dialog-using-css-and-javascript/

Answered By – user1401072

Answer Checked By – Willingham (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *