mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-19 13:29:12 +00:00
Fixed no data issue on home top items
This commit is contained in:
parent
dd927bbd25
commit
56943ec73d
1 changed files with 40 additions and 17 deletions
|
@ -90,27 +90,16 @@ class TopItemsSection extends StatelessWidget {
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
final lineChartData = lineData();
|
final List<Map<String, dynamic>> lineChartData = lineData();
|
||||||
final total = lineChartData.map((e) => e["value"]).reduce((a, b) => a + b);
|
final mapData = lineChartData.map((e) => e["value"]);
|
||||||
|
final List<dynamic> total = mapData.isNotEmpty
|
||||||
final Widget noItems = Padding(
|
? mapData.reduce((a, b) => a + b)
|
||||||
padding: const EdgeInsets.only(
|
: [];
|
||||||
bottom: 20,
|
|
||||||
top: 10
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(context)!.noItems,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (data.isEmpty) noItems,
|
if (data.isEmpty) _NoData(label: label),
|
||||||
if (data.isNotEmpty && width > 700) Padding(
|
if (data.isNotEmpty && width > 700) Padding(
|
||||||
padding: EdgeInsets.only(bottom: withChart == false ? 16 : 0),
|
padding: EdgeInsets.only(bottom: withChart == false ? 16 : 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
@ -321,4 +310,38 @@ class _ItemsList extends StatelessWidget {
|
||||||
)).toList()
|
)).toList()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NoData extends StatelessWidget {
|
||||||
|
final String label;
|
||||||
|
|
||||||
|
const _NoData({
|
||||||
|
required this.label
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Theme.of(context).colorScheme.onSurface
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.noDataThisSection,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue