Skyrocketing cpu temps & usage only when on DataGrid screen in iOS emulator
Hello, looking to see if I'm doing something wrong here. I have have an Sf DataGrid inside a Stateless Widget, I'm using an iPhone 12 emulator. I have a very small amount of data in the table and for some reason I'm getting skyrocketing cpu temps (85 degrees Celsius +) which keep rising along with fan speeds but ONLY when I'm on the DataGrid screen in the emulator app. This is very unusual.
Im my activity monitor (on Macbook pro) the iOS "runner" looks to be the culprit. Any idea if I'm doing something wrong here?
I have performed a few tests to confirm the above. The above is invariable. Problem persists...
Any help is much appreciated :)
Here is my code:
```
class IncomeDataGrid extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<IncomeData>(
builder: (context, incomeData, child) {
var incomeDataSource =
IncomeGridSource(incomeData: incomeData.getIncomeList());
return Scaffold(
body: SafeArea(
child: SfDataGrid(
source: incomeDataSource,
columnWidthMode: ColumnWidthMode.fill,
columns: <GridColumn>[
GridTextColumn(
columnName: 'source',
label: Container(
color: Colors.green,
padding: EdgeInsets.all(16.0),
alignment: Alignment.center,
child: Text(
'Source',
style: TextStyle(color: Colors.white),
),
),
),
GridTextColumn(
columnName: 'gross',
label: Container(
color: Colors.green,
padding: EdgeInsets.all(8.0),
alignment: Alignment.center,
child: Text(
'Gross',
style: TextStyle(color: Colors.white),
),
),
),
GridTextColumn(
columnName: 'cgi',
label: Container(
color: Colors.green,
padding: EdgeInsets.all(8.0),
alignment: Alignment.center,
child: Text(
'CGI',
style: TextStyle(color: Colors.white),
overflow: TextOverflow.ellipsis,
),
),
),
GridTextColumn(
columnName: 'incomeDate',
label: Container(
color: Colors.green,
padding: EdgeInsets.all(8.0),
alignment: Alignment.center,
child: Text(
'Income Date',
style: TextStyle(color: Colors.white),
),
),
),
GridTextColumn(
columnName: 'dateAdded',
label: Container(
color: Colors.green,
padding: EdgeInsets.all(8.0),
alignment: Alignment.center,
child: Text(
'Date Added',
style: TextStyle(color: Colors.white),
),
),
),
],
),
),
);
},
);
}
}
class IncomeGridSource extends DataGridSource {
/// Creates the income data source class with required details.
IncomeGridSource({@required List<Income> incomeData}) {
_incomeData = incomeData
.map<DataGridRow>(
(income) => DataGridRow(
cells: [
DataGridCell<String>(columnName: 'source', value: income.source),
DataGridCell<double>(columnName: 'gross', value: income.gross),
DataGridCell<double>(columnName: 'cgi', value: income.cgi),
DataGridCell<String>(
columnName: 'incomeDate',
value: DateFormat.yMMMd().format(income.incomeDate)),
DataGridCell<String>(
columnName: 'dateAdded',
value: DateFormat.yMMMd().format(income.dateAdded)),
],
),
)
.toList();
}
List<DataGridRow> _incomeData = [];
@override
List<DataGridRow> get rows => _incomeData;
@override
DataGridRowAdapter buildRow(DataGridRow row) {
Color getRowBackgroundColor() {
final int index = _incomeData.indexOf(row);
if (index % 2 == 0) {
return Colors.green.shade100;
}
return Colors.transparent;
}
return DataGridRowAdapter(
color: getRowBackgroundColor(),
cells: row.getCells().map<Widget>((e) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.all(8.0),
child: Text(e.value.toString()),
);
}).toList());
}
}
```
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
BS
Balasubramani Sundaram
Syncfusion Team
April 5, 2021 06:00 PM UTC
Hi RobbB,
Thank you for contacting the Syncfusion support,
Based on your provided details and code snippet, we have analysed your reported issue. We have tried the same code snippet and our local data. We didn’t face any CPU increasing issue. We have attached the code snippet, video and system configuration details below.
Also, we suspect that you’re creating the `DataGridSource` and `getIncomeList` consumer itself. So, may be continuous call from the provider to consumer may led to this issue. So, we did some modification on getting the data and assigned the `DataGridSource` to SfDataGrid in below code snippet.
Regarding the `albeit in a very complex manner compared to DataTable`, we have adapted the paginated DataTable Structure of getting the widget from the user end and did the virtualizing concept in our `SfDataGrid`.
Code snippet:
|
|
Configuration details:
We have tested your reported issue the below configured mac machine
|
· MacOS version
· Flutter Channel version
· XCode -> 12.4
· Simulator
o iPhone 12 Pro Max
o version: iOS 14.4 |
Please let us know the below details of your end,
· macOS version
· XCode version
· Simulator version
· Flutter channel version
It will help us to analysis the reported issue on exact version.
Regards,
Balasubramani Sundaram.
Marked as answer
DO
David OGUNDEPO
January 17, 2023 10:40 AM UTC
Hello Balasubramani, can I use your assistance with the Datagrid widget?
SP
Sangavi Periyannan
Syncfusion Team
January 17, 2023 12:49 PM UTC
David,
Please include more details about your query. This would be helpful for us to serve you.
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
- Marked answer
-
RO Roberto
- Apr 4, 2021 05:35 AM UTC
- Jan 17, 2023 12:49 PM UTC