dart - Re: create a dropdown button in flutter -


i have used dropdownbutton in build want arrow displayed @ end , dropdown items displayed arrow, in app displaying top. have attached screenshots reference.

please can tell me how change or there other way create drop down menu.

an example appreciated.

please excuse code new programming , comments or suggestions welcome.

many thanks, mahi.

import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'dart:ui';  void main(){     runapp(new branchsetup());       }  class branchsetup extends statefulwidget {     @override     state<statefulwidget> createstate() {          return new _branchsetupstate();           }        }       class _branchsetupstate extends state<branchsetup>                                  widgetsbindingobserver {       @override            widget build(buildcontext context){            return new materialapp(               theme: new themedata(                   primarycolor: const color(0xff229e9c),                                 ),               title: 'branch setup',               home: new scaffold(               body: new container(               child: new listview(                 children: <widget>[                  new container(                    margin: const edgeinsets.all(16.0),                     child: new row(                      children: <widget>[                       new expanded(                         child: new textformfield(             decoration: new inputdecoration([enter image description here][1]                                                   labeltext: 'branch name',                    ),                 ),               ),             ],           ),          ),           new container(             margin: const edgeinsets.all(16.0),             child:               new dropdownbutton<string>(                 items: <string>['mens','womans']                       .map((string value) {                     return new dropdownmenuitem<string>(                         value: value,                         child: new text(value),                     );                   }                   ).tolist(),                onchanged: null,                 ),             ),            ],         ),         ),      ),     );    }    } 

this looks bug in flutter. filed issue.

in meantime, can work around wrapping dropdownbutton in column.

screenshot

import 'package:flutter/material.dart';  void main() {   runapp(new materialapp(home: new demoapp())); }  class demoapp extends statelesswidget {   @override   widget build(buildcontext context) {     return new scaffold(       appbar: new appbar(title: new text('dropdownbutton example')),       body: new listview(         children: [           new column(             children: <widget>[               new dropdownbutton<string>(                 items: <string>['foo', 'bar'].map((string value) {                   return new dropdownmenuitem<string>(                     value: value,                     child: new text(value),                   );                 }).tolist(),                 onchanged: (_) {},               ),             ],           ),         ],       ),     );   } } 

Comments

Popular posts from this blog

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -