import 'package:dotted_border/dotted_border.dart';
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/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';

import '../app_style/app_color.dart';

class AppDashedButton extends StatelessWidget {
  final String title;
  final VoidCallback onPressed;

  const AppDashedButton({@required this.title, @required this.onPressed, Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      padding: EdgeInsets.symmetric(horizontal: 2.toScreenWidth),
      decoration: BoxDecoration(color: AppColor.background(context), borderRadius: BorderRadius.circular(10)),
      child: DottedBorder(
        strokeWidth: 2,
        padding: EdgeInsets.symmetric(vertical: 16.toScreenHeight, horizontal: 16.toScreenWidth),
        color: context.isDark ? AppColor.primary40 : AppColor.primary60,
        dashPattern: const [4, 3],
        radius: const Radius.circular(10),
        borderType: BorderType.RRect,
        child: title.heading6(context).custom(color: context.isDark ? AppColor.primary40 : AppColor.primary60).center,
      ),
    ).onPress(onPressed);
  }
}
