import 'package:e_commerce_training/res/R.dart';
import 'package:e_commerce_training/src/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class RowLabelValueWidget extends StatelessWidget {
  final String label;
  final String value;
  final Color colorValue;
  final VoidCallback callback;

  const RowLabelValueWidget(
      {Key? key, required this.label, required this.value, required this.colorValue, required this.callback})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Visibility(
      visible: !Util.isEmpty(value),
      child: Container(
        padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 8),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Expanded(
              flex: 3,
              child: Text(
                label ?? "",
                style: TextStyle(
                  color: R.color.grey,
                  fontSize: 33.sp,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
            Expanded(
              flex: 5,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  GestureDetector(
                    onTap: callback,
                    child: Text(
                      value ?? "",
                      style: TextStyle(
                        fontSize: 40.sp,
                        color: colorValue ?? R.color.black,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  Divider(
                    height: 1.0,
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
