connection settings cleanup and mock test added. removed bluetooth implementation
This commit is contained in:
@@ -26,8 +26,12 @@ import '../dmc_colors.dart';
|
||||
class BatteryIndicatorBar extends StatelessWidget {
|
||||
const BatteryIndicatorBar({super.key, required this.percent});
|
||||
|
||||
/// 0-100, ungeklemmter Rohwert aus TelemetryFrame.batteryPercent.
|
||||
final int percent;
|
||||
/// 0-100, ungeklemmter Rohwert aus TelemetryFrame.batteryPercent - null,
|
||||
/// solange noch kein Telemetrie-Frame vorliegt (Verbindungsaufbau laeuft
|
||||
/// noch). Rendert dann einen neutralen "keine Daten"-Zustand statt eines
|
||||
/// Balkens bei 0%, das faelschlich als kritischer Ladestand gelesen werden
|
||||
/// koennte (siehe MissionFooterBar.showBattery).
|
||||
final int? percent;
|
||||
|
||||
/// Absolute Positionen (vom linken Rand aus), an denen rot in orange und
|
||||
/// orange in gruen uebergeht - siehe Klassendoku.
|
||||
@@ -51,7 +55,46 @@ class BatteryIndicatorBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final clampedPercent = percent.clamp(0, 100);
|
||||
final rawPercent = percent;
|
||||
if (rawPercent == null) {
|
||||
return SizedBox(
|
||||
height: _pillHeight,
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: (_pillHeight - _barHeight) / 2,
|
||||
height: _barHeight,
|
||||
child: ColoredBox(color: Colors.white.withValues(alpha: _trackAlpha)),
|
||||
),
|
||||
Center(
|
||||
child: Container(
|
||||
height: _pillHeight,
|
||||
constraints: const BoxConstraints(minWidth: _pillMinWidth),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: _pillNeutralAlpha),
|
||||
borderRadius: BorderRadius.circular(_pillHeight / 2),
|
||||
),
|
||||
child: const Text(
|
||||
'--%',
|
||||
style: TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
final clampedPercent = rawPercent.clamp(0, 100);
|
||||
|
||||
return SizedBox(
|
||||
height: _pillHeight,
|
||||
|
||||
Reference in New Issue
Block a user