import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/common/text_field/custom_web_textfield.dart';
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';

class MenuSidebar extends StatelessWidget with HelperResponsiveLayout {
  const MenuSidebar({super.key});

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        double sidebarWidth;

        if (isLargeScreenSize(context)) {
          sidebarWidth = 250;
        } else if (isMediumScreenSize(context)) {
          sidebarWidth = 230;
        } else {
          sidebarWidth = 200;
        }

        return Container(
          width: sidebarWidth,
          decoration: const BoxDecoration(
            shape: BoxShape.rectangle,
            boxShadow: [
              BoxShadow(
                color: Colors.black26,
                offset: Offset(4, 0),
                blurRadius: 10,
              )
            ],
            color: Colors.white,
          ),
          child: Padding(
            padding: const EdgeInsets.all(15.0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    const Text(
                      'Community',
                      style: TextStyle(fontSize: 20),
                    ),
                    CircleAvatar(
                      backgroundColor: Colors.grey.shade200,
                      child: IconButton(
                        color: Colors.grey,
                        onPressed: () {},
                        icon: const Icon(Icons.add),
                      ),
                    ),
                  ],
                ),
                const SizedBox(height: 20),
                SizedBox(
                  height: 100,
                  child: CustomWebTextField(
                    isRequired: false,
                    textFieldName: '',
                    controller: TextEditingController(),
                    hintText: 'Search...',
                  ),
                ),
                const Spacer(),
              ],
            ),
          ),
        );
      },
    );
  }
}
