Skip to content

Commit

Permalink
Move battery graph into debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Jun 12, 2024
1 parent 28850ce commit bcc1b50
Showing 1 changed file with 43 additions and 31 deletions.
74 changes: 43 additions & 31 deletions lib/Frontend/pages/shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,37 +229,6 @@ class _ManageGearState extends ConsumerState<ManageGear> {
),
)
],
ValueListenableBuilder(
valueListenable: widget.device.batteryLevel,
builder: (BuildContext context, double value, Widget? child) {
return ExpansionTile(
title: Text(manageDevicesBatteryGraphTitle()),
children: [
SizedBox(
height: 200,
child: Padding(
padding: const EdgeInsets.only(right: 16, top: 8, bottom: 8, left: 8),
child: LineChart(
LineChartData(
titlesData: const FlTitlesData(
rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
),
lineTouchData: const LineTouchData(enabled: false),
borderData: FlBorderData(show: false),
minY: 0,
maxY: 100,
minX: 0,
maxX: widget.device.stopWatch.elapsed.inSeconds.toDouble(),
lineBarsData: [LineChartBarData(spots: widget.device.batlevels, color: Theme.of(context).colorScheme.primary, dotData: const FlDotData(show: false), isCurved: true, show: widget.device.batlevels.isNotEmpty)],
),
),
),
)
],
);
},
),
if (widget.device.hasUpdate.value || HiveProxy.getOrDefault(settings, showDebugging, defaultValue: showDebuggingDefault)) ...[
Padding(
padding: const EdgeInsets.all(16.0),
Expand Down Expand Up @@ -383,6 +352,49 @@ class _ManageGearState extends ConsumerState<ManageGear> {
const ListTile(
title: Divider(),
),
ValueListenableBuilder(
valueListenable: widget.device.batteryLevel,
builder: (BuildContext context, double value, Widget? child) {
return ExpansionTile(
title: Text(manageDevicesBatteryGraphTitle()),
children: [
SizedBox(
height: 200,
child: Padding(
padding: const EdgeInsets.only(right: 16, top: 8, bottom: 8, left: 8),
child: LineChart(
LineChartData(
titlesData: const FlTitlesData(
rightTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: false,
)),
topTitles: AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
leftTitles: AxisTitles(
axisNameWidget: Text('Battery'),
),
bottomTitles: AxisTitles(
axisNameWidget: Text('Time'),
sideTitles: SideTitles(showTitles: true),
),
),
lineTouchData: const LineTouchData(enabled: false),
borderData: FlBorderData(show: false),
minY: 0,
maxY: 100,
minX: 0,
maxX: widget.device.stopWatch.elapsed.inSeconds.toDouble(),
lineBarsData: [LineChartBarData(spots: widget.device.batlevels, color: Theme.of(context).colorScheme.primary, dotData: const FlDotData(show: false), isCurved: true, show: widget.device.batlevels.isNotEmpty)],
),
),
),
)
],
);
},
),
ListTile(
title: const Text("Debug"),
subtitle: Column(
Expand Down

0 comments on commit bcc1b50

Please sign in to comment.