feat(ui_component): add button components
This commit is contained in:
parent
602a372d7c
commit
160b30d21b
@ -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"}}}}
|
{"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"}}}}
|
@ -14,6 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
export 'enums/control_state.dart';
|
||||||
export 'extensions/build_context_extensions.dart';
|
export 'extensions/build_context_extensions.dart';
|
||||||
export 'extensions/string_extension.dart';
|
export 'extensions/string_extension.dart';
|
||||||
export 'mixins/copy_with_mixin.dart';
|
export 'mixins/copy_with_mixin.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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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<Color>? borderColors;
|
||||||
|
|
||||||
|
/// Button background color
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
|
/// Drop shadow
|
||||||
|
final BoxShadow? shadow;
|
||||||
|
}
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
export './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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -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,
|
||||||
|
});
|
||||||
|
}
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
export './app_bar_component.dart';
|
export './app_bar_component.dart';
|
||||||
export './bottom_navigation_bar_component.dart';
|
export './bottom_navigation_bar_component.dart';
|
||||||
|
export './buttons/buttons.dart';
|
||||||
export './cards/cards.dart';
|
export './cards/cards.dart';
|
||||||
export './component.dart';
|
export './component.dart';
|
||||||
export './error_widget_component.dart';
|
export './error_widget_component.dart';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user