Trying to add a delete button in a listViewBuilder - flutter

I am trying to add a delete button in a ListViewBuilder and I have gotten the Delete function to work but I can not seem to get the listViewBuilder to refresh to show the user the new list without going to another screen.
ListViewBuilder Widget:
class LayoutBuilderWidgetDoorsOptions extends StatelessWidget {
LayoutBuilderWidgetDoorsOptions({Key? key}) : super(key: key);
String? dropdownValueObjects;
String? dropdownValueDoorWidth;
String? dropdownValueDoorPanelType;
String? dropdownValueOpLcWidth;
String? dropdownValueOpLcPanelType;
String? dropdownValueWalls;
bool deleted = false;
#override
Widget build(BuildContext context) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.all(20),
width: 150,
child: DropdownButton(
value: dropdownValueObjects,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
onChanged: (String? value) {
if (value == 'Sliding Door') {
if (SelectedUpperPanelHt == 'None') {
Fluttertoast.showToast(
msg:
'ERROR: Sliding Door can not have top removed. Please remove Sliding Doors or change Upper Height',
webPosition: "center",
webBgColor:
"linear-gradient(to right, #dc1c13, #B90E0A)",
timeInSecForIosWeb: 5,
toastLength: Toast.LENGTH_LONG);
throw new FormatException();
}
}
dropdownValueObjects = value!;
(context as Element).markNeedsBuild();
},
items: Options.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
if (dropdownValueObjects == 'Swing Door' ||
dropdownValueObjects == 'Sliding Door' ||
dropdownValueObjects == null)
Container(
margin: const EdgeInsets.all(20),
width: 150,
child: DropdownButton(
value: dropdownValueDoorPanelType,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
onChanged: (String? value) {
if (value != 'Select A Value') {
dropdownValueDoorPanelType = value!;
(context as Element).markNeedsBuild();
} else {
Fluttertoast.showToast(
msg: 'Select A Value is not a valid choice',
webPosition: "center",
webBgColor:
"linear-gradient(to right, #dc1c13, #B90E0A)",
timeInSecForIosWeb: 5,
toastLength: Toast.LENGTH_LONG);
throw new FormatException();
}
},
items: PanelTypeOptions.map<DropdownMenuItem<String>>(
(String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
if (dropdownValueObjects == 'Swing Door' ||
dropdownValueObjects == 'Sliding Door' ||
dropdownValueObjects == null)
Container(
margin: const EdgeInsets.all(20),
width: 150,
child: DropdownButton(
value: dropdownValueDoorWidth,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
onChanged: (String? value) {
dropdownValueDoorWidth = value!;
(context as Element).markNeedsBuild();
},
items: DoorWidthOptions.map<DropdownMenuItem<String>>(
(String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
if (dropdownValueObjects == 'Opening' ||
dropdownValueObjects == 'Light Curtain')
Container(
margin: const EdgeInsets.all(20),
width: 150,
child: DropdownButton(
value: dropdownValueOpLcPanelType,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
onChanged: (String? value) {
if (value != 'Select A Value') {
dropdownValueOpLcPanelType = value!;
(context as Element).markNeedsBuild();
} else {
Fluttertoast.showToast(
msg: 'Select A Value is not a valid choice',
webPosition: "center",
webBgColor:
"linear-gradient(to right, #dc1c13, #B90E0A)",
timeInSecForIosWeb: 5,
toastLength: Toast.LENGTH_LONG);
throw new FormatException();
}
},
items:
NAOption.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
if (dropdownValueObjects == 'Opening' ||
dropdownValueObjects == 'Light Curtain')
Container(
margin: const EdgeInsets.all(20),
width: 150,
child: DropdownButton(
value: dropdownValueOpLcWidth,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
onChanged: (String? value) {
dropdownValueOpLcWidth = value!;
(context as Element).markNeedsBuild();
},
items: PanelWidthOptions.map<DropdownMenuItem<String>>(
(String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
Container(
margin: const EdgeInsets.all(20),
width: 150,
child: DropdownButton(
value: dropdownValueWalls,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
onChanged: (String? value) {
dropdownValueWalls = value!;
(context as Element).markNeedsBuild();
},
items:
ActualWalls.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
FloatingActionButton.extended(
onPressed: () {
deleted = true;
for (var i = 0; i < listDynamicDoorsOptions.length; i++) {
if (listDynamicDoorsOptions[i].deleted == true) {
listDynamicDoorsOptions.removeAt(i);
(context as Element).markNeedsBuild();
}
}
},
label: Text('Delete', style: TextStyle(color: Colors.white)))
],
),
],
),
);
}
}
I have used the Function: (context as Element).markNeedsBuild(); to reload the dropdownButtons but this does not need to work in this cause because now the context is deleted. Obviously SetState((){}); will not work since this has to be a Stateless Widget. Any help would be greatly appreciated!

Related

Selected value from DropdownButton not showing in Flutter

I have a DropdownButton which displays user type.
List<String> items = ['Engineer', 'Technician', 'Sales'];
String? currentSelectedValue;
child: DropdownButtonHideUnderline(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20.0),
child: DropdownButton<String>(
dropdownColor: Colors.blue.shade100,
isExpanded: true,
hint: Text('Select the user Type'),
onChanged: (newValue) {
setState(() {
currentSelectedValue = newValue;
});
print(currentSelectedValue);
},
items: items.map((String value) {
return DropdownMenuItem(
value: value,
child: Text(
value,
style: TextStyle(color: Colors.black),
),
);
}).toList(),
value: currentSelectedValue,
),
),
),
I can see the list, but when I select a value, it is not displaying on the Text portion of the DropdownButton. I could see the selected value printed in the console.
Can anyone help me to find the mistake?
Make sure to put currentSelectedValue outside the build method.
class Ft extends StatefulWidget {
const Ft({super.key});
#override
State<Ft> createState() => _FtState();
}
class _FtState extends State<Ft> {
List<String> items = ['Engineer', 'Technician', 'Sales'];
String? currentSelectedValue;
#override
Widget build(BuildContext context) {
return Scaffold(
body: DropdownButtonHideUnderline(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: DropdownButton<String>(
dropdownColor: Colors.blue.shade100,
isExpanded: true,
hint: Text('Select the user Type'),
onChanged: (newValue) {
setState(() {
currentSelectedValue = newValue;
});
print(currentSelectedValue);
},
items: items.map((String value) {
return DropdownMenuItem(
value: value,
child: Text(
value,
style: TextStyle(color: Colors.black),
),
);
}).toList(),
value: currentSelectedValue,
),
),
),
);
}
}

How to select only one checkbox from Checkbox List tile in Flutter and show selected item in textField

Here there's a text field that shows bottom sheet of train stations how could i select only one checkbox and show the selected in text field and here is the code thanks in advance and i will appreciate if you taught me how to search by name in the text field from check box list
Scaffold(
backgroundColor: Colors.grey[300],
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ticketbookinghomepage()));
},
),
backgroundColor: Color(0xff240e8b),
title: Text('Search By Station'),
centerTitle: true,
),
body: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.all(10),
child: Column(
children: [
Text('Departure Station'),
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: TextField(
controller: startController,
autocorrect: true,
decoration: InputDecoration(
labelText: '-Select Station',
floatingLabelBehavior:
FloatingLabelBehavior.never,
filled: true,
fillColor: Colors.white,
suffixIcon: InkWell(
onTap: () {
showSourceBottomSheet(context);
},
child: Icon(
Icons.arrow_drop_down_circle_outlined,
color: Colors.black,
),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(30)))),
))
],
)),
SizedBox(height: 12),
IconButton(
icon: Icon(Icons.wifi_protected_setup_rounded),
color: Colors.black,
onPressed: () {},
),
SizedBox(height: 12),
Container(
padding: EdgeInsets.all(10),
child: Column(
children: [
Text('ِِِArrival Station'),
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: TextField(
controller: arriveController,
autocorrect: true,
decoration: InputDecoration(
labelText: '-Select Station',
floatingLabelBehavior:
FloatingLabelBehavior.never,
filled: true,
fillColor: Colors.white,
suffixIcon: InkWell(
onTap: () {
showDestinationBottomSheet(context);
},
child: Icon(
Icons.arrow_drop_down_circle_outlined,
color: Colors.black,
),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(30)))),
))
],
)),
SizedBox(
height: 20,
),
Container(
child: SizedBox(
height: 80,
width: 170,
child: ElevatedButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.amberAccent),
padding:
MaterialStateProperty.all(EdgeInsets.all(15)),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25)))),
onPressed: () {},
child: Icon(
Icons.train,
color: Colors.deepPurple,
),
),
),
),
SizedBox(
height: 15,
),
],
),
),
)
Bottom Sheet Code
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class sourceBottomSheet extends StatefulWidget {
const sourceBottomSheet({Key? key}) : super(key: key);
#override
State<sourceBottomSheet> createState() => _sourceBottomSheetState();
}
bool? checkBox1=false;
bool? checkBox2=false;
bool? checkBox3=false;
bool? checkBox4=false;
bool? checkBox5=false;
bool? checkBox6=false;
bool? checkBox7=false;
bool? checkBox8=false;
class _sourceBottomSheetState extends State<sourceBottomSheet> {
#override
Widget build(BuildContext context) {
return StatefulBuilder(builder: (context, setState) {
return Container(
color: Colors.grey[600],
child: Container(
decoration: BoxDecoration(
color:Colors.white,
borderRadius: BorderRadius.only(topLeft: Radius.circular(30),topRight: Radius.circular(30))
),
child: SingleChildScrollView(
child: Column(
children: [
CheckboxListTile(
activeColor:Color(0xff070000),
checkColor:Color(0xffffffff) ,
title: Text('Cairo'),
value: checkBox1, onChanged: (v) {
setState(() {
checkBox1 = v;
});
}),
CheckboxListTile(
activeColor:Color(0xff070000),
checkColor:Color(0xffffffff) ,
title: Text('Alexandria')
, value: checkBox2, onChanged: (v) {
setState(() {
checkBox2 = v;
});
}),
CheckboxListTile(
activeColor:Color(0xff070000),
checkColor:Color(0xffffffff) ,
title: Text('Mansoura'),
value: checkBox3, onChanged: (v) {
setState(() {
checkBox3 = v;
});
}),
CheckboxListTile(
activeColor:Color(0xff070000),
checkColor:Color(0xffffffff) ,
title: Text('Shoubra Elkhema'),
value: checkBox4, onChanged: (v) {
setState(() {
checkBox4 = v;
});
}),
CheckboxListTile(
activeColor:Color(0xff070000),
checkColor:Color(0xffffffff) ,
title: Text('Banha'),
value: checkBox5, onChanged: (v) {
setState(() {
checkBox5 = v;
});
}),
CheckboxListTile(
activeColor:Color(0xff070000),
checkColor:Color(0xffffffff) ,
title: Text('Louxor'),
value: checkBox7, onChanged: (v) {
setState(() {
checkBox7 = v;
});
}
),
CheckboxListTile(
activeColor:Color(0xff070000),
checkColor:Color(0xffffffff) ,
title: Text('Port Said'),
value: checkBox8, onChanged: (v) {
setState(() {
checkBox8 = v;
});
}),
ListTile(
title:Text('Submit',textAlign: TextAlign.center,),
onTap:(){
Navigator.pop(context);
}),
],
),
),
),
);
}
);
}
}
Home ERROR
Home class error
show bottom sheet error he want context and builder
You can follow the snippet, described on code-commnet and simplified for test and use case.
class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
#override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
Future<List<String?>> showBottomSheet() async {
Map<String, bool> items = {
'Cairo': false,
'Alexandria': false,
'Mansoura': false,
};
await showModalBottomSheet(
context: context,
builder: (c) => StatefulBuilder(
builder: (context, setStateSB) {
return Container(
color: Colors.grey[600],
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30))),
child: SingleChildScrollView(
child: Column(
children: [
...items.keys.map(
(key) => CheckboxListTile(
activeColor: Color(0xff070000),
checkColor: Color(0xffffffff),
title: Text(key),
value: items[key],
onChanged: (v) {
setStateSB(() {
items[key] = v ?? false;
});
}),
),
ListTile(
title: Text(
'Submit',
textAlign: TextAlign.center,
),
onTap: () {
Navigator.pop(context);
}),
],
),
),
),
);
},
),
);
/// we will store selected items
List<String> result = [];
///finding the selected items
items.entries.map(
(element) {
if (element.value == true) result.add(element.key);
},
).toList();
return result;
}
final TextEditingController controller = TextEditingController();
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[300],
body: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.all(10),
child: Column(
children: [
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: TextField(
controller: controller,
autocorrect: true,
decoration: InputDecoration(
labelText: '-Select Station',
floatingLabelBehavior:
FloatingLabelBehavior.never,
filled: true,
fillColor: Colors.white,
suffixIcon: InkWell(
onTap: () async {
final result = await showBottomSheet();
print(result);
final text = result.toString();
///removing start and end brackets
controller.text =
text.substring(1, text.length - 1);
},
child: Icon(
Icons.arrow_drop_down_circle_outlined,
color: Colors.black,
),
),
border: OutlineInputBorder(
borderRadius:
BorderRadius.all(Radius.circular(30)))),
))
],
)),
],
),
),
);
}
}
so i used roadio list instead of checkbox list and it was more easier to use here's the code:
class sourceBottomSheet extends StatefulWidget {
sourceBottomSheet(TextEditingController? _cont) {
controller = _cont;
}
String get value => valuet;
#override
State<sourceBottomSheet> createState() => _sourceBottomSheetState(controller);
}
String valuet = "";
Object? st;
void setval(String _value) {
controller?.text = _value;
}
class _sourceBottomSheetState extends State<sourceBottomSheet> {
_sourceBottomSheetState(TextEditingController? cont) {
// con?.text = valuet;
}
#override
Widget build(BuildContext context) {
return StatefulBuilder(builder: (context, setState) {
return Container(
color: Colors.grey[600],
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30), topRight: Radius.circular(30))),
child: SingleChildScrollView(
child: Column(
children: [
RadioListTile(
value: 1,
groupValue: st,
title: Text("Cairo"),
// subtitle: Text("Radio 1 Subtitle"),
onChanged: (val) {
setval("Cairo");
setState(() {
if (st != val) {
st = val;
}
//else{st=val;}
});
},
// selected:true,
activeColor: Colors.red,
),
RadioListTile(
value: 2,
groupValue: st,
title: Text("Banha"),
// subtitle: Text("Radio 1 Subtitle"),
onChanged: (val) {
setval("Banha");
print("st pressed $st");
setState(() {
if (st != val) {
st = val;
}
// else{st=0;}
});
},
// selected:true,
activeColor: Colors.red,
),
RadioListTile(
value: 3,
groupValue: st,
title: Text("Aleaxandria"),
// subtitle: Text("Radio 1 Subtitle"),
onChanged: (val) {
print("Radio Tile pressed $val");
print("st pressed $st");
setval("Aleaxandria");
setState(() {
if (st != val) {
st = val;
}
// else{st=0;}
});
},
// selected:true,
activeColor: Colors.red,
),
RadioListTile(
value: 4,
groupValue: st,
title: Text("Matrouh"),
// subtitle: Text("Radio 1 Subtitle"),
onChanged: (val) {
print("Radio Tile pressed $val");
print("st pressed $st");
setval("Matrouh");
setState(() {
if (st != val) {
st = val;
}
// else{st=0;}
});
},
// selected:true,
activeColor: Colors.red,
),
RadioListTile(
value: 5,
groupValue: st,
title: Text("Port Said"),
// subtitle: Text("Radio 1 Subtitle"),
onChanged: (val) {
print("Radio Tile pressed $val");
print("st pressed $st");
setval("Port Said");
setState(() {
if (st != val) {
st = val;
}
// else{st=0;}
});
},
// selected:true,
activeColor: Colors.red,
),
RadioListTile(
value: 6,
groupValue: st,
title: Text("Mansoura"),
// subtitle: Text("Radio 1 Subtitle"),
onChanged: (val) {
print("Radio Tile pressed $val");
print("st pressed $st");
setval("Mansoura");
setState(() {
if (st != val) {
st = val;
}
// else{st=0;}
});
},
// selected:true,
activeColor: Colors.red,
),
RadioListTile(
value: 7,
groupValue: st,
title: Text("Louxor"),
// subtitle: Text("Radio 1 Subtitle"),
onChanged: (val) {
print("Radio Tile pressed $val");
print("st pressed $st");
setval("Louxor");
setState(() {
if (st != val) {
st = val;
}
// else{st=0;}
});
},
// selected:true,
activeColor: Colors.red,
),
ListTile(
title: Text(
'Submit',
textAlign: TextAlign.center,
),
onTap: () {
Navigator.pop(context);
}),
],
),
),
),
);
});
}
}```
Bottom Source Sheet Function code
sourceBottomSheet bs = sourceBottomSheet(_cont);
//bs.sourceBottomSheet1(_cont);
showModalBottomSheet(
context: context,
builder: (buildContext) {
return bs;
// return sourceBottomSheet();
});
} ```

