feat(ui_components): add extra state

This commit is contained in:
Hugo Pointcheval 2023-02-23 16:57:18 +01:00
parent 881cbc5bef
commit d6c9dfd8a7
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC
3 changed files with 37 additions and 0 deletions

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// Defines standard UI control states
enum ControlState {
/// When the control is disabled and un-clickable
disabled,

View File

@ -15,4 +15,5 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export './control_state.dart';
export './extra_state.dart';
export './status_state.dart';

View File

@ -0,0 +1,35 @@
// 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:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
/// Defines extra UI control states that can
/// be combined with [ControlState]
enum ExtraState {
/// When the control is selected
selected,
/// When the control is invalid
invalid,
/// When the control is freezed
/// Useful to prevent user from changing the control state
freezed;
bool isSelected() => this == ExtraState.selected;
bool isInvalid() => this == ExtraState.invalid;
bool isFreezed() => this == ExtraState.freezed;
}