Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui_kit): atomic design system #19

Merged
merged 10 commits into from
Feb 24, 2024
Prev Previous commit
Next Next commit
refactor(sizes): use new size class
  • Loading branch information
ryanaidilp committed Feb 24, 2024
commit 2b76ce03b9d78f2c641b11b5995db2313c59bcdc
8 changes: 4 additions & 4 deletions app/smart/lib/error_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ class ErrorApp extends StatelessWidget {
width: 0.5.sw,
fit: BoxFit.cover,
),
Gap(SmartDimension.h16),
Gap(SmartDimension.size16.h),
Text(
context.i10n.errors.somethingWrong.description,
textAlign: TextAlign.center,
style: SmartTextStyle.headingXs(),
),
Gap(SmartDimension.h8),
Gap(SmartDimension.size8.h),
Padding(
padding: EdgeInsets.symmetric(
horizontal: SmartDimension.v64,
horizontal: SmartDimension.size64.w,
),
child: Text(
context.i10n.errors.somethingWrong.description,
Expand Down Expand Up @@ -78,7 +78,7 @@ class ErrorApp extends StatelessWidget {
),
],
),
Gap(SmartDimension.h32),
Gap(SmartDimension.size32.h),
],
),
),
Expand Down
12 changes: 6 additions & 6 deletions app/smart_widgetbook/lib/presentation/pages/animation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class AnimationPage extends StatelessWidget {
],
),
body: Padding(
padding: EdgeInsets.all(SmartDimension.r16),
padding: EdgeInsets.all(SmartDimension.size16.r),
child: StaggeredGrid.count(
crossAxisCount: 2,
crossAxisSpacing: SmartDimension.h16,
mainAxisSpacing: SmartDimension.v16,
crossAxisSpacing: SmartDimension.size16.w,
mainAxisSpacing: SmartDimension.size16.h,
children: List.generate(
SmartAnimations.values.length,
(index) => Container(
Expand All @@ -31,7 +31,7 @@ class AnimationPage extends StatelessWidget {
),
color: context.smartColor.background.card.main,
),
padding: EdgeInsets.all(SmartDimension.r16),
padding: EdgeInsets.all(SmartDimension.size16.r),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
Expand All @@ -42,10 +42,10 @@ class AnimationPage extends StatelessWidget {
animation: SmartAnimations.values[index],
fit: BoxFit.contain,
),
Gap(SmartDimension.v8),
Gap(SmartDimension.size8.h),
Padding(
padding: EdgeInsets.symmetric(
horizontal: SmartDimension.h16,
horizontal: SmartDimension.size16.w,
),
child: SelectableText(
SmartAnimations.values[index].name,
Expand Down
30 changes: 15 additions & 15 deletions app/smart_widgetbook/lib/presentation/pages/button_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class _ButtonList extends StatelessWidget {

@override
Widget build(BuildContext context) => SingleChildScrollView(
padding: EdgeInsets.all(SmartDimension.r16),
padding: EdgeInsets.all(SmartDimension.size16.r),
child: Column(
children: [
SmartButton(
Expand All @@ -119,7 +119,7 @@ class _ButtonList extends StatelessWidget {
onPressed: () async {},
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -132,7 +132,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -145,7 +145,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -162,15 +162,15 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
size: size,
label: 'Filled (Disabled)',
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -180,7 +180,7 @@ class _ButtonList extends StatelessWidget {
onPressed: () async {},
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -194,7 +194,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -208,7 +208,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -226,7 +226,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -235,7 +235,7 @@ class _ButtonList extends StatelessWidget {
type: SmartButtonType.outline,
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -245,7 +245,7 @@ class _ButtonList extends StatelessWidget {
onPressed: () async {},
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -259,7 +259,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -273,7 +273,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand All @@ -291,7 +291,7 @@ class _ButtonList extends StatelessWidget {
),
),
Gap(
SmartDimension.v8,
SmartDimension.size8.h,
),
SmartButton(
variant: variant,
Expand Down
8 changes: 4 additions & 4 deletions app/smart_widgetbook/lib/presentation/pages/logo_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class LogoPage extends StatelessWidget {
],
),
body: Padding(
padding: EdgeInsets.all(SmartDimension.r16),
padding: EdgeInsets.all(SmartDimension.size16.r),
child: StaggeredGrid.count(
crossAxisCount: 2,
crossAxisSpacing: SmartDimension.h16,
mainAxisSpacing: SmartDimension.v16,
crossAxisSpacing: SmartDimension.size16.w,
mainAxisSpacing: SmartDimension.size16.h,
children: List.generate(
SmartLogo.values.length,
(index) => Container(
Expand All @@ -31,7 +31,7 @@ class LogoPage extends StatelessWidget {
),
color: context.smartColor.background.card.main,
),
padding: EdgeInsets.all(SmartDimension.r16),
padding: EdgeInsets.all(SmartDimension.size16.r),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class IconColorPage extends StatelessWidget {
size: 24.sp,
color: colorData.color,
),
Gap(SmartDimension.h12),
Gap(SmartDimension.size12.w),
Text(
colorData.token.replaceAll('.', '/'),
style: SmartTextStyle.body(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OutlineColorPage extends StatelessWidget {
width: 150.w,
height: 150.h,
alignment: Alignment.center,
padding: EdgeInsets.all(SmartDimension.r8),
padding: EdgeInsets.all(SmartDimension.size8.r),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(SmartBorderRadius.md),
border: Border.all(
Expand Down
3 changes: 3 additions & 0 deletions packages/smart_ui_kit/lib/smart_ui_kit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ export 'src/components/components.dart';
// core
export 'src/core/core.dart';

// tokens
export 'src/tokens/tokens.dart';

// utils
export 'src/utils/utils.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ enum SmartButtonSize {
ButtonSizeData get data => switch (this) {
xs => ButtonSizeData(
padding: EdgeInsets.symmetric(
vertical: SmartDimension.v8,
horizontal: SmartDimension.h8,
vertical: SmartDimension.size8.h,
horizontal: SmartDimension.size8.w,
),
borderRadius: SmartBorderRadius.xs,
textStyle: SmartTextStyle.bodyXs(
Expand All @@ -24,8 +24,8 @@ enum SmartButtonSize {
),
sm => ButtonSizeData(
padding: EdgeInsets.symmetric(
vertical: SmartDimension.v8,
horizontal: SmartDimension.h12,
vertical: SmartDimension.size8.h,
horizontal: SmartDimension.size12.w,
),
borderRadius: SmartBorderRadius.sm,
textStyle: SmartTextStyle.bodySm(
Expand All @@ -36,8 +36,8 @@ enum SmartButtonSize {
),
md => ButtonSizeData(
padding: EdgeInsets.symmetric(
vertical: SmartDimension.v8,
horizontal: SmartDimension.h12,
vertical: SmartDimension.size8.h,
horizontal: SmartDimension.size12.w,
),
borderRadius: SmartBorderRadius.sm,
textStyle: SmartTextStyle.body(
Expand All @@ -48,8 +48,8 @@ enum SmartButtonSize {
),
lg => ButtonSizeData(
padding: EdgeInsets.symmetric(
vertical: SmartDimension.v12,
horizontal: SmartDimension.h16,
vertical: SmartDimension.size12.h,
horizontal: SmartDimension.size16.w,
),
borderRadius: SmartBorderRadius.md,
textStyle: SmartTextStyle.bodyLg(
Expand All @@ -59,7 +59,7 @@ enum SmartButtonSize {
height: 48.h,
),
xl => ButtonSizeData(
padding: EdgeInsets.all(SmartDimension.r16),
padding: EdgeInsets.all(SmartDimension.size16.r),
borderRadius: SmartBorderRadius.md,
textStyle: SmartTextStyle.bodyLg(
fontWeight: FontWeight.w700,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class _ButtonWidget extends StatelessWidget {
children: [
if (leading != null) ...[
leading!,
Gap(SmartDimension.h8),
const Gap(SmartDimension.size8),
],
Text(
label,
Expand All @@ -204,7 +204,7 @@ class _ButtonWidget extends StatelessWidget {
overflow: TextOverflow.ellipsis,
),
if (trailing != null) ...[
Gap(SmartDimension.h8),
const Gap(SmartDimension.size8),
trailing!,
],
],
Expand Down
2 changes: 0 additions & 2 deletions packages/smart_ui_kit/lib/src/core/size/size.dart

This file was deleted.

11 changes: 0 additions & 11 deletions packages/smart_ui_kit/lib/src/core/size/smart_border_radius.dart

This file was deleted.

44 changes: 0 additions & 44 deletions packages/smart_ui_kit/lib/src/core/size/smart_dimension.dart

This file was deleted.