source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\ui\arkts-layout-development-flex-layout.md
Flex() { Text('flexGrow(2)') .flexGrow(2) .width(100) .height(100) .backgroundColor(0xF5DEB3) Text('flexGrow(3)') .flexGrow(3) .width(100) .height(100) .backgroundColor(0xD2B48C) Text('no flexGrow') .width(100) .height(100) .backgroundColo...
application-dev\ui\arkts-layout-development-flex-layout.md
Flex({ direction: FlexDirection.Row }) { Text('flexShrink(3)') .flexShrink(3) .width(200) .height(100) .backgroundColor(0xF5DEB3) Text('no flexShrink') .width(200) .height(100) .backgroundColor(0xD2B48C) Text('flexShrink(2)') .flexShrink(2) .width(...
application-dev\ui\arkts-layout-development-flex-layout.md
@Entry @Component struct FlexExample { build() { Column() { Column({ space: 5 }) { Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Text('1').width('30%').height(50).backgroundColor(0xF5DEB3) T...
application-dev\ui\arkts-layout-development-grid-layout.md
breakpoints: {value: ['100vp', '200vp']}
application-dev\ui\arkts-layout-development-grid-layout.md
breakpoints: {value: ['320vp', '520vp', '840vp', '1080vp']}
application-dev\ui\arkts-layout-development-grid-layout.md
@State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157,180)', 'rgb(23,169,141)', 'rgb(255,192,0)', 'rgb(170,10,33)']; // ... GridRow({ breakpoints: { value: ['200vp', '300vp', '400vp', '500vp', '600vp'], reference: BreakpointsRefer...
application-dev\ui\arkts-layout-development-grid-layout.md
@State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157,180)', 'rgb(23,169,141)', 'rgb(255,192,0)', 'rgb(170,10,33)', 'rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)']; // ... GridRow() { ForEach(t...
application-dev\ui\arkts-layout-development-grid-layout.md
class CurrTmp{ currentBp: string = 'unknown'; set(val:string){ this.currentBp = val } } let BorderWH:Record<string,Color|number> = { 'color': Color.Blue, 'width': 2 } @State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157...
application-dev\ui\arkts-layout-development-grid-layout.md
@State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157,180)', 'rgb(23,169,141)', 'rgb(255,192,0)', 'rgb(170,10,33)']; GridRow({ columns: { sm: 4, md: 8 }, breakpoints: { value: ['200vp', '300vp', '400vp', '500vp', '600vp'] } }) { F...
application-dev\ui\arkts-layout-development-grid-layout.md
GridRow({ direction: GridRowDirection.Row }){}
application-dev\ui\arkts-layout-development-grid-layout.md
GridRow({ direction: GridRowDirection.RowReverse }){}
application-dev\ui\arkts-layout-development-grid-layout.md
GridRow({ gutter: 10 }){}
application-dev\ui\arkts-layout-development-grid-layout.md
GridRow({ gutter: { x: 20, y: 50 } }){}
application-dev\ui\arkts-layout-development-grid-layout.md
let Gspan:Record<string,number> = { 'xs': 1, 'sm': 2, 'md': 3, 'lg': 4 } GridCol({ span: 2 }){} GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 } }){} GridCol(){}.span(2) GridCol(){}.span(Gspan)
application-dev\ui\arkts-layout-development-grid-layout.md
let Goffset:Record<string,number> = { 'xs': 1, 'sm': 2, 'md': 3, 'lg': 4 } GridCol({ offset: 2 }){} GridCol({ offset: { xs: 2, sm: 2, md: 2, lg: 2 } }){} GridCol(){}.offset(Goffset)
application-dev\ui\arkts-layout-development-grid-layout.md
let Gorder:Record<string,number> = { 'xs': 1, 'sm': 2, 'md': 3, 'lg': 4 } GridCol({ order: 2 }){} GridCol({ order: { xs: 1, sm: 2, md: 3, lg: 4 } }){} GridCol(){}.order(2) GridCol(){}.order(Gorder)
application-dev\ui\arkts-layout-development-grid-layout.md
@State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157,180)', 'rgb(23,169,141)', 'rgb(255,192,0)', 'rgb(170,10,33)']; // ... GridRow({ columns: 8 }) { ForEach(this.bgColors, (color:ResourceColor, index?:number|undefined) =>...
application-dev\ui\arkts-layout-development-grid-layout.md
@State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157,180)', 'rgb(23,169,141)', 'rgb(255,192,0)', 'rgb(170,10,33)']; // ... GridRow({ columns: 8 }) { ForEach(this.bgColors, (color:ResourceColor, index?:number|undefined) =>...
application-dev\ui\arkts-layout-development-grid-layout.md
@State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157,180)', 'rgb(23,169,141)', 'rgb(255,192,0)', 'rgb(170,10,33)']; // ... GridRow() { ForEach(this.bgColors, (color:ResourceColor, index?:number|undefined) => { Gri...
application-dev\ui\arkts-layout-development-grid-layout.md
@State bgColors: ResourceColor[] = ['rgb(213,213,213)', 'rgb(150,150,150)', 'rgb(0,74,175)', 'rgb(39,135,217)', 'rgb(61,157,180)', 'rgb(23,169,141)', 'rgb(255,192,0)', 'rgb(170,10,33)']; // ... GridRow() { ForEach(this.bgColors, (color:ResourceColor, index?:number|undefined) => { ...
application-dev\ui\arkts-layout-development-grid-layout.md
GridRow() { GridCol({ order: 4 }) { Row() { Text('1') }.width('100%').height('50vp') }.backgroundColor('rgb(213,213,213)') GridCol({ order: 3 }) { Row() { Text('2') }.width('100%').height('50vp') }.backgroundColor('rgb(150,150,150)') GridCol({ order: 2 }) { ...
application-dev\ui\arkts-layout-development-grid-layout.md
GridRow() { GridCol({ order: { xs:1, sm:5, md:3, lg:7}}) { Row() { Text('1') }.width('100%').height('50vp') }.backgroundColor(Color.Red) GridCol({ order: { xs:2, sm:2, md:6, lg:1} }) { Row() { Text('2') }.width('100%').height('50vp') }.backgrou...
application-dev\ui\arkts-layout-development-grid-layout.md
@Entry @Component struct GridRowExample { build() { GridRow() { GridCol({ span: { sm: 12 } }) { GridRow() { GridCol({ span: { sm: 2 } }) { Row() { Text('left').fontSize(24) } .justifyContent(FlexAlign.Center) .height('90%') ...
application-dev\ui\arkts-layout-development-linear.md
Column({ space: 20 }) { Text('space: 20').fontSize(15).fontColor(Color.Gray).width('90%') Row().width('90%').height(50).backgroundColor(0xF5DEB3) Row().width('90%').height(50).backgroundColor(0xD2B48C) Row().width('90%').height(50).backgroundColor(0xF5DEB3) }.width('100%')
application-dev\ui\arkts-layout-development-linear.md
Row({ space: 35 }) { Text('space: 35').fontSize(15).fontColor(Color.Gray) Row().width('10%').height(150).backgroundColor(0xF5DEB3) Row().width('10%').height(150).backgroundColor(0xD2B48C) Row().width('10%').height(150).backgroundColor(0xF5DEB3) }.width('90%')
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').alignItems(HorizontalAlign.Start).backgroundColor('rgb(242,242,242)')
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').alignItems(HorizontalAlign.Center).backgroundColor('rgb(242,242,242)')
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').alignItems(HorizontalAlign.End).backgroundColor('rgb(242,242,242)')
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).alignItems(VerticalAlign.Top).backgroundColor('rgb(242,242,242)')
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).alignItems(VerticalAlign.Center).backgroundColor('rgb(242,242,242...
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).alignItems(VerticalAlign.Bottom).backgroundColor('rgb(242,242,242...
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.S...
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.C...
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.E...
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.S...
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.S...
application-dev\ui\arkts-layout-development-linear.md
Column({}) { Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) Column() { }.width('80%').height(50).backgroundColor(0xD2B48C) Column() { }.width('80%').height(50).backgroundColor(0xF5DEB3) }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.S...
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Star...
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Cent...
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.End)
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Spac...
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Spac...
application-dev\ui\arkts-layout-development-linear.md
Row({}) { Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) Column() { }.width('20%').height(30).backgroundColor(0xD2B48C) Column() { }.width('20%').height(30).backgroundColor(0xF5DEB3) }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Spac...
application-dev\ui\arkts-layout-development-linear.md
@Entry @Component struct BlankExample { build() { Column() { Row() { Text('Bluetooth').fontSize(18) Blank() Toggle({ type: ToggleType.Switch, isOn: true }) }.backgroundColor(0xFFFFFF).borderRadius(15).padding({ left: 12 }).width('100%') }.backgroundColor(0xEFEFEF).padding(2...
application-dev\ui\arkts-layout-development-linear.md
@Entry @Component struct layoutWeightExample { build() { Column() { Text('1:2:3').width('100%') Row() { Column() { Text('layoutWeight(1)') .textAlign(TextAlign.Center) }.layoutWeight(1).backgroundColor(0xF5DEB3).height('100%') Column...
application-dev\ui\arkts-layout-development-linear.md
@Entry @Component struct WidthExample { build() { Column() { Row() { Column() { Text('left width 20%') .textAlign(TextAlign.Center) }.width('20%').backgroundColor(0xF5DEB3).height('100%') Column() { Text('center width 50%') ...
application-dev\ui\arkts-layout-development-linear.md
@Entry @Component struct ScrollExample { scroller: Scroller = new Scroller(); private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; build() { Scroll(this.scroller) { Column() { ForEach(this.arr, (item?:number|undefined) => { if(item){ Text(item.toSt...
application-dev\ui\arkts-layout-development-linear.md
@Entry @Component struct ScrollExample { scroller: Scroller = new Scroller(); private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; build() { Scroll(this.scroller) { Row() { ForEach(this.arr, (item?:number|undefined) => { if(item){ Text(item.toStrin...
application-dev\ui\arkts-layout-development-media-query.md
import { mediaquery } from '@kit.ArkUI';
application-dev\ui\arkts-layout-development-media-query.md
let listener: mediaquery.MediaQueryListener = this.getUIContext().getMediaQuery().matchMediaSync('(orientation: landscape)');
application-dev\ui\arkts-layout-development-media-query.md
onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) { if (mediaQueryResult.matches as boolean) { // do something here } else { // do something here } } listener.on('change', onPortrait);
application-dev\ui\arkts-layout-development-media-query.md
[media-type] [media-logic-operations] [(media-feature)]
application-dev\ui\arkts-layout-development-media-query.md
import { mediaquery, window } from '@kit.ArkUI'; import { common } from '@kit.AbilityKit'; @Entry @Component struct MediaQueryExample { @State color: string = '#DB7093'; @State text: string = 'Portrait'; // The query is valid when the device is in landscape mode. listener:mediaquery.MediaQueryListener = this.g...
application-dev\ui\arkts-layout-development-media-query.md
import { mediaquery } from '@kit.ArkUI'; import { featureAbility } from '@kit.AbilityKit'; @Entry @Component struct MediaQueryExample { @State color: string = '#DB7093'; @State text: string = 'Portrait'; listener:mediaquery.MediaQueryListener = mediaquery.matchMediaSync('(orientation: landscape)'); // The query ...
application-dev\ui\arkts-layout-development-relative-layout.md
let AlignRus: Record<string, Record<string, string | VerticalAlign | HorizontalAlign>> = { 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top }, 'left': { 'anchor': '__container__', 'align': HorizontalAlign.Start } } let AlignRue: Record<string, Record<string, string | VerticalAlign | Horizontal...
application-dev\ui\arkts-layout-development-relative-layout.md
let AlignRus: Record<string, Record<string, string | VerticalAlign | HorizontalAlign>> = { 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top }, 'left': { 'anchor': '__container__', 'align': HorizontalAlign.Start } } let RelConB: Record<string, Record<string, string | VerticalAlign | HorizontalA...
application-dev\ui\arkts-layout-development-relative-layout.md
@Entry @Component struct Index { build() { Row() { RelativeContainer() { Row(){Text('row1')}.justifyContent(FlexAlign.Center).width(100).height(100) .backgroundColor('#a3cf62') .alignRules({ top: {anchor: "__container__", align: VerticalAlign.Top}, ...
application-dev\ui\arkts-layout-development-relative-layout.md
@Entry @Component struct Index { build() { Row() { RelativeContainer() { Row() { Text('row1') } .justifyContent(FlexAlign.Center) .width(100) .height(100) .backgroundColor('#a3cf62') .alignRules({ top: { anchor: "__container__", ali...
application-dev\ui\arkts-layout-development-relative-layout.md
@Entry @Component struct Index { @State value: number = 0 build() { Row() { RelativeContainer() { Row() .width(100) .height(100) .backgroundColor('#a3cf62') .alignRules({ top: { anchor: "__container__", align: VerticalAlign.Top }, l...
application-dev\ui\arkts-layout-development-relative-layout.md
@Entry @Component struct Index { build() { Row() { RelativeContainer() { Row() { Text('row1') } .justifyContent(FlexAlign.Center) .width(100) .height(100) .backgroundColor('#a3cf62') .alignRules({ top: { anchor: "__container__", ali...
application-dev\ui\arkts-layout-development-stack-layout.md
// xxx.ets let MTop:Record<string,number> = { 'top': 50 } @Entry @Component struct StackExample { build() { Column(){ Stack({ }) { Column(){}.width('90%').height('100%').backgroundColor('#ff58b87c') Text('text').width('60%').height('60%').backgroundColor('#ffc3f6aa') Button('button'...
application-dev\ui\arkts-layout-development-stack-layout.md
// xxx.ets @Entry @Component struct StackExample { build() { Stack({ alignContent: Alignment.TopStart }) { Text('Stack').width('90%').height('100%').backgroundColor('#e1dede').align(Alignment.BottomEnd) Text('Item 1').width('70%').height('80%').backgroundColor(0xd2cab3).align(Alignment.BottomEnd) ...
application-dev\ui\arkts-layout-development-stack-layout.md
Stack({ alignContent: Alignment.BottomStart }) { Column() { Text('Stacked element 1').textAlign(TextAlign.End).fontSize(20) }.width(100).height(100).backgroundColor(0xffd306) Column() { Text('Stacked element 2').fontSize(20) }.width(150).height(150).backgroundColor(Color.Pink) Column() { Text('S...
application-dev\ui\arkts-layout-development-stack-layout.md
Stack({ alignContent: Alignment.BottomStart }) { Column() { Text('Stacked element 1').fontSize(20) }.width(100).height(100).backgroundColor(0xffd306).zIndex(2) Column() { Text('Stacked element 2').fontSize(20) }.width(150).height(150).backgroundColor(Color.Pink).zIndex(1) Column() { Text('Stacke...
application-dev\ui\arkts-layout-development-stack-layout.md
@Entry @Component struct StackSample { private arr: string[] = ['APP1', 'APP2', 'APP3', 'APP4', 'APP5', 'APP6', 'APP7', 'APP8']; build() { Stack({ alignContent: Alignment.Bottom }) { Flex({ wrap: FlexWrap.Wrap }) { ForEach(this.arr, (item:string) => { Text(item) .width(100) ...
application-dev\ui\arkts-modal-transition.md
// Use @Builder to build a modal view. @Builder MyBuilder() { Column() { Text('my model view') } // Use the transition API to implement the transition animation for component appearance and disappearance. The transition API must be added to the first component of the builder. .transition(T...
application-dev\ui\arkts-modal-transition.md
// Define the state variable to control the visibility of the modal. @State isPresent: boolean = false; Button('Click to present model view') // Bind a modal to the component. ModalTransition.NONE means not to use the default transition animation for the modal. You can use onDisappear to control state varia...
application-dev\ui\arkts-modal-transition.md
import { curves } from '@kit.ArkUI'; interface PersonList { name: string, cardnum: string } @Entry @Component struct BindContentCoverDemo { private personList: Array<PersonList> = [ { name: 'Wang **', cardnum: '1234***********789' }, { name: 'Song *', cardnum: '2345***********789' }, { name: 'Xu **'...
application-dev\ui\arkts-modal-transition.md
@Entry @Component struct BindSheetDemo { // Set visibility of the sheet. @State isShowSheet: boolean = false; private menuList: string[] = ['No ice', 'Light ice', 'Extra ice', 'Light sauce', 'Extra sauce', 'Plastic cutlery', 'No plastic cutlery']; // Use @Builder to build a sheet view. @Builder mySheet() {...
application-dev\ui\arkts-modal-transition.md
class BMD{ value:ResourceStr = '' action:() => void = () => {} } @Entry @Component struct BindMenuDemo { // Step 1: Define a data array to represent menu items. @State items:BMD[] = [ { value:'Menu item 1', action: () => { console.info('handle Menu1 select') } }, { v...
application-dev\ui\arkts-modal-transition.md
@Entry @Component struct BindContextMenuDemo { private menu: string[] = ['Save', 'Favorite', 'Search']; private pics: Resource[] = [$r('app.media.icon_1'), $r('app.media.icon_2')]; // Use @Builder to build custom menu items. @Builder myMenu() { Column() { ForEach(this.menu, (item: string) => { ...
application-dev\ui\arkts-modal-transition.md
@Entry @Component struct BindPopupDemo { // Step 1: Define the state variable to control the visibility of the popup. @State customPopup: boolean = false; // Step 2: Use @Builder to build a custom popup. @Builder popupBuilder() { Column({ space: 2 }) { Row().width(64) .height(64) .ba...
application-dev\ui\arkts-modal-transition.md
@Entry @Component struct ModalTransitionWithIf { private listArr: string[] = ['WLAN', 'Bluetooth', 'Personal hotspot', 'Connected devices']; private shareArr: string[] = ['Projection', 'Printing', 'VPN','Private DNS', 'NFC']; // Step 1: Define a state variable to control page display. @State isShowShare: boolea...
application-dev\ui\arkts-navigation-navigation.md
Navigation() { // ... } .mode(NavigationMode.Stack)
application-dev\ui\arkts-navigation-navigation.md
@Entry @Component struct NavigationExample { @State TooTmp: ToolbarItem = { 'value': "func", 'icon': "./image/ic_public_highlights.svg", 'action': () => { } } @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() private arr: number[] = [1, 2, 3]; @Builder PageMap(n...
application-dev\ui\arkts-navigation-navigation.md
Navigation() { // ... } .titleMode(NavigationTitleMode.Mini)
application-dev\ui\arkts-navigation-navigation.md
Navigation() { // ... } .titleMode(NavigationTitleMode.Full)
application-dev\ui\arkts-navigation-navigation.md
let TooTmp: NavigationMenuItem = {'value': "", 'icon': "./image/ic_public_highlights.svg", 'action': ()=> {}} Navigation() { // ... } .menus([TooTmp, TooTmp, TooTmp])
application-dev\ui\arkts-navigation-navigation.md
let TooTmp: NavigationMenuItem = {'value': "", 'icon': "resources/base/media/ic_public_highlights.svg", 'action': ()=> {}} Navigation() { // ... } .menus([TooTmp, TooTmp, TooTmp])
application-dev\ui\arkts-navigation-navigation.md
let TooTmp: NavigationMenuItem = {'value': "", 'icon': "./image/ic_public_highlights.svg", 'action': ()=> {}} Navigation() { // ... } // In portrait mode, the toolbar shows a maximum of five icons, with any additional icons placed under an automatically generated More icon. .menus([TooTmp, TooTmp, TooTmp, TooTm...
application-dev\ui\arkts-navigation-navigation.md
let TooTmp: ToolbarItem = {'value': "func", 'icon': "./image/ic_public_highlights.svg", 'action': ()=> {}} let TooBar: ToolbarItem[] = [TooTmp,TooTmp,TooTmp] Navigation() { // ... } .toolbarConfiguration(TooBar)
application-dev\ui\arkts-navigation-navigation.md
@Entry @Component struct Index { // Create a NavPathStack object and pass it to Navigation. pageStack: NavPathStack = new NavPathStack() build() { Navigation(this.pageStack) { } .title('Main') } }
application-dev\ui\arkts-navigation-navigation.md
this.pageStack.pushPath({ name: "PageOne", param: "PageOne Param" }) this.pageStack.pushPathByName("PageOne", "PageOne Param")
application-dev\ui\arkts-navigation-navigation.md
this.pageStack.pushPathByName('PageOne', "PageOne Param", (popInfo) => { console.log('Pop page name is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result)) });
application-dev\ui\arkts-navigation-navigation.md
this.pageStack.pushDestination({name: "PageOne", param: "PageOne Param"}) .catch((error: BusinessError) => { console.error(`Push destination failed, error code = ${error.code}, error.message = ${error.message}.`); }).then(() => { console.info('Push destination succeed.'); }); this....
application-dev\ui\arkts-navigation-navigation.md
// Return to the previous page. this.pageStack.pop() // Return to the previous PageOne page. this.pageStack.popToName("PageOne") // Return to the page whose index is 1. this.pageStack.popToIndex(1) // Return to the root home page (clear all pages in the stack). this.pageStack.clear()
application-dev\ui\arkts-navigation-navigation.md
// Replace the top page of the stack with PageOne. this.pageStack.replacePath({ name: "PageOne", param: "PageOne Param" }) this.pageStack.replacePathByName("PageOne", "PageOne Param") // Replacement with an error code: Upon failure, an asynchronous callback is triggered to provide the error code information. this.pageS...
application-dev\ui\arkts-navigation-navigation.md
// Remove all pages whose name is PageOne from the stack. this.pageStack.removeByName("PageOne") // Remove the page with the specified index. this.pageStack.removeByIndexes([1,3,5]) // Remove the page with the specified ID. this.pageStack.removeByNavDestinationId("1");
application-dev\ui\arkts-navigation-navigation.md
// Move the page named PageOne to the top of the stack. this.pageStack.moveToTop("PageOne"); // Move the page at index 1 to the top of the stack. this.pageStack.moveIndexToTop(1);
application-dev\ui\arkts-navigation-navigation.md
// Obtain all page names in the stack. this.pageStack.getAllPathName() // Obtain the parameters of the page whose index is 1. this.pageStack.getParamByIndex(1) // Obtain the parameters of the PageOne page. this.pageStack.getParamByName("PageOne") // Obtain the index set of the PageOne page. this.pageStack.getIndexByNam...
application-dev\ui\arkts-navigation-navigation.md
this.pageStack.setInterception({ willShow: (from: NavDestinationContext | "navBar", to: NavDestinationContext | "navBar", operation: NavigationOperation, animated: boolean) => { if (typeof to === "string") { console.log("target page is navigation home page."); return; } // Redirect navigat...
application-dev\ui\arkts-navigation-navigation.md
// Dialog NavDestination @Entry @Component struct Index { @Provide('NavPathStack') pageStack: NavPathStack = new NavPathStack() @Builder PagesMap(name: string) { if (name == 'DialogPage') { DialogPage() } } build() { Navigation(this.pageStack) { ...
application-dev\ui\arkts-navigation-navigation.md
import { uiObserver } from '@kit.ArkUI'; // Custom components within NavDestination @Component struct MyComponent { navDesInfo: uiObserver.NavDestinationInfo | undefined aboutToAppear(): void { this.navDesInfo = this.queryNavDestinationInfo(); } build() { Column() {...
application-dev\ui\arkts-navigation-navigation.md
uiObserver.on('navDestinationUpdate', (info) => { console.info('NavDestination state update', JSON.stringify(info)); });
application-dev\ui\arkts-navigation-navigation.md
// Used in UIAbility import { UIContext, uiObserver } from '@kit.ArkUI'; // callBackFunc is a callback defined by you. function callBackFunc(info: uiObserver.NavDestinationSwitchInfo) {} uiObserver.on('navDestinationSwitch', this.context, callBackFunc); // The getUIContext() API of the window can b...
application-dev\ui\arkts-navigation-navigation.md
pageStack: NavPathStack = new NavPathStack() aboutToAppear(): void { this.pageStack.disableAnimation(true) }
application-dev\ui\arkts-navigation-navigation.md
pageStack: NavPathStack = new NavPathStack() this.pageStack.pushPath({ name: "PageOne" }, false) this.pageStack.pop(false)
application-dev\ui\arkts-navigation-navigation.md
// Set id of the source page. NavDestination() { Column() { // ... Image($r('app.media.startIcon')) .geometryTransition('sharedId') .width(100) .height(100) } } .title('FromPage') // Set id of the destination page. NavDestination() { Column(...
application-dev\ui\arkts-navigation-navigation.md
NavDestination() { Column() { Button('Go to Destination Page') .width('80%') .height(40) .margin(20) .onClick(() => { this.getUIContext()?.animateTo({ duration: 1000 }, () => { this.pageStack.pushPath({ name: 'ToPage' }, false) }) ...
application-dev\ui\arkts-navigation-navigation.md
// Entry point function for redirection to the target page @Builder export function PageOneBuilder() { PageOne() } @Component struct PageOne { pathStack: NavPathStack = new NavPathStack() build() { NavDestination() { } .title('PageOne') ...