import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../blocs/bluetooth_read/bluetooth_read_bloc.dart';
import '../../../blocs/bluetooth_read/bluetooth_read_state.dart';

class MonitoringTopStatusBar extends StatelessWidget {
  const MonitoringTopStatusBar({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: const BoxDecoration(
        image: DecorationImage(
          image: AssetImage('lib/assets/monitoring/top_status_bg.png'),
          fit: BoxFit.fill,
        ),
      ),
      padding: EdgeInsets.only(left: 32.w, bottom: 22.h),
      child: Row(
        children: [
          Text(
            '总运行时长:9999h',
            style: TextStyle(
              color: Colors.white,
              fontSize: 25.sp,
            ),
          ),
          SizedBox(width: 32.w),
          Text(
            '环境温度:30.68',
            style: TextStyle(
              color: Colors.white,
              fontSize: 25.sp,
            ),
          ),
          SizedBox(width: 32.w),
          Text(
            '总制氧时长:500h',
            style: TextStyle(
              color: Colors.white,
              fontSize: 25.sp,
            ),
          ),

          SizedBox(width: 32.w),
          BlocBuilder<BluetoothReadBloc, BluetoothReadState>(
            builder: (context, state) {
              final sn = state.info.sn;
              return Text(
                'sn:${sn ?? ''}',
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 25.sp,
                ),
              );
            },
          ),
        ],
      ),
    );
  }
}
