feat: Add xSmall size and destructive variant to UiChip, refactor AttireItemCard to use these new chip features, and adjust body4r font size.
This commit is contained in:
@@ -374,7 +374,7 @@ class UiTypography {
|
|||||||
/// Body 4 Regular - Font: Instrument Sans, Size: 14, Height: 1.5, Spacing: 0.05 (#121826)
|
/// Body 4 Regular - Font: Instrument Sans, Size: 14, Height: 1.5, Spacing: 0.05 (#121826)
|
||||||
static final TextStyle body4r = _primaryBase.copyWith(
|
static final TextStyle body4r = _primaryBase.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 12,
|
fontSize: 10,
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
letterSpacing: 0.05,
|
letterSpacing: 0.05,
|
||||||
color: UiColors.textPrimary,
|
color: UiColors.textPrimary,
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import '../ui_typography.dart';
|
|||||||
|
|
||||||
/// Sizes for the [UiChip] widget.
|
/// Sizes for the [UiChip] widget.
|
||||||
enum UiChipSize {
|
enum UiChipSize {
|
||||||
|
// X-Small size (e.g. for tags in tight spaces).
|
||||||
|
xSmall,
|
||||||
|
|
||||||
/// Small size (e.g. for tags in tight spaces).
|
/// Small size (e.g. for tags in tight spaces).
|
||||||
small,
|
small,
|
||||||
|
|
||||||
@@ -25,6 +28,9 @@ enum UiChipVariant {
|
|||||||
|
|
||||||
/// Accent style with highlight background.
|
/// Accent style with highlight background.
|
||||||
accent,
|
accent,
|
||||||
|
|
||||||
|
/// Desructive style with red background.
|
||||||
|
destructive,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A custom chip widget with supports for different sizes, themes, and icons.
|
/// A custom chip widget with supports for different sizes, themes, and icons.
|
||||||
@@ -119,6 +125,8 @@ class UiChip extends StatelessWidget {
|
|||||||
return UiColors.tagInProgress;
|
return UiColors.tagInProgress;
|
||||||
case UiChipVariant.accent:
|
case UiChipVariant.accent:
|
||||||
return UiColors.accent;
|
return UiColors.accent;
|
||||||
|
case UiChipVariant.destructive:
|
||||||
|
return UiColors.iconError.withValues(alpha: 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,11 +142,15 @@ class UiChip extends StatelessWidget {
|
|||||||
return UiColors.primary;
|
return UiColors.primary;
|
||||||
case UiChipVariant.accent:
|
case UiChipVariant.accent:
|
||||||
return UiColors.accentForeground;
|
return UiColors.accentForeground;
|
||||||
|
case UiChipVariant.destructive:
|
||||||
|
return UiColors.iconError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextStyle _getTextStyle() {
|
TextStyle _getTextStyle() {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
|
case UiChipSize.xSmall:
|
||||||
|
return UiTypography.body4r;
|
||||||
case UiChipSize.small:
|
case UiChipSize.small:
|
||||||
return UiTypography.body3r;
|
return UiTypography.body3r;
|
||||||
case UiChipSize.medium:
|
case UiChipSize.medium:
|
||||||
@@ -150,6 +162,8 @@ class UiChip extends StatelessWidget {
|
|||||||
|
|
||||||
EdgeInsets _getPadding() {
|
EdgeInsets _getPadding() {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
|
case UiChipSize.xSmall:
|
||||||
|
return const EdgeInsets.symmetric(horizontal: 6, vertical: 4);
|
||||||
case UiChipSize.small:
|
case UiChipSize.small:
|
||||||
return const EdgeInsets.symmetric(horizontal: 10, vertical: 6);
|
return const EdgeInsets.symmetric(horizontal: 10, vertical: 6);
|
||||||
case UiChipSize.medium:
|
case UiChipSize.medium:
|
||||||
@@ -161,6 +175,8 @@ class UiChip extends StatelessWidget {
|
|||||||
|
|
||||||
double _getIconSize() {
|
double _getIconSize() {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
|
case UiChipSize.xSmall:
|
||||||
|
return 10;
|
||||||
case UiChipSize.small:
|
case UiChipSize.small:
|
||||||
return 12;
|
return 12;
|
||||||
case UiChipSize.medium:
|
case UiChipSize.medium:
|
||||||
@@ -172,6 +188,8 @@ class UiChip extends StatelessWidget {
|
|||||||
|
|
||||||
double _getGap() {
|
double _getGap() {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
|
case UiChipSize.xSmall:
|
||||||
|
return UiConstants.space1;
|
||||||
case UiChipSize.small:
|
case UiChipSize.small:
|
||||||
return UiConstants.space1;
|
return UiConstants.space1;
|
||||||
case UiChipSize.medium:
|
case UiChipSize.medium:
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ class AttireItemCard extends StatelessWidget {
|
|||||||
final bool hasPhoto = uploadedPhotoUrl != null;
|
final bool hasPhoto = uploadedPhotoUrl != null;
|
||||||
|
|
||||||
final String statusText = hasPhoto ? 'Pending' : 'Not Uploaded';
|
final String statusText = hasPhoto ? 'Pending' : 'Not Uploaded';
|
||||||
final Color statusColor = hasPhoto
|
|
||||||
? UiColors.textWarning
|
|
||||||
: UiColors.textInactive;
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
@@ -33,13 +30,6 @@ class AttireItemCard extends StatelessWidget {
|
|||||||
color: UiColors.white,
|
color: UiColors.white,
|
||||||
borderRadius: BorderRadius.circular(UiConstants.radiusBase),
|
borderRadius: BorderRadius.circular(UiConstants.radiusBase),
|
||||||
border: Border.all(color: UiColors.border),
|
border: Border.all(color: UiColors.border),
|
||||||
boxShadow: const <BoxShadow>[
|
|
||||||
BoxShadow(
|
|
||||||
color: Color(0x19000000),
|
|
||||||
blurRadius: 4,
|
|
||||||
offset: Offset(0, 2),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -68,7 +58,6 @@ class AttireItemCard extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(item.label, style: UiTypography.body1m.textPrimary),
|
Text(item.label, style: UiTypography.body1m.textPrimary),
|
||||||
if (item.description != null) ...<Widget>[
|
if (item.description != null) ...<Widget>[
|
||||||
const SizedBox(height: UiConstants.space1),
|
|
||||||
Text(
|
Text(
|
||||||
item.description!,
|
item.description!,
|
||||||
style: UiTypography.body2r.textSecondary,
|
style: UiTypography.body2r.textSecondary,
|
||||||
@@ -80,19 +69,10 @@ class AttireItemCard extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (item.isMandatory)
|
if (item.isMandatory)
|
||||||
Container(
|
const UiChip(
|
||||||
padding: const EdgeInsets.symmetric(
|
label: 'Required',
|
||||||
horizontal: 8,
|
size: UiChipSize.xSmall,
|
||||||
vertical: 4,
|
variant: UiChipVariant.destructive,
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: UiColors.error.withValues(alpha: 0.1),
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Required',
|
|
||||||
style: UiTypography.footnote2m.textError,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (isUploading)
|
if (isUploading)
|
||||||
@@ -102,11 +82,10 @@ class AttireItemCard extends StatelessWidget {
|
|||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
)
|
)
|
||||||
else if (hasPhoto)
|
else if (hasPhoto)
|
||||||
Text(
|
UiChip(
|
||||||
statusText,
|
label: statusText,
|
||||||
style: UiTypography.footnote2m.copyWith(
|
size: UiChipSize.xSmall,
|
||||||
color: statusColor,
|
variant: UiChipVariant.secondary,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user