import 'package:didvan/config/design_config.dart';
import 'package:didvan/config/theme_data.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;

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

  @override
  Widget build(BuildContext context) {
    return InkWrapper(
      borderRadius: DesignConfig.lowBorderRadius,
      onPressed: () =>
          Navigator.of(context).pushNamed(Routes.hashtag, arguments: tag),
      child: Container(
        padding: const EdgeInsets.symmetric(
          vertical: 4,
          horizontal: 8,
        ),
        decoration: BoxDecoration(
          borderRadius: DesignConfig.lowBorderRadius,
          border: Border.all(
            color: Theme.of(context).colorScheme.focusedBorder,
          ),
        ),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            Icon(
              DidvanIcons.hashtag_regular,
              color: Theme.of(context).colorScheme.focusedBorder,
            ),
            DidvanText(
              tag.label,
              color: Theme.of(context).colorScheme.focusedBorder,
              style: Theme.of(context).textTheme.bodyText1,
            ),
          ],
        ),
      ),
    );
  }
}
