added : ConfirmationPanel
This commit is contained in:
+8
-2
@@ -10,14 +10,20 @@ class Strings {
|
||||
// MainFooter strings
|
||||
public static final MF_S1:String = "Licences FFE";
|
||||
|
||||
//ToolBar strings
|
||||
// ToolBar strings
|
||||
public static final TB_S1:String = "Recherche";
|
||||
|
||||
// RidersList strings
|
||||
public static final RL_S1:String = "Crédit: ";
|
||||
|
||||
//RideCardDrawer strings
|
||||
// RideCardDrawer strings
|
||||
public static final RCD_S1:String = "Cours restants sur la carte : ";
|
||||
public static final RCD_S2:String = "Décompter un cours";
|
||||
|
||||
// ConfirmationPanel strings
|
||||
public static final CP_S1:String = "Confirmation";
|
||||
public static final CP_S2:String = "Annuler";
|
||||
public static final CP_S3:String = "Confirmer";
|
||||
public static final CP_S4:String = "Vous allez décompter un cours pour ";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package view;
|
||||
|
||||
import model.AppModelLocator;
|
||||
import model.String.Strings;
|
||||
import feathers.layout.HorizontalAlign;
|
||||
import feathers.layout.VerticalLayout;
|
||||
import openfl.text.TextFormatAlign;
|
||||
import feathers.controls.Label;
|
||||
import feathers.layout.HorizontalLayout;
|
||||
import feathers.events.TriggerEvent;
|
||||
import feathers.core.PopUpManager;
|
||||
import feathers.controls.ButtonState;
|
||||
import ui.LPTCTheme;
|
||||
import feathers.layout.VerticalAlign;
|
||||
import ui.SVGIconFactory;
|
||||
import feathers.controls.Button;
|
||||
import feathers.layout.HorizontalDistributedLayout;
|
||||
import feathers.controls.LayoutGroup;
|
||||
import openfl.Assets;
|
||||
import feathers.text.TextFormat;
|
||||
import model.Constants;
|
||||
import feathers.skins.RectangleSkin;
|
||||
import feathers.controls.Header;
|
||||
import feathers.events.FeathersEvent;
|
||||
import feathers.controls.Panel;
|
||||
import t9.util.ColorTraces.*;
|
||||
|
||||
class ConfirmationPanel extends Panel {
|
||||
|
||||
private var head:Header;
|
||||
private var foot:LayoutGroup;
|
||||
private var b1:Button;
|
||||
private var b2:Button;
|
||||
private var mainLabel:Label;
|
||||
|
||||
public function new(pB1Text:String, pB2Text:String) {
|
||||
super();
|
||||
|
||||
head = new Header();
|
||||
|
||||
mainLabel = new Label();
|
||||
|
||||
foot = new LayoutGroup();
|
||||
|
||||
b1 = new Button(pB1Text);
|
||||
b2 = new Button(pB2Text);
|
||||
|
||||
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
super.initialize();
|
||||
|
||||
// general
|
||||
//autoSizeMode = STAGE;
|
||||
width = stage.stageWidth - (Constants.GLOBAL_PADDING * 2);
|
||||
height = stage.stageHeight - (Constants.GLOBAL_PADDING * 2);
|
||||
setPadding(Constants.GLOBAL_PADDING);
|
||||
var hl:VerticalLayout = new VerticalLayout();
|
||||
hl.verticalAlign = VerticalAlign.MIDDLE;
|
||||
hl.horizontalAlign = HorizontalAlign.JUSTIFY;
|
||||
layout = hl;
|
||||
|
||||
var bkg1:RectangleSkin = new RectangleSkin(SolidColor(Constants.MAIN_COLOR3, 1));
|
||||
bkg1.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
|
||||
backgroundSkin = bkg1;
|
||||
|
||||
// header
|
||||
var bkg2:RectangleSkin = new RectangleSkin(SolidColor(Constants.WARNING, 1));
|
||||
bkg2.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
|
||||
head.backgroundSkin = bkg2;
|
||||
head.height = Std.int(stage.stageHeight * Constants.MAIN_HEADER_HEIGHT_RATIO);
|
||||
head.textFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_22, Constants.MAIN_COLOR3);
|
||||
head.text = Strings.CP_S1;
|
||||
header = head;
|
||||
|
||||
// content
|
||||
var mainLabelTF:TextFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_22, Constants.MAIN_COLOR1);
|
||||
mainLabelTF.align = TextFormatAlign.CENTER;
|
||||
mainLabel.embedFonts = true;
|
||||
mainLabel.wordWrap = true;
|
||||
mainLabel.textFormat = mainLabelTF;
|
||||
mainLabel.setPadding(Constants.GLOBAL_PADDING * 8);
|
||||
//mainLabel.backgroundSkin = new RectangleSkin(SolidColor(Constants.WARNING, 1));
|
||||
mainLabel.text = Strings.CP_S4 + AppModelLocator.getInstance().selectedRider.firstName;
|
||||
addChild(mainLabel);
|
||||
|
||||
|
||||
// buttons
|
||||
b1.icon = SVGIconFactory.makeIcon("vector/cancel_icon_black.svg", Constants.BUTTONS_ICON_SIZE, Constants.HERO_COLOR);
|
||||
b1.setIconForState(ButtonState.DOWN, SVGIconFactory.makeIcon("vector/cancel_icon_black.svg", Constants.BUTTONS_ICON_SIZE, Constants.MAIN_COLOR3));
|
||||
b1.variant = LPTCTheme.BUTTON_VARIANT_WHITE;
|
||||
b1.addEventListener(TriggerEvent.TRIGGER, (e) -> {
|
||||
PopUpManager.removePopUp(this);
|
||||
});
|
||||
|
||||
b2.icon = SVGIconFactory.makeIcon("vector/check_icon_black.svg", Constants.BUTTONS_ICON_SIZE, Constants.MAIN_COLOR3);
|
||||
b2.setIconForState(ButtonState.DOWN, SVGIconFactory.makeIcon("vector/check_icon_black.svg", Constants.BUTTONS_ICON_SIZE, Constants.HERO_COLOR));
|
||||
|
||||
// footer
|
||||
foot.height = Std.int(stage.stageHeight * Constants.MAIN_HEADER_HEIGHT_RATIO);
|
||||
var bkg3:RectangleSkin = new RectangleSkin(SolidColor(Constants.MAIN_COLOR3, 1));
|
||||
bkg3.cornerRadius = Constants.GLOBAL_CORNER_RADIUS;
|
||||
foot.backgroundSkin = bkg3;
|
||||
var hdl:HorizontalDistributedLayout = new HorizontalDistributedLayout();
|
||||
hdl.verticalAlign = VerticalAlign.MIDDLE;
|
||||
hdl.gap = Constants.GLOBAL_PADDING;
|
||||
hdl.setPadding(Constants.GLOBAL_PADDING);
|
||||
foot.layout = hdl;
|
||||
foot.addChild(b1);
|
||||
foot.addChild(b2);
|
||||
footer = foot;
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package view;
|
||||
|
||||
import feathers.core.PopUpManager;
|
||||
import components.VSpacer;
|
||||
import feathers.controls.AssetLoader;
|
||||
import feathers.controls.Button;
|
||||
@@ -142,6 +143,7 @@ class RiderCardDrawer extends Drawer {
|
||||
removeOneCredit.text = Strings.RCD_S2;
|
||||
removeOneCredit.addEventListener(TriggerEvent.TRIGGER, (e) -> {
|
||||
traceRed("removeOneCredit()");
|
||||
PopUpManager.addPopUp(new ConfirmationPanel(Strings.CP_S2, Strings.CP_S3), parent, true, true);
|
||||
});
|
||||
mainScrollContainer.addChild(removeOneCredit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user