Widget generateReorderableList() {
return Column(
children: [
Stack(
children: [
SizedBox(
width: double.infinity,
height: 600, //A modifier
child:
ReorderableListView(
header: Column(
children: [
Row(
children: [
for (final item in headersList)
Container(
padding: const EdgeInsets.all(19.0),
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 16.0,),
child: item,
),
),
],
),
const CustomSeparator()
],
),
onReorder: (int oldIndex, int newIndex) {
handleDraggable(newIndex, oldIndex);
},
children: [
for (final item in rowsList)
InkWell(
key: ValueKey(item),
onHover: (bool value){
handleChangeIsHovering(value);
},
hoverColor: isHovering ? Colors.red : Colors.blue ,
onTap: () {
onClickRow != null
? (bool? selected) {
onClickRow!(item.item);
}
: null;
},
child: ListTile(
key: ValueKey(item),
title: Container(
padding: const EdgeInsets.only(left: 10.0),
child: DefaultTextStyle(
style: const TextStyle(
color: Colors.black,
fontSize: 14.0,
),
child: item.widgets.first
),
),
onFocusChange: onClickRow != null
? (bool? selected) {
onClickRow!(item.item);
}
: null,
selected: item.selected ?? false,
mouseCursor: SystemMouseCursors.click,
hoverColor: isHovering ? Colors.yellow : Colors.green ,
),
),
],
),
),
if (button != null)
Positioned(
top: 12,
right: 33,
child: InkWell(
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
button!();
},
child: Container(
decoration: BoxDecoration(color: Theme.of(context).colorScheme.surfaceVariant, borderRadius: BorderRadius.circular(100)),
padding: const EdgeInsets.all(2),
child: const Align(
child: Icon(
Icons.add,
color: Colors.white,
size: 24,
)))))))
],
),
if (rowsList.isEmpty) const SizedBox(width: double.infinity, child: Text('Aucune donnée', textAlign: TextAlign.center, style: TextStyle(fontStyle: FontStyle.italic)))
],
);
}
字符串
你好,我无法让我的线有颜色取决于他们是否悬停。蓝色和红色的颜色出现时,我移动线^^有时它是红色的,有时它是蓝色的,我不明白。
同样的onFocusChange
,我似乎不能重定向到onClickRow
。
想找一个保持器和一个onClickRow
1条答案
按热度按时间qc6wkl3g1#
您可以浏览MouseRegion小部件来控制悬停:https://api.flutter.dev/flutter/widgets/MouseRegion-class.html