Untitled
unknown
plain_text
a year ago
3.0 kB
8
Indexable
Widget buildRow(int index) {
var mediaQuery = MediaQuery.of(context);
double height = mediaQuery.size.height;
double width = mediaQuery.size.width;
return Column(
children: [
SizedBox(
height: height * 0.015,
),
Row(
children: [
SizedBox(
width: width * 0.37,
height: height * 0.05,
child: TextField(
controller: _amountControllers[index],
cursorColor: Colors.grey,
keyboardType: TextInputType.number,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 10),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(color: Colors.grey),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(color: Colors.grey),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(color: Colors.grey),
),
alignLabelWithHint: true,
hintText: 'Enter amount',
hintStyle: TextStyle(color: Colors.grey),
),
),
),
SizedBox(
width: 20,
),
SizedBox(
width: width * 0.4,
height: height * 0.05,
child: TextField(
controller: _detailsControllers[index],
cursorColor: Colors.grey,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 10),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(color: Colors.grey),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(color: Colors.grey),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(color: Colors.grey),
),
alignLabelWithHint: true,
hintStyle: TextStyle(color: Colors.grey),
),
),
),
IconButton(
onPressed: () {
if (index == _amountControllers.length - 1) {
addRow();
} else {
removeRow(index);
}
},
icon: Icon(index == _amountControllers.length - 1
? Icons.add_circle_outline
: Icons.remove_circle_outline),
color: AppTheme.primaryColor,
),
],
),
],
);
}
Editor is loading...
Leave a Comment