// ignore_for_file: deprecated_member_use

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hoshan/ui/screens/family/add_family.dart';
import 'package:hoshan/ui/screens/splash/cubit/user_info_cubit.dart';

class FamilyBanner extends StatelessWidget {
  const FamilyBanner({super.key});

  @override
  Widget build(BuildContext context) {
    final hasParent = UserInfoCubit.userInfoModel.parent != null;
    
    if (hasParent) {
      return const SizedBox.shrink();
    }
    
    return Padding(
      padding: const EdgeInsets.all(16.0),
      child: GestureDetector(
        onTap: () {
          Navigator.push(
            context,
            MaterialPageRoute(
              builder: (context) => const AddFamily(),
            ),
          );
        },
        child: Container(
          width: double.infinity,
          height: 150,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(20),
            boxShadow: [
              BoxShadow(
                color: Colors.black.withOpacity(0.1),
                blurRadius: 10,
                offset: const Offset(0, 5),
              ),
            ],
          ),
          child: ClipRRect(
              borderRadius: BorderRadius.circular(20),
              child: SvgPicture.asset('assets/icon/outline/family.svg')),
        ),
      ),
    );
  }
}
