feat(ui_component): add simple icon button and dimension style
This commit is contained in:
parent
168d840b87
commit
4f1a064298
@ -18,5 +18,7 @@ export './button_component.dart';
|
||||
export './button_style.dart';
|
||||
export './flat_button_component.dart';
|
||||
export './flat_button_style.dart';
|
||||
export './simple_icon_button_component.dart';
|
||||
export './simple_icon_button_style.dart';
|
||||
export './symbol_button_component.dart';
|
||||
export './symbol_button_style.dart';
|
||||
|
@ -0,0 +1,58 @@
|
||||
// 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/simple_icon_button_style.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
part 'simple_icon_button_component.g.dart';
|
||||
|
||||
@ComponentProxyExtension()
|
||||
abstract class SimpleIconButtonComponent extends ButtonComponent
|
||||
with CopyWithMixin<$SimpleIconButtonComponentCWProxy> {
|
||||
const SimpleIconButtonComponent({
|
||||
this.icon,
|
||||
super.disabledStyle,
|
||||
super.normalStyle,
|
||||
super.hoveredStyle,
|
||||
super.focusedStyle,
|
||||
super.tappedStyle,
|
||||
super.selectedStyle,
|
||||
super.onPressed,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle? get disabledStyle;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle? get normalStyle;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle? get hoveredStyle;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle? get focusedStyle;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle? get tappedStyle;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle? get selectedStyle;
|
||||
|
||||
final Icon? icon;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'simple_icon_button_component.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// ComponentProxyGenerator
|
||||
// **************************************************************************
|
||||
|
||||
abstract class $SimpleIconButtonComponentCWProxy {
|
||||
SimpleIconButtonComponent icon(Icon? icon);
|
||||
SimpleIconButtonComponent disabledStyle(ButtonStyle? disabledStyle);
|
||||
SimpleIconButtonComponent normalStyle(ButtonStyle? normalStyle);
|
||||
SimpleIconButtonComponent hoveredStyle(ButtonStyle? hoveredStyle);
|
||||
SimpleIconButtonComponent focusedStyle(ButtonStyle? focusedStyle);
|
||||
SimpleIconButtonComponent tappedStyle(ButtonStyle? tappedStyle);
|
||||
SimpleIconButtonComponent selectedStyle(ButtonStyle? selectedStyle);
|
||||
SimpleIconButtonComponent onPressed(void Function(ControlState)? onPressed);
|
||||
SimpleIconButtonComponent key(Key? key);
|
||||
SimpleIconButtonComponent call({
|
||||
Icon? icon,
|
||||
ButtonStyle? disabledStyle,
|
||||
ButtonStyle? normalStyle,
|
||||
ButtonStyle? hoveredStyle,
|
||||
ButtonStyle? focusedStyle,
|
||||
ButtonStyle? tappedStyle,
|
||||
ButtonStyle? selectedStyle,
|
||||
void Function(ControlState)? onPressed,
|
||||
Key? key,
|
||||
});
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
// 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/utils/multi_color.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
|
||||
|
||||
class SimpleIconButtonStyle extends ButtonStyle {
|
||||
const SimpleIconButtonStyle({
|
||||
this.dimension = 30,
|
||||
super.radius = 5,
|
||||
super.padding = 5,
|
||||
super.foregroundColors,
|
||||
super.backgroundColors,
|
||||
super.borderColors,
|
||||
super.stroke = 2,
|
||||
super.shadow = const BoxShadow(
|
||||
blurRadius: 30,
|
||||
offset: Offset(0, 5),
|
||||
color: Color.fromRGBO(0, 0, 0, 0.05),
|
||||
),
|
||||
});
|
||||
|
||||
final double? dimension;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle copyWith({
|
||||
double? dimension,
|
||||
double? radius,
|
||||
double? padding,
|
||||
MultiColor? foregroundColors,
|
||||
MultiColor? backgroundColors,
|
||||
MultiColor? borderColors,
|
||||
double? stroke,
|
||||
BoxShadow? shadow,
|
||||
}) =>
|
||||
SimpleIconButtonStyle(
|
||||
dimension: dimension ?? this.dimension,
|
||||
radius: radius ?? radius,
|
||||
padding: padding ?? padding,
|
||||
foregroundColors: foregroundColors ?? foregroundColors,
|
||||
backgroundColors: backgroundColors ?? backgroundColors,
|
||||
borderColors: borderColors ?? borderColors,
|
||||
stroke: stroke ?? stroke,
|
||||
shadow: shadow ?? shadow,
|
||||
);
|
||||
}
|
@ -7,6 +7,8 @@ part of 'symbol_button_component.dart';
|
||||
// **************************************************************************
|
||||
|
||||
abstract class $SymbolButtonComponentCWProxy {
|
||||
SymbolButtonComponent mainAxisSize(MainAxisSize? mainAxisSize);
|
||||
SymbolButtonComponent label(TextWrapper? label);
|
||||
SymbolButtonComponent icon(Widget? icon);
|
||||
SymbolButtonComponent disabledStyle(ButtonStyle? disabledStyle);
|
||||
SymbolButtonComponent normalStyle(ButtonStyle? normalStyle);
|
||||
@ -17,6 +19,8 @@ abstract class $SymbolButtonComponentCWProxy {
|
||||
SymbolButtonComponent onPressed(void Function(ControlState)? onPressed);
|
||||
SymbolButtonComponent key(Key? key);
|
||||
SymbolButtonComponent call({
|
||||
MainAxisSize? mainAxisSize,
|
||||
TextWrapper? label,
|
||||
Widget? icon,
|
||||
ButtonStyle? disabledStyle,
|
||||
ButtonStyle? normalStyle,
|
||||
|
@ -20,6 +20,7 @@ import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dar
|
||||
|
||||
class SymbolButtonStyle extends ButtonStyle {
|
||||
const SymbolButtonStyle({
|
||||
this.dimension = 60,
|
||||
super.radius = 15,
|
||||
super.padding = 10,
|
||||
super.foregroundColors,
|
||||
@ -33,8 +34,11 @@ class SymbolButtonStyle extends ButtonStyle {
|
||||
),
|
||||
});
|
||||
|
||||
final double? dimension;
|
||||
|
||||
@override
|
||||
SymbolButtonStyle copyWith({
|
||||
double? dimension,
|
||||
double? radius,
|
||||
double? padding,
|
||||
MultiColor? foregroundColors,
|
||||
@ -44,6 +48,7 @@ class SymbolButtonStyle extends ButtonStyle {
|
||||
BoxShadow? shadow,
|
||||
}) =>
|
||||
SymbolButtonStyle(
|
||||
dimension: dimension ?? this.dimension,
|
||||
radius: radius ?? this.radius,
|
||||
padding: padding ?? this.padding,
|
||||
foregroundColors: foregroundColors ?? this.foregroundColors,
|
||||
|
Loading…
x
Reference in New Issue
Block a user