import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';

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

extension WidgetExtensions on Widget {
  Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this, highlightColor: Colors.transparent, splashColor: Colors.transparent);

  Widget get expanded => Expanded(child: this);

  Widget get center => Center(child: this);

  Widget circle(double value) => ClipRRect(borderRadius: BorderRadius.circular(value), child: this);

  Widget paddingAll(double value) => Padding(padding: EdgeInsets.all(value), child: this);

  Widget paddingOnly({int left = 0, int right = 0, int top = 0, int bottom = 0}) =>
      Padding(padding: EdgeInsets.only(left: left.toScreenWidth, right: right.toScreenWidth, top: top.toScreenHeight, bottom: bottom.toScreenHeight), child: this);

  Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this);
}

extension DividerExtension on Divider {
  Divider defaultStyle(BuildContext context) => Divider(thickness: 1, color: context.isDark ? AppColor.neutral50 : AppColor.neutral30);
}
