friend_interaction_entry.dart 1.46 KB
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class FriendInteractionButton extends StatelessWidget {
  const FriendInteractionButton({
    super.key,
    required this.enabled,
    this.size = 24,
  });

  final bool enabled;
  final double size;

  @override
  Widget build(BuildContext context) => Opacity(
    opacity: enabled ? 1 : 0.4,
    child: GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: enabled ? _openInteraction : null,
      child: SizedBox(
        width: size,
        height: size,
        child: DecoratedBox(
          decoration: const BoxDecoration(
            color: Color(0xFF845EEE),
            shape: BoxShape.circle,
          ),
          child: Padding(
            padding: EdgeInsets.all(size / 8),
            child: Image.asset('assets/images/interact/icon_stick.png'),
          ),
        ),
      ),
    ),
  );

  void _openInteraction() => Get.toNamed(Routes.INTERACT);
}

class FriendInteractionFloatingEntry extends StatelessWidget {
  const FriendInteractionFloatingEntry({super.key, this.size = 72});

  final double size;

  @override
  Widget build(BuildContext context) => GestureDetector(
    behavior: HitTestBehavior.opaque,
    onTap: () => Get.toNamed(Routes.INTERACT),
    child: Image.asset(
      'assets/images/interact/interaction_float.png',
      width: size,
      height: size,
      fit: BoxFit.contain,
    ),
  );
}