import 'package:flutter/material.dart';
import 'package:satu/shared/app_colors.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'note_text.dart';

class LineCheckBox extends StatelessWidget {
  const LineCheckBox(this.text,
      {required this.value, this.labelText, this.onTap});

  final String text;
  final bool value;
  final String? labelText;
  final Function()? onTap;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        if (labelText != null)
          Padding(
            padding:
                const EdgeInsets.symmetric(horizontal: 14.0, vertical: 5.0),
            child: NoteText(labelText ?? ''),
          ),
        Container(
          decoration: const BoxDecoration(color: whiteColor),
          child: Material(
            color: Colors.transparent,
            child: InkWell(
              onTap: onTap,
              child: Padding(
                padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 12.w),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      text,
                      style: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.normal,
                      ),
                    ),
                    SizedBox(
                      width: 20,
                      height: 20,
                      child: Visibility(
                        visible: value,
                        child: const Icon(
                          Icons.check,
                          color: primaryColor,
                          size: 20,
                        ),
                      ),
                    )
                  ],
                ),
              ),
            ),
          ),
        ),
      ],
    );
  }
}
