import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';

import '../app/constant.dart';

class MyCounterCustomerServiceDedicated extends HookWidget {
  final String counter;
  final String nomorAntrian;
  final BorderRadiusGeometry borderLuar;
  final BorderRadiusGeometry borderDalam;
  final bool blink;

  const MyCounterCustomerServiceDedicated(
      {Key? key,
      required this.counter,
      required this.nomorAntrian,
      required this.borderLuar,
      required this.borderDalam,
      required this.blink})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    AnimationController _ac =
        useAnimationController(duration: Duration(seconds: 2), initialValue: 1);
    _ac.repeat();
    return Stack(
      alignment: Alignment.center,
      children: [
        Container(
          width: Constant.getActualX(context: context, x: 355),
          height: Constant.getActualY(context: context, y: 355),
          decoration: BoxDecoration(
            borderRadius: borderLuar,
            gradient: LinearGradient(colors: [Constant.red1, Constant.red2]),
            boxShadow: [
              BoxShadow(
                  color: Colors.black.withOpacity(0.25),
                  blurRadius: 8,
                  offset: const Offset(-2, 6))
            ],
          ),
        ),
        Container(
          width: Constant.getActualX(context: context, x: 297),
          height: Constant.getActualY(context: context, y: 297),
          decoration: BoxDecoration(
            borderRadius: borderDalam,
            border: Border.all(
                color: Colors.white,
                strokeAlign: BorderSide.strokeAlignInside,
                width: 3),
            color: Colors.transparent,
          ),
          child: blink
              ? FadeTransition(
                  opacity: _ac,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text(counter,
                          textAlign: TextAlign.center,
                          style: Constant.body_1(context: context)
                              .copyWith(color: Colors.white)),
                      // blink
                      //     ? FadeTransition(
                      //         opacity: _ac,
                      //         child: Text(nomorAntrian,
                      //             style: Constant.body_1(context: context)
                      //                 .copyWith(color: Colors.white)),
                      //       )
                      //     :
                      Text(nomorAntrian,
                          style: Constant.h1(context: context)
                              .copyWith(color: Colors.white)),
                    ],
                  ),
                )
              : Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Text(counter,
                        textAlign: TextAlign.center,
                        style: Constant.body_1(context: context)
                            .copyWith(color: Colors.white)),
                    // blink
                    //     ? FadeTransition(
                    //         opacity: _ac,
                    //         child: Text(nomorAntrian,
                    //             style: Constant.body_1(context: context)
                    //                 .copyWith(color: Colors.white)),
                    //       )
                    //     :
                    Text(nomorAntrian,
                        style: Constant.S75(context: context)
                            .copyWith(color: Colors.white)),
                  ],
                ),
        )
      ],
    );
  }
}
