的滚动条
SingleChildScrollView
出现在整个
Column
,而不仅仅是里面的内容
SingleChildScrollView
。我想完全删除滚动条,或者确保滚动条仅适用于
SingleChildScrollView
我尝试了所有的方法,但都无济于事,就连我也试着设定身高
SingleChildScrollView
烧烤架还在往下掉。请让我知道我做错了什么?
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: selectedPickValues!.map((pickValue) {
return Padding(
padding: const EdgeInsets.only(right: 10.0),
child: InputChip(
backgroundColor: Colors.white,
padding: EdgeInsets.zero,
labelPadding: EdgeInsets.only(left: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0), // Set the desired radius
side: BorderSide(color: UiUtils.getColor().withOpacity(0.30), width: 1.0), // Optional: add a border
),
label: Text(CommonUtils.maxLength(pickValue.fieldvalue ?? '', 50),style: TextStyle(fontSize: 10),),
deleteIcon: Icon(
Icons.cancel,
color: UiUtils.getColor(),
size: 18.0, // Reduce the icon size as needed
),
onDeleted: () {
setState(() {
selectedPickValues!.remove(pickValue);
});
widget.selectedFields(selectedPickValues);
},
),
);
}).toList(),
),
),
const SizedBox(height: 10,),
SizedBox(
height: 35,
child: TextField(
style: TextStyle(fontSize: 13),
maxLines: 1,
minLines: 1,
enabled: true,
onChanged: (value) {
setState(() {
searchingText = value;
});
},
decoration: InputDecoration(
prefixIcon: Icon(Icons.search,color: Colors.grey,),
counterText: "",
hintText: 'Search here',
filled: true,
hintStyle: TextStyle(color: Colors.grey,fontWeight: FontWeight.normal),
contentPadding: EdgeInsets.only(left: 8),
fillColor: Colors.white70,
enabledBorder: UiUtils.searchBorder(),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(color: Colors.grey, width: 0.5),
),
focusedBorder: UiUtils.searchBorder(),
),
),
),
SizedBox(height: 10),
Container(
constraints: BoxConstraints(maxHeight: 360),
child: Column(
children: [
Wrap(
children: fieldValues!.pickvalues!.map((pickValues) {
bool userMatches = searchingText.isEmpty || pickValues.fieldvalue!.toLowerCase().contains(searchingText.toLowerCase());
if (searchingText.isNotEmpty && !userMatches) {
return SizedBox();
}
String fieldValue = pickValues.fieldvalue ?? '';
int id = pickValues.id ?? 0;
bool isSelected = selectedPickValues!.any((pickValue) => pickValue.id == id);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: ChoiceChip(
selectedColor: UiUtils.getColor(),
backgroundColor: Colors.white,
showCheckmark: false,
shape: RoundedRectangleBorder(
side: BorderSide(color: isSelected ? Colors.white : Colors.grey),
borderRadius: BorderRadius.all(Radius.circular(26))),
label: Text(fieldValue,style: TextStyle(color: isSelected ? Colors.white : null),),
selected: isSelected,
onSelected: (selected) {
setState(() {
if (selected) {
selectedPickValues!.add(pickValues);
} else {
selectedPickValues!.remove(pickValues);
}
widget.selectedFields(selectedPickValues);
});
},
),
);
}).toList(),
),
],
),
),
],
),
我尝试了以下方法来删除滚动条,但无济于事
ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
child: ...,),
尝试添加
Scrollbar(
thickness: 0,
child: ...
)
还有
NotificationListener<ScrollNotification>(
onNotification: (_) => true,
child: ListView(....)
)