import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:provider/provider.dart';

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

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
            color: AppColors.whiteColor,
            borderRadius: 24.r,
            hasShadow: false,
          ),
          child: Consumer<HabibWalletViewModel>(builder: (context, habibWalletVM, child) {
            return ListView.separated(
              itemCount: habibWalletVM.habibWalletBalanceList.length,
              physics: NeverScrollableScrollPhysics(),
              padding: EdgeInsets.only(top: 8, bottom: 8),
              shrinkWrap: true,
              itemBuilder: (context, index) {
                return Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Expanded(child: habibWalletVM.habibWalletBalanceList[index].projectDescription!.toText16(isBold: true, color: AppColors.textColor)),
                    Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletBalanceList[index].patientAdvanceBalanceAmount!, //did the changes because of negative value
                        textColor: AppColors.textColor,
                        iconColor: AppColors.textColor,
                        iconSize: 18.h,
                        isExpanded: false,
                        fontSize: 28.f,
                        fontWeight: FontWeight.w600,
                        letterSpacing: -1),
                  ],
                ).paddingSymmetrical(0, 12.h);
              },
              separatorBuilder: (BuildContext context, int index) {
                return Divider(height: 1, color: AppColors.textColor.withAlpha(20));
              },
            ).paddingSymmetrical(16.h, 24.h).toShimmer2(isShow: habibWalletVM.isWalletAmountLoading);
          }),
        ),
      ],
    );
  }
}
