import 'package:flutter/material.dart';
import 'package:unit2/model/profile/other_information/organization_memberships.dart';
import 'package:unit2/theme-data.dart/box_shadow.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';

import '../../../../utils/global.dart';

class OrgMembershipsScreen extends StatelessWidget {
  final List<OrganizationMembership> orgMemberships;
  const OrgMembershipsScreen({super.key, required this.orgMemberships});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(orgMembershipTitle),
        backgroundColor: primary,
        centerTitle: true,
        actions: [AddLeading(onPressed: (){})],
      ),
      body: orgMemberships.isNotEmpty? ListView.builder(
          itemCount: orgMemberships.length,
           padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 10),
          itemBuilder: (BuildContext context, int index) {
            String entity =
                orgMemberships[index].agency!.privateEntity == false
                    ? governmentText.toUpperCase()
                    : privateText.toUpperCase();
            String agencyName = orgMemberships[index].agency!.name!;
            return Column(
              children: [
                Container(
                  width: screenWidth,
                  decoration: box1(),
                  padding:
                      const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
                  child: Row(children: [
                    Expanded(
                        child: Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                 
                        Text(agencyName,style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500),),
                              const Divider(),
                               Text(entity,style: Theme.of(context).textTheme.labelLarge,),
                      ],
                    )),
                    IconButton(
                        onPressed: () {}, icon: const Icon(Icons.more_vert,color: Colors.grey,))
                  ]),
                ),
                const SizedBox(height: 5,),
              ],
            );
          }):const EmptyData(message: "You don't have any Organization Membership added. Please click + to add."),
    );
  }
}
