列表圆角修改

Signed-off-by: fanchenxuan <fanchenxuan@huawei.com>
This commit is contained in:
fanchenxuan 2023-08-07 11:24:36 +08:00
parent 09a6d7be82
commit 24d5abee38
10 changed files with 59 additions and 58 deletions

View File

@ -21,7 +21,7 @@ export struct backBar {
@Prop title: string; // return title name
@Prop recordable: boolean;
@State record: string = '';
@State isToush: string = '';
@State isTouch: string = '';
@State isBack: boolean = false;
@State isMore: boolean = false;
@ -110,7 +110,7 @@ export struct backBar {
.height(Constants.LISTITEM_ROW_HEIGHT)
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === 'true') ? {
.linearGradient((this.isTouch === 'true') ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -121,10 +121,10 @@ export struct backBar {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = 'true';
this.isTouch = 'true';
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
.onClick(() => {

View File

@ -100,7 +100,6 @@ export default class Constants {
static IMAGE_WIDTH_RECORD = 24;
static IMAGE_HEIGHT_RECORD_APPLICATION = 16;
static IMAGE_WIDTH_RECORD_APPLICATION = 16;
static BORDER_RADIUS = 24;
static TITLE_MARGIN_BOTTOM = 16;
static SUBTITLE_MIN_HEIGHT = 48;
static SUBTITLE_LINE_HEIGHT = 24;

View File

@ -68,7 +68,7 @@ struct appNamePlusPage {
@State bannedListItem: permissionObj[] = []; // array of forbidden permissions
@State routerData: ResourceObj = globalThis.applicationInfo; // Routing jump data
@State label: string = '';
@State isToush: string = '';
@State isTouch: string = '';
@Builder ListItemLayout(item, index, status) {
ListItem() {
@ -114,7 +114,7 @@ struct appNamePlusPage {
}
}.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === item.group) ? {
.linearGradient((this.isTouch === item.group) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -125,10 +125,10 @@ struct appNamePlusPage {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = item.group;
this.isTouch = item.group;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}
@ -298,7 +298,7 @@ struct appNamePlusPage {
}.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT })
}
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM })
}.margin({ top: Constants.ROW_MARGIN_TOP })
.padding({ left: Constants.SECONDARY_LIST_PADDING_LEFT, right: Constants.SECONDARY_LIST_PADDING_RIGHT })
@ -327,7 +327,7 @@ struct appNamePlusPage {
}, item => JSON.stringify(item))
}
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
}.margin({ top: Constants.ROW_MARGIN_TOP })
.padding({
@ -358,7 +358,7 @@ struct appNamePlusPage {
}, item => JSON.stringify(item))
}
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
}.margin({ top: Constants.ROW_MARGIN_TOP })
.padding({

View File

@ -120,7 +120,7 @@ struct mediaDocumentItem {
@State accurateIsOn: boolean = true;
@State api: number = 0;
@State isRisk: boolean = false; // Whether it is a risky application
@State isToush: number = -1;
@State isTouch: number = -1;
@State reason: string = '';
@State label: string = '';
@State version: string = '';
@ -431,7 +431,7 @@ struct mediaDocumentItem {
}
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === index) ? {
.linearGradient((this.isTouch === index) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -442,16 +442,16 @@ struct mediaDocumentItem {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = index;
this.isTouch = index;
}
if (event.type === TouchType.Up) {
this.isToush = -1;
this.isTouch = -1;
}
})
.margin({ top: Constants.TERTIARY_LISTITEM_MARGIN_TOP })
}, item => JSON.stringify(item))
}
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.padding(Constants.LIST_PADDING_TOP)
@ -487,7 +487,7 @@ struct mediaDocumentItem {
top: Constants.TERTIARY_LIST_PADDING_TOP,
bottom: Constants.TERTIARY_LIST_PADDING_BOTTOM
})
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
Row() {

View File

@ -147,7 +147,7 @@ struct authorityManagementPage {
}
}.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === item.group) ? {
.linearGradient((this.isTouch === item.group) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -158,10 +158,10 @@ struct authorityManagementPage {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = item.group;
this.isTouch = item.group;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}
@ -169,7 +169,7 @@ struct authorityManagementPage {
@State allPermissionApplications: permissionApplications [] = []; // All app permissions
@State allGroupPermission: groupPermission[] = []; // All group permissions
@State currentIndex: number = 0;
@State isToush: string = '';
@State isTouch: string = '';
@Builder TabBuilder(index: number) {
Flex({ alignItems: index ? ItemAlign.Start : ItemAlign.End, justifyContent: FlexAlign.Center, direction: FlexDirection.Column }) {
Text(index ? $r('app.string.application') : $r('app.string.permission'))
@ -520,7 +520,7 @@ struct authorityManagementPage {
this.ListItemLayout(item, index == (this.getPermissionGroup(this.allGroupPermission, Constants.FIXED_GROUP).length - 1))
}, item => JSON.stringify(item))
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
.margin({ bottom: Constants.LIST_MARGIN_BOTTOM })
}
@ -531,7 +531,7 @@ struct authorityManagementPage {
this.ListItemLayout(item, index == (this.getPermissionGroup(this.allGroupPermission, Constants.CHANGE_GROUP).length - 1))
}, item => JSON.stringify(item))
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
.margin({ bottom: Constants.LIST_MARGIN_BOTTOM })
}
@ -543,7 +543,7 @@ struct authorityManagementPage {
this.ListItemLayout(item, index == (this.getPermissionGroup(this.allGroupPermission, Constants.EXTRA_GROUP).length - 1))
}, item => JSON.stringify(item))
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
.margin({ bottom: Constants.LIST_MARGIN_BOTTOM })
}
@ -555,11 +555,11 @@ struct authorityManagementPage {
this.ListItemLayout(item, Constants.SLICE_END_INDEX)
}, item => JSON.stringify(item))
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
}.margin({ bottom: Constants.AUTHORITY_ROW_MARGIN_BOTTOM })
}.height(Constants.FULL_HEIGHT)
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.clip(true)
}.padding({
left: Constants.MANAGEMENT_ROW_PADDING_LEFT,
@ -601,7 +601,7 @@ struct applicationItem {
@State applicationItem: any[] = globalThis.allBundleInfo; // application info array
@State searchResult: boolean = true; // search results
@State selectedIndex: number = 0;
@State isToush: string = '';
@State isTouch: string = '';
scroller: Scroller = new Scroller();
@Builder ListItemLayout(item, index) {
@ -654,7 +654,7 @@ struct applicationItem {
}
}.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === item.bundleName) ? {
.linearGradient((this.isTouch === item.bundleName) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -665,10 +665,10 @@ struct applicationItem {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = item.bundleName;
this.isTouch = item.bundleName;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}
@ -704,7 +704,7 @@ struct applicationItem {
this.ListItemLayout(item, index)
}, item => JSON.stringify(item))
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
.onScrollIndex((start, end) => {
globalThis.scroller = this.scroller;
@ -715,7 +715,7 @@ struct applicationItem {
}
})
}.margin({ left: Constants.MANAGEMENT_ROW_PADDING_LEFT })
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.clip(true)
}
}.height(Constants.FULL_HEIGHT)