Dropdown is not keeping the value selected

I am working on a dropdown and I have the values in a variable, but I can't get the selected value to be shown, instead is always a static value on.
So far I did this:
class DropDownWidget extends State {
String dropdownValue = 'Activities';
String holder = '';
List<String> postType = ['Activities', 'Sell/buy', 'New Friends', 'City Recommendations', 'Post'];
void getDropDownItem() {
setState(() {
holder = dropdownValue;
});
}
#override
Widget build(BuildContext context) {
return Container(
height: 100,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/blue.png'),
fit: BoxFit.cover,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
child: DropdownButton<String>(
value: dropdownValue,
icon: Icon(
Icons.keyboard_arrow_down_outlined,
color: TheBaseColors.lightRed,
),
iconSize: 30,
elevation: 16,
style: TextStyle(color: TheBaseColors.lightRed, fontSize: 18),
onChanged: (String data) {
setState(() {
dropdownValue = data;
});
switch (data) {
case 'Activities':
Navigator.push(
context,
MaterialPageRoute(builder: (context) => CreateActivity()),
);
break;
case 'Sell/buy':
Navigator.push(
context,
}
},
items: postType.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
],
),
);
}
}
I have saved the dropdow value in a variable and then set it in the SetState, but how to show the selected item each time?
Try This
String dropdownValue = 'Activities';
DropdownButton<String>(
value: dropdownValue,
icon: const Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
setState(() {
dropdownValue = newValue!;
});
},
items: <String>['Activities', 'Sell/buy', 'New Friends', 'City Recommendations', 'Post']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),

