import 'package:flutter/material.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/add_member_interface.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';

class AddMemberView extends StatelessWidget {
  const AddMemberView({super.key});
  @override
  Widget build(BuildContext context) {
    return DefaultScaffold(
      title: 'Add Member',
      child: Column(
        children: [
          DefaultContainer(
            padding: const EdgeInsets.symmetric(
              horizontal: 15,
              vertical: 20,
            ),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                const BodyMedium(
                    text: 'Family Members', fontWeight: FontWeight.bold),
                const Padding(
                  padding: EdgeInsets.symmetric(vertical: 13),
                  child: BodySmall(
                    text:
                        'After adding:\n\n\t\t1.The user will join the family.\n\n\t\t2.The user will be able to control and use all devices in the family.',
                    fontColor: ColorsManager.greyColor,
                    fontSize: 10,
                  ),
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    TextButton(
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all(
                          ColorsManager.primaryColorWithOpacity,
                        ),
                      ),
                      onPressed: () {
                        Navigator.of(context).push(
                          MaterialPageRoute(
                            builder: (context) => const AddMemberInterface(
                              memberRole: MemberRole.FamilyMember,
                            ),
                          ),
                        );
                      },
                      child: const Padding(
                        padding: EdgeInsets.symmetric(horizontal: 50),
                        child: BodyMedium(
                          text: 'ADD',
                          fontColor: Colors.white,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ),
                  ],
                )
              ],
            ),
          ),
          const SizedBox(
            height: 10,
          ),
          DefaultContainer(
            padding: const EdgeInsets.symmetric(
              horizontal: 15,
              vertical: 20,
            ),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                const BodyMedium(
                    text: 'Other Member', fontWeight: FontWeight.bold),
                const Padding(
                  padding: EdgeInsets.symmetric(vertical: 13),
                  child: BodySmall(
                    text:
                        'After adding:\n\n\t\t1.The user only appears in the member list of the current lock and can only view their own unlocking records.\n\n\t\t2.The user cannot obtain the permissions to operate or manage the lock.\n\n\t\t3.To grant the user operation permissions on the lock, you must use the device sharing functions.',
                    fontColor: ColorsManager.greyColor,
                    fontSize: 10,
                  ),
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    TextButton(
                      onPressed: () {
                        Navigator.of(context).push(
                          MaterialPageRoute(
                            builder: (context) => const AddMemberInterface(
                              memberRole: MemberRole.OtherMember,
                            ),
                          ),
                        );
                      },
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all(
                          ColorsManager.primaryColorWithOpacity,
                        ),
                      ),
                      child: const Padding(
                        padding: EdgeInsets.symmetric(horizontal: 50),
                        child: BodyMedium(
                          text: 'ADD',
                          fontColor: Colors.white,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ),
                  ],
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
