import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_svg/svg.dart';
import 'package:tanami_app/core/styles/app_color.dart';
import 'package:tanami_app/core/styles/app_images.dart';
import 'package:gap/gap.dart';
import 'package:tanami_app/shared/components/text_widget.dart';

import 'login_signup_button.dart';
import 'welcome_indicator.dart';

Widget buildOnboardingPage(
  BuildContext context, {
  required int index,
  required String imageAsset,
  required String title,
  required String description,
  bool isLastPage = false,
  required PageController pageController,
}) {
  return Column(
    children: [
      const Gap(80),
      SvgPicture.asset(AppImages.welcomeLogo),
      Image.asset(
        imageAsset,
        width: 1.sw,
        height: index == 2 ? 380 : 450,
        fit: BoxFit.cover,
      ),
      const Gap(12),
      TextWidget().text22W700(
        title,
        clr: AppColor.primaryColor,
      ),
      const Gap(12),
      Padding(
        padding: const EdgeInsets.symmetric(
          horizontal: 50,
        ),
        child: TextWidget().text15W500(
          description,
          clr: AppColor.darkGreyColor,
        ),
      ),
      const Gap(20),
      welcomeIndicator(pageController),
      if (isLastPage) const LoginSignUpButton(),
    ],
  );
}
