import 'package:flutter/material.dart';
import 'package:concierge/presentation/theme/app_color_scheme.dart';
import 'package:concierge/presentation/theme/app_textstyles.dart';
import 'app_colors.dart';
class AppButtonStyles {
final AppColorScheme colorScheme;
AppButtonStyles({required this.colorScheme});
static final defaultShape = WidgetStatePropertyAll(
RoundedRectangleBorder(borderRadius: BorderRadiusGeometry.circular(16)),
);
static final smallShape = WidgetStatePropertyAll(
RoundedRectangleBorder(borderRadius: BorderRadiusGeometry.circular(8)),
);
static final linkShape = WidgetStatePropertyAll(
RoundedRectangleBorder(borderRadius: BorderRadiusGeometry.circular(2)),
);
static final defaultMinSize = WidgetStatePropertyAll(Size(0, 48));
static final defaultMinSizeLarge = WidgetStatePropertyAll(Size(240, 48));
static final smallMinSize = WidgetStatePropertyAll(Size(0, 32));
static final squareMinSize = WidgetStatePropertyAll(Size(36, 36));
static final squareMinSizeLarge = WidgetStatePropertyAll(Size(0, 48));
static final defaultPadding = WidgetStatePropertyAll(
EdgeInsets.symmetric(horizontal: 16),
);
static final smallPadding = WidgetStatePropertyAll(
EdgeInsets.symmetric(horizontal: 12),
);
static final squarePadding = WidgetStatePropertyAll(EdgeInsets.all(4));
static final defaultTextStyle = WidgetStatePropertyAll(
AppTextStyles.b2Highlight,
);
static final secondaryTextStyle = WidgetStatePropertyAll(
AppTextStyles.textHighlightSemiBold,
);
late final primaryMainDefault = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfacePrimary,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
textStyle: defaultTextStyle,
minimumSize: defaultMinSize,
padding: defaultPadding,
shape: WidgetStateProperty.fromMap({
WidgetState.disabled: defaultShape.value,
WidgetState.any: defaultShape.value.copyWith(
side: BorderSide(color: AppColors.colorPrimaryText, width: 1),
),
}),
);
late final transparentDefault = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: Colors.transparent,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
minimumSize: defaultMinSize,
textStyle: defaultTextStyle,
padding: defaultPadding,
shape: defaultShape,
);
late final greyDefault = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfaceSecondary,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
minimumSize: defaultMinSize,
textStyle: defaultTextStyle,
padding: defaultPadding,
shape: defaultShape,
);
late final greyDefaultLarge = greyDefault.copyWith(
minimumSize: defaultMinSizeLarge,
);
late final bottomNav = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.selected: colorScheme.surfacePrimary,
WidgetState.any: colorScheme.background,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.any: colorScheme.textPrimary,
}),
minimumSize: defaultMinSize,
textStyle: defaultTextStyle,
padding: defaultPadding,
shape: defaultShape,
);
late final invertDefault = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfaceInvert,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textInvertPrimary,
}),
minimumSize: defaultMinSize,
textStyle: secondaryTextStyle,
padding: smallPadding,
shape: defaultShape,
);
late final invertDefaultLarge = invertDefault.copyWith(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfaceInvert,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textInvertPrimary,
}),
minimumSize: defaultMinSizeLarge,
padding: defaultPadding,
shape: defaultShape,
);
late final mainHighlight = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfaceHighlight,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
minimumSize: defaultMinSize,
textStyle: defaultTextStyle,
shape: defaultShape,
padding: defaultPadding,
);
late final outlineDefault = ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Colors.transparent),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
shape: WidgetStateProperty.fromMap({
WidgetState.disabled: RoundedRectangleBorder(
borderRadius: BorderRadiusGeometry.circular(16),
side: BorderSide(color: AppColors.colorDivider, width: 1),
),
WidgetState.any: RoundedRectangleBorder(
borderRadius: BorderRadiusGeometry.circular(16),
side: BorderSide(color: AppColors.colorDivider, width: 1),
),
}),
minimumSize: defaultMinSize,
textStyle: defaultTextStyle,
padding: defaultPadding,
);
late final outlineHighlight = ButtonStyle(
backgroundColor: WidgetStatePropertyAll(Colors.transparent),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
shape: WidgetStateProperty.fromMap({
WidgetState.disabled: RoundedRectangleBorder(
borderRadius: BorderRadiusGeometry.circular(16),
side: BorderSide(color: AppColors.colorDivider, width: 1),
),
WidgetState.any: RoundedRectangleBorder(
borderRadius: BorderRadiusGeometry.circular(16),
side: BorderSide(color: colorScheme.borderHighlight, width: 1),
),
}),
minimumSize: defaultMinSize,
padding: defaultPadding,
textStyle: defaultTextStyle,
);
late final textLinkDefault = ButtonStyle(
textStyle: WidgetStatePropertyAll(
AppTextStyles.textRegular.copyWith(decoration: TextDecoration.underline),
),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.textSecondary,
WidgetState.any: colorScheme.textPrimary,
}),
backgroundColor: WidgetStatePropertyAll(Colors.transparent),
padding: WidgetStatePropertyAll(EdgeInsets.zero),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
shape: linkShape,
);
late final textLinkGrey = ButtonStyle(
textStyle: WidgetStatePropertyAll(
AppTextStyles.textRegular.copyWith(decoration: TextDecoration.underline),
),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.textSecondary,
WidgetState.any: colorScheme.textPrimary,
}),
backgroundColor: WidgetStatePropertyAll(Colors.transparent),
padding: WidgetStatePropertyAll(EdgeInsets.zero),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
shape: linkShape,
);
late final textLinkHighLight = ButtonStyle(
textStyle: WidgetStatePropertyAll(
TextStyle(decoration: TextDecoration.underline),
),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.textSecondary,
WidgetState.any: colorScheme.textHighlight,
}),
backgroundColor: WidgetStatePropertyAll(Colors.transparent),
padding: WidgetStatePropertyAll(EdgeInsets.zero),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
shape: linkShape,
);
late final secondaryMainDefault = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfacePrimary,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
padding: smallPadding,
textStyle: secondaryTextStyle,
shape: smallShape,
minimumSize: smallMinSize,
);
late final secondaryMainDefaultLarge = secondaryMainDefault.copyWith(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfacePrimary,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
minimumSize: defaultMinSizeLarge,
padding: defaultPadding,
shape: defaultShape,
);
late final squareIconButton = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfacePrimary,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
padding: squarePadding,
shape: smallShape,
minimumSize: squareMinSize,
);
late final invertSquareIconButton = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfaceInvert,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textInvertPrimary,
}),
padding: squarePadding,
shape: smallShape,
minimumSize: squareMinSize,
);
late final squareIconButtonLarge = ButtonStyle(
backgroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: colorScheme.borderDefault,
WidgetState.any: colorScheme.surfacePrimary,
}),
foregroundColor: WidgetStateProperty.fromMap({
WidgetState.disabled: AppColors.disabledText,
WidgetState.any: colorScheme.textPrimary,
}),
padding: squarePadding,
shape: defaultShape,
minimumSize: squareMinSizeLarge,
);
}