Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a popup window in Dart?

Tags:

dart

I am new to using Dart. I was wonder how do I create a pop-up window based on an event? i know how to create the event but not sure how to create the pop-up window.

void main()
{
  List<Element> radioButtons = queryAll(".requestType");
  Iterator i = radioButtons.iterator();
  while(i.hasNext)
  {
    var item = i.next();
    item.on.click.add(addRequestTypeEvent);
  }
}

void addRequestTypeEvent(Event event) {
    <POPUP WINDOW>
}

Update 01/17/2013: I figured out how to do it.

 window.open("http://www.yahoo.com", "yahoo", "status = 1, height = 300, width = 300, resizable = 0");
like image 921
Philathea80 Avatar asked Jan 17 '13 21:01

Philathea80


1 Answers

Just use Window.open:

window.open(url, name);

You can read more on what options you can give as third parameter on MDN.

One more thing, you can simplify your code. The following does the same :

void main()
{
  final radioButtons = queryAll(".requestType");

  // with forEach method
  radioButtons.forEach((item) => item.on.click.add(addRequestTypeEvent));

  // with for loop
  for (final item in radioButtons) {
    item.on.click.add(addRequestTypeEvent);
  }
}
like image 100
Alexandre Ardhuin Avatar answered Oct 29 '22 17:10

Alexandre Ardhuin