I'm making a bool condition for search and review cart page then i face these 3 errors i try to solve but not success(first 2 error on container //Expected to find ','. //The element type 'bool' can't be assigned to the list type 'Widget'. )and the second one on the text widget(Expected to find ']'.)
bool isBool = false;
SigleItem(this.isBool);
isBool ==false Container( //Expected to find ','. //The element type 'bool' can't be assigned to the list type 'Widget'.
margin: const EdgeInsets.only(right: 15),
padding: const EdgeInsets.symmetric(horizontal: 10),
height: 35,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(30),
),
child: Row(
children: [
const Expanded(
child: Text(
'RS-799',
style: TextStyle(
color: Colors.grey,
),
),
),
Center(
child: Icon(
Icons.arrow_drop_down,
size: 20,
color: primaryColor,
),
),
],
),
):Text('750')//Expected to find ']'.
You forgot the question mark after bool condition, read this for Conditional Statement
isBool == false
? Container(
margin: const EdgeInsets.only(right: 15),
padding: const EdgeInsets.symmetric(horizontal: 10),
height: 35,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(30),
),
child: Row(
children: [
const Expanded(
child: Text(
'RS-799',
style: TextStyle(
color: Colors.grey,
),
),
),
Center(
child: Icon(
Icons.arrow_drop_down,
size: 20,
color: Colors.red,
),
),
],
),
)
: Text('750'),