import 'package:fis_i18n/i18n.dart';
import 'package:fis_ui/index.dart';
import 'package:fis_ui/values/font_sizes.dart';
import 'package:fis_ui/values/spacings.dart';
import 'package:flutter/material.dart';

class LinePatientData extends FStatelessWidget {
  final String? value;
  final String titleKey;
  final bool isReadOnly;
  LinePatientData(this.titleKey, this.value, {this.isReadOnly = false});

  @override
  FWidget build(BuildContext context) {
    bool isNullValue = value == null || value!.isEmpty;
    var _textStyle = TextStyle(
      fontSize: FFontSizes.H5,
    );
    return FContainer(
      margin: EdgeInsets.only(top: 2),
      color: isReadOnly ? Colors.grey[100] : Colors.white,
      padding: EdgeInsets.symmetric(
          horizontal: FSpacings.XXL, vertical: FSpacings.M),
      child: FRow(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          FText(
            titleKey,
            style: _textStyle,
          ),
          FSizedBox(
            width: 10,
          ),
          FExpanded(
            child: FAlign(
              alignment: Alignment.centerRight,
              child: FText(
                isNullValue ? i18nBook.remedical.notFill.t : value!,
                textAlign: TextAlign.start,
                style: _textStyle.copyWith(
                  color: isNullValue ? Colors.grey[600] : Colors.black87,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
