import 'package:cims_apps/application/assets/path_assets.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/plan/view/step_invest_plan/result_options_product.dart';
import 'package:flutter/material.dart';

class OptionsStartingInvest extends StatelessWidget {
  final int totalInvest;
  const OptionsStartingInvest({super.key, required this.totalInvest});

  @override
  Widget build(BuildContext context) {
    List<dynamic> listOptions = [
      {
        "title": "Results From Your Risk Profile",
        "subtitle": "Start Investing from recommended products that suit you",
        "iconImg": PathAssets.iconThumb,
        "value": "risk profile"
      },
      {
        "title": "Create Portfolio",
        "subtitle": "Choose a portfolio according to your investment goals",
        "iconImg": PathAssets.iconPortofolio,
        "value": "investment goals"
      }
    ];

    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(16)
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisSize: MainAxisSize.min,
        children: [
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text('Your options for starting to invest',
                  style: TextStyle(
                    fontSize: 18,
                    fontWeight: FontWeight.w600
                  ),
                ),
                GestureDetector(
                  onTap: () {
                    Navigator.pop(context);
                  },
                  child: Icon(Icons.close_rounded),
                )
              ],
            ),
          ),
          SizedBox(height: 8),
          ...listOptions.asMap().entries.map((e) {
            return GestureDetector(
              onTap: () {
                Navigator.pop(context);
                showModalBottomSheet(
                  context: context,
                  isScrollControlled: true,
                  builder: (context) => ResultOptionsProduct(totalInvest: totalInvest));
              },
              child: Container(
                margin: const EdgeInsets.only(left: 24, right: 24, bottom: 12),
                padding: EdgeInsets.all(16),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(14),
                  border: Border.all(color: ColorPalette.slate200),
                ),
                child: Row(
                  children: [
                    Expanded(
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            padding: EdgeInsets.all(8),
                            alignment: Alignment.center,
                            decoration: BoxDecoration(
                              color: ColorPalette.blue200.withOpacity(0.5),
                              borderRadius: BorderRadius.circular(8)
                            ),
                            child: Image.asset(e.value['iconImg'], width: 22),
                          ),
                          SizedBox(width: 16),
                          Expanded(
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Text(e.value['title'],
                                  style: TextStyle(
                                    fontWeight: FontWeight.w600,
                                    color: ColorPalette.slate800,
                                    fontSize: 16
                                  ),
                                ),
                                SizedBox(height: 4),
                                Text(e.value['subtitle'],
                                  style: TextStyle(
                                    color: ColorPalette.slate400
                                  ),
                                )
                              ],
                            ),
                          )
                        ],
                      ),
                    ),
                    Icon(Icons.keyboard_arrow_right_rounded, color: ColorPalette.slate400,)
                  ],
                ),
              ),
            );
          }),
          SizedBox(height: 16,)
        ],
      ),
    );
  }
}
