import 'package:didvan/config/design_config.dart';
import 'package:didvan/constants/app_icons.dart';
import 'package:didvan/models/tag.dart';
import 'package:didvan/routes/routes.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:didvan/views/widgets/ink_wrapper.dart';
import 'package:flutter/material.dart';

class TagItem extends StatelessWidget {
  final Tag tag;
  final void Function(int id, bool value) onMarkChanged;
  final String type;

  const TagItem({
    Key? key,
    required this.tag,
    required this.onMarkChanged,
    required this.type,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWrapper(
      borderRadius: DesignConfig.lowBorderRadius,
      onPressed: () => Navigator.of(context).pushNamed(Routes.hashtag,
          arguments: {
            'tag': tag,
            'onMarkChanged': onMarkChanged,
            'type': type
          }),
      child: Container(
        padding: const EdgeInsets.symmetric(
          vertical: 4,
          horizontal: 8,
        ),
        decoration: BoxDecoration(
          borderRadius: const BorderRadius.all(
            Radius.circular(12),
          ),
          border: Border.all(
            color: const Color.fromARGB(255, 184, 184, 184),
          ),
        ),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            const Icon(
              DidvanIcons.hashtag_regular,
              color: Color.fromARGB(255, 102, 102, 102),
              size: 17,
            ),
            DidvanText(
              tag.label,
              color: const Color.fromARGB(255, 102, 102, 102),
              style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
            ),
          ],
        ),
      ),
    );
  }
}
