import 'package:flutter/material.dart';

import '../../app_style/colors.dart';
import '../../app_style/sizing.dart';

class ReportIssueItem extends StatelessWidget {
  final bool? isSelected;
  final String? issueInfo;
  final Function(String, bool)? onChange;

  const ReportIssueItem({Key? key, this.isSelected, this.issueInfo, this.onChange}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialButton(
      splashColor: AColors.secondaryColor.withOpacity(.5),
      padding: EdgeInsets.symmetric(vertical: 4),
      onPressed: () {
        onChange!(issueInfo!, !isSelected!);
      },
      child: Column(
        children: [
          Row(
            children: [
              Expanded(
                child: Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 8),
                  child: Text(
                    issueInfo ?? "",
                    style: Theme.of(context).textTheme.subtitle2,
                    textScaleFactor: AppStyle.getScaleFactor(context),
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
                child: Checkbox(
                  value: isSelected,
                  onChanged: (value) {
                    onChange!(issueInfo!, value!);
                  },
                ),
              ),
            ],
          ),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 16),
            child: Divider(),
          ),
        ],
      ),
    );
  }
}
