source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
application-dev\ui\arkts-common-events-device-input-event.md | import { KeyCode } from '@kit.InputKit';
@Entry
@Component
struct PreImeEventExample {
@State buttonText: string = '';
@State buttonType: string = '';
@State columnText: string = '';
@State columnType: string = '';
build() {
Column() {
Search({
placeholder: "Search..."
})
.wi... |
application-dev\ui\arkts-common-events-device-input-event.md | @Entry
@Component
struct Index {
build() {
Row() {
Row() {
Button('button1').id('button1').onKeyEvent((event) => {
console.log("button1");
return true
})
Button('button1').id('button2').onKeyEvent((event) => {
console.log("button2");
return tru... |
application-dev\ui\arkts-common-events-drag-event.md | import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData';
Image($r('app.media.app_icon'))
.width(100)
.height(100)
.draggable(true)
.onDragStart((event) => {
let data: unifiedDataChannel.Image = new unifiedDataChannel.Image();
data.imageUri = ... |
application-dev\ui\arkts-common-events-drag-event.md | .parallelGesture(LongPressGesture().onAction(() => {
promptAction.showToast({ duration: 100, message: 'Long press gesture trigger' });
})) |
application-dev\ui\arkts-common-events-drag-event.md | .onPreDrag((status: PreDragStatus) => {
if (preDragStatus == PreDragStatus.ACTION_DETECTING_STATUS) {
this.getComponentSnapshot();
}
}) |
application-dev\ui\arkts-common-events-drag-event.md | @Builder
pixelMapBuilder() {
Column() {
Image($r('app.media.startIcon'))
.width(120)
.height(120)
.backgroundColor(Color.Yellow)
}
}
private getComponentSnapshot(): void {
this.getUIContext().getComponentSnapshot().c... |
application-dev\ui\arkts-common-events-drag-event.md | import { UIAbility } from '@kit.AbilityKit';
import { window, UIContext } from '@kit.ArkUI';
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
... |
application-dev\ui\arkts-common-events-drag-event.md | .allowDrop([uniformTypeDescriptor.UniformDataType.HYPERLINK, uniformTypeDescriptor.UniformDataType.PLAIN_TEXT]) |
application-dev\ui\arkts-common-events-drag-event.md | .onDragMove((event) => {
event.setResult(DragResult.DROP_ENABLED);
event.dragBehavior = DragBehavior.MOVE;
}) |
application-dev\ui\arkts-common-events-drag-event.md | .onDrop((dragEvent?: DragEvent) => {
// Obtain the drag data.
this.getDataFromUdmf((dragEvent as DragEvent), (event: DragEvent) => {
let records: Array<unifiedDataChannel.UnifiedRecord> = event.getData().getRecords();
let rect: Rectangle = event.getPreviewRect();
this.imageWidth ... |
application-dev\ui\arkts-common-events-drag-event.md | getDataFromUdmfRetry(event: DragEvent, callback: (data: DragEvent) => void) {
try {
let data: UnifiedData = event.getData();
if (!data) {
return false;
}
let records: Array<unifiedDataChannel.UnifiedRecord> = data.getRecords();
if (!records || records.lengt... |
application-dev\ui\arkts-common-events-drag-event.md | import { promptAction } from '@kit.ArkUI';
.onDragEnd((event) => {
// The result value obtained from onDragEnd is set in onDrop of the drop target.
if (event.getResult() === DragResult.DRAG_SUCCESSFUL) {
promptAction.showToast({ duration: 100, message: 'Drag Success' });
} else if (even... |
application-dev\ui\arkts-common-events-drag-event.md | import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData';
import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { image } from '@kit.ImageKit';
@Entry
@Component
struct Index {
@State targetImage: string = '';
@State imageWidth: number = 100;
@St... |
application-dev\ui\arkts-common-events-drag-event.md | Grid() {
ForEach(this.numbers, (idx: number) => {
GridItem() {
Column()
.backgroundColor(this.colors[idx % 9])
.width(50)
.height(50)
.opacity(1.0)
.id('grid'+idx)
}
.onDragStart(()=>{})
.selectable(true)
}... |
application-dev\ui\arkts-common-events-drag-event.md | .dragPreviewOptions({isMultiSelectionEnabled:true,defaultAnimationBeforeLifting:true}) |
application-dev\ui\arkts-common-events-drag-event.md | .selected(this.isSelectedGrid[idx])
.onClick(()=>{
this.isSelectedGrid[idx] = !this.isSelectedGrid[idx]
}) |
application-dev\ui\arkts-common-events-drag-event.md | .dragPreview({
pixelMap:this.pixmap
}) |
application-dev\ui\arkts-common-events-drag-event.md | @State previewData: DragItemInfo[] = []
@State isSelectedGrid: boolean[] = []
.onClick(()=>{
this.isSelectedGrid[idx] = !this.isSelectedGrid[idx]
if (this.isSelectedGrid[idx]) {
let gridItemName = 'grid' + idx
this.getUIContext().getComponentSnapshot().get(gridItemName, (... |
application-dev\ui\arkts-common-events-drag-event.md | @Styles
normalStyles(): void{
.opacity(1.0)
}
@Styles
selectStyles(): void{
.opacity(0.4)
}
.stateStyles({
normal : this.normalStyles,
selected: this.selectStyles
}) |
application-dev\ui\arkts-common-events-drag-event.md | @State numberBadge: number = 0;
.onClick(()=>{
this.isSelectedGrid[idx] = !this.isSelectedGrid[idx]
if (this.isSelectedGrid[idx]) {
this.numberBadge++;
} else {
this.numberBadge--;
}
})
// Set the numberBadge parameter in dragPreviewOptions for the number b... |
application-dev\ui\arkts-common-events-drag-event.md | import { image } from '@kit.ImageKit';
@Entry
@Component
struct GridEts {
@State pixmap: image.PixelMap|undefined = undefined
@State numbers: number[] = []
@State isSelectedGrid: boolean[] = []
@State previewData: DragItemInfo[] = []
@State colors: Color[] = [Color.Red, Color.Blue, Color.Brown, Color.Gray, C... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct FocusActiveExample {
build() {
Column() {
Button('Set Active').width(140).height(45).margin(5).onClick(() => {
this.getUIContext().getFocusController().activate(true, true);
})
Button('Set Not Active').width(140).height(45).margin(5).onClick(() => {
this.... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct FocusLinerExample {
build() {
Column() {
Column() {
Button("Column Button1")
.width(150)
.height(45)
.fontColor(Color.White)
.margin(10)
Button("Column Button2")
.width(150)
.height(45)
.fontColor(... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct ProjectAreaFocusExample {
build() {
Column() {
Column({ space: 5 }) {
Text('Wrap').fontSize(12).width('90%')
// Multi-line layout for child components
Flex({ wrap: FlexWrap.Wrap }) {
Button('1').width(140).height(50).margin(5)
Button('2').... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct ProjectAreaFocusExample2 {
build() {
Column() {
Column({ space: 5 }) {
Text('Wrap').fontSize(12).width('90%')
// Multi-line layout for child components
Flex({ wrap: FlexWrap.Wrap }) {
Button('1').width(145).height(50).margin(5)
Button('2')... |
application-dev\ui\arkts-common-events-focus-event.md | onFocus(event: () => void) |
application-dev\ui\arkts-common-events-focus-event.md | onBlur(event:() => void) |
application-dev\ui\arkts-common-events-focus-event.md | // xxx.ets
@Entry
@Component
struct FocusEventExample {
@State oneButtonColor: Color = Color.Gray;
@State twoButtonColor: Color = Color.Gray;
@State threeButtonColor: Color = Color.Gray;
build() {
Column({ space: 20 }) {
// You can use the up and down arrow keys on an external keyboard to move the fo... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct FocusAndBlurExample {
build() {
Column() {
Column({ space: 5 }) {
Row() { // Parent node Row1
Button('Button1') // Child node Button1
.width(140)
.height(45)
.margin(5)
.onFocus(() => {
console.log("Butt... |
application-dev\ui\arkts-common-events-focus-event.md | Row1 onBlur
Button1 onBlur
Button2 onFocus
Row2 onFocus |
application-dev\ui\arkts-common-events-focus-event.md | focusable(value: boolean) |
application-dev\ui\arkts-common-events-focus-event.md | enabled(value: boolean) |
application-dev\ui\arkts-common-events-focus-event.md | visibility(value: Visibility) |
application-dev\ui\arkts-common-events-focus-event.md | focusOnTouch(value: boolean) |
application-dev\ui\arkts-common-events-focus-event.md | // xxx.ets
@Entry
@Component
struct FocusableExample {
@State textFocusable: boolean = true;
@State textEnabled: boolean = true;
@State color1: Color = Color.Yellow;
@State color2: Color = Color.Yellow;
@State color3: Color = Color.Yellow;
build() {
Column({ space: 5 }) {
Text('Default Text') ... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct ScopeFocusExample {
@State scopeFocusState: boolean = true;
build() {
Column() {
Column({ space: 5 }) {
Text("Container focus").textAlign(TextAlign.Center)
}
.justifyContent(FlexAlign.Center)
.width('80%')
.height(50)
.margin({ top: 5, bottom... |
application-dev\ui\arkts-common-events-focus-event.md | tabStop(isTabStop: boolean) |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct TabStopExample {
build() {
Column({ space: 20 }) {
Button('Button1')
.width(140)
.height(45)
.margin(5)
Column() {
Button('Button2')
.width(140)
.height(45)
.margin(5)
Button('Button3')
.width(140)... |
application-dev\ui\arkts-common-events-focus-event.md | defaultFocus(value: boolean) |
application-dev\ui\arkts-common-events-focus-event.md | // xxx.ets
@Entry
@Component
struct morenjiaodian {
@State oneButtonColor: Color = Color.Gray;
@State twoButtonColor: Color = Color.Gray;
@State threeButtonColor: Color = Color.Gray;
build() {
Column({ space: 20 }) {
// You can use the up and down arrow keys on an external keyboard to move the focus ... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct Index {
build() {
Row() {
Button('Button1')
.defaultFocus(true)
Button('Button2')
.focusScopePriority('RowScope', FocusPriority.PREVIOUS)
}.focusScopeId('RowScope')
}
} |
application-dev\ui\arkts-common-events-focus-event.md | focusBox(style: FocusBoxStyle) |
application-dev\ui\arkts-common-events-focus-event.md | import { ColorMetrics, LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct RequestFocusExample {
build() {
Column({ space: 30 }) {
Button("small black focus box")
.focusBox({
margin: new LengthMetrics(0),
strokeColor: ColorMetrics.rgba(0, 0, 0),
})
Button("l... |
application-dev\ui\arkts-common-events-focus-event.md | requestFocus(key: string): void |
application-dev\ui\arkts-common-events-focus-event.md | clearFocus(): void |
application-dev\ui\arkts-common-events-focus-event.md | requestFocus(value: string): boolean |
application-dev\ui\arkts-common-events-focus-event.md | // focusTest.ets
@Entry
@Component
struct RequestExample {
@State btColor: string = '#ff2787d9'
@State btColor2: string = '#ff2787d9'
build() {
Column({ space: 20 }) {
Column({ space: 5 }) {
Button('Button')
.width(200)
.height(70)
.fontColor(Color.White)
... |
application-dev\ui\arkts-common-events-focus-event.md | tabIndex(index: number) |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct TabIndexExample {
build() {
Column() {
Button('Button1')
.width(140)
.height(45)
.margin(5)
Button('Focus Button1')
.width(140)
.height(45)
.margin(5).tabIndex(1)
Button('Button2')
.width(140)
.height(45)
... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct TabIndexExample2 {
build() {
Column() {
Button('Focus Button1')
.width(140)
.height(45)
.margin(5).tabIndex(1)
Column() {
Button('Button1')
.width(140)
.height(45)
.margin(5)
Button('Button2')
.wid... |
application-dev\ui\arkts-common-events-focus-event.md | focusScopePriority(scopeId: string, priority?: FocusPriority) |
application-dev\ui\arkts-common-events-focus-event.md | focusScopeId(id: string, isGroup?: boolean) |
application-dev\ui\arkts-common-events-focus-event.md | // focusTest.ets
@Entry
@Component
struct FocusableExample {
@State inputValue: string = ''
build() {
Scroll() {
Row({ space: 20 }) {
Column({ space: 20 }) { // Labeled as Column1.
Column({ space: 5 }) {
Button('Group1')
.width(165)
.height(40)
... |
application-dev\ui\arkts-common-events-focus-event.md | focusScopeId(id: string, isGroup?: boolean, arrowStepOut?: boolean) |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct FocusScopeIdExample {
build() {
Column({ space: 20 }) {
Column() {
Button('Group1')
.width(165)
.height(40)
.margin(5)
.fontColor(Color.White)
Row({ space: 5 }) {
Button("Button1")
.width(80)
.... |
application-dev\ui\arkts-common-events-focus-event.md | @Entry
@Component
struct FocusOnclickExample {
@State count: number = 0
@State name: string = 'Button'
build() {
Column() {
Button(this.name)
.fontSize(30)
.onClick(() => {
this.count++
if (this.count <= 0) {
this.name = "count is negative number"
... |
application-dev\ui\arkts-common-events-touch-screen-event.md | onClick(event: (event?: ClickEvent) => void) |
application-dev\ui\arkts-common-events-touch-screen-event.md | @Entry
@Component
struct IfElseTransition {
@State flag: boolean = true;
@State btnMsg: string = 'show';
build() {
Column() {
Button(this.btnMsg).width(80).height(30).margin(30)
.onClick(() => {
if (this.flag) {
this.btnMsg = 'hide';
} else {
this.btn... |
application-dev\ui\arkts-common-events-touch-screen-event.md | onTouch(event: (event?: TouchEvent) => void) |
application-dev\ui\arkts-common-events-touch-screen-event.md | // xxx.ets
@Entry
@Component
struct TouchExample {
@State text: string = '';
@State eventType: string = '';
build() {
Column() {
Button('Touch').height(40).width(100)
.onTouch((event?: TouchEvent) => {
if(event){
if (event.type === TouchType.Down) {
this.even... |
application-dev\ui\arkts-component-animation.md | @Entry
@Component
struct ComponentDemo {
build() {
Row() {
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
.select(true)
.shape(CheckBoxShape.CIRCLE)
.size({ width: 50, height: 50 })
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
}
} |
application-dev\ui\arkts-component-animation.md | import { curves, window, display, mediaquery } from '@kit.ArkUI';
import { UIAbility } from '@kit.AbilityKit';
export default class GlobalContext extends AppStorage{
static mainWin: window.Window|undefined = undefined;
static mainWindowSize:window.Size|undefined = undefined;
}
/**
* Encapsulates the WindowManager... |
application-dev\ui\arkts-contentcover-page.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-create-overlaymanager.md | import { ComponentContent, OverlayManager, router } from '@kit.ArkUI';
class Params {
text: string = ""
offset: Position
constructor(text: string, offset: Position) {
this.text = text
this.offset = offset
}
}
@Builder
function builderText(params: Params) {
Column() {
Text(params.text)
.font... |
application-dev\ui\arkts-create-overlaymanager.md | import { ComponentContent, OverlayManager } from '@kit.ArkUI';
class Params {
context: UIContext
offset: Position
constructor(context: UIContext, offset: Position) {
this.context = context
this.offset = offset
}
}
@Builder
function builderOverlay(params: Params) {
Column() {
Stack(){
}.width(... |
application-dev\ui\arkts-create-overlaymanager.md | import { ComponentContent, LevelOrder, OverlayManager } from '@kit.ArkUI';
class Params {
text: string = ""
offset: Position
constructor(text: string, offset: Position) {
this.text = text
this.offset = offset
}
}
@Builder
function builderTopText(params: Params) {
Column() {
Stack(){
Text(p... |
application-dev\ui\arkts-create-toast.md | import {promptAction} from '@kit.ArkUI';
@Entry
@Component
struct Index {
build() {
Column({space: 10}) {
TextInput()
Button() {
Text("Toast of the DEFAULT type")
.fontSize(20)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.onClick(()=>{
promptAct... |
application-dev\ui\arkts-create-toast.md | import { LengthMetrics, PromptAction } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit'
@Entry
@Component
struct toastExample {
private uiContext: UIContext = this.getUIContext()
private promptAction: PromptAction = this.uiContext.getPromptAction()
build() {
Column() {
Button('S... |
application-dev\ui\arkts-create-toast.md | import { LengthMetrics, PromptAction } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit'
@Entry
@Component
struct toastExample {
@State toastId: number = 0;
private uiContext: UIContext = this.getUIContext()
private promptAction: PromptAction = this.uiContext.getPromptAction()
build() {
... |
application-dev\ui\arkts-custom-attribute-animation.md | // Step 1: Use the @AnimatableExtend decorator to customize an animatable property API.
@AnimatableExtend(Text)
function animatableWidth(width: number) {
.width(width) // Call the system property API to modify the property value on a frame-by-frame basis.
}
@Entry
@Component
struct AnimatablePropertyExample {
@Sta... |
application-dev\ui\arkts-custom-attribute-animation.md | declare type Point = number[];
// Define the parameter type of the animatable property API and implement the addition, subtraction, multiplication, and equivalence judgment functions in the AnimatableArithmetic<T> API.
class PointClass extends Array<number> {
constructor(value: Point) {
super(value[0], value[1])... |
application-dev\ui\arkts-dialog-levelorder.md | @Builder normalCustomDialog(index: number) {
Column() {
Text("I am normal dialog box " + index).fontSize(26)
}.height(400).padding(5).justifyContent(FlexAlign.SpaceBetween)
} |
application-dev\ui\arkts-dialog-levelorder.md | @Builder topCustomDialog() {
Column() {
Text("I am a top-level dialog box").fontSize(26)
Row({ space: 50 }) {
Button('Open Normal Dialog Box')
.onClick(() => {
this.getUIContext().getPromptAction().openCustomDialog({
builder: () => {
this.normalCustomDialog(th... |
application-dev\ui\arkts-dialog-levelorder.md | this.getUIContext().getPromptAction().openCustomDialog({
builder: () => {
this.topCustomDialog()
},
levelOrder: LevelOrder.clamp(100000)
}).catch((err: BusinessError) => {
console.error("openCustomDialog error: " + err.code + " " + err.message)
}) |
application-dev\ui\arkts-dialog-levelorder.md | import { LevelOrder } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct Index {
@StorageLink('dialogIndex') dialogIndex: number = 0
@Builder normalCustomDialog(index: number) {
Column() {
Text("I am normal dialog box " + index).fontSize(26)
}.height(4... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | @Entry
@Component
struct CanvasExample1 {
// Configure the parameters of the CanvasRenderingContext2D object, including whether to enable anti-aliasing. The value true indicates that anti-aliasing is enabled.
private settings: RenderingContextSettings = new RenderingContextSettings(true)
// Create a Can... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | @Entry
@Component
struct CanvasExample2 {
// Configure the parameters of the CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D objects, including whether to enable anti-aliasing. The value true indicates that anti-aliasing is enabled.
private settings: RenderingContextSettings = new RenderingCo... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | import lottie from '@ohos/lottie' |
application-dev\ui\arkts-drawing-customization-on-canvas.md | Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#F5DC62')
.onReady(() => {
this.context.fillStyle = '#0097D4';
this.context.fillRect(50, 50, 100, 100);
}) |
application-dev\ui\arkts-drawing-customization-on-canvas.md | Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#F5DC62')
.onReady(() => {
this.context.beginPath();
this.context.moveTo(50, 50);
this.context.lineTo(280, 160);
this.context.stroke();
}) |
application-dev\ui\arkts-drawing-customization-on-canvas.md | Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#F5DC62')
.onReady(() => {
let region = new Path2D();
region.arc(100, 75, 50, 0, 6.28);
this.context.stroke(region);
}) |
application-dev\ui\arkts-drawing-customization-on-canvas.md | Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#F5DC62')
.onReady(() => {
// Draw a rectangle.
this.context.beginPath();
this.context.rect(100, 50, 100, 100);
this.context.stroke();
// Draw a circle on the canvas.
this.context.beginPath();... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#F5DC62')
.onReady(() => {
// Draw filled text on the canvas.
this.context.font = '50px bolder sans-serif';
this.context.fillText("Hello World!", 50, 100);
// Draw a text stroke on the canvas.
this.contex... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#F5DC62')
.onReady(() => {
// Load a custom font.
this.context.font = '30vp customFont'
this.context.fillText("Hello World!", 20, 50)
this.context.strokeText("Hello World!", 20, 100)
}) |
application-dev\ui\arkts-drawing-customization-on-canvas.md | @Entry
@Component
struct GetImageData {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offCanvas: OffscreenCanvas = new OffscreenCanvas(600, 600)
private img: ImageBitmap ... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#F5DC62')
.onReady(() => {
// Create a CanvasGradient object with radial gradient colors.
let grad = this.context.createRadialGradient(200, 200, 50, 200, 200, 200)
// Set the gradient color stop for the CanvasGradien... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | @Entry
@Component
struct ClearRect {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyCon... |
application-dev\ui\arkts-drawing-customization-on-canvas.md | @Entry
@Component
struct Path2d {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
build() {
Row() {
Column() {
Canvas(this.context)
.width('1... |
application-dev\ui\arkts-embedded-dialog.md | promptAction.openCustomDialog({
builder: () => {
this.customDialogComponent()
},
levelMode: LevelMode.EMBEDDED, // Enable the page-level dialog box.
}) |
application-dev\ui\arkts-embedded-dialog.md | Text(this.message).id("test_text")
.onClick(() => {
const node: FrameNode | null = this.getUIContext().getFrameNodeById("test_text") || null;
promptAction.openCustomDialog({
builder: () => {
this.customDialogComponent()
},
levelMode: LevelMode.EMBEDDED, // Enable the page-level dialo... |
application-dev\ui\arkts-embedded-dialog.md | Text(this.message).id("test_text")
.onClick(() => {
const node: FrameNode | null = this.getUIContext().getFrameNodeById("test_text") || null;
promptAction.openCustomDialog({
builder: () => {
this.customDialogComponent()
},
levelMode: LevelMode.EMBEDDED, // Enable the page-level dialo... |
application-dev\ui\arkts-embedded-dialog.md | // Index.ets
import { promptAction, LevelMode, ImmersiveMode, router } from '@kit.ArkUI'
let customDialogId: number = 0
@Builder
function customDialogBuilder() {
Column() {
Text('Custom dialog Message').fontSize(20).height(100)
Row() {
Button("Next").onClick(() => {
// Perform route redirectio... |
application-dev\ui\arkts-embedded-dialog.md | // Next.ets
import { router } from '@kit.ArkUI'
@Entry
@Component
struct Next {
@State message: string = 'Back'
build() {
Row() {
Column() {
Button(this.message)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.onClick(() => {
router.back()
})
... |
application-dev\ui\arkts-enter-exit-transition.md | // The component enters by applying all enter transition effects and exits by applying all exit transition effects.
// Define the animation settings for each transition effect.
private effect: object =
TransitionEffect.OPACITY // Apply an opacity transition effect. As the animation API is not called here, th... |
application-dev\ui\arkts-enter-exit-transition.md | Text('test')
.transition(this.effect) |
application-dev\ui\arkts-enter-exit-transition.md | @State isPresent: boolean = true;
// ...
if (this.isPresent) {
Text('test')
.transition(this.effect)
}
// ...
// Control the addition or deletion of the component.
// Method 1: Place the control variable in the animateTo closure. In this case, the transition effect for which the animation ... |
application-dev\ui\arkts-enter-exit-transition.md | import { curves } from '@kit.ArkUI';
@Entry
@Component
struct TransitionEffectDemo {
@State isPresent: boolean = false;
// Step 1: Create a TransitionEffect object.
private effect: TransitionEffect =
// Apply the default opacity transition effect and specify springMotion (0.6, 0.8) as the curve.
Transiti... |
application-dev\ui\arkts-enter-exit-transition.md | const ITEM_COUNTS = 9;
const ITEM_COLOR = '#ED6F21';
const INTERVAL = 30;
const DURATION = 300;
@Entry
@Component
struct Index1 {
@State isGridShow: boolean = false;
private dataArray: number[] = new Array(ITEM_COUNTS);
aboutToAppear(): void {
for (let i = 0; i < ITEM_COUNTS; i++) {
this.dataArray[i] ... |
application-dev\ui\arkts-fixes-style-dialog.md | import { PromptAction } from '@kit.ArkUI';
let uiContext = this.getUIContext();
let promptAction: PromptAction = uiContext.getPromptAction();
try {
promptAction.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666'
},
{
tex... |
application-dev\ui\arkts-fixes-style-dialog.md | // xxx.ets
import { PromptAction } from '@kit.ArkUI';
let uiContext = this.getUIContext();
let promptAction: PromptAction = uiContext.getPromptAction();
try {
promptAction.showDialog({
title: 'showDialog Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#00... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.