import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
import 'package:sizer/sizer.dart';

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

  @override
  Widget build(BuildContext context) {
    return Shimmer.fromColors(
      baseColor: Colors.grey.shade300,
      highlightColor: Colors.grey.shade100,
      child: Column(
        children: [
          Expanded(
            child: SingleChildScrollView(
              physics: const NeverScrollableScrollPhysics(),
              child: Column(
                children: [
                  Container(
                    width: double.infinity,
                    padding: EdgeInsets.symmetric(vertical: 3.h),
                    child: Column(
                      children: [
                        Container(
                          width: 24.w,
                          height: 24.w,
                          decoration: const BoxDecoration(
                            color: Colors.white,
                            shape: BoxShape.circle,
                          ),
                        ),
                      ],
                    ),
                  ),

                  Padding(
                    padding: EdgeInsets.symmetric(horizontal: 5.w),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: List.generate(
                        3,
                        (index) => Padding(
                          padding: EdgeInsets.only(bottom: 2.h),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Container(
                                width: 30.w,
                                height: 1.5.h,
                                color: Colors.white,
                              ),
                              SizedBox(height: 1.h),
                              Container(
                                width: double.infinity,
                                height: 7.h,
                                decoration: BoxDecoration(
                                  color: Colors.white,
                                  borderRadius: BorderRadius.circular(2.5.w),
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                  ),

                  _buildSectionLabelShimmer("Aktivitas Dengan Pemasok"),
                  Column(
                    children: List.generate(
                      2,
                      (index) => Container(
                        height: 12.h,
                        margin: EdgeInsets.fromLTRB(5.w, 0, 5.w, 1.5.h),
                        decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(2.5.w),
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

  Widget _buildSectionLabelShimmer(String title) {
    return Padding(
      padding: EdgeInsets.fromLTRB(5.w, 3.h, 5.w, 1.5.h),
      child: Align(
        alignment: Alignment.centerLeft,
        child: Container(width: 40.w, height: 2.h, color: Colors.white),
      ),
    );
  }
}