View File

@ -69,7 +69,7 @@ struct appNameItem {
@State calendarListItem: CalendarObj[] = []; // Permission management secondary interface data array
private routerData: any = router.getParams()['routerData']; // Routing jump data
private group = router.getParams()['group'];
@State isToush: string = '';
@State isTouch: string = '';
@Builder ListItemLayout(item, index) {
ListItem() {
@ -111,7 +111,7 @@ struct appNameItem {
}
}.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === item.permissionName) ? {
.linearGradient((this.isTouch === item.permissionName) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -122,10 +122,10 @@ struct appNameItem {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = item.permissionName;
this.isTouch = item.permissionName;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}
@ -172,7 +172,8 @@ struct appNameItem {
.height(Constants.LISTITEM_ROW_HEIGHT)
.padding({ left: Constants.DEFAULT_PADDING_START, right: Constants.DEFAULT_PADDING_END })
}
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg')).borderRadius(Constants.BORDER_RADIUS)
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
}.margin({ top: Constants.ROW_MARGIN_TOP })
.padding({ left: Constants.LIST_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT })

View File

@ -154,7 +154,7 @@ struct applicationItem {
@Link polymorphismIsOn: Array<boolean>;
@State globalIsOn: boolean = true;
@State selectedIndex: number = 0;
@State isToush: string = '';
@State isTouch: string = '';
scroller: Scroller = new Scroller();
privacyDialogController: CustomDialogController = new CustomDialogController({
@ -282,7 +282,7 @@ struct applicationItem {
.enabled(!this.isRisk[item.index])
.opacity(this.isRisk[item.index] ? $r('sys.float.ohos_id_alpha_disabled') : 1)
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === item.bundleName) ? {
.linearGradient((this.isTouch === item.bundleName) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -293,10 +293,10 @@ struct applicationItem {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down && polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) {
this.isToush = item.bundleName;
this.isTouch = item.bundleName;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}
@ -479,7 +479,7 @@ struct applicationItem {
.padding({ left: Constants.DEFAULT_PADDING_START, right: Constants.DEFAULT_PADDING_END })
}.padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM })
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.margin({ top: Constants.TERTIARY_ROW_MARGIN_TOP })
}
Flex({ justifyContent: FlexAlign.Start }) {
@ -521,7 +521,7 @@ struct applicationItem {
}, item => JSON.stringify(item))
}
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
.onScrollIndex((start, end) => {
globalThis.scroller = this.scroller;

View File

@ -314,7 +314,7 @@ struct applicationItem {
}, item => JSON.stringify(item))
}
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM })
.onScrollIndex((start, end) => {
globalThis.scroller = this.scroller;

View File

@ -77,7 +77,7 @@ struct appNamePage {
@Component
struct appNameItem {
@State otherPermissionListItem: string[] = otherPermissionList; // Other permission interface data array
@State isToush: string = '';
@State isTouch: string = '';
@Builder ListItemLayout(item, index) {
ListItem() {
@ -121,7 +121,7 @@ struct appNameItem {
}
}.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === item.permission) ? {
.linearGradient((this.isTouch === item.permission) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -132,10 +132,10 @@ struct appNameItem {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = item.permission;
this.isTouch = item.permission;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}
@ -152,7 +152,8 @@ struct appNameItem {
ForEach(this.otherPermissionListItem.slice(Constants.SLICE_END), (item) => {
this.ListItemLayout(item, Constants.SLICE_END_INDEX)
}, item => JSON.stringify(item))
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg')).borderRadius(Constants.BORDER_RADIUS)
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
.padding(Constants.LIST_PADDING_TOP)
}.margin({ top: Constants.ROW_MARGIN_TOP })
.padding({ left: Constants.LIST_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT })

View File

@ -50,7 +50,7 @@ struct permissionRecordPage {
@State strings: StringObj = new StringObj('', '');
@State currentIndex: number = 0;
@State show: boolean = false;
@State isToush: string = '';
@State isTouch: string = '';
@Builder TabBuilder(index: number) {
Flex({ alignItems: index ? ItemAlign.Start : ItemAlign.End, justifyContent: FlexAlign.Center, direction: FlexDirection.Column }) {
Text(index ? $r('app.string.application') : $r('app.string.permission'))
@ -208,7 +208,7 @@ struct permissionRecordPage {
})
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === permissionApplication.name) ? {
.linearGradient((this.isTouch === permissionApplication.name) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -219,10 +219,10 @@ struct permissionRecordPage {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = permissionApplication.name;
this.isTouch = permissionApplication.name;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}, item => JSON.stringify(item))
@ -277,7 +277,7 @@ struct permissionRecordPage {
})
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
.linearGradient((this.isToush === permission.name) ? {
.linearGradient((this.isTouch === permission.name) ? {
angle: 90,
direction: GradientDirection.Right,
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
@ -288,10 +288,10 @@ struct permissionRecordPage {
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isToush = permission.name;
this.isTouch = permission.name;
}
if (event.type === TouchType.Up) {
this.isToush = '';
this.isTouch = '';
}
})
}, item => JSON.stringify(item))
@ -301,7 +301,7 @@ struct permissionRecordPage {
}.padding(Constants.LIST_PADDING_TOP)
.margin({ bottom: Constants.LISTITEM_MARGIN_BOTTOM })
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
.borderRadius(Constants.BORDER_RADIUS)
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
}
build() {