diff --git a/mason-lock.json b/mason-lock.json index 74703dd6..83cb506c 100644 --- a/mason-lock.json +++ b/mason-lock.json @@ -1 +1 @@ -{"bricks":{"wyatt_package_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_package_template","ref":"7cea909470ce75b91840f479649b93f953ded596"}}}} \ No newline at end of file +{"bricks":{"wyatt_component_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_component_template","ref":"7cea909470ce75b91840f479649b93f953ded596"}}}} \ No newline at end of file diff --git a/packages/wyatt_ui_components/lib/src/core/core.dart b/packages/wyatt_ui_components/lib/src/core/core.dart index 079c0687..0b041fe7 100644 --- a/packages/wyatt_ui_components/lib/src/core/core.dart +++ b/packages/wyatt_ui_components/lib/src/core/core.dart @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +export 'enums/control_state.dart'; export 'extensions/build_context_extensions.dart'; export 'extensions/string_extension.dart'; export 'mixins/copy_with_mixin.dart'; diff --git a/packages/wyatt_ui_components/lib/src/core/enums/control_state.dart b/packages/wyatt_ui_components/lib/src/core/enums/control_state.dart new file mode 100644 index 00000000..ce66679a --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/core/enums/control_state.dart @@ -0,0 +1,42 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +enum ControlState { + /// When the control is disabled and un-clickable + disabled, + + /// Default state of a control + normal, + + /// When the mouse cursor is hover the control + hovered, + + /// When the control is focused (like pressing tab) + focused, + + /// When the control is selected + selected, + + /// When the control content is invalid + invalid; + + bool isDisabled() => this == ControlState.disabled; + bool isEnabled() => this != ControlState.disabled; + bool isHovered() => this == ControlState.hovered; + bool isFocused() => this == ControlState.focused; + bool isSelected() => this == ControlState.selected; + bool isInvalid() => this == ControlState.invalid; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/buttons/button_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/button_component.dart new file mode 100644 index 00000000..1a1c30ed --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/button_component.dart @@ -0,0 +1,53 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_ui_components/src/core/enums/control_state.dart'; +import 'package:wyatt_ui_components/src/domain/entities/component.dart'; + +abstract class ButtonComponent extends Component { + const ButtonComponent({ + this.state = ControlState.normal, + this.radius = 12, + this.padding = 25, + this.borderColors, + this.backgroundColor, + this.shadow = const BoxShadow( + blurRadius: 30, + offset: Offset(0, 5), + color: Color.fromRGBO(0, 0, 0, 0.05), + ), + super.key, + }); + + /// Actual state of the button + final ControlState? state; + + /// Button radius + final double? radius; + + /// Padding and gaps of this card + final double? padding; + + /// Border gradient color (from left to right) + final List? borderColors; + + /// Button background color + final Color? backgroundColor; + + /// Drop shadow + final BoxShadow? shadow; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/buttons/buttons.dart b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/buttons.dart new file mode 100644 index 00000000..8e646b7f --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/buttons.dart @@ -0,0 +1,17 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export './flat_button_component.dart'; diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/buttons/flat_button_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/flat_button_component.dart new file mode 100644 index 00000000..a5b1c00e --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/flat_button_component.dart @@ -0,0 +1,43 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/src/domain/entities/buttons/button_component.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; + +part 'flat_button_component.g.dart'; + +@ComponentProxyExtension() +abstract class FlatButtonComponent extends ButtonComponent + with CopyWithMixin<$FlatButtonComponentCWProxy> { + const FlatButtonComponent({ + this.prefix, + this.suffix, + this.label, + super.state, + super.radius, + super.padding, + super.borderColors, + super.backgroundColor, + super.shadow, + super.key, + }); + + final Widget? prefix; + final Widget? suffix; + final TextWrapper? label; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/buttons/flat_button_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/flat_button_component.g.dart new file mode 100644 index 00000000..359ec686 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/buttons/flat_button_component.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flat_button_component.dart'; + +// ************************************************************************** +// ComponentProxyGenerator +// ************************************************************************** + +abstract class $FlatButtonComponentCWProxy { + FlatButtonComponent key(Key? key); + FlatButtonComponent call({ + Key? key, + }); +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart b/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart index 0d8a3b29..5a07411a 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/entities.dart @@ -16,6 +16,7 @@ export './app_bar_component.dart'; export './bottom_navigation_bar_component.dart'; +export './buttons/buttons.dart'; export './cards/cards.dart'; export './component.dart'; export './error_widget_component.dart';