feat(ui_component): add file selection component
This commit is contained in:
parent
e4d904eb8d
commit
d49a4cad31
@ -16,6 +16,8 @@
|
||||
|
||||
export './button_component.dart';
|
||||
export './button_style.dart';
|
||||
export './file_selection_button_component.dart';
|
||||
export './file_selection_button_style.dart';
|
||||
export './flat_button_component.dart';
|
||||
export './flat_button_style.dart';
|
||||
export './simple_icon_button_component.dart';
|
||||
|
@ -0,0 +1,69 @@
|
||||
// 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/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
part 'file_selection_button_component.g.dart';
|
||||
|
||||
@ComponentProxyExtension()
|
||||
abstract class FileSelectionButtonComponent extends ButtonComponent
|
||||
with CopyWithMixin<$FileSelectionButtonComponentCWProxy> {
|
||||
const FileSelectionButtonComponent({
|
||||
this.mainAxisSize = MainAxisSize.min,
|
||||
this.leading,
|
||||
this.title,
|
||||
this.subTitle,
|
||||
super.disabledStyle,
|
||||
super.normalStyle,
|
||||
super.hoveredStyle,
|
||||
super.focusedStyle,
|
||||
super.tappedStyle,
|
||||
super.selectedStyle,
|
||||
super.invalidStyle,
|
||||
super.onPressed,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle? get disabledStyle;
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle? get normalStyle;
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle? get hoveredStyle;
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle? get focusedStyle;
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle? get tappedStyle;
|
||||
|
||||
// When a file is selected
|
||||
@override
|
||||
FileSelectionButtonStyle? get selectedStyle;
|
||||
|
||||
// When the input file is invalid (too large, not supported format... etc)
|
||||
@override
|
||||
FileSelectionButtonStyle? get invalidStyle;
|
||||
|
||||
final MainAxisSize? mainAxisSize;
|
||||
final Widget? leading;
|
||||
final TextWrapper? title;
|
||||
final TextWrapper? subTitle;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'file_selection_button_component.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// ComponentProxyGenerator
|
||||
// **************************************************************************
|
||||
|
||||
abstract class $FileSelectionButtonComponentCWProxy {
|
||||
FileSelectionButtonComponent mainAxisSize(MainAxisSize? mainAxisSize);
|
||||
FileSelectionButtonComponent leading(Widget? leading);
|
||||
FileSelectionButtonComponent title(TextWrapper? title);
|
||||
FileSelectionButtonComponent subTitle(TextWrapper? subTitle);
|
||||
FileSelectionButtonComponent disabledStyle(ButtonStyle? disabledStyle);
|
||||
FileSelectionButtonComponent normalStyle(ButtonStyle? normalStyle);
|
||||
FileSelectionButtonComponent hoveredStyle(ButtonStyle? hoveredStyle);
|
||||
FileSelectionButtonComponent focusedStyle(ButtonStyle? focusedStyle);
|
||||
FileSelectionButtonComponent tappedStyle(ButtonStyle? tappedStyle);
|
||||
FileSelectionButtonComponent selectedStyle(ButtonStyle? selectedStyle);
|
||||
FileSelectionButtonComponent invalidStyle(ButtonStyle? invalidStyle);
|
||||
FileSelectionButtonComponent onPressed(
|
||||
void Function(ControlState)? onPressed);
|
||||
FileSelectionButtonComponent key(Key? key);
|
||||
FileSelectionButtonComponent call({
|
||||
MainAxisSize? mainAxisSize,
|
||||
Widget? leading,
|
||||
TextWrapper? title,
|
||||
TextWrapper? subTitle,
|
||||
ButtonStyle? disabledStyle,
|
||||
ButtonStyle? normalStyle,
|
||||
ButtonStyle? hoveredStyle,
|
||||
ButtonStyle? focusedStyle,
|
||||
ButtonStyle? tappedStyle,
|
||||
ButtonStyle? selectedStyle,
|
||||
ButtonStyle? invalidStyle,
|
||||
void Function(ControlState)? onPressed,
|
||||
Key? key,
|
||||
});
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// 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 FileSelectionButtonStyle extends ButtonStyle {
|
||||
const FileSelectionButtonStyle({
|
||||
super.radius = 12,
|
||||
super.padding = 13,
|
||||
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),
|
||||
),
|
||||
});
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle copyWith({
|
||||
double? radius,
|
||||
double? padding,
|
||||
MultiColor? foregroundColors,
|
||||
MultiColor? backgroundColors,
|
||||
MultiColor? borderColors,
|
||||
double? stroke,
|
||||
BoxShadow? shadow,
|
||||
}) =>
|
||||
FileSelectionButtonStyle(
|
||||
radius: radius ?? this.radius,
|
||||
padding: padding ?? this.padding,
|
||||
foregroundColors: foregroundColors ?? this.foregroundColors,
|
||||
backgroundColors: backgroundColors ?? this.backgroundColors,
|
||||
borderColors: borderColors ?? this.borderColors,
|
||||
stroke: stroke ?? this.stroke,
|
||||
shadow: shadow ?? this.shadow,
|
||||
);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user