- ToolBar search TextInput

- Strings class
This commit is contained in:
2025-12-20 20:10:56 +01:00
parent 9c3e0c85c8
commit 4ba0bae65b
10 changed files with 161 additions and 55 deletions
+80 -11
View File
@@ -1,5 +1,7 @@
package ui;
import feathers.controls.TextInputState;
import feathers.controls.TextInput;
import openfl.Assets;
import model.Constants;
import feathers.text.TextFormat;
@@ -10,8 +12,10 @@ import feathers.themes.ClassVariantTheme;
class LPTCTheme extends ClassVariantTheme {
public static final VARIANT_WHITE:String = "whiteButton";
public static final VARIANT_RED:String = "redButton";
public static final BUTTON_VARIANT_WHITE:String = "buttonVariantWhite";
public static final BUTTON_VARIANT_ORANGE:String = "buttonVariantOrange";
public static final TEXT_INPUT_VARIANT_SEARCH:String = "textInputVariantSearch";
public function new() {
super();
@@ -21,21 +25,24 @@ class LPTCTheme extends ClassVariantTheme {
private function initialize():Void {
styleProvider.setStyleFunction(Button, null, setButtonStyles);
styleProvider.setStyleFunction(Button, LPTCTheme.VARIANT_WHITE, setWhiteButtonStyles);
styleProvider.setStyleFunction(Button, LPTCTheme.VARIANT_RED, setRedButtonStyles);
styleProvider.setStyleFunction(Button, LPTCTheme.BUTTON_VARIANT_WHITE, setWhiteButtonStyles);
styleProvider.setStyleFunction(Button, LPTCTheme.BUTTON_VARIANT_ORANGE, setOrangeButtonStyles);
styleProvider.setStyleFunction(TextInput, null, setSearchTextInputStyles);
}
//############################################################### BUTTONS
private function setButtonStyles(button:Button):Void {
var backgroundSkin = new RectangleSkin();
backgroundSkin.border = SolidColor(1.0, Constants.HERO_COLOR);
backgroundSkin.fill = SolidColor(Constants.HERO_COLOR);
backgroundSkin.cornerRadius = 6.0;
backgroundSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
button.backgroundSkin = backgroundSkin;
var downSkin = new RectangleSkin();
downSkin.border = SolidColor(1.0, Constants.HERO_COLOR);
downSkin.fill = SolidColor(Constants.MAIN_COLOR3);
downSkin.cornerRadius = 6.0;
downSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
button.setSkinForState(ButtonState.DOWN, downSkin);
var format = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.MAIN_COLOR3);
@@ -44,20 +51,22 @@ class LPTCTheme extends ClassVariantTheme {
var downFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.HERO_COLOR);
button.setTextFormatForState(ButtonState.DOWN, downFormat);
button.setPadding(10);
button.paddingLeft = button.paddingRight = 10;
button.paddingTop = button.paddingBottom = 5;
button.iconOffsetX = Constants.GLOBAL_BUTTON_ICON_OFFSET;
}
private function setWhiteButtonStyles(button:Button):Void {
var backgroundSkin = new RectangleSkin();
backgroundSkin.border = SolidColor(1.0, Constants.HERO_COLOR);
backgroundSkin.fill = SolidColor(Constants.MAIN_COLOR3);
backgroundSkin.cornerRadius = 6.0;
backgroundSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
button.backgroundSkin = backgroundSkin;
var downSkin = new RectangleSkin();
downSkin.border = SolidColor(1.0, Constants.HERO_COLOR);
downSkin.fill = SolidColor(Constants.HERO_COLOR);
downSkin.cornerRadius = 6.0;
downSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
button.setSkinForState(ButtonState.DOWN, downSkin);
var format = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.HERO_COLOR);
@@ -66,9 +75,69 @@ class LPTCTheme extends ClassVariantTheme {
var downFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.MAIN_COLOR3);
button.setTextFormatForState(ButtonState.DOWN, downFormat);
button.setPadding(10);
button.paddingLeft = button.paddingRight = 10;
button.paddingTop = button.paddingBottom = 5;
button.iconOffsetX = Constants.GLOBAL_BUTTON_ICON_OFFSET;
}
private function setRedButtonStyles(button:Button):Void {
private function setOrangeButtonStyles(button:Button):Void {
var backgroundSkin = new RectangleSkin();
backgroundSkin.border = SolidColor(1.0, Constants.ACCENT_COLOR2);
backgroundSkin.fill = SolidColor(Constants.ACCENT_COLOR2);
backgroundSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
button.backgroundSkin = backgroundSkin;
var downSkin = new RectangleSkin();
downSkin.border = SolidColor(1.0, Constants.ACCENT_COLOR2);
downSkin.fill = SolidColor(Constants.MAIN_COLOR3);
downSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
button.setSkinForState(ButtonState.DOWN, downSkin);
var format = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.HERO_COLOR);
button.textFormat = format;
var downFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.MAIN_COLOR3);
button.setTextFormatForState(ButtonState.DOWN, downFormat);
button.paddingLeft = button.paddingRight = 10;
button.paddingTop = button.paddingBottom = 5;
button.iconOffsetX = Constants.GLOBAL_BUTTON_ICON_OFFSET;
}
//############################################################### TEXT_INPUTS
private function setSearchTextInputStyles(pTextInput:TextInput):Void {
var backgroundSkin = new RectangleSkin();
backgroundSkin.border = SolidColor(1, Constants.MAIN_COLOR3, .1);
backgroundSkin.fill = SolidColor(Constants.MAIN_COLOR3, 0.1);
backgroundSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
pTextInput.backgroundSkin = backgroundSkin;
var disabledSkin = new RectangleSkin();
disabledSkin.border = SolidColor(1, Constants.MAIN_COLOR3, .1);
disabledSkin.fill = SolidColor(Constants.MAIN_COLOR3, 0.1);
disabledSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
pTextInput.setSkinForState(TextInputState.DISABLED, disabledSkin);
var focusSkin = new RectangleSkin();
focusSkin.border = SolidColor(1, Constants.MAIN_COLOR3, .8);
focusSkin.fill = SolidColor(Constants.MAIN_COLOR3, 0.2);
focusSkin.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
pTextInput.setSkinForState(TextInputState.FOCUSED, focusSkin);
var format:TextFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.MAIN_COLOR3);
pTextInput.textFormat = format;
var disabledFormat:TextFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.MAIN_COLOR3);
pTextInput.setTextFormatForState(TextInputState.DISABLED, disabledFormat);
var focusFormat:TextFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_14, Constants.MAIN_COLOR3);
pTextInput.setTextFormatForState(TextInputState.FOCUSED, focusFormat);
pTextInput.paddingLeft = pTextInput.paddingRight = 10;
pTextInput.paddingTop = pTextInput.paddingBottom = 5;
pTextInput.embedFonts = true;
}
}
+1 -2
View File
@@ -7,8 +7,7 @@ import openfl.display.Shape;
class SVGIconFactory {
public static function makeIcon(pSvgIconPath:String = null, pIconSize:Int = 64, pIconColor:Int = 0x000000):Shape {
// icon
var svgIcon:Shape = new Shape();
new SVG(Assets.getText(pSvgIconPath)).render(svgIcon.graphics);