| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import 'package:flutter/material.dart';
- import '../../../core/theme/app_colors.dart';
- import '../../../core/widgets/surface_card.dart';
- /// Speed from GPS, shown only when no OBD-II adapter is connected.
- class GpsSpeedCard extends StatelessWidget {
- const GpsSpeedCard({super.key, required this.speedKmh, this.compact = false});
- final double speedKmh;
- final bool compact;
- @override
- Widget build(BuildContext context) {
- final colors = context.colors;
- final theme = Theme.of(context);
- return Semantics(
- label: '${speedKmh.round()} kilometers per hour from GPS',
- child: SurfaceCard(
- padding: EdgeInsets.fromLTRB(
- compact ? 16 : 20,
- compact ? 13 : 16,
- compact ? 16 : 20,
- compact ? 13 : 16,
- ),
- radius: 24,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- children: [
- Container(
- width: 7,
- height: 7,
- decoration: BoxDecoration(
- color: colors.accent,
- shape: BoxShape.circle,
- ),
- ),
- const SizedBox(width: 8),
- Text(
- 'GPS',
- style: theme.textTheme.labelMedium?.copyWith(
- color: colors.inkMuted,
- letterSpacing: 0.8,
- ),
- ),
- const Spacer(),
- Text(
- 'FROM LOCATION',
- style: theme.textTheme.labelSmall?.copyWith(
- color: colors.inkFaint,
- fontSize: compact ? 9 : 10,
- letterSpacing: 0.5,
- ),
- ),
- ],
- ),
- SizedBox(height: compact ? 6 : 8),
- Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- speedKmh.round().toString(),
- style: theme.textTheme.displaySmall?.copyWith(
- fontSize: compact ? 38 : 46,
- height: 0.95,
- fontFeatures: const [FontFeature.tabularFigures()],
- ),
- ),
- const SizedBox(width: 7),
- Padding(
- padding: const EdgeInsets.only(bottom: 5),
- child: Text(
- 'km/h',
- style: theme.textTheme.bodySmall?.copyWith(
- color: colors.inkMuted,
- ),
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- );
- }
- }
|