Skip to content

Commit

Permalink
优化语法写法,以适配最新的 api12 和 ide,hvigor 5.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
zmtzawqlp committed Jun 18, 2024
1 parent b273445 commit 5bd3c1f
Show file tree
Hide file tree
Showing 17 changed files with 240 additions and 315 deletions.
6 changes: 3 additions & 3 deletions build-profile.json5
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"app": {
"compileSdkVersion": 9,
"compatibleSdkVersion": 9,
"products": [
{
"name": "default",
"signingConfig": "default"
"signingConfig": "default",
"compatibleSdkVersion": "4.0.0(10)",
"runtimeOS": "HarmonyOS"
}
],
"buildModeSet": [
Expand Down
75 changes: 38 additions & 37 deletions entry/src/main/ets/pages/Index.ets
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ struct Index {

@Builder
buildLikeCountWidget($$: LikeCountWidgetBuilderParam) {
if ($$.likeCount == 0)
if ($$.likeCount == 0) {
Text('love')
else
} else {
Text(`${$$.showText}`)
}
}

@Builder
Expand All @@ -83,10 +84,11 @@ struct Index {

@Builder
buildLikeCountWidget2($$: LikeCountWidgetBuilderParam) {
if ($$.likeCount >= 1000)
if ($$.likeCount >= 1000) {
Text(`${($$.likeCount / 1000).toFixed(1)}k`).fontColor($$.isLiked ? '#FF004D40' : Color.Gray)
else
} else {
Text(`${$$.showText}`).fontColor($$.isLiked ? '#FF004D40' : Color.Gray)
}
}

@Builder
Expand All @@ -108,7 +110,6 @@ struct Index {
}
)
}

GridItem() {
LikeButton(
{
Expand All @@ -117,14 +118,14 @@ struct Index {
return true;
},
likeWidgetBuilder: this.buildLikeWidget1,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: '#ff33b5e5',
dotSecondaryColor: '#ff0099cc',
},),
circleColor: new CircleColor({
},
circleColor: {
start: '#ff00ddff',
end: '#ff0099cc',
}),
},
}
)
}
Expand All @@ -134,14 +135,14 @@ struct Index {
{
likeCount: 888,
likeWidgetBuilder: this.buildLikeWidget2,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: new DartColor(0xff669900),
dotSecondaryColor: new DartColor(0xff99cc00),
},),
circleColor: new CircleColor({
},
circleColor: {
start: new DartColor(0xff669900),
end: new DartColor(0xff669900),
}),
},
flexOptions: {
direction: FlexDirection.RowReverse,
justifyContent: FlexAlign.Center,
Expand All @@ -156,14 +157,14 @@ struct Index {
{
likeCount: 888,
likeWidgetBuilder: this.buildLikeWidget3,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: '#FFE57373',
dotSecondaryColor: '#FFEF9A9A',
},),
circleColor: new CircleColor({
},
circleColor: {
start: '#FFFF8A80',
end: '#FFFF1744',
}),
},
flexOptions: {
direction: FlexDirection.Column,
justifyContent: FlexAlign.Center,
Expand All @@ -178,14 +179,14 @@ struct Index {
{
likeCount: 888,
likeWidgetBuilder: this.buildLikeWidget4,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: '#FF4FC3F7',
dotSecondaryColor: '#FF81D4FA',
},),
circleColor: new CircleColor({
},
circleColor: {
start: '#FFFF4081',
end: '#FFF50057',
}),
},
flexOptions: {
direction: FlexDirection.ColumnReverse,
justifyContent: FlexAlign.Center,
Expand All @@ -200,14 +201,14 @@ struct Index {
{
likeCount: 0,
likeWidgetBuilder: this.buildLikeWidget5,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: '#FF757575',
dotSecondaryColor: '#FFEEEEEE',
},),
circleColor: new CircleColor({
},
circleColor: {
start: '#FFEEEEEE',
end: '#FFBDBDBD',
}),
},
likeCountWidgetBuilder: this.buildLikeCountWidget,
}
)
Expand All @@ -218,14 +219,14 @@ struct Index {
{
likeCount: 888,
likeWidgetBuilder: this.buildLikeWidget6,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: '#FF304FFE',
dotSecondaryColor: '#FF536DFE',
},),
circleColor: new CircleColor({
},
circleColor: {
start: '#FF536DFE',
end: '#FF3D5AFE',
}),
},
likeCountWidgetBuilder: this.buildLikeCountWidget1,
}
)
Expand All @@ -236,14 +237,14 @@ struct Index {
{
likeCount: 888,
likeWidgetBuilder: this.buildLikeWidget7,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: '#FFFB8C00',
dotSecondaryColor: '#FFFFCC80',
},),
circleColor: new CircleColor({
},
circleColor: {
start: '#FFFFCC80',
end: '#FFFFA726',
}),
},
likeCountAnimationType: LikeCountAnimationType.all,
}
)
Expand All @@ -254,14 +255,14 @@ struct Index {
{
likeCount: 999,
likeWidgetBuilder: this.buildLikeWidget8,
bubblesColor: new BubblesColor({
bubblesColor: {
dotPrimaryColor: '#FF00796B',
dotSecondaryColor: '#FF004D40',
},),
circleColor: new CircleColor({
},
circleColor: {
start: '#FF26A69A',
end: '#FFB2DFDB',
}),
},
likeCountWidgetBuilder: this.buildLikeCountWidget2,
}
)
Expand Down
5 changes: 2 additions & 3 deletions hvigor/hvigor-config.json5
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"hvigorVersion": "3.0.9",
"modelVersion": "5.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "3.0.9"
},
"execution": {
// "daemon": true, /* Enable daemon compilation. Default: true */
Expand All @@ -15,4 +14,4 @@
"debugging": {
// "stacktrace": false /* Disable stacktrace compilation. Default: false */
}
}
}
1 change: 0 additions & 1 deletion hvigor/hvigor-wrapper.js

This file was deleted.

48 changes: 0 additions & 48 deletions hvigorw

This file was deleted.

64 changes: 0 additions & 64 deletions hvigorw.bat

This file was deleted.

17 changes: 17 additions & 0 deletions like_button/BuildProfile.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.2';
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const TARGET_NAME = 'default';

/**
* BuildProfile Class is used only for compatibility purposes.
*/
export default class BuildProfile {
static readonly HAR_VERSION = HAR_VERSION;
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
static readonly DEBUG = DEBUG;
static readonly TARGET_NAME = TARGET_NAME;
}
4 changes: 4 additions & 0 deletions like_button/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.2

* 优化语法写法,以适配最新的 api12 和 ide,hvigor 5.0.0.

## 1.0.1

* 优化语法写法,以适配最新的 api 和 ide
Expand Down
2 changes: 1 addition & 1 deletion like_button/build-profile.json5
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"runtimeOS": "HarmonyOS"
}
]
}
}
2 changes: 1 addition & 1 deletion like_button/oh-package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Like Button 支持推特点赞效果和点赞数量动画的 ArkUI 库.",
"main": "Index.ets",
"repository": "https://github.com/HarmonyCandies/like_button",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/HarmonyCandies/like_button",
"dependencies": {}
}
4 changes: 2 additions & 2 deletions like_button/src/main/ets/common/Controller.ets
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { Cubic, DecelerateCurve, Interval, OvershootCurve } from './Curve';

namespace like_button {
export class Controller {
onTap: () => void;
onTap?: () => void | undefined = undefined;

Tap() {
if (this.onTap != undefined) {
this.onTap();
}
}
}
}
}

Expand Down
Loading

0 comments on commit 5bd3c1f

Please sign in to comment.