source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
application-dev\security\UserAuthenticationKit\apply-custom-authentication.md | import { BusinessError } from '@kit.BasicServicesKit';
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
import { userAuth } from '@kit.UserAuthenticationKit';
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
const randData: Uint8Array = rand?.generateRandomSync(len)?.data;... |
application-dev\security\UserAuthenticationKit\cancel-authentication.md | import { BusinessError } from '@kit.BasicServicesKit';
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
import { userAuth } from '@kit.UserAuthenticationKit';
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
const randData: Uint8Array = rand?.generateRandomSync(len)?.data;... |
application-dev\security\UserAuthenticationKit\obtain-enrolled-state-capabilities.md | import { BusinessError } from '@kit.BasicServicesKit';
import { userAuth } from '@kit.UserAuthenticationKit';
try {
let enrolledState = userAuth.getEnrolledState(userAuth.UserAuthType.FACE);
console.info(`get current enrolled state success, enrolledState: ${JSON.stringify(enrolledState)}`);
} catch (error) {
co... |
application-dev\security\UserAuthenticationKit\obtain-supported-authentication-capabilities.md | import { BusinessError } from '@kit.BasicServicesKit';
import { userAuth } from '@kit.UserAuthenticationKit';
// Check whether the specified authentication capabilities are supported.
try {
userAuth.getAvailableStatus(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL1);
console.info('current aut... |
application-dev\security\UserAuthenticationKit\start-authentication.md | // API version 10
import { BusinessError } from '@kit.BasicServicesKit';
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
import { userAuth } from '@kit.UserAuthenticationKit';
try {
const rand = cryptoFramework.createRandom();
const len: number = 16; // Generate a 16-byte random number.
const randD... |
application-dev\security\UserAuthenticationKit\start-authentication.md | // API version 10
import { BusinessError } from '@kit.BasicServicesKit';
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
import { userAuth } from '@kit.UserAuthenticationKit';
// Set authentication parameters.
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.AUTH_TYP... |
application-dev\security\UserAuthenticationKit\start-authentication.md | // API version 14
import { BusinessError } from '@kit.BasicServicesKit';
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
import { userAuth } from '@kit.UserAuthenticationKit';
// Set authentication parameters.
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.CALLER_I... |
application-dev\security\UserAuthenticationKit\start-authentication.md | // API version 18
import { BusinessError } from '@kit.BasicServicesKit';
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
import { userAuth } from '@kit.UserAuthenticationKit';
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
const randData: Uint8Array = rand?.generateRando... |
application-dev\task-management\agent-powered-reminder.md | import { reminderAgentManager } from '@kit.BackgroundTasksKit';
import { notificationManager } from '@kit.NotificationKit';
import { BusinessError } from '@kit.BasicServicesKit'; |
application-dev\task-management\agent-powered-reminder.md | let targetReminderAgent: reminderAgentManager.ReminderRequestTimer = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, // The reminder type is timer.
triggerTimeInSeconds: 10,
actionButton: [ // Set the button type and title displayed for the reminder in the notification p... |
application-dev\task-management\agent-powered-reminder.md | let targetReminderAgent: reminderAgentManager.ReminderRequestCalendar = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_CALENDAR, // The reminder type is calendar.
dateTime: { // Reminder time.
year: 2023,
month: 1,
day: 1,
hour: 11,
mi... |
application-dev\task-management\agent-powered-reminder.md | let targetReminderAgent: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, // The reminder type is alarm.
hour: 23, // Hour portion of the reminder time.
minute: 9, // Minute portion of the reminder time.
daysOfWeek: [2], /... |
application-dev\task-management\agent-powered-reminder.md | reminderAgentManager.publishReminder(targetReminderAgent).then((res: number) => {
console.info('Succeeded in publishing reminder. ');
let reminderId: number = res; // ID of the published reminder.
}).catch((err: BusinessError) => {
console.error(`Failed to publish reminder. Code: ${err.code}, mess... |
application-dev\task-management\agent-powered-reminder.md | let reminderId: number = 1;
// The reminder ID is obtained from the callback after the reminder is published.
reminderAgentManager.cancelReminder(reminderId).then(() => {
console.log('Succeeded in canceling reminder.');
}).catch((err: BusinessError) => {
console.error(`Failed to cancel reminder.... |
application-dev\task-management\continuous-task.md | import { backgroundTaskManager } from '@kit.BackgroundTasksKit';
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { rpc } from '@kit.IPCKit'
import { BusinessError } from '@kit.BasicServicesKit';
import { wantAgent, WantAgent } from '@ki... |
application-dev\task-management\continuous-task.md | function callback(info: backgroundTaskManager.ContinuousTaskCancelInfo) {
// ID of a continuous task.
console.info('OnContinuousTaskCancel callback id ' + info.id);
// Reason for canceling the continuous task.
console.info('OnContinuousTaskCancel callback reason ' + info.reason);
}
@Ent... |
application-dev\task-management\continuous-task.md | const MSG_SEND_METHOD: string = 'CallSendMsg'
let mContext: Context;
function startContinuousTask() {
let wantAgentInfo : wantAgent.WantAgentInfo = {
// List of operations to be executed after the notification is clicked.
wants: [
{
bundleName: "com.example.myappli... |
application-dev\task-management\efficiency-resource-request.md | import { backgroundTaskManager } from '@kit.BackgroundTasksKit'; |
application-dev\task-management\efficiency-resource-request.md | // The application needs to remain active in the background.
let request: backgroundTaskManager.EfficiencyResourcesRequest = {
resourceTypes: backgroundTaskManager.ResourceType.CPU, // The resource type is CPU, which prevents the application process from being suspended.
isApply: true, // The request is us... |
application-dev\task-management\efficiency-resource-request.md | // The application releases all the efficiency resources.
backgroundTaskManager.resetAllEfficiencyResources();
// The application releases some efficiency resources.
let request: backgroundTaskManager.EfficiencyResourcesRequest = {
resourceTypes: backgroundTaskManager.ResourceType.CPU,
isApply: false... |
application-dev\task-management\native-transient-task.md | export const RequestSuspendDelay: () => number;
export const GetRemainingDelayTime: () => number;
export const CancelSuspendDelay: () => number; |
application-dev\task-management\native-transient-task.md | import testTransientTask from 'libentry.so';
@Entry
@Component
struct Index {
@State message: string = '';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button('Request transient task').onCl... |
application-dev\task-management\transient-task.md | import { backgroundTaskManager } from '@kit.BackgroundTasksKit';
import { BusinessError } from '@kit.BasicServicesKit'; |
application-dev\task-management\transient-task.md | let id: number; // ID of the transient task.
let delayTime: number; // Remaining time of the transient task.
// Request a transient task.
function requestSuspendDelay() {
let myReason = 'test requestSuspendDelay'; // Reason for the request.
let delayInfo = backgroundTaskManager.requestSuspe... |
application-dev\task-management\transient-task.md | let id: number; // ID of the transient task.
async function getRemainingDelayTime() {
backgroundTaskManager.getRemainingDelayTime(id).then((res: number) => {
console.info('Succeeded in getting remaining delay time.');
}).catch((err: BusinessError) => {
console.error(`Failed to get remaining ... |
application-dev\task-management\transient-task.md | let id: number; // ID of the transient task.
function cancelSuspendDelay() {
backgroundTaskManager.cancelSuspendDelay(id);
} |
application-dev\task-management\work-scheduler.md | import { WorkSchedulerExtensionAbility, workScheduler } from '@kit.BackgroundTasksKit'; |
application-dev\task-management\work-scheduler.md | export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
// Callback invoked when the system starts scheduling the deferred task.
onWorkStart(workInfo: workScheduler.WorkInfo) {
console.info(`onWorkStart, workInfo = ${JSON.stringify(workInfo)}`);
// Print the ... |
application-dev\task-management\work-scheduler.md | import { workScheduler } from '@kit.BackgroundTasksKit';
import { BusinessError } from '@kit.BasicServicesKit'; |
application-dev\task-management\work-scheduler.md | // Create workinfo.
const workInfo: workScheduler.WorkInfo = {
workId: 1,
networkType: workScheduler.NetworkType.NETWORK_TYPE_WIFI,
bundleName: 'com.example.application',
abilityName: 'MyWorkSchedulerExtensionAbility'
}
try {
workScheduler.startWork(workInfo);
console.info(`st... |
application-dev\task-management\work-scheduler.md | // Create workinfo.
const workInfo: workScheduler.WorkInfo = {
workId: 1,
networkType: workScheduler.NetworkType.NETWORK_TYPE_WIFI,
bundleName: 'com.example.application',
abilityName: 'MyWorkSchedulerExtensionAbility'
}
try {
workScheduler.stopWork(workInfo);
console.info(`s... |
application-dev\telephony\telephony-call.md | // Import the required modules.
import { call, observer } from '@kit.TelephonyKit';
import { BusinessError } from '@kit.BasicServicesKit';
// Check whether the voice call function is supported.
let isSupport = call.hasVoiceCapability();
if (isSupport) {
// If the device supports the voice c... |
application-dev\telephony\telephony-call.md | // Import the required modules.
import { call, observer } from '@kit.TelephonyKit';
import { BusinessError } from '@kit.BasicServicesKit';
// Check whether the voice call function is supported.
let isSupport = call.hasVoiceCapability();
if (isSupport) {
// If the voice call function is s... |
application-dev\telephony\telephony-sms.md | // Sample code
import { sms } from '@kit.TelephonyKit';
import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
let sendCallback: AsyncCallback<sms.ISendShortMessageCallback> = (err: BusinessError, data: sms.ISendShortMessageCallback) => {
console.log(`sendCallback: err->${JSON.stringify(err)}, data-... |
application-dev\telephony\telephony-sms.md | // Sample code
import { common, Want } from '@kit.AbilityKit';
const MMS_BUNDLE_NAME = "com.ohos.mms";
const MMS_ABILITY_NAME = "com.ohos.mms.MainAbility";
const MMS_ENTITIES = "entity.system.home";
export class Contact {
contactsName: string;
telephone: number;
constructor(contactsName: string, telephon... |
application-dev\telephony\telephony-sms.md | @Entry
@Component
struct Index {
build() {
Column() {
Button ('Send SMS')
.onClick(() => {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
let exampleUrl = "sms:106XXXXXXXXXX?body=%E5%8F%91%E9%80%81%E7%9F%AD%E4%BF%A1%E5%86%85%E5%AE%B9";
... |
application-dev\tools\aa-tool.md | import UIAbility from '@ohos.app.ability.UIAbility';
import hilog from '@ohos.hilog';
import Want from '@ohos.app.ability.Want';
export default class TargetAbility extends UIAbility {
onCreate(want:Want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability o... |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
position: ArcButtonPosition.TOP_EDGE,
styleMode: ArcButtonStyleMode.EMPHASIZED_LIGHT
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
position: ArcButtonPosition.BOTTOM_EDGE,
styleMode: ArcButtonStyleMode.EMPHASIZED_LIGHT
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
position: ArcButtonPosition.TOP_EDGE,
styleMode: ArcButtonStyleMode.EMPHASIZED_LIGHT
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
styleMode: ArcButtonStyleMode.CUSTOM,
backgroundColor: ColorMetrics.resourceColor('#707070')
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
styleMode: ArcButtonStyleMode.CUSTOM,
backgroundColor: ColorMetrics.resourceColor('#E84026'),
fontColor: ColorMetrics.resourceColor('#707070')
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
shadowEnabled: true,
shadowColor: ColorMetrics.resourceColor('#707070')
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
onClick: () => {
console.info('ArcButton onClick')
}
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | ArcButton({
options: new ArcButtonOptions({
label: 'OK',
onTouch: (event: TouchEvent) => {
console.info('ArcButton onTouch')
}
})
}) |
application-dev\ui\arkts-advanced-components-arcbutton.md | import { LengthMetrics, LengthUnit, ArcButton, ArcButtonOptions, ArcButtonStyleMode, } from '@kit.ArkUI';
@Entry
@ComponentV2
struct BrightnessPage {
@Local brightnessValue: number = 30
private defaultBrightnessValue: number = 50
build() {
RelativeContainer() {
Text('Set brightness')
.fontColo... |
application-dev\ui\arkts-animation-smoothing.md | import { curves } from '@kit.ArkUI';
class SetSlt {
isAnimation: boolean = true
set(): void {
this.isAnimation = !this.isAnimation;
}
}
@Entry
@Component
struct AnimationToAnimationDemo {
// Step 1: Declare the related state variable.
@State SetAnimation: SetSlt = new SetSlt();
build() {
Column(... |
application-dev\ui\arkts-animation-smoothing.md | import { curves } from '@kit.ArkUI';
@Entry
@Component
struct SpringMotionDemo {
// Step 1: Declare the related state variable.
@State positionX: number = 100;
@State positionY: number = 100;
diameter: number = 50;
build() {
Column() {
Row() {
Circle({ width: this.diameter, height: this.di... |
application-dev\ui\arkts-animator.md | import { AnimatorOptions, AnimatorResult } from '@kit.ArkUI'; |
application-dev\ui\arkts-animator.md | // Initial options for creating an animator object
let options: AnimatorOptions = {
duration: 1500,
easing: "friction",
delay: 0,
fill: "forwards",
... |
application-dev\ui\arkts-animator.md | // Play the animation.
result.play(); |
application-dev\ui\arkts-animator.md | // Release the animation object.
result = undefined; |
application-dev\ui\arkts-animator.md | import { AnimatorOptions, AnimatorResult } from '@kit.ArkUI'; |
application-dev\ui\arkts-animator.md | Button()
.width(60)
.height(60)
.translate({ x: this.translateX, y: this.translateY }) |
application-dev\ui\arkts-animator.md | onPageShow(): void {
// Create an animatorResult object.
this.animatorOptions = this.getUIContext().createAnimator(options);
this.animatorOptions.onFrame = (progress: number) => {
this.translateX = progress;
if (progress > this.topWidth && this.translateY < this.bottomHeight) {
... |
application-dev\ui\arkts-animator.md | Button('Play').onClick(() => {
this.animatorOptions?.play();
this.animatorStatus = 'Playing'
}).width(80).height(35)
Button("Reset").onClick(() => {
this.translateX = 0;
this.translateY = 0;
}).width(80).height(35)
Button("Pause").onClick(() => {
this.animatorOptions?.pause();
... |
application-dev\ui\arkts-animator.md | onPageHide(): void {
this.animatorOptions = undefined;
} |
application-dev\ui\arkts-animator.md | import { AnimatorOptions, AnimatorResult } from '@kit.ArkUI';
@Entry
@Component
struct Index {
@State animatorOptions: AnimatorResult | undefined = undefined;
@State animatorStatus: string =' Created'
begin: number = 0;
end: number = 300
topWidth: number = 150;
bottomHeight: number = 100;
g: number = 0.1... |
application-dev\ui\arkts-attribute-animation-apis.md | import { curves } from '@kit.ArkUI';
@Entry
@Component
struct AnimateToDemo {
@State animate: boolean = false;
// Step 1: Declare related state variables.
@State rotateValue: number = 0; // Rotation angle of component 1.
@State translateX: number = 0; // Offset of component 2
@State opacityValue: number = 1;... |
application-dev\ui\arkts-attribute-animation-apis.md | import { curves } from '@kit.ArkUI';
@Entry
@Component
struct AnimationDemo {
@State animate: boolean = false;
// Step 1: Declare related state variables.
@State rotateValue: number = 0; // Rotation angle of component 1.
@State translateX: number = 0; // Offset of component 2
@State opacityValue: number = 1;... |
application-dev\ui\arkts-blur-effect.md | @Entry
@Component
struct BlurEffectsExample {
build() {
Column({ space: 10 }) {
Text('backdropBlur')
.width('90%')
.height('90%')
.fontSize(20)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.backdropBlur(10) // Apply background blur.
.background... |
application-dev\ui\arkts-blur-effect.md | @Entry
@Component
struct Index1 {
@State radius: number = 0;
@State text: string = '';
@State y: string = 'Finger not on the screen';
aboutToAppear() {
this.text = "Press a finger on the screen and slide up and down\n" + "Current finger position on the y-axis: " + this.y +
"\n" + "Blur radius:" + this.... |
application-dev\ui\arkts-blur-effect.md | @Entry
@Component
struct BackDropBlurStyleDemo {
build() {
Grid() {
GridItem() {
Column() {
Column() {
Text('Original')
.fontSize(20)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.width('100%')
.heigh... |
application-dev\ui\arkts-blur-effect.md | @Entry
@Component
struct ForegroundBlurStyleDemo {
build() {
Grid() {
GridItem() {
Column() {
Column() {
Text('Original')
.fontSize(20)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.width('100%')
.hei... |
application-dev\ui\arkts-blur-effect.md | import { curves } from '@kit.ArkUI';
@Entry
@Component
struct motionBlurTest {
@State widthSize: number = 400
@State heightSize: number = 320
@State flag: boolean = true
@State radius: number = 0
@State x: number = 0
@State y: number = 0
build() {
Column() {
Column() {
Image($r('app.me... |
application-dev\ui\arkts-color-effect.md | @Entry
@Component
struct LinearGradientDemo {
build() {
Grid() {
GridItem() {
Column() {
Text('angle: 180')
.fontSize(15)
}
.width(100)
.height(100)
.justifyContent(FlexAlign.Center)
.borderRadius(10)
.linearGradient({
/... |
application-dev\ui\arkts-color-effect.md | @Entry
@Component
struct SweepGradientDemo {
build() {
Grid() {
GridItem() {
Column() {
Text('center: 50')
.fontSize(15)
}
.width(100)
.height(100)
.justifyContent(FlexAlign.Center)
.borderRadius(10)
.sweepGradient({
cen... |
application-dev\ui\arkts-color-effect.md | @Entry
@Component
struct radialGradientDemo {
build() {
Grid() {
GridItem() {
Column() {
Text('center: 50')
.fontSize(15)
}
.width(100)
.height(100)
.justifyContent(FlexAlign.Center)
.borderRadius(10)
.radialGradient({
c... |
application-dev\ui\arkts-common-components-button.md | Button(label?: ResourceStr, options?: { type?: ButtonType, stateEffect?: boolean }) |
application-dev\ui\arkts-common-components-button.md | Button('Ok', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(8)
.backgroundColor(0x317aff)
.width(90)
.height(40) |
application-dev\ui\arkts-common-components-button.md | Button(options?: {type?: ButtonType, stateEffect?: boolean}) |
application-dev\ui\arkts-common-components-button.md | Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
Image($r('app.media.loading')).width(20).height(40).margin({ left: 12 })
Text('loading').fontSize(12).fontColor(0xffffff).margin({ left: 5, right: 12 })
}.alignItems(VerticalAlign.Center)
}.borderRadius(8).backgroundColor(0x317aff).w... |
application-dev\ui\arkts-common-components-button.md | Button('Disable', { type: ButtonType.Capsule, stateEffect: false })
.backgroundColor(0x317aff)
.width(90)
.height(40) |
application-dev\ui\arkts-common-components-button.md | Button('Circle', { type: ButtonType.Circle, stateEffect: false })
.backgroundColor(0x317aff)
.width(90)
.height(90) |
application-dev\ui\arkts-common-components-button.md | Button('Ok', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(8)
.backgroundColor(0x317aff)
.width(90)
.height(40) |
application-dev\ui\arkts-common-components-button.md | Button('Disable', { type: ButtonType.ROUNDED_RECTANGLE, stateEffect: true })
.backgroundColor(0x317aff)
.width(90)
.height(40) |
application-dev\ui\arkts-common-components-button.md | Button('circle border', { type: ButtonType.Normal })
.borderRadius(20)
.height(40) |
application-dev\ui\arkts-common-components-button.md | Button('font style', { type: ButtonType.Normal })
.fontSize(20)
.fontColor(Color.Pink)
.fontWeight(800) |
application-dev\ui\arkts-common-components-button.md | Button('background color').backgroundColor(0xF55A42) |
application-dev\ui\arkts-common-components-button.md | let MarLeft: Record<string, number> = { 'left': 20 }
Button({ type: ButtonType.Circle, stateEffect: true }) {
Image($r('app.media.ic_public_delete_filled')).width(30).height(30)
}.width(55).height(55).margin(MarLeft).backgroundColor(0xF55A42) |
application-dev\ui\arkts-common-components-button.md | Button('Ok', { type: ButtonType.Normal, stateEffect: true })
.onClick(()=>{
console.info('Button onClick')
}) |
application-dev\ui\arkts-common-components-button.md | // xxx.ets
@Entry
@Component
struct ButtonCase1 {
pathStack: NavPathStack = new NavPathStack();
@Builder
PageMap(name: string) {
if (name === "first_page") {
pageOneTmp()
} else if (name === "second_page") {
pageTwoTmp()
} else if (name === "third_page") {
pa... |
application-dev\ui\arkts-common-components-button.md | // xxx.ets
@Entry
@Component
struct ButtonCase2 {
build() {
Column() {
TextInput({ placeholder: 'input your username' }).margin({ top: 20 })
TextInput({ placeholder: 'input your password' }).type(InputType.Password).margin({ top: 20 })
Button('Register').width(300).margin({ top: ... |
application-dev\ui\arkts-common-components-button.md | // xxx.ets
@Entry
@Component
struct HoverButtonExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
build() {
Stack() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item:number) => {
ListItem() {
Text('' + item)
.wi... |
application-dev\ui\arkts-common-components-custom-dialog.md | @CustomDialog
struct CustomDialogExample {
controller: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample({}),
})
build() {
Column() {
Text('I am content')
.fontSize(20)
}.height(60).justifyContent(FlexAlign.Center)
}
... |
application-dev\ui\arkts-common-components-custom-dialog.md | @Entry
@Component
struct CustomDialogUser {
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample(),
})
} |
application-dev\ui\arkts-common-components-custom-dialog.md | @Entry
@Component
struct CustomDialogUser {
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample(),
})
build() {
Column() {
Button('click me')
.onClick(() => {
this.dialogController.open()
... |
application-dev\ui\arkts-common-components-custom-dialog.md | @CustomDialog
struct CustomDialogExample {
cancel?: () => void
confirm?: () => void
controller: CustomDialogController
build() {
Column() {
Text('I am content').fontSize(20).margin({ top: 10, bottom: 10 })
Flex({ justifyContent: FlexAlign.SpaceAround }) {
B... |
application-dev\ui\arkts-common-components-custom-dialog.md | @Entry
@Component
struct CustomDialogUser {
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample({
cancel: ()=> { this.onCancel() },
confirm: ()=> { this.onAccept() },
}),
})
onCancel() {
console.info('Callba... |
application-dev\ui\arkts-common-components-custom-dialog.md | // Index.ets
@CustomDialog
struct CustomDialogExample {
@Link textValue: string
controller?: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column({ space: 20 }) {
if (this.textValue != '') {
Text(`C... |
application-dev\ui\arkts-common-components-custom-dialog.md | // Index2.ets
@Entry
@Component
struct Index2 {
@State message: string =' Back';
build() {
Column() {
Button(this.message)
.type(ButtonType.Capsule)
.onClick(() => {
this.getUIContext().getRouter().back({
url: 'pages/Index',
... |
application-dev\ui\arkts-common-components-custom-dialog.md | @CustomDialog
struct CustomDialogExample {
controller?: CustomDialogController
build() {
Column() {
Text('Whether to change a text?').fontSize(16).margin({ bottom: 10 })
}
}
}
@Entry
@Component
struct CustomDialogUser {
@State textValue: string = ''
@State inputValue: string = 'click me'
dia... |
application-dev\ui\arkts-common-components-custom-dialog.md | @CustomDialog
struct CustomDialogExample {
controller?: CustomDialogController
build() {
Column() {
Text('I am content').fontSize(16).margin({ bottom: 10 })
}
}
}
@Entry
@Component
struct CustomDialogUser {
@State textValue: string = ''
@State inputValue: string = 'Click Me'
dialogController... |
application-dev\ui\arkts-common-components-custom-dialog.md | @CustomDialog
struct CustomDialogExampleTwo {
controllerTwo?: CustomDialogController
@State message: string = "I'm the second dialog box."
@State showIf: boolean = false;
build() {
Column() {
if (this.showIf) {
Text("Text")
.fontSize(30)
.height(100)
}
Text(this... |
application-dev\ui\arkts-common-components-progress-indicator.md | Progress(options: {value: number, total?: number, type?: ProgressType}) |
application-dev\ui\arkts-common-components-progress-indicator.md | Progress({ value: 24, total: 100, type: ProgressType.Linear }) // Create a linear progress indicator whose total progress is 100 and initial progress is 24. |
application-dev\ui\arkts-common-components-progress-indicator.md | Progress({ value: 20, total: 100, type: ProgressType.Linear }).width(200).height(50)
Progress({ value: 20, total: 100, type: ProgressType.Linear }).width(50).height(200) |
application-dev\ui\arkts-common-components-progress-indicator.md | // The progress indicator in the indeterminate ring style on the left: Retain its default settings for the foreground color (blue gradient) and stroke width (2.0 vp).
Progress({ value: 40, total: 150, type: ProgressType.Ring }).width(100).height(100)
// The right progress indicator in the indeterminate ring style o... |
application-dev\ui\arkts-common-components-progress-indicator.md | Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100).height(100)
.backgroundColor(Color.Black)
.style({ scaleCount: 20, scaleWidth: 5 }) // Set the total number of scales to 20 and the scale width to 5 vp.
Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100)... |
application-dev\ui\arkts-common-components-progress-indicator.md | // The progress indicator in the eclipse style on the left: Retain its default settings for the foreground color (blue).
Progress({ value: 10, total: 150, type: ProgressType.Eclipse }).width(100).height(100)
// The progress indicator in the eclipse style on the right: Set its foreground color to gray.
Progress({ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.