import '../../../../../../food_delivery_client.dart';

class WOnBoardingBody extends StatelessWidget {
  const WOnBoardingBody({
    super.key,
    required this.pageController,
    required this.onPageChanged,
  });

  final PageController pageController;
  final Function(int value) onPageChanged;

  @override
  Widget build(BuildContext context) {
    final List<String> titles = [
      context.loc.onboarding_title_1,
      context.loc.onboarding_title_1,
    ];
    final List<String> descriptions = [
      context.loc.onboarding_subtitle_1,
      context.loc.onboarding_subtitle_2,
    ];

    final List<Widget> children = [
      SvgPicture.asset(AppIcons.icOnBoarding1),
      Stack(
        alignment: Alignment.center,
        children: [
          Positioned(
            top: 80,
            left: 40,
            child: SvgPicture.asset(AppIcons.icOnBoarding2),
          ),
          SvgPicture.asset(AppIcons.icOnBoarding3),
        ],
      ),
    ];

    return Positioned.fill(
      child: PageView.builder(
        itemCount: titles.length,
        controller: pageController,
        scrollDirection: Axis.horizontal,
        onPageChanged: onPageChanged,
        itemBuilder: (context, index) => Column(
          children: [
            Expanded(child: children[index]),
            Expanded(
              child: Column(
                spacing: 20,
                children: [
                  25.verticalSpace,
                  Text(
                    titles[index],
                    textAlign: TextAlign.center,
                    style: context.appThemeTextStyles.size24SemiBold,
                  ),
                  Text(
                    descriptions[index],
                    textAlign: TextAlign.center,
                    style: AppTextStyles.size14Regular.copyWith(
                      color: AppColors.cA9A9A9,
                    ),
                  ), 
                ],
              ).paddingSymmetric(horizontal: 22),
            ),
          ],
        ),
      ),
    );
  }
}
