Skip to content

Commit

Permalink
Fix file manager page issue
Browse files Browse the repository at this point in the history
Fixed the issue of the list view not destroying properly its cards
once the files got uploaded.
  • Loading branch information
DariusIMP committed Mar 24, 2022
1 parent 23a779d commit cc4c55a
Showing 1 changed file with 34 additions and 38 deletions.
72 changes: 34 additions & 38 deletions lib/pages/file_manager_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,43 @@ class _FileManagerPage extends State<FileManagerPage> {
builder: (c, snapshot) => Column(
children: snapshot.data!
.map(
(f) => Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
leading: IconButton(
icon: Icon(Icons.folder_open_sharp),
(deviceMeasurementsFile) => Card(
key: Key(deviceMeasurementsFile.path),
child: ListTile(
leading: IconButton(
icon: Icon(Icons.folder_open_sharp),
onPressed: () async {
BufferedSensorMeasurements measurements =
await deviceMeasurementsFile.readJsonContent();
Navigator.pushNamed(
context,
FileContentChartPage.routeName,
arguments: measurements,
);
},
),
title: Text(basename(deviceMeasurementsFile.path)),
subtitle: Text(deviceMeasurementsFile.lastModified),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(Icons.delete_outline_outlined,
color: Theme.of(context)
.iconTheme
.color
?.withOpacity(0.5)),
onPressed: () async {
BufferedSensorMeasurements measurements =
await f.readJsonContent();
Navigator.pushNamed(
context,
FileContentChartPage.routeName,
arguments: measurements,
);
await deviceMeasurementsFile.deleteFile();
//refresh
setState(() {});
},
),
title: Text(basename(f.path)),
subtitle: Text(f.lastModified),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(Icons.delete_outline_outlined,
color: Theme.of(context)
.iconTheme
.color
?.withOpacity(0.5)),
onPressed: () async {
await f.deleteFile();
//refresh
setState(() {});
},
),
UploadButton(
onButtonPressed: () =>
uploadFileCallBack(f))
],
),
),
],
UploadButton(
onButtonPressed: () =>
uploadFileCallBack(deviceMeasurementsFile))
],
),
),
),
)
Expand Down

0 comments on commit cc4c55a

Please sign in to comment.