Latest source merged from Syncfusion

This commit is contained in:
pipeline 2021-08-11 03:25:55 -07:00
Родитель 5ec74a9d0a
Коммит a3278edbcf
2 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

@ -287,7 +287,7 @@ class EmployeeDataSource extends DataGridSource {
### Styling alternate rows
The appearance of the alternating rows in `SfDataGrid` can be customized by using the `DataGridRowAdapter.color`.
The appearance of the alternating rows in `SfDataGrid` can be customized by using the `DataGridRowAdapter.color`. Use the [effectiveRows]() property to get the index of the row. This collection contains the sorted collection if the sorting is applied.
{% tabs %}
{% highlight Dart %}
@ -316,7 +316,7 @@ class EmployeeDataSource extends DataGridSource {
@override
DataGridRowAdapter? buildRow(DataGridRow row) {
Color getRowBackgroundColor() {
final int index = dataGridRows.indexOf(row);
final int index = effectiveRows.indexOf(row);
if (index % 2 != 0) {
return Colors.lightGreen[300]!;
}

Просмотреть файл

@ -26,11 +26,12 @@ Widget build(BuildContext context) {
allowSwiping: true,
swipeMaxOffset: 100.0,
source: employeeDataSource,
startSwipeActionsBuilder: (BuildContext context, DataGridRow row) {
startSwipeActionsBuilder:
(BuildContext context, DataGridRow row, int rowIndex) {
return GestureDetector(
onTap: () {
_employeeDataSource.dataGridRows.insert(
_employeeDataSource.dataGridRows.indexOf(row),
rowIndex,
DataGridRow(cells: [
DataGridCell(value: 1011, columnName: 'id'),
DataGridCell(value: 'Tom Bass', columnName: 'name'),
@ -47,11 +48,11 @@ Widget build(BuildContext context) {
),
);
},
endSwipeActionsBuilder: (BuildContext context, DataGridRow row) {
endSwipeActionsBuilder:
(BuildContext context, DataGridRow row, int rowIndex) {
return GestureDetector(
onTap: () {
_employeeDataSource.dataGridRows.removeAt(
_employeeDataSource.dataGridRows.indexOf(row));
_employeeDataSource.dataGridRows.removeAt(rowIndex);
_employeeDataSource.updateDataSource();
},
child: Container(
@ -140,11 +141,11 @@ Widget build(BuildContext context) {
allowSwiping: true,
swipeMaxOffset: constraints.maxWidth,
source: employeeDataSource,
startSwipeActionsBuilder: (BuildContext context, DataGridRow row) {
startSwipeActionsBuilder:
(BuildContext context, DataGridRow row, int rowIndex) {
return GestureDetector(
onTap: () {
_employeeDataSource.dataGridRows.removeAt(
_employeeDataSource.dataGridRows.indexOf(row));
_employeeDataSource.dataGridRows.removeAt(rowIndex);
_employeeDataSource.updateDataSource();
},
child: Container(