import 'package:flutter/material.dart';
import 'package:hoshan/ui/theme/colors.dart';
import 'package:hoshan/ui/theme/responsive.dart';
import 'package:hoshan/ui/theme/text.dart';
import 'package:hoshan/ui/widgets/sections/loading/default_placeholder.dart';

class BotRowCardPlaceholder extends StatelessWidget {
  final int index;
  const BotRowCardPlaceholder({super.key, this.index = 0});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: Responsive(context).isMobile()
          ? MediaQuery.sizeOf(context).width * 0.7
          : 300,
      margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
      decoration: BoxDecoration(
          boxShadow: const [
            BoxShadow(
              color: Color(0x664D4D4D),
              blurRadius: 6,
              offset: Offset(0, 1),
              spreadRadius: 0,
            )
          ],
          color: Theme.of(context).colorScheme.surface,
          borderRadius: BorderRadius.circular(8)),
      child: Stack(
        children: [
          Positioned(
              top: 0,
              right: 0,
              bottom: 0,
              child: DefaultPlaceHolder(
                child: Container(
                  width: 40,
                  decoration: BoxDecoration(
                      borderRadius: const BorderRadius.only(
                          topRight: Radius.circular(8),
                          bottomRight: Radius.circular(8)),
                      color: index % 2 == 0
                          ? AppColors.primaryColor[50]
                          : AppColors.secondryColor[50]),
                ),
              )),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: Row(
              children: [
                const SizedBox(
                  width: 8,
                ),
                Center(
                  child: DefaultPlaceHolder(
                    child: Container(
                      width: 48,
                      height: 48,
                      decoration: const BoxDecoration(
                          shape: BoxShape.circle, color: Colors.white),
                    ),
                  ),
                ),
                Expanded(
                    child: Padding(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      DefaultPlaceHolder(
                        child: Container(
                          decoration: BoxDecoration(
                              color: Colors.white,
                              borderRadius: BorderRadius.circular(16)),
                          child: Text(
                            'name of bot',
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis,
                            style: AppTextStyles.body3
                                .copyWith(fontWeight: FontWeight.bold),
                          ),
                        ),
                      ),
                      const SizedBox(
                        height: 4,
                      ),
                      DefaultPlaceHolder(
                        child: Container(
                          decoration: BoxDecoration(
                              color: Colors.white,
                              borderRadius: BorderRadius.circular(16)),
                          child: Text(
                            '15 پیام در هر ساعت',
                            style: AppTextStyles.body5,
                          ),
                        ),
                      ),
                    ],
                  ),
                )),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
