import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:guru_rating/page/rating_style.dart';

import 'package:guru_widgets/common/flexible_container.dart';
import 'package:guru_widgets/common/spacer.dart';

import 'going_store_design_spec.dart';

class GoingStoreLoadingPage extends StatefulWidget {
  final GoingStoreStyle style;

  const GoingStoreLoadingPage(this.style, {Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return GoingStoreLoadingState();
  }
}

class GoingStoreLoadingState extends State<GoingStoreLoadingPage> {
  late GoingStoreDialogSpec dialogSpec = GoingStoreDialogSpec.get();

  @override
  Widget build(BuildContext context) {
    return Center(
      child: FlexibleContainer(
        color: widget.style.backgroundColor,
        constraints: BoxConstraints(
          minWidth: dialogSpec.goingStoreSpec.measuredSize.width,
          maxWidth: dialogSpec.goingStoreSpec.measuredSize.width,
          minHeight: dialogSpec.goingStoreSpec.measuredSize.height,
        ),
        radius: dialogSpec.goingStoreSpec.radius,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            SizedSpacer(
              height: dialogSpec.goingStoreSpec.dotTopSpacing,
            ),
            SpinKitThreeBounce(
              size: dialogSpec.goingStoreSpec.dotSize,
              color: const Color(0xff00FDAF),
            ),
            SizedSpacer(
              height: dialogSpec.goingStoreSpec.summaryTopSpacing,
            ),
            Container(
              padding: const EdgeInsets.symmetric(horizontal: 10),
              child: Text(
                widget.style.summary.replaceAll("\\n", "\n"),
                style: TextStyle(
                    fontWeight: FontWeight.w500,
                    color: widget.style.summaryTextColor,
                    fontSize: dialogSpec.goingStoreSpec.summaryFontSize),
                textAlign: TextAlign.center,
                strutStyle: const StrutStyle(height: 1.4),
              ),
            ),
            SizedSpacer(
              height: dialogSpec.goingStoreSpec.emojiTopSpacing,
            ),
            Text(
              "🙏",
              style: TextStyle(fontSize: dialogSpec.goingStoreSpec.emojiTextSize),
            ),
            SizedSpacer(
              height: dialogSpec.goingStoreSpec.emojiBottomSpacing,
            ),
          ],
        ),
      ),
    );
  }
}
