import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/views/widgets/images/files_list.dart';

import '../../controllers/api_routes/urls.dart';
import '../../extensions/text_extensions.dart';
import '../../new_views/app_style/app_color.dart';
import '../../new_views/common_widgets/app_filled_button.dart';
import '../../new_views/common_widgets/default_app_bar.dart';
import '../cm_module/views/components/action_button/footer_action_button.dart';
import 'demo_extension_bottom_sheet.dart';

class DemoActivitiesPage extends StatelessWidget {
  DemoActivitiesPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: const DefaultAppBar(title: "Activities"),
        body: FutureBuilder<void>(
          future: Future.delayed(Duration(seconds: 1)),
          builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
            if (snapshot.connectionState == ConnectionState.waiting) return CircularProgressIndicator(color: AppColor.loadingColor(context)).center;
            List<String> allAttachments = [];
            return Column(
              children: [
                SingleChildScrollView(
                    padding: const EdgeInsets.all(16),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            Text(
                              'Installation Date',
                              style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
                            ),
                            Text(
                              '03 Mar, 2025',
                              style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral50),
                            ),
                            12.height,
                            Text(
                              "End-user signature",
                              style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
                            ),
                            12.height,
                            if (allAttachments.isNotEmpty) ...[
                              const Divider().defaultStyle(context),
                              Text(
                                "Attachments".addTranslation,
                                style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
                              ),
                              FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e ?? '') ?? '').toList() ?? []),
                            ],
                          ],
                        ).toShadowContainer(context, borderRadius: 14, backgroundColor: Color(0xffF4F8FC), showShadow: false),
                        16.height,
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            Text(
                              'Estimation Delivery Date',
                              style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120),
                            ),
                            Text(
                              '03 Mar, 2025',
                              style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral50),
                            ),
                          ],
                        ).toShadowContainer(context, borderRadius: 14, backgroundColor: Color(0xffF4F8FC), showShadow: false),
                      ],
                    ).toShadowContainer(
                      context,
                      borderRadius: 20,
                      showShadow: false,
                    )).expanded,
                FooterActionButton.footerContainer(
                  context: context,
                  child: AppFilledButton(
                    buttonColor: AppColor.primary10,
                    label: "Extension Request",
                    // onPressed: () => _extensionRequest(context),
                    onPressed: () {

                    },
                  ),
                ),
              ],
            );
          },
        ));
  }

  // void _extensionRequest(context) {
  //   showModalBottomSheet(
  //     context: context,
  //     useSafeArea: true,
  //     backgroundColor: Colors.transparent,
  //     builder: (context) =>  DemoExtensionBottomSheet(),
  //   );
  // }
}
