Skip to content

Commit

Permalink
fix: some border radiusses
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Oct 4, 2024
1 parent 52badbf commit 1e35be4
Show file tree
Hide file tree
Showing 48 changed files with 391 additions and 348 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@ import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_example/src/component_library/components/input_field/input_field_library_item.dart';
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';

class InputFieldVariant
extends ComponentLibraryVariant<InputFieldLibraryVariantInputs> {
class InputFieldVariant extends ComponentLibraryVariant<InputFieldLibraryVariantInputs> {
InputFieldVariant();

@override
String get title => 'Default';

@override
List<Widget> build(
BuildContext context, InputFieldLibraryVariantInputs inputs) {
List<Widget> build(BuildContext context, InputFieldLibraryVariantInputs inputs) {
final label = inputs.label.value;
final hint = inputs.hint.value ?? '{hint}';
final value = inputs.value.value;
final leadingIcon = inputs.leadingIcon.value;
return [
ImpaktfullUiInputField(
leadingIcon:
leadingIcon == null ? null : ImpaktfullUiAsset.icon(leadingIcon),
leadingIcon: leadingIcon == null ? null : ImpaktfullUiAsset.icon(leadingIcon),
label: label,
hint: hint,
value: value,
onChanged: inputs.value.updateState,
trailingAction: ImpaktfullUiInputFieldAction(
label: 'Copy',
onTap: () => ImpaktfullUiNotification.show(
title: 'Copied to clipboard',
),
),
),
];
}
Expand Down
3 changes: 3 additions & 0 deletions lib/impaktfull_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export 'src/components/grid_view/grid_view.dart';
export 'src/components/horizontal_tab/horizontal_tab.dart';
export 'src/components/horizontal_tabs/horizontal_tabs.dart';
export 'src/components/icon_button/icon_button.dart';
export 'src/components/input_field/action/input_field_action.dart';
export 'src/components/input_field/input_field.dart';
export 'src/components/list_item/list_item.dart';
export 'src/components/list_view/list_view.dart';
Expand Down Expand Up @@ -44,6 +45,8 @@ export 'src/theme/theme.dart';
export 'src/components/theme/theme_builder.dart';
// Widget Library
export 'src/util/descriptor/component_descriptor_mixin.dart';
// Extensions
export 'src/util/extension/border_radius_geometry_extension.dart';
// Util
export 'src/util/responsive/responsive_extension.dart';
// External packages
Expand Down
13 changes: 8 additions & 5 deletions lib/src/components/badge/badge.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import 'package:flutter/material.dart';
import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_2/src/components/asset/asset_widget.dart';
import 'package:impaktfull_ui_2/src/components/auto_layout/auto_layout.dart';
import 'package:impaktfull_ui_2/src/components/badge/badge.dart';
import 'package:impaktfull_ui_2/src/components/theme/theme_component_builder.dart';
import 'package:impaktfull_ui_2/src/components/touch_feedback/touch_feedback.dart';
import 'package:impaktfull_ui_2/src/theme/theme.dart';
import 'package:impaktfull_ui_2/src/util/descriptor/component_descriptor_mixin.dart';

export 'badge_style.dart';
export 'badge_type.dart';
Expand Down Expand Up @@ -57,12 +62,10 @@ class _ImpaktfullUiBadgeState extends State<ImpaktfullUiBadge> {
padding: EdgeInsets.only(
left: widget.leading == null
? widget.size.horizontalPadding
: (widget.size.horizontalPadding / 2) -
widget.size.paddingOffset,
: (widget.size.horizontalPadding / 2) - widget.size.paddingOffset,
right: widget.trailing == null
? widget.size.horizontalPadding
: (widget.size.horizontalPadding / 2) -
widget.size.paddingOffset,
: (widget.size.horizontalPadding / 2) - widget.size.paddingOffset,
top: widget.size.verticalPadding,
bottom: widget.size.verticalPadding,
),
Expand Down
5 changes: 2 additions & 3 deletions lib/src/components/badge/badge_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ class ImpaktfullUiBadgeTheme extends ImpaktfullUiComponentTheme {
required this.assets,
});

static ImpaktfullUiBadgeTheme of(BuildContext context) =>
ImpaktfullUiTheme.of(context).components.badge;
static ImpaktfullUiBadgeTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.badge;
}

class ImpaktfullUiBadgeColorTheme {
const ImpaktfullUiBadgeColorTheme();
}

class ImpaktfullUiBadgeDimensTheme {
final BorderRadius borderRadius;
final BorderRadiusGeometry borderRadius;

const ImpaktfullUiBadgeDimensTheme({
required this.borderRadius,
Expand Down
19 changes: 6 additions & 13 deletions lib/src/components/bottom_sheet/bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export 'bottom_sheet_style.dart';

part 'bottom_sheet.describe.dart';

class ImpaktfullUiBottomSheet extends StatelessWidget
with ComponentDescriptorMixin {
class ImpaktfullUiBottomSheet extends StatelessWidget with ComponentDescriptorMixin {
final String? title;
final String? subtitle;
final bool hasClose;
Expand Down Expand Up @@ -86,9 +85,7 @@ class ImpaktfullUiBottomSheet extends StatelessWidget
final width = constraints.maxWidth;
final actionsOrientation = _getActionsOrientation(width);
List<Widget> actions = this.actions;
if (actions.isNotEmpty &&
actionsOrientation ==
ImpaktfullUiAutoLayoutOrientation.horizontal) {
if (actions.isNotEmpty && actionsOrientation == ImpaktfullUiAutoLayoutOrientation.horizontal) {
actions = actions
.map((action) => Expanded(
child: action,
Expand All @@ -110,8 +107,7 @@ class ImpaktfullUiBottomSheet extends StatelessWidget
margin: const EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: componentTheme.colors.handle,
borderRadius:
componentTheme.dimens.handleBorderRadius,
borderRadius: componentTheme.dimens.handleBorderRadius,
),
height: 4,
width: 50,
Expand Down Expand Up @@ -139,8 +135,7 @@ class ImpaktfullUiBottomSheet extends StatelessWidget
if (subtitle != null) ...[
Text(
subtitle!,
style:
componentTheme.textStyles.subtitle,
style: componentTheme.textStyles.subtitle,
),
],
],
Expand All @@ -157,8 +152,7 @@ class ImpaktfullUiBottomSheet extends StatelessWidget
Align(
alignment: AlignmentDirectional.topEnd,
child: Padding(
padding:
componentTheme.dimens.closeIconButtonPadding,
padding: componentTheme.dimens.closeIconButtonPadding,
child: ImpaktfullUiIconButton(
onTap: () {
if (onCloseTapped != null) {
Expand Down Expand Up @@ -187,8 +181,7 @@ class ImpaktfullUiBottomSheet extends StatelessWidget
child: ImpaktfullUiAutoLayout(
spacing: 8,
orientation: actionsOrientation,
crossAxisAlignment: actionsOrientation ==
ImpaktfullUiAutoLayoutOrientation.vertical
crossAxisAlignment: actionsOrientation == ImpaktfullUiAutoLayoutOrientation.vertical
? CrossAxisAlignment.stretch
: CrossAxisAlignment.start,
children: [
Expand Down
7 changes: 3 additions & 4 deletions lib/src/components/bottom_sheet/bottom_sheet_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ class ImpaktfullUiBottomSheetTheme extends ImpaktfullUiComponentTheme {
required this.textStyles,
});

static ImpaktfullUiBottomSheetTheme of(BuildContext context) =>
ImpaktfullUiTheme.of(context).components.bottomSheet;
static ImpaktfullUiBottomSheetTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.bottomSheet;
}

class ImpaktfullUiBottomSheetAssetsTheme {
Expand All @@ -42,8 +41,8 @@ class ImpaktfullUiBottomSheetColorTheme {
class ImpaktfullUiBottomSheetDimensTheme {
final EdgeInsetsDirectional closeIconButtonPadding;
final EdgeInsetsDirectional padding;
final BorderRadius borderRadius;
final BorderRadius handleBorderRadius;
final BorderRadiusGeometry borderRadius;
final BorderRadiusGeometry handleBorderRadius;

const ImpaktfullUiBottomSheetDimensTheme({
required this.closeIconButtonPadding,
Expand Down
21 changes: 11 additions & 10 deletions lib/src/components/button/button.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_2/src/components/asset/asset_widget.dart';
import 'package:impaktfull_ui_2/src/components/auto_layout/auto_layout.dart';
import 'package:impaktfull_ui_2/src/components/button/button.dart';
import 'package:impaktfull_ui_2/src/components/loading_indicator/loading_indicator.dart';
import 'package:impaktfull_ui_2/src/components/theme/theme_component_builder.dart';
import 'package:impaktfull_ui_2/src/components/touch_feedback/touch_feedback.dart';
import 'package:impaktfull_ui_2/src/models/asset.dart';
import 'package:impaktfull_ui_2/src/util/descriptor/component_descriptor_mixin.dart';

export 'button_type.dart';
export 'button_style.dart';
Expand Down Expand Up @@ -70,8 +76,7 @@ class _ImpaktfullUiButtonState extends State<ImpaktfullUiButton> {
width: 1,
strokeAlign: BorderSide.strokeAlignInside,
),
onTap:
widget.onTap == null && widget.onAsyncTap == null ? null : _onTap,
onTap: widget.onTap == null && widget.onAsyncTap == null ? null : _onTap,
child: Stack(
alignment: Alignment.center,
children: [
Expand All @@ -80,8 +85,7 @@ class _ImpaktfullUiButtonState extends State<ImpaktfullUiButton> {
child: Padding(
padding: _getPadding(componentTheme),
child: ImpaktfullUiAutoLayout.horizontal(
mainAxisSize:
widget.fullWidth ? MainAxisSize.max : MainAxisSize.min,
mainAxisSize: widget.fullWidth ? MainAxisSize.max : MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 4,
children: [
Expand Down Expand Up @@ -124,18 +128,15 @@ class _ImpaktfullUiButtonState extends State<ImpaktfullUiButton> {
duration: theme.durations.short,
curve: Curves.easeInOut,
child: ImpaktfullUiAutoLayout.horizontal(
mainAxisSize:
widget.fullWidth ? MainAxisSize.max : MainAxisSize.min,
mainAxisSize: widget.fullWidth ? MainAxisSize.max : MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 4,
children: [
Expanded(
flex: widget.fullWidth ? 1 : 0,
child: SizedBox(
height: _getLoadingSize(),
child: _isLoading
? ImpaktfullUiLoadingIndicator(color: color)
: const SizedBox(),
child: _isLoading ? ImpaktfullUiLoadingIndicator(color: color) : const SizedBox(),
),
),
],
Expand Down
5 changes: 2 additions & 3 deletions lib/src/components/button/button_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class ImpaktfullUiButtonTheme extends ImpaktfullUiComponentTheme {
required this.textStyles,
});

static ImpaktfullUiButtonTheme of(BuildContext context) =>
ImpaktfullUiTheme.of(context).components.button;
static ImpaktfullUiButtonTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.button;
}

class ImpaktfullUiButtonColorTheme {
Expand All @@ -39,7 +38,7 @@ class ImpaktfullUiButtonColorTheme {
}

class ImpaktfullUiButtonDimensTheme {
final BorderRadius borderRadius;
final BorderRadiusGeometry borderRadius;

const ImpaktfullUiButtonDimensTheme({
required this.borderRadius,
Expand Down
13 changes: 7 additions & 6 deletions lib/src/components/card/card.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:impaktfull_ui_2/src/components/card/card_style.dart';
import 'package:impaktfull_ui_2/src/components/theme/theme_component_builder.dart';
Expand All @@ -16,6 +17,7 @@ class ImpaktfullUiCard extends StatefulWidget with ComponentDescriptorMixin {
final MouseCursor cursor;
final VoidCallback? onFocus;
final EdgeInsets? padding;
final BorderRadiusGeometry? borderRadius;
final ImpaktfullUiCardTheme? theme;

const ImpaktfullUiCard({
Expand All @@ -26,6 +28,7 @@ class ImpaktfullUiCard extends StatefulWidget with ComponentDescriptorMixin {
this.onTap,
this.onFocus,
this.padding,
this.borderRadius,
this.theme,
super.key,
});
Expand All @@ -46,13 +49,13 @@ class _ImpaktfullUiCardState extends State<ImpaktfullUiCard> {
width: widget.width,
height: widget.height,
decoration: BoxDecoration(
borderRadius: componentTheme.dimens.borderRadius,
borderRadius: widget.borderRadius ?? componentTheme.dimens.borderRadius,
color: componentTheme.colors.background,
border: componentTheme.colors.border == null
? null
: Border.all(
color: componentTheme.colors.border!,
strokeAlign: BorderSide.strokeAlignInside,
strokeAlign: BorderSide.strokeAlignOutside,
width: 1,
),
boxShadow: [
Expand All @@ -65,12 +68,10 @@ class _ImpaktfullUiCardState extends State<ImpaktfullUiCard> {
),
child: ImpaktfullUiTouchFeedback(
canRequestFocus: false,
cursor: widget.onTap != null && widget.cursor == MouseCursor.defer
? SystemMouseCursors.click
: widget.cursor,
cursor: widget.onTap != null && widget.cursor == MouseCursor.defer ? SystemMouseCursors.click : widget.cursor,
onTap: widget.onTap,
onFocus: widget.onFocus,
borderRadius: componentTheme.dimens.borderRadius,
borderRadius: widget.borderRadius ?? componentTheme.dimens.borderRadius,
child: ClipRRect(
borderRadius: componentTheme.dimens.borderRadius,
child: Padding(
Expand Down
5 changes: 2 additions & 3 deletions lib/src/components/card/card_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class ImpaktfullUiCardTheme extends ImpaktfullUiComponentTheme {
required this.dimens,
});

static ImpaktfullUiCardTheme of(BuildContext context) =>
ImpaktfullUiTheme.of(context).components.card;
static ImpaktfullUiCardTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.card;
}

class ImpaktfullUiCardColorTheme {
Expand All @@ -27,7 +26,7 @@ class ImpaktfullUiCardColorTheme {
}

class ImpaktfullUiCardDimensTheme {
final BorderRadius borderRadius;
final BorderRadiusGeometry borderRadius;
final EdgeInsets padding;

const ImpaktfullUiCardDimensTheme({
Expand Down
6 changes: 2 additions & 4 deletions lib/src/components/checkbox/checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export 'checkbox_style.dart';

part 'checkbox.describe.dart';

class ImpaktfullUiCheckBox extends StatelessWidget
with ComponentDescriptorMixin {
class ImpaktfullUiCheckBox extends StatelessWidget with ComponentDescriptorMixin {
final CheckboxType type;
final bool? value;
final ValueChanged<bool>? onChanged;
Expand Down Expand Up @@ -92,8 +91,7 @@ class ImpaktfullUiCheckBox extends StatelessWidget
),
),
),
] else if (type == CheckboxType.indeterminate &&
value == null) ...[
] else if (type == CheckboxType.indeterminate && value == null) ...[
Positioned.fill(
child: Center(
child: ImpaktfullUiAssetWidget(
Expand Down
7 changes: 3 additions & 4 deletions lib/src/components/checkbox/checkbox_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class ImpaktfullUiCheckboxTheme extends ImpaktfullUiComponentTheme {
required this.assets,
});

static ImpaktfullUiCheckboxTheme of(BuildContext context) =>
ImpaktfullUiTheme.of(context).components.checkbox;
static ImpaktfullUiCheckboxTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.checkbox;

ImpaktfullUiCheckboxTheme copyWith({
ImpaktfullUiCheckboxColorTheme? colors,
Expand Down Expand Up @@ -60,14 +59,14 @@ class ImpaktfullUiCheckboxColorTheme {
}

class ImpaktfullUiCheckboxDimensTheme {
final BorderRadius borderRadius;
final BorderRadiusGeometry borderRadius;

const ImpaktfullUiCheckboxDimensTheme({
required this.borderRadius,
});

ImpaktfullUiCheckboxDimensTheme copyWith({
BorderRadius? borderRadius,
BorderRadiusGeometry? borderRadius,
}) =>
ImpaktfullUiCheckboxDimensTheme(
borderRadius: borderRadius ?? this.borderRadius,
Expand Down
5 changes: 2 additions & 3 deletions lib/src/components/color_picker/color_picker_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class ImpaktfullUiColorPickerTheme extends ImpaktfullUiComponentTheme {
required this.textStyles,
});

static ImpaktfullUiColorPickerTheme of(BuildContext context) =>
ImpaktfullUiTheme.of(context).components.colorPicker;
static ImpaktfullUiColorPickerTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.colorPicker;
}

class ImpaktfullUiColorPickerAssetsTheme {
Expand All @@ -27,7 +26,7 @@ class ImpaktfullUiColorPickerColorTheme {
}

class ImpaktfullUiColorPickerDimensTheme {
final BorderRadius simpleColorPickerItemBorderRadius;
final BorderRadiusGeometry simpleColorPickerItemBorderRadius;
final double simpleColorPickerItemSize;

const ImpaktfullUiColorPickerDimensTheme({
Expand Down
Loading

0 comments on commit 1e35be4

Please sign in to comment.