import { Group, Panel, navbar, text, gravity, Color, LayoutSpec, vlayout, Gravity, hlayout, scroller, layoutConfig, image, IVLayout, modal, IText, navigator } from "doric"; import { title, label, colors } from "./utils"; const shareIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAACZFBMVEUAAABEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBDQ0NDQ0JCQkJCQkJDQ0JCQkJDQ0NBQUBBQUBAQEBAQEBBQUFCQkFCQkFBQUFCQkI8PDxDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NBQUE7OztDQ0NDQ0NDQ0NDQ0NERERDQ0NDQ0NCQkJCQkJCQkJDQ0NBQUFCQkJDQ0NAQD5AQEBDQ0NCQkJCQkJCQkJCQkJDQ0NEREQAAABBQUFCQkJBQUFCQkJDQ0NBQUGAgIBDQ0JDQ0NCQkJCQkJCQkJFRUVFRURBQUFCQkJCQkJCQkJDQ0JDQ0JDQ0NCQkJDQ0NDQ0FLS0dBQUFCQkJBQUEzMzNDQ0JCQkJCQkJCQkJCQkJCQkJCQkJAQD1CQkJCQkJAQEBAQD5CQkJCQkJCQkJCQkFCQkJDQ0JCQkJBQUFCQkFERENBQUBGRkRCQkJCQkI+Pj1AQDxDQ0NCQkJAQEBCQkJCQkJCQkJCQkJHR0VCQkJDQ0NCQkJDQ0JCQkJCQkJBQUFBQUFERENBQUFCQkJCQkJDQ0JDQ0NDQ0NBQUBDQ0NCQkJDQ0NCQkJBQUFCQkJCQkJCQkJCQkJAQEBDQ0NBQUFDQ0NBQUFCQkJBQUFCQkJCQkJBQUFBQUFBQUFBQUFDQ0NDQ0NCQkJAQEBDQ0NCQkJCQkFCQkJEREI9PT1CQkJAQEBCQkJDQ0FCQkJCQkBCQkIvLyxBQUFCQkJCQkJDQ0NCQkJFRUVCQkJCQkJCQkE8PDxDQ0NCQkJBQUFCQkJCQkJBQUE9PTxCQkIOEjPPAAAAy3RSTlMAAQIDBA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ZEyHyaQrECZFxNIVpzMjwkkK0zmyQSSFTBzagLJiphxP+if+0H/c+cDI42fEMtkQlnr+eBw44SoTCaUtX4+UKvV2s+EyYLO4lOqDg4OVktkQln8Z8DSsmq12nYmTBZ4FjOBpcrAwEDbmTBZ4FnMBJb6K5VKf/vvkwWeLSxA3+y0vSkgCz9rrkSpXC6X2t8Ukglk/weJWCcLFzLySAAAAABJRU5ErkJggg==" @Entry class NavbarDemo extends Panel { build(rootView: Group): void { scroller(vlayout([ title("Navbar Demo"), label('isHidden').apply({ width: 200, height: 50, backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).isHidden().then(e => modal(context).alert(`Navbar isHidden:${e}`)).catch(e => { modal(context).alert(e) }) } } as IText), label('setHidden').apply({ width: 200, height: 50, backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).isHidden() .then(e => navbar(context).setHidden(!e)) .catch(e => { modal(context).alert(e) }) } } as IText), label('setTitle').apply({ width: 200, height: 50, backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).setTitle('Setted Title') .catch(e => { modal(context).alert(e) }) } } as IText), label('setBgColor').apply({ width: 200, height: 50, backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).setBgColor(Color.YELLOW) .catch(e => { modal(context).alert(e) }) } } as IText), label('setLeft').apply({ width: 200, height: 50, backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).setLeft(text({ width: 70, height: 44, textColor: Color.BLACK, layoutConfig: layoutConfig().just().configAlignment(Gravity.Center), text: "Left", })) .catch(e => { modal(context).alert(e) }) } } as IText), label('setRight').apply({ width: 200, height: 50, backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).setRight(hlayout([ text({ width: 70, height: 44, textColor: Color.BLACK, layoutConfig: layoutConfig().just().configAlignment(Gravity.Center), text: "Right", }), image({ imageBase64: shareIcon }).apply({ layoutConfig: layoutConfig().just().configAlignment(gravity().centerY()), width: 33, height: 33, onClick: () => { modal(context).toast('Right Clicked', Gravity.Bottom) } }) ])) .catch(e => { modal(context).alert(e) }) } } as IText), label('Pop').apply({ width: 200, height: 50, backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, layoutConfig: layoutConfig().just(), onClick: () => { navigator(context).pop() } } as IText), ]).apply({ layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().center(), space: 10, } as IVLayout)).apply({ layoutConfig: layoutConfig().most(), }).in(rootView) } }