I created a Flutter gridview of containers and every one makes use of an onTap detector to vary shade, however I need to have dragging performance to vary a number of containers at a time with out lifting the pointer.
Right here is my container class that makes use of OnTap:
class CalendarBox extends StatelessWidget {
closing little one;
bool chosen;
closing operate;
CalendarBox({this.little one, required this.chosen, this.operate});
@override
Widget construct(BuildContext context) {
return GestureDetector(
onTap: operate,
little one: Container(
// shade: Colours.blue,
ornament: BoxDecoration(
shade: chosen ? Colours.inexperienced : Colours.gray,
border: Border.all(shade: Colours.black, width: 0.2)),
// shade: Colours.blue,
little one: Middle(little one: Textual content(little one.toString())),
),
);
;
}
}
that is the gridview that builds the containers:
Container(
width: 290,
top: 600,
little one: GridView.builder(
physics: NeverScrollableScrollPhysics(),
itemCount: calendarBoxCount,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
mainAxisSpacing: 0,
crossAxisSpacing: 0,
crossAxisCount: calendarBoxInEachRow,
childAspectRatio: (20 / 10),
),
itemBuilder: (context, index) {
return CalendarBox(
little one: index,
chosen: boxStatus[index],
operate: () {
//pointer detected on field turns field inexperienced
selectBox(index);
},
);
}),
),