startSwipeActionsBuilder and endSwipeActionsBuilder does not work- no swiping works

Hi, trying to enable swiping with my DataGrid. Did everything exactly as Instructions with no luck. Any ideas?

5 Replies

NK Neelakandan Kannan Syncfusion Team April 5, 2021 07:46 AM UTC

Hi Roberto,

Thanks for contacting Syncfusion support.

Please ensure that you have set the following properties,

We suspect that you might not set the allowSwiping property. We have also published the SB sample in below GitHub location,

https://github.com/syncfusion/flutter-examples/blob/master/lib/samples/datagrid/swiping/datagrid_swiping.dart

If you still couldn’t swipe the rows, please share your code or example project. We will check and provide you the solution as early as possible.

Regards,

Neelakandan



RO Roberto April 5, 2021 07:55 AM UTC

Hi Neelakandan,

Thank you for the super fast reply. Here is my code for the data grid not including the data source. Everything else works except the swipe issue. I also just confirmed that swiping does not work on both iOS emulator and android emulator. I also tried a physical iPhone- does not work. Any ideas?

```
class ExpenseDataGrid extends StatefulWidget {
@override
_ExpenseDataGridState createState() => _ExpenseDataGridState();
}

class _ExpenseDataGridState extends State<ExpenseDataGrid> {
@override
Widget build(BuildContext context) {
return Consumer<ExpenseData>(
builder: (context, expenseData, child) {
var expenseDataSource =
ExpenseGridSource(expenseData: expenseData.getExpenseList());
return Scaffold(
body: SafeArea(
///
/// TODO: Handle no swipe problem
///

child: SfDataGrid(
allowSwiping: true,
swipeMaxOffset: 100.0,
source: expenseDataSource,
columnWidthMode: ColumnWidthMode.fill,
startSwipeActionsBuilder: (context, row) {
return GestureDetector(
child: Container(
width: 100.0,
color: Colors.orange,
child: Center(
child: Icon(
Icons.edit,
),
),
),
onTap: () {
int index = expenseDataSource._expenseData.indexOf(row);
EditExpense(index: index);
},
);
},
endSwipeActionsBuilder: (context, row) {
return GestureDetector(
child: Container(
width: 100.0,
color: Colors.red,
child: Center(
child: Icon(
Icons.delete,
),
),
),
onTap: () {
int index = expenseDataSource._expenseData.indexOf(row);
Provider.of<ExpenseData>(context).deleteExpense(index);
},
);
},
columns: <GridColumn>[
GridTextColumn(
columnName: 'item',
label: Container(
color: Colors.red,
padding: EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: Text(
'Item',
style: TextStyle(color: Colors.white),
),
),
),
GridTextColumn(
columnName: 'cost',
label: Container(
color: Colors.red,
padding: EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: Text(
'Cost',
style: TextStyle(color: Colors.white),
),
),
),
GridTextColumn(
columnName: 'expenseDate',
label: Container(
color: Colors.red,
padding: EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: Text(
'Expense Date',
style: TextStyle(color: Colors.white),
overflow: TextOverflow.ellipsis,
),
),
),
GridTextColumn(
columnName: 'status',
label: Container(
color: Colors.red,
padding: EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: Text(
'Status',
style: TextStyle(color: Colors.white),
),
),
),
GridTextColumn(
columnName: 'dateAdded',
label: Container(
color: Colors.red,
padding: EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: Text(
'Date Added',
style: TextStyle(color: Colors.white),
),
),
),
],
),
),
);
},
);
}
}
```


RS Renugadevi Sadagoban Syncfusion Team April 5, 2021 05:21 PM UTC

Hi Roberto,  
  
Thanks for your update. 
  
From the provided information, we have checked your reported scenario, but we could not reproduce your reported issueWe have tested swiping sample with the following devices it's working fine.  
  
Devices:  
Moto G5S plus,  
iPhone 12 pro max(version-14:4)  
Emulator-Nexus 5  
  
Please refer to the following sample for your reference,  
   
Please check the above sample and revert us if you still facing the same issue? If yes, please provide the following details,  
1.       Which is Flutter channel (Stable, beta or Master) are you using?  
2.       Provide the flutter version details? 
3.       Your emulator version or physical device details.   
 
 
It will be helpful for us to check on it and provide you the solution at the earliest.     
  
 
Regards, 
Renuga devi S  



RO Roberto April 5, 2021 10:12 PM UTC

Hi Renuga,

Looks like this problem is a problem with how I'm loading data from Provider/Consumer. Its exactly related to my other issue and is causing it. As Here.
Possibly I could get some help on this once I wrap my head around how to even propose it? That would be super helpful.

Also I have to say that customer support here is phenomenal!


RS Renugadevi Sadagoban Syncfusion Team April 6, 2021 01:54 PM UTC

Hi Roberto,   
  
Thanks for your feedback on customer support.   
 
We hope that our provided simple swiping example is working fine at your end. As you updated, this may be the problem in Provider/Consumer data binding. As Balasubramani has requested the details in below forum, please provide the details in below forum. So that, the swiping problem will be resolved. 
  
  
Please let us know if you need further assistance on swiping example. 
 
Regards, 
Renuga devi S  


Loader.
Up arrow icon