import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:tanami_app/core/routes/route_name.dart';
import 'package:tanami_app/core/routes/routes.dart';
import 'package:tanami_app/core/styles/app_images.dart';

import '../../../../../core/styles/app_text.dart';
import '../../../../../core/utils/language/localizations_delegate.dart';
import '../../domain/model/detail_io_model.dart';

class InvestVideoSection extends StatelessWidget {
  List<ArtifactsVideo> artifactsVideoList;
  InvestVideoSection({super.key, required this.artifactsVideoList});

  @override
  Widget build(BuildContext context) {
    var localizations = AppLocalizations.of(context);
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: const BorderRadius.all(Radius.circular(20.0)),
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.15),
            spreadRadius: 2,
            blurRadius: 10,
            offset: const Offset(0, 3), // changes position of shadow
          ),
        ],
      ),
      child: Padding(
        padding: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              localizations.translate(AppText.videosTitle),
              style: GoogleFonts.dmSans(
                color: Colors.black,
                fontSize: 15.sp,
                fontWeight: FontWeight.w700,
              ),
            ),
            SizedBox(
              height: 12.h,
            ),
            ListView.builder(
              physics: const NeverScrollableScrollPhysics(),
              shrinkWrap: true,
              itemCount: artifactsVideoList.length,
              itemBuilder: (context, index) {
                return InkWell(
                  onTap: () {
                    goRouter.pushNamed(RouteName.vimeoScreen, pathParameters: {
                      "videoUrl":
                          artifactsVideoList[index].artifactStreamingURL!
                    });
                  },
                  child: Padding(
                    padding: const EdgeInsets.only(bottom: 18.0),
                    child: ClipRRect(
                      borderRadius: const BorderRadius.all(
                        Radius.circular(18.0),
                      ),
                      child: Stack(
                        children: [
                          Image.asset(
                            "assets/images/academy_screen/vd_bg.jpg",
                            fit: BoxFit.cover,
                            height: 160.h,
                            width: 1.sw,
                          ),
                          Positioned(
                            bottom: 0.0,
                            child: Image.asset(
                              AppImages.academyCardOverlay,
                            ),
                          ),
                          Positioned.fill(
                            child: Image.asset(
                              AppImages.videoPlayIcon,
                            ),
                          )
                        ],
                      ),
                    ),
                  ),
                );
              },
            )
          ],
        ),
      ),
    );
  }
}
