main
1import 'package:blood_pressure_app/features/bluetooth/ui/input_card.dart';
2import 'package:blood_pressure_app/logging.dart';
3import 'package:flutter/material.dart';
4import 'package:blood_pressure_app/l10n/app_localizations.dart';
5
6/// Indication of a failure while taking a bluetooth measurement.
7class MeasurementFailure extends StatelessWidget with TypeLogger {
8 /// Indicate a failure while taking a bluetooth measurement.
9 const MeasurementFailure({super.key, required this.onTap, required this.reason});
10
11 /// Called when the user requests closing.
12 final void Function() onTap;
13 /// Likely reason why the measurement failed
14 final String reason;
15
16 @override
17 Widget build(BuildContext context) {
18 logger.warning('MeasurementFailure reason: $reason');
19 return GestureDetector(
20 onTap: onTap,
21 child: InputCard(
22 onClosed: onTap,
23 child: Center(
24 child: Column(
25 mainAxisAlignment: MainAxisAlignment.center,
26 children: [
27 const Icon(Icons.error_outline, color: Colors.red),
28 const SizedBox(height: 8,),
29 Text(AppLocalizations.of(context)!.errMeasurementRead),
30 const SizedBox(height: 4,),
31 Text(AppLocalizations.of(context)!.tapToClose),
32 const SizedBox(height: 8,),
33 ],
34 ),
35 ),
36 ),
37 );
38 }
39}