import 'package:flutter/material.dart'; import '../core/app_colors.dart'; import '../models/bp_reading.dart'; Future showBleSyncDialog( BuildContext context, { required BpReading reading, }) { return showDialog( context: context, barrierDismissible: false, barrierColor: Colors.black.withValues(alpha: 0.54), builder: (ctx) => Dialog( insetPadding: const EdgeInsets.symmetric(horizontal: 28), backgroundColor: Colors.transparent, child: Container( width: double.infinity, constraints: const BoxConstraints(maxWidth: 380), padding: const EdgeInsets.fromLTRB(22, 28, 22, 22), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(28), boxShadow: [ BoxShadow( color: Colors.black.withValues(alpha: 0.14), blurRadius: 34, offset: const Offset(0, 18), ), ], ), child: Column( mainAxisSize: MainAxisSize.min, children: [ const Text( '数据已录入', textAlign: TextAlign.center, style: TextStyle( fontSize: 22, fontWeight: FontWeight.w900, color: AppColors.textPrimary, ), ), const SizedBox(height: 24), Row( children: [ Expanded( child: _MetricCard( label: '收缩压', value: '${reading.systolic}', unit: 'mmHg', ), ), const SizedBox(width: 16), Expanded( child: _MetricCard( label: '舒张压', value: '${reading.diastolic}', unit: 'mmHg', ), ), ], ), if (reading.pulse != null) ...[ const SizedBox(height: 16), Row( children: [ Expanded( child: _MetricCard( label: '脉搏', value: '${reading.pulse}', unit: 'bpm', ), ), const Expanded(child: SizedBox.shrink()), ], ), ], const SizedBox(height: 28), GestureDetector( onTap: () => Navigator.pop(ctx), child: Container( height: 50, width: double.infinity, alignment: Alignment.center, decoration: BoxDecoration( gradient: AppColors.doctorGradient, borderRadius: BorderRadius.circular(18), boxShadow: AppColors.buttonShadow, ), child: const Text( '知道了', style: TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.w900, ), ), ), ), ], ), ), ), ); } class _MetricCard extends StatelessWidget { final String label; final String value; final String unit; const _MetricCard({ required this.label, required this.value, required this.unit, }); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(vertical: 16), decoration: BoxDecoration( color: const Color(0xFFF8FAFC), borderRadius: BorderRadius.circular(14), ), child: Column( children: [ Text( value, style: const TextStyle( fontSize: 36, fontWeight: FontWeight.w900, color: AppColors.textPrimary, height: 1, ), ), const SizedBox(height: 6), Text( unit, style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w700, color: AppColors.textHint, ), ), const SizedBox(height: 4), Text( label, style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w700, color: AppColors.textSecondary, ), ), ], ), ); } }