import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/ui/work_list/sheets/delegate_sheet.dart';
import 'package:mohem_flutter_app/ui/work_list/sheets/request_more_info_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'dart:math' as math;

class ActionsFragment extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: double.infinity,
      child: ListView.separated(
        itemCount: actionsList.length,
        padding: EdgeInsets.all(21),
        itemBuilder: (context, index) {
          return showItem(context, actionsList[index]);
        },
        separatorBuilder: (BuildContext context, int index) {
          return 16.height;
        },
      ),
    );
  }

  Widget showItem(BuildContext context, Color color) {
    return Container(
      width: double.infinity,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(15),
        boxShadow: [
          BoxShadow(
            color: const Color(0xff000000).withOpacity(.05),
            blurRadius: 26,
            offset: const Offset(0, -3),
          ),
        ],
      ),
      clipBehavior: Clip.antiAlias,
      child: Stack(
        clipBehavior: Clip.antiAlias,
        children: [
          Positioned(
            left: -21,
            child: Transform.rotate(
              angle: 125,
              child: Container(
                width: 60,
                height: 20,
                color: color,
              ),
            ),
          ),
          Column(
            children: [
              Padding(
                padding: const EdgeInsets.only(left: 12, right: 12, top: 12),
                child: Column(
                  children: [
                    Row(
                      children: [
                        CircularAvatar(),
                        12.width,
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              "Mahmoud Shrouf".toText16(),
                              6.height,
                              "Missing Swipe Request for Hussain, Mohammad has been approved"
                                  .toText12(),
                              3.height,
                              Row(
                                children: [
                                  "Submitted".toText10(),
                                  12.width,
                                  "On 07 Jan 2021"
                                      .toText12(color: MyColors.lightTextColor)
                                ],
                              )
                            ],
                          ),
                        )
                      ],
                    ),
                  ],
                ),
              ),
              12.height,
              Container(
                width: double.infinity,
                height: 1,
                color: MyColors.lightTextColor,
              ),
              Row(
                children: [
                  Expanded(
                    child: InkWell(
                      onTap: () {
                        showMyBottomSheet(context,
                            child: RequestMoreInfoSheet());
                      },
                      child: Center(
                        child: "Request Info"
                            .toText12(isBold: true)
                            .paddingOnly(
                                left: 21, right: 21, top: 8, bottom: 8),
                      ),
                    ),
                  ),
                  Center(
                    child: Container(
                      width: 1,
                      height: 45,
                      color: MyColors.lightTextColor,
                    ),
                  ),
                  Expanded(
                    child: InkWell(
                      onTap: () {
                        showMyBottomSheet(context, child: DelegateSheet());
                      },
                      child: Center(
                        child: "Delegate"
                            .toText12(
                                color: MyColors.gradiantEndColor, isBold: true)
                            .paddingOnly(
                                left: 21, right: 21, top: 8, bottom: 8),
                      ),
                    ),
                  ),
                ],
              ),
            ],
          ),
        ],
      ),
    );
  }
}

List<Color> actionsList = [
  Colors.black,
  Colors.red,
  Colors.green,
];
