flutter dropdown button example

Example 1: dropdown button flutter example

DropdownButton<String>(
                value: 'Dept1',
                elevation: 16,
                icon: Icon(Icons.arrow_drop_down_circle),
                isExpanded: true,
                items: <String>['Dept1','Dept2'].map((e) {
                  return DropdownMenuItem(
                    value: e,
                    child: Text(e) ,
                  );
                }).toList(),
              onChanged: (value){},
              ),

Example 2: react button example

import React, { Component } from 'react';

class App extends Component {
  
  constructor(props) {
    super(props);
    this.sayHello = this.sayHello.bind(this);
  }

  sayHello() {
    alert('Hello!');
  }
  
  return (
    <button onClick={this.sayHello}>
      Click me!
    </button>
  );
}

export default App;

Tags:

Misc Example