import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';

class SkillHobbiesScreen extends StatelessWidget {
  final List<SkillsHobbies>skillsHobbies;
  const SkillHobbiesScreen({super.key,required this.skillsHobbies});

  @override
  Widget build(BuildContext context) {
    return  Scaffold(
      appBar: AppBar(title: const Text(skillAndHobbiesTitle),
      backgroundColor: primary,
      centerTitle: true,
      actions: [AddLeading(onPressed: (){})],
      
      ),
      body: skillsHobbies.isNotEmpty? Padding(
        padding: const EdgeInsets.all(24),
        child: Wrap(
          spacing: 8,
          runSpacing: 8,
         alignment: WrapAlignment.start,
          clipBehavior: Clip.none,
          verticalDirection: VerticalDirection.up,
          crossAxisAlignment: WrapCrossAlignment.start,
          direction: Axis.horizontal,
          children:skillsHobbies.map((SkillsHobbies sh){
            return FittedBox(
              child: Row(
                children: [
                  Text(sh.name!),
                  IconButton(
                    onPressed: () {},
                    icon: const Icon(Icons.close)),
                ],
              ),
            );
        }).toList()
        
        ),
      ):const EmptyData(message: "You don't have any Skills and Hobbies added. Please click + to add"),
    );
  }
}