Dropdown button not expanding

I'm trying to build a form with a DropdownButtonFormField with 4 items but i don't know why it doesn't want to expand.
Added isDense : true but it wasn't because of it being too small
Here's the button code
new Container(
child: DropdownButtonFormField(
isDense: false,
hint: Text('Ecole'),
onSaved: (value) {
this._data.ecole = value.toString();
},
items: ['HEI', 'ISEN', 'ISA', 'all'].map((String value) {
return DropdownMenuItem(
value: value,
child: Text(value),
);
}).toList()),
),
1
Try this
String dropdownValue = 'HEI';
DropdownButton<String>(
value: dropdownValue,
icon: const Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
setState(() {
dropdownValue = newValue!;
});
},
items: <String>['HEI', 'ISEN', 'ISA', 'all']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),

remove dropdown bottom line in flutter

How to remove dropdown bottom line?
My Code
Container(
padding: EdgeInsets.fromLTRB(15, 5, 10, 5),
child: Row(
children: <Widget>[
dropdownButton,
Expanded(child: phoneField),
],
),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey, width: 1),
borderRadius: BorderRadius.circular(32.0)),
)
And this is Dropdown
var dropdownButton = DropdownButton(
value: dropdownValue,
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>['99451', '99450', '99455', '99470 ']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
);
You have to wrap your DropdownButton inside 
DropdownButtonHideUnderline like this 
var dropdownButton = DropdownButtonHideUnderline(
child: DropdownButton(
value: dropdownValue,
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>['99451', '99450', '99455', '99470 '].map<DropdownMenuItem<String>>
((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
)
);
you can use like that
underline: SizedBox()
Found a solution using
underline: Container(),
Full Changed Code
var dropdownButton = DropdownButton(
value: dropdownValue,
underline: Container(),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>['99451', '99450', '99455', '99470 ']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
);