SwipeActions
์์ผ๋ก ๋ฐ๋ฉด ํ ๋ค์์ ์ก์ ์ด ๋๋ฌ๋๋ ๋ชฉ๋ก ํ โ ๋ณด๊ด ยท ๊ณ ์ ยท ์ญ์ ๊ฐ์ ๋์์ ํ์์ ๋ฐ๋ก ์คํ
๋ชฉ์ฐจ
SwipeActions ๋ ๋ชฉ๋ก ํ์ ์์ผ๋ก ๋ฐ๋ฉด ๊ทธ ๋ค์์ ์ก์
๋ฒํผ์ด ๋๋ฌ๋๋ ์ปดํฌ๋ํธ์
๋๋ค. ๋ณด๊ด ยท ๊ณ ์ ยท ์ญ์ ์ฒ๋ผ ํ ๋ฒ์ ๋๋๋ ๋์์ ํ์ ์ด์ง ์๊ณ ๊ณง๋ฐ๋ก ์คํํ ๋ ์๋๋ค. ํ์
child ์ด๊ณ , ์์ ์ชฝ ๊ฐ์ฅ์๋ฆฌ(leadingActions)์ ๋ ์ชฝ ๊ฐ์ฅ์๋ฆฌ(trailingActions)์ ์ก์
์ ๋ฐ๋ก ๋ก๋๋ค.
์ก์
์ Button ์ ํฉ์ฑํด ๊ทธ๋ฆฝ๋๋ค. ์ด ์ปดํฌ๋ํธ๊ฐ ์ ํ๋ ๊ฒ์ ๋ฒํผ์ด ๋์ด๋ ์๋ฆฌ์ ํ์ด ์์ง์ด๋ ๊ฑฐ๋ฆฌ๋ฟ์ด๋ผ, ๋ฒํผ์ ํ
๋ง๋ฅผ ๋ฐ๊พธ๋ฉด ์ก์
๋ ๊ฐ์ด ๋ฐ๋๋๋ค. ํ์ด ์ด๋๊น์ง ๋ฐ๋ผ์ค๋์ง ยท ๋์์ ๋ ์ด๋์ ๋ฉ์ถ๋์ง ยท ์ด๋ ์ ๋ ๋น๊ธฐ๋ฉด ์ฒซ ์ก์
์ด ์คํ๋๋์ง๋ ์์น์ ํ์ ์ด๋ผ Core ๊ฐ ํ ๋ฒ๋ก ์ ํ๊ณ , Flutter ์ Web ์ด ๊ฐ์ ๋ต์ ์๋๋ค. ๊ฐ์ ๋น๊น์ ๋ ํ๋ซํผ์์ ๊ฐ์ ๊ฒฐ๊ณผ๋ฅผ ๋
๋๋ค.
๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ (Basic Usage)#
SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: handleArchive,
),
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: handleDelete,
),
],
child: Basic(
leading: const Icon(LucideIcons.mail),
title: const Text('์ฃผ๊ฐ ๋ณด๊ณ ์'),
subtitle: const Text('์ด๋ฒ ์ฃผ ์งํ ์ํฉ์ ์ ๋ฆฌํ์ด์'),
),
)
SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: handleArchive,
),
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: handleDelete,
),
],
child: Basic(
leading: const Icon(LucideIcons.mail),
title: Text('์ฃผ๊ฐ ๋ณด๊ณ ์'),
subtitle: Text('์ด๋ฒ ์ฃผ ์งํ ์ํฉ์ ์ ๋ฆฌํ์ด์'),
),
)
์ฒซ ๋ฒ์งธ ์ก์ ์ด ๊ฐ์ฅ ๋ฐ๊นฅ, ๊ณง ํ๋ฉด ๊ฐ์ฅ์๋ฆฌ์ ๊ฐ์ฅ ๊ฐ๊น์ด ์นธ์ ๋๋ค. ์ ์ฒด ์ค์์ดํ๊ฐ ์คํํ๋ ๊ฒ๋ ์ด ์ก์ ์ ๋๋ค.
๋น ๋ฅธ ์ค๋ฒ๋ผ์ด๋ (Chain)#
์ด๋ฏธ ๋ง๋ SwipeActions ์ธ์คํด์ค์ ์คํ์ผ์ ๋น ๋ฅด๊ฒ ๋ง๋ถ์ด๊ณ ์ถ๋ค๋ฉด withStyle ์ฒด์ธ์ ์ธ ์ ์์ต๋๋ค. ์์ฑ์์ swipeActionsStyle
์ธ์์ ๋์ผํ๊ฒ ๋์ํ์ง๋ง, ์ด๋ฏธ ๊ตฌ์ฑ๋ ์์ ฏ ์์์ ๋ฐ๋ก ์ด์ด ์ธ ์ ์์ต๋๋ค.
class SwipeActionsChainExample extends StatelessWidget {
const SwipeActionsChainExample({super.key});
@override
Widget build(BuildContext context) {
return SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: () => debugPrint('Archived'),
),
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: () => debugPrint('Deleted'),
),
],
child: Basic(
leading: const Icon(LucideIcons.mail),
title: const Text('์ฃผ๊ฐ ๋ณด๊ณ ์'),
subtitle: const Text('์ด๋ฒ ์ฃผ ์งํ ์ํฉ์ ์ ๋ฆฌํ์ด์'),
),
).withStyle(
const CoreSwipeActionsStyle(
platterColor: CoreColor.token(CoreColors.surfaceContainer),
fullSwipeScale: 1.08,
),
);
}
}
class SwipeActionsChainExample extends StatelessComponent {
const SwipeActionsChainExample({super.key});
@override
Component build(BuildContext context) {
return SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: () => print('Archived'),
),
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: () => print('Deleted'),
),
],
child: Basic(
leading: const Icon(LucideIcons.mail),
title: Text('์ฃผ๊ฐ ๋ณด๊ณ ์'),
subtitle: Text('์ด๋ฒ ์ฃผ ์งํ ์ํฉ์ ์ ๋ฆฌํ์ด์'),
),
).withStyle(
const CoreSwipeActionsStyle(
platterColor: CoreColor.token(CoreColors.surfaceContainer),
fullSwipeScale: 1.08,
),
);
}
}
Live Preview#
์ฝ๋ ๋ณด๊ธฐ
class SwipeActionsDefaultExample extends StatelessComponent {
const SwipeActionsDefaultExample({super.key});
@override
Component build(BuildContext context) {
return SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: () => print('Archived'),
),
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: () => print('Deleted'),
),
],
child: Basic(
leading: const Icon(LucideIcons.mail),
title: Text('์ฃผ๊ฐ ๋ณด๊ณ ์'),
subtitle: Text('์ด๋ฒ ์ฃผ ์งํ ์ํฉ์ ์ ๋ฆฌํ์ด์'),
),
);
}
}
class SwipeActionsDefaultExample extends StatelessWidget {
const SwipeActionsDefaultExample({super.key});
@override
Widget build(BuildContext context) {
return SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: () => debugPrint('Archived'),
),
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: () => debugPrint('Deleted'),
),
],
child: Basic(
leading: const Icon(LucideIcons.mail),
title: const Text('์ฃผ๊ฐ ๋ณด๊ณ ์'),
subtitle: const Text('์ด๋ฒ ์ฃผ ์งํ ์ํฉ์ ์ ๋ฆฌํ์ด์'),
),
);
}
}
ํ์ ์์ผ๋ก ๋์ด ๋ณด์ธ์. ๋ ๋ฒ์งธ ์์ ๋ SwipeActionScope ๋ก ๋ ํ์ ๊ฐ์ธ, ํ ํ์ ์ด๋ฉด ๋ค๋ฅธ ํ์ด ๋ซํ๋๋ค.
๊ตฌ์กฐ (Anatomy)#
trailingActions ๊ฐ ๋๋ฌ๋ ๋ชจ์ต (ํ์ ์์ ์ชฝ์ผ๋ก ๋ฐ์์ ๋)
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ
โ child โ (icon) (icon) โ // platter: ํ ๋ค์ ๋์ธ ๋
โ โ label label โ // ํ์ด ๋น์ผ ์ค ํญ๋ง ๋ณด์ธ๋ค
โโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ
row โ ๋ฐ๋ฆฐ ๋งํผ ์ด๋ platter
| ๋ถ๋ถ | ์ญํ | ์ฌ๋กฏ |
|---|---|---|
child | ์์ผ๋ก ๋ฐ๋ฆฌ๋ ํ ๋ณธ๋ฌธ | child |
platter |
ํ ๋ค, ๊ฐ์ฅ์๋ฆฌ์ ๋์ธ ๋ . ํ์ด ๋น์ผ ์ค ํญ๋งํผ๋ง ๋ณด์ธ๋ค | leadingActions ยท trailingActions |
action |
๊ณ ์ ๋๋น ์นธ ํ๋ โ ์ํ ๋ฒํผ๊ณผ ๊ทธ ์๋ ๋ผ๋ฒจ | CoreSwipeAction |
icon | ์ํ ๋ฒํผ ์์ ๊ธ๋ฆฌํ | CoreSwipeAction.icon |
label | ๋ฒํผ ์๋ ํ ์ค ์ด๋ฆ | CoreSwipeAction.label |
์ฌ์ฉ ์๊ธฐ (When to Use)#
์ด ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฉํ์ธ์:
- ๋ชฉ๋ก์ ๊ฐ ํ์์ ๋ณด๊ด ยท ๊ณ ์ ยท ์ญ์ ์ฒ๋ผ ํ๋ ๋ฒ์ ๋๋๋ ๋์์ด ๋ฐ๋ณต๋ ๋
- ํฐ์น ํ๋ฉด์์ ํ๋ง๋ค ๋ฒํผ์ ๋์ด๋์ผ๋ฉด ๋ชฉ๋ก์ด ์ด์์ ํด์ง ๋ โ ๋์์ด ํ ๋ค์ ์จ์๋ค๊ฐ ๋ฐ๋ฉด ๋๋ฌ๋ฉ๋๋ค
- ๊ฐ์ฅ ํํ ๋์ ํ๋๋ฅผ ๊ธธ๊ฒ ๋ฐ์ด ํ ๋ฒ์ ๋๋ด๊ฒ ํ๊ณ ์ถ์ ๋(์ ์ฒด ์ค์์ดํ)
๋์ ๋ค๋ฅธ ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฉํ์ธ์:
- Button: ๋์์ด ๋ ๋ณด์ฌ์ผ ํ ๋. ๋ฐ๊ธฐ๋ ๋์ ๋ณด์ด์ง ์๋ ์กฐ์์ด๋ผ ๋ง์ฐ์ค ์ฌ์ฉ์๊ฐ ๋ฐ๊ฒฌํ๊ธฐ ์ด๋ ต์ต๋๋ค. ์ด ์ปดํฌ๋ํธ๋ ๊ฐ์ ๋์์ ์ง๋ฆ๊ธธ์ด๋ฏ๋ก, ํ์ ๋์ ๋ณด์ด๋ ๊ฒฝ๋ก๊ฐ ๋ฐ๋ก ์๋ ํธ์ด ์ข์ต๋๋ค
- DropdownMenu ยท ContextMenu: ๋์์ด ์๋ ๊ฐ๋ฅผ ๋์ด ํ ์ค ๋ฐํ์ ๋ด๊ธฐ ์ด๋ ค์ธ ๋
- Swiper: ํ์ ๋์์ด ์๋๋ผ, ํ๋ฉด ๊ฐ์ฅ์๋ฆฌ์์ ๋ฐ์ด ๋ฉ๋ด๋ ์ํธ ๊ฐ์ ์ค๋ฒ๋ ์ด ํจ๋์ ์ด ๋
Props / Parameters#
W ๋ Flutter์ Widget, Web์ Jaspr Component ์
๋๋ค. W?
๋ ์ ํ ์ฌ๋กฏ์
๋๋ค.
| ์์ฑ | ํ์ | ๊ธฐ๋ณธ๊ฐ | ์ค๋ช |
|---|---|---|---|
child | W | ํ์ | ์์ผ๋ก ๋ฐ๋ฆฌ๋ ํ ๋ณธ๋ฌธ |
leadingActions |
List<CoreSwipeAction<W>> |
const [] |
์์ ์ชฝ ๊ฐ์ฅ์๋ฆฌ์ ์ก์ . ํ์ ๋ ์ชฝ์ผ๋ก ๋ฐ๋ฉด ๋๋ฌ๋จ. ์ฒซ ํญ๋ชฉ์ด ๊ฐ์ฅ ๋ฐ๊นฅ |
trailingActions |
List<CoreSwipeAction<W>> |
const [] |
๋ ์ชฝ ๊ฐ์ฅ์๋ฆฌ์ ์ก์ . ํ์ ์์ ์ชฝ์ผ๋ก ๋ฐ๋ฉด ๋๋ฌ๋จ. ์ฒซ ํญ๋ชฉ์ด ๊ฐ์ฅ ๋ฐ๊นฅ |
allowsFullSwipe |
bool |
true |
๊ธธ๊ฒ ๋ฐ๋ฉด ๊ทธ ์ชฝ ์ฒซ ์ก์
์ ์คํ. false ์ด๋ฉด ๋ฐํ์ ๋๊ธด ๋น๊น์ ์ ํญ์ด ๊ฑธ๋ฆฌ๊ณ ๋์ผ๋ฉด ์ด๋ฆผ |
fullSwipeThreshold |
double |
0.65 |
์ฒซ ์ก์ ์ด ์คํ๋๋ ๋น๊น ๊ฑฐ๋ฆฌ, ํ ๋๋น์ ๋น์จ. 0 ์ด๊ณผ 1 ์ดํ |
showLabels |
bool |
true |
๋ฒํผ ์๋์ ๋ผ๋ฒจ์ ๊ทธ๋ฆด์ง. false ์ฌ๋ ๋ผ๋ฒจ์ ์ ๊ทผ ๊ฐ๋ฅํ ์ด๋ฆ์ผ๋ก ๋จ์ |
enabled |
bool? |
null |
null ์ด๋ฉด ์ผ์ง. false ์ด๋ฉด ๋ฐ๋ฆฌ์ง ์๊ณ ๋ ๋ซํ ์์ |
swipeActionsStyle |
CoreSwipeActionsStyle? |
null |
๋ชจ๋ chrome ์ด ์ง๋๋ ๋จ์ผ ์ฌ๋กฏ (์๋ ํ ์ฐธ๊ณ ) |
์ก์ ์ด ์๋ ์ชฝ์ผ๋ก๋ ๋ฐ๋ฆฌ์ง ์์ต๋๋ค.
CoreSwipeAction ํ๋#
์ก์
ํ๋๋ ์์ ฏ์ด ์๋๋ผ ๋ฐ์ดํฐ์
๋๋ค. ๊ทธ๋ ค์ง๋ ๋ชจ์์ ํฉ์ฑ๋ Button ์ด ์ ํฉ๋๋ค.
| ํ๋ | ํ์ | ๊ธฐ๋ณธ๊ฐ | ์ค๋ช |
|---|---|---|---|
label |
String |
ํ์ | ์ก์
์ ์ด๋ฆ. ๋ฒํผ ์๋์ ๊ทธ๋ ค์ง๊ณ (showLabels), ์ด๋์๋ ์ ๊ทผ ๊ฐ๋ฅํ ์ด๋ฆ |
onPressed |
void Function() |
ํ์ | ๋ฒํผ์ ๋๋ฅด๊ฑฐ๋ ยท ์ ์ฒด ์ค์์ดํ๊ฐ ์คํํ๊ฑฐ๋ ยท ๋ณด์กฐ ๊ธฐ์ ์ด ๊ณ ๋ฅผ ๋ ํธ์ถ. ํธ์ถ ๋ค ํ์ด ๋ซํ |
icon |
W? |
null |
๋ฒํผ ์์ ๊ธ๋ฆฌํ. ๋ผ๋ฒจ์ ๋ฒํผ ์์ ๊ทธ๋ ค์ง์ง ์์ผ๋ฏ๋ก ์์ด์ฝ์ ๋๊น |
variant |
CoreSwipeActionVariant |
defaultVariant |
์ก์
์ ์๋ฏธ. defaultVariant ์ destructive |
enabled |
bool |
true |
false ์ด๋ฉด ๋นํ์ฑ์ผ๋ก ๊ทธ๋ ค์ง๊ณ , ์ ์ฒด ์ค์์ดํ์ "์ฒซ ์ก์
" ์์ ๋น ์ง๋ฉฐ, ๋ณด์กฐ ๊ธฐ์ ์ ์ก์
๋ชฉ๋ก์๋ ์์ |
SwipeActionScope#
| ์์ฑ | ํ์ | ๊ธฐ๋ณธ๊ฐ | ์ค๋ช |
|---|---|---|---|
child |
W |
ํ์ | ๋ฒ์๋ฅผ ๊ณต์ ํ๋ ํ์ ํธ๋ฆฌ. ์์ SwipeActions ํ๋ผ๋ฆฌ ํ ๋ฒ์ ํ ํ๋ง ์ด๋ฆผ |
CoreSwipeActionsStyle ํ๋#
| ํ๋ | ํ์ | ์ค๋ช |
|---|---|---|
actionWidth |
double? |
The width of one action cell (logical px). null โ [defaultActionWidth]. |
actionSpacing |
double? |
The space between neighbouring cells (logical px). null โ [defaultActionSpacing]. |
platterInset |
double? |
The space between a platter end and the cell next to it (logical px).
null
โ [defaultPlatterInset].
|
platterColor |
CoreColor? |
The platter's fill. null โ [defaultPlatterColor]. |
labelGapStyle |
CoreGapStyle? |
The space between a cell's button and its label. null โ [defaultLabelGapStyle]. |
labelStyle |
CoreTextStyle? |
The label's type and colour. null โ [defaultLabelStyle]. |
fullSwipeScale |
double? |
The first action's scale during a full-swipe pull, as a factor.
null
โ [defaultFullSwipeScale].
|
actionButtonStyle |
CoreButtonStyle? |
Chrome of the composed action buttons, forwarded raw to each
Button
. Deliberately has no default: each action is a circular
Button
of the
lg
rung in the variant its action asks for, and the chrome of that variant is the button's own to design. An empty partial here would only restate it, so
null
forwards nothing and the button resolves its own defaults.
|
์คํ์ผ ์์คํ (Style System)#
CoreSwipeActionsStyle ์ ๋ฐํ์ ๊ทธ๋ฆฌ๋ ์ซ์(actionWidth ยท actionSpacing
ยท platterInset ยท platterColor), ๋ผ๋ฒจ(labelGapStyle ยท labelStyle), ์ ์ฒด ์ค์์ดํ ์ ํธ(fullSwipeScale), ๊ทธ๋ฆฌ๊ณ ํฉ์ฑ๋ ๋ฒํผ์ ๊ทธ๋๋ก ์ ๋ฌ๋๋
actionButtonStyle ์ ๊ฐ์ง๋๋ค. ์ก์
์ ๋ฒํผ ๋ชจ์์ ์ด ์ฌ๋กฏ์ด ์๋๋ผ Button ์ ๊ฒ์
๋๋ค. ๋ณํ(defaultVariant
ยท destructive)์ด ๊ฐ๊ฐ Button ์ ๋ณํ์ ๊ณ ๋ฅด๋ฏ๋ก, ์ญ์ ์ก์
๋ง ๋ค๋ฅด๊ฒ ์น ํ๋ ค๋ฉด Button ์ ํ
๋ง๋ฅผ ๋ฐ๊ฟ๋๋ค.
actionButtonStyle ์ ์ผ๋ถ๋ฌ ๊ธฐ๋ณธ๊ฐ์ด ์์ต๋๋ค โ null ์ด๋ฉด ์๋ฌด๊ฒ๋ ์ ๋ฌํ์ง ์๊ณ , ๊ฐ ๋ฒํผ์ด ์๊ธฐ ๋ณํ์ chrome ์ ๊ทธ๋๋ก ๊ทธ๋ฆฝ๋๋ค.
Resolve chain#
design system default
โ CoreSwipeActionsTheme.style
โ widget.swipeActionsStyle
๋ณํ๋ณ ์ฌ๋กฏ(variantStyles)์ ์์ต๋๋ค. ์ก์
์ ๋ณํ์ Button ์ด ๊ทธ๋ฆฌ๊ธฐ ๋๋ฌธ์
๋๋ค.
์ด๋ฆฌ๋ ๊ฑฐ๋ฆฌ#
ํ์ด ์ด๋ฆฌ๋ ๊ฑฐ๋ฆฌ๋ ์นธ์ ์์ ์ด ์ฌ๋กฏ์ ์ธ ์ซ์๊ฐ ์ ํฉ๋๋ค. ์นธ ๋๋น๋ฅผ ๊ธ์๋ก ์ฌ์ง ์๊ณ ์ซ์๋ก ์ ํ๊ธฐ ๋๋ฌธ์, ๋ ํ๋ซํผ์ด ํ ์คํธ๋ฅผ ๋ฐฐ์นํ์ง ์๊ณ ๋ ๊ฐ์ ๊ฑฐ๋ฆฌ๋ฅผ ์๋๋ค.
๋ฐํ ๋๋น = 2 ร platterInset + n ร actionWidth + (n โ 1) ร actionSpacing
๊ธฐ๋ณธ๊ฐ์์ ์ก์
์ด ํ๋๋ฉด 72, ๋์ด๋ฉด 132, ์
์ด๋ฉด 192 ์
๋๋ค. ๋ผ๋ฒจ์ ์นธ ๋๋น ์์ ํ ์ค๋ก ๊ทธ๋ ค์ง๊ณ ๋์น๋ฉด ๋ง์ค์ํ๋ก ์๋ฆฌ๋ฏ๋ก, ๋ผ๋ฒจ์ ๊ธธ๊ฒ ์ฐ๋ ค๋ฉด actionWidth
๋ฅผ ํจ๊ป ํค์๋๋ค.
ํ ๋ง๋ก ๋ฎ์ด์ฐ๊ธฐ#
ThemeData.fromCore(
CoreThemePresets.light,
coreComponentTheme: CoreComponentTheme(
swipeActions: CoreSwipeActionsTheme(
style: CoreSwipeActionsStyle(
platterColor: CoreColor.token(CoreColors.surfaceContainer),
),
),
),
)
๋์์ด๋ ํ๋จ ๊ฐ#
์๋ ๊ฐ์ ์ฝ๋๊ฐ ์ ๋ต์ ๊ฐ๋ฆฌ์ง ๋ชปํด ๋์์ด๋๊ฐ ํ๋จํ ๊ฐ์ ๋๋ค. ๊ธฐ๋ณธ๊ฐ์ ๊ฐ์ฅ ๋ณด์์ ์ธ ์ชฝ์ด๊ณ , ๋์์ ๊ฐ์ ์๋ฆฌ์์ ๋ฐ๊ฟ ์ ์๋ ๋ค๋ฅธ ์ ํ์ ๋๋ค.
| ๊ฐ | ๊ธฐ๋ณธ๊ฐ | ๋์ | ๋ฐ๊พธ๋ ๊ณณ |
|---|---|---|---|
| ๋์์ด๋ ํ๋จ ๊ฐ ๋ฐํ ์ | ํฌ๋ช โ ๋ฒํผ์ด ์์ ๊ฐ๋๋ค | ํค ์๋ ์ปจํ
์ด๋ ์(CoreColors.surfaceContainer ๋ฑ) โ ์นธ๋ค์ด ํ ๋ ๋ก ์ฝํ๋ค |
platterColor |
| ๋์์ด๋ ํ๋จ ๊ฐ ๋ผ๋ฒจ ์๋ฆฌ | ๋ฒํผ ์๋ | ๋ผ๋ฒจ ์์ด ์์ด์ฝ๋ง. ๋ฒํผ ์์๋ ๋์ง ์๋๋ค โ ๊ณ ์ ๋๋น ์นธ์ด ์์ด์ฝ๊ณผ ๋ผ๋ฒจ์ ๋๋ํ ๋ด์ง ๋ชปํ๊ณ , ๊ธ์์ ๋ง์ถฐ ๋๋ฆฌ๋ฉด ์นธ ๋๋น๊ฐ ๊ธ๊ผด์ ๋ฌ๋ผ์ง๋ค | showLabels |
| ๋์์ด๋ ํ๋จ ๊ฐ ์ ์ฒด ์ค์์ดํ ํ๋ | 1 (ํ๋ ์์) |
1.08 โ ์ฒซ ์ก์
์นธ์ด ์ปค์ ธ "๋์ผ๋ฉด ์คํ๋๋ค" ๋ ์ ํธ๊ฐ ๋๋ค |
fullSwipeScale |
| ๋์์ด๋ ํ๋จ ๊ฐ ์ก์ ์นธ ํฌ๊ธฐ | ์ปจํธ๋กค ์ฌ๋ค๋ฆฌ์ lg ๋จ, 48 |
ํ ๋จ ์ heightXl, 56 โ ์นธ ๋๋น์ ๋ฒํผ ํฌ๊ธฐ๊ฐ ๊ฐ์ ๋จ์ ์ฝ์ผ๋ฏ๋ก ๋์ ํจ๊ป ์ฎ๊ธด๋ค |
Core ๊ธฐ๋ณธ๊ฐ |
| ๋์์ด๋ ํ๋จ ๊ฐ ์นธ ๊ฐ๊ฒฉ ยท ๋ฐํ ์์ชฝ ์ฌ๋ฐฑ | CoreSpace.space12 |
4px ๊ฒฉ์์ ๋ค๋ฅธ ๋จ(8 ยท 16) | actionSpacing ยท platterInset |
| ๋์์ด๋ ํ๋จ ๊ฐ ๋๋ ์์น | ๋์ง๋ ์๋ 400 px/s ยท ์ ์ฒด ์ค์์ดํ ๋ฌธํฑ ํ ๋๋น์ 0.65 ยท ์ ํญ 0.25 | ๋ค๋ฅธ ์์น | ๋ฌธํฑ์ fullSwipeThreshold, ๋๋จธ์ง๋ Core ์์ |
| ๋์์ด๋ ํ๋จ ๊ฐ ์ ์ฐฉ ์๊ฐ | CoreDuration.normal, 200 ms |
CoreDuration.moderate, 300 ms |
Core ์์ |
| ๋์์ด๋ ํ๋จ ๊ฐ ์ ์ฒด ์ค์์ดํ ๊ธฐ๋ณธ | ์ผ์ง | ๊บผ์ง โ ์ฒซ ์ก์ ์ด ๋๋๋ฆด ์ ์๋ ๋์์ผ ๋ | allowsFullSwipe |
| ๋์์ด๋ ํ๋จ ๊ฐ ๊ธฐ๋ณธ ์ก์ ์ ๋ฒํผ | ํค ์๋ secondary |
๋ธ๋๋ ์ฑ์์ primary |
CoreSwipeActionVariant.toButtonVariant |
๋ณํ (Variants)#
์ก์ ๋ณํ#
์ก์
์ ์๋ฏธ๋ฅผ variant ๋ก ๋งํฉ๋๋ค. ์๋ฏธ๊ฐ ํฉ์ฑ๋ Button ์ ๋ณํ์ ๊ณ ๋ฅด๋ฏ๋ก ๋ชจ์์ Button ํ
๋ง๋ฅผ ๋ฐ๋ฆ
๋๋ค.
| ๋ณํ | ์๋ฏธ | Button ๋ณํ |
|---|---|---|
CoreSwipeActionVariant.defaultVariant |
๋ณด๊ด ยท ๊ณ ์ ยท ํ์์ฒ๋ผ ์ผ๋ฐ์ ์ธ ๋์ | secondary |
CoreSwipeActionVariant.destructive |
์ญ์ ์ฒ๋ผ ๋ฌด์ธ๊ฐ๋ฅผ ์์ ๋ ๋์ | destructive |
์์ชฝ ๊ฐ์ฅ์๋ฆฌ#
leadingActions ์ trailingActions ๋ฅผ ํจ๊ป ๋๊ธฐ๋ฉด ํ์ ์ด๋ ์ชฝ์ผ๋ก ๋ฏธ๋๋์ ๋ฐ๋ผ ๋ค๋ฅธ ๋ฐํ์ด ๋๋ฌ๋ฉ๋๋ค. ๋ ๋ฐฉํฅ์ ์ฝ๊ธฐ ๋ฐฉํฅ์ ๋ฐ๋ฆ
๋๋ค. ์ค๋ฅธ์ชฝ์์ ์ผ์ชฝ์ผ๋ก ์ฐ๋ ๋ก์ผ์ผ์์๋ ์ข์ฐ๊ฐ ๋ค์งํ๋๋ค.
SwipeActions(
leadingActions: [
CoreSwipeAction(
label: '๊ณ ์ ',
icon: const Icon(LucideIcons.pin),
onPressed: handlePin,
),
],
trailingActions: [
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: handleDelete,
),
],
child: row,
)
๋ผ๋ฒจ ์์ด#
showLabels: false ๋ ๋ฒํผ๋ง ๋จ๊น๋๋ค. ๋ผ๋ฒจ์ ๊ทธ๋ ค์ง์ง ์์๋ ์ ๊ทผ ๊ฐ๋ฅํ ์ด๋ฆ์ผ๋ก ๋จ์ต๋๋ค.
SwipeActions(
showLabels: false,
trailingActions: [
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: handleDelete,
),
],
child: row,
)
์ ์ฒด ์ค์์ดํ ๋๊ธฐ#
์ฒซ ์ก์
์ด ๋๋๋ฆด ์ ์๋ ๋์์ด๋ฉด allowsFullSwipe: false ๋ก ๊ธธ๊ฒ ๋ฐ์ด ์คํ๋๋ ๊ธธ์ ๋ง์ต๋๋ค. ๋ฐํ๋ณด๋ค ๋ ๋ฐ๋ฉด ํ์ด ์ ํญ์ ๋ฐ๊ณ , ๋์ผ๋ฉด ์ด๋ฆฝ๋๋ค.
SwipeActions(
allowsFullSwipe: false,
trailingActions: [
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: handleDelete,
),
],
child: row,
)
๋์ ์คํ (Behavior)#
์์น๋ ๋ ผ๋ฆฌ ํฝ์ (Web ์ CSS ํฝ์ )์ด๊ณ ์๋๋ ํฝ์ /์ด์ ๋๋ค.
์ธํฐ๋์ #
-
๋ฐ๊ธฐ: ํฌ์ธํฐ๊ฐ ๊ฐ๋ก๋ก 18 px ๋๊ฒ ์์ง์ด๊ณ ์ธ๋ก ์ด๋์ ๋ฐ๋ฆฌ์ง ์์ผ๋ฉด ํ์ด ํฌ์ธํฐ๋ฅผ ๋ฐ๋ผ ์์ง์
๋๋ค. ์ธ๋ก ์ด๋์ด ๋จผ์ ํฌ๋ฉด ๊ทธ ์
๋ ฅ์ ์คํฌ๋กค๋ฌ์ ๊ฒ์ด๋ผ ํ์ ๋ฐ์ํ์ง ์์ต๋๋ค. ๊ทธ๋์
SwipeActions๋ฅผ ์์ ๋ชฉ๋ก์ ์ธ๋ก ์คํฌ๋กค์ ๊ฐ๋ก์ฑ์ง ์์ต๋๋ค. -
๋ฐ๋ผ๊ฐ๊ธฐ: ๋ฐํ ๋๋น ์์์๋ ํฌ์ธํฐ๋ฅผ ๊ทธ๋๋ก ๋ฐ๋ผ๊ฐ๋๋ค. ๋์ด๊ฐ๋ฉด
allowsFullSwipe๊ฐ ์ผ์ง ์ชฝ์ ํ ๋๋น๊น์ง ๊ณ์ ๋ฐ๋ผ๊ฐ๊ณ , ๊บผ์ง ์ชฝ์ ๋์น ๊ฑฐ๋ฆฌ์ 25 % ๋ง ๋ฐ๋ผ๊ฐ ๋์ด๋๋ ๋ฏ์ด ์ ํญํฉ๋๋ค. -
๋๊ธฐ: ๋์ ์๊ฐ ๋ค์ ๊ท์น์ ์์์๋ถํฐ ๋ณด๊ณ ์ฒ์ ๋ง๋ ๊ฒ์ด ๊ฒฐ๊ณผ์
๋๋ค.
- ๋ซํ ์๋ฆฌ(1 px ์ด๋ด)์ด๊ฑฐ๋ ์ก์ ์ด ์๋ ์ชฝ์ด๋ฉด ๋ซํ๋๋ค.
- ์ก์ ์์ ๋ฉ์ด์ง๋ ๋ฐฉํฅ์ผ๋ก 400 px/s ์ด์์ด๋ฉด ๋ซํ๋๋ค. ์ ์ฒด ์ค์์ดํ ๊ฑฐ๋ฆฌ๋ฅผ ๋๊ฒผ์ด๋ ๋๋๋ฆฌ๋ ์๊ธธ์ด๋ฉด ๋ซํ๋ฏ๋ก, ๋๋๋ฆด ์ ์๋ ์ก์ ์ด ๋๋๋ฆฌ๋ ์ ์ค์ฒ์์ ์คํ๋์ง ์์ต๋๋ค.
- ๋ฐํ์ ๋๊ธฐ๊ณ ์ ์ฒด ์ค์์ดํ ๊ฑฐ๋ฆฌ ์ด์์ด๋ฉด(์ผ์ง ์ชฝ) ๊ทธ ์ชฝ ์ฒซ ์ก์
์ด ์คํ๋๊ณ ํ์ด ๋ซํ๋๋ค. ๊ฑฐ๋ฆฌ๋
fullSwipeThresholdร ํ ๋๋น์ด๊ณ , ๋ฐํ๋ณด๋ค ์งง์ ์๋ ์์ต๋๋ค. - ์ก์ ์ชฝ์ผ๋ก 400 px/s ์ด์์ด๋ฉด, ์งง๊ฒ ๋น๊ฒผ์ด๋ ์ด๋ฆฝ๋๋ค.
- ๊ทธ ๋ฐ์๋ ๊ฐ๊น์ด ์๋ฆฌ์ ๋ฉ์ถฅ๋๋ค. ๋ฐํ์ ์ ๋ฐ ์ด์ ์ด๋ ธ์ผ๋ฉด ์ด๋ฆฌ๊ณ , ์๋๋ฉด ๋ซํ๋๋ค.
-
์ด๋ฆฐ ํ: ์ด๋ฆฐ ํ์ ํญํ๋ฉด
child์ ๋ฟ์ง ์๊ณ ํ์ด ๋ซํ๋๋ค. ์ด๋ฆฐ ํ์์ ๋ค์ ๋ฐ ์ ์๊ณ , ๊ทธ ๋๋๊ทธ๋ ์ด๋ ค ์๋ ์ชฝ์ ๋ฌถ์ฌ ๋ฐ๋์ชฝ ๋ฐํ์ผ๋ก ๋์ด๊ฐ์ง ์์ต๋๋ค. - ์ก์
๋๋ฅด๊ธฐ: ๋ฒํผ์ ๋๋ฅด๋ฉด
onPressed๊ฐ ํธ์ถ๋๊ณ ํ์ด ๋ซํ๋๋ค. ์ ์ฒด ์ค์์ดํ๊ฐ ์คํํ ๋๋ ๊ฐ์ต๋๋ค. - ์ทจ์: ์์คํ ์ด ํฌ์ธํฐ๋ฅผ ๊ฐ์ ธ๊ฐ๋ฉด(์คํฌ๋กค ์์ ยท ํฌ์ธํฐ ์ทจ์) ํ์ ๋๋๊ทธ๊ฐ ์์๋ ์๋ฆฌ๋ก ๋์๊ฐ๋๋ค. ์ทจ์๋ ๋น๊น์ ๊ฑฐ๋ฆฌ์ ์๊ด์์ด ์ก์ ์ ์คํํ์ง ์์ต๋๋ค.
- ํธ๋ฒ ยท ํฌ์ปค์ค: ํ ์์ฒด์๋ ํธ๋ฒ ๋ฐ์์ด ์์ต๋๋ค. ์ก์
๋ฒํผ์
Button์ ํธ๋ฒ ยท ํฌ์ปค์ค ๋ฐ์์ ๊ทธ๋๋ก ๊ฐ์ต๋๋ค.
์ํ ์ ํ#
- ํ์ ๋ซํ ยท ์์ ์ชฝ ์ด๋ฆผ ยท ๋ ์ชฝ ์ด๋ฆผ ์ ์ค ํ๋์ ๋ฉ์ถ๊ณ , ํ ๋ฒ์ ํ ์ชฝ๋ง ์ด๋ฆฝ๋๋ค.
- ์ฒซ ์ก์ ์ด ๋นํ์ฑ์ด๋ฉด ๊ทธ ์ชฝ ์ ์ฒด ์ค์์ดํ๊ฐ ๊บผ์ ธ, ๊ธธ๊ฒ ๋ฐ์ด๋ ์ด๋ฆฌ๊ธฐ๋ง ํฉ๋๋ค.
enabled: false์ด๋ฉด ํ์ ๋ฐ๋ฆฌ์ง ์๊ณ ๋ ๋ซํ ์์ผ๋ฉฐ, ์ก์ ์ ์ด๋ ๊ฒฝ๋ก๋ก๋ ์คํ๋์ง ์์ต๋๋ค.- ์ก์ ์ ๊ฐ์๊ฐ ๋ฐ๋๋ฉด ์ด๋ฆฐ ํ์ ๋ซํ๋๋ค. ์ด๋ฆฐ ๊ฑฐ๋ฆฌ๊ฐ ์ด์ ๊ฐ์๋ก ์ ํด์ง ๊ฐ์ด๊ธฐ ๋๋ฌธ์ ๋๋ค.
-
SwipeActionScope์์์๋ ํ ํ์ด ์์ง์ด๊ธฐ ์์ํ๋ ์๊ฐ ์ด๋ ค ์๋ ๋ค๋ฅธ ํ์ด ๋ซํ๋๋ค. ํฌ์ปค์ค๊ฐ ๋ค๋ฅธ ํ์ ๋ฐํ์ ๋ฟ์ ๊ทธ ํ์ด ์ด๋ฆด ๋๋ ๊ฐ์ต๋๋ค. ๋ฒ์๊ฐ ์์ผ๋ฉด ํ์ ์๋ก ๋ ๋ฆฝ์ ๋๋ค. ์คํฌ๋กคํ๊ฑฐ๋ ํ ๋ฐ์ ํญํด๋ ์ด๋ฆฐ ํ์ด ๋ซํ์ง ์์ต๋๋ค. - ํ๋ก๊ทธ๋จ์์ ํ์ ์ด๊ณ ๋ซ๋ ์ปจํธ๋กค๋ฌ๋ ์์ต๋๋ค.
์ ๋๋ฉ์ด์ #
-
์ ์ฐฉ: ๋์ ํ์
CoreDuration.normal(200 ms)์ ๊ฑธ์ณ ๋ฉ์ถ ์๋ฆฌ๋ก ๊ฐ๋๋ค. Flutter ๋ ๋๋ ์๋๋ฅผ ์ด์ด๋ฐ๋ ์๊ณ ๊ฐ์ ์คํ๋ง(ํ๊น ์์), Web ์CoreEasing.enter๊ณก์ ์ CSS ์ ํ(ํ์transform๊ณผ ๋ฐํ์ ๋๋น)์ ๋๋ค. ๋ ๋ค ๋์น์ง ์๊ณ ๊ฐ์ ์๊ฐ์ ๋ฉ์ถ์ง๋ง ๊ณก์ ์ด ๊ฐ์ง๋ ์์ต๋๋ค. ์คํ๋ง์ ๋๋ ์๋์์ ์ถ๋ฐํ๋ฏ๋ก ์ ์ ๋ฐ์ด ๋ ๋น ๋ฆ ๋๋ค. - ๋๋๊ทธ ์ค: ์ ์ฐฉ ์ ํ์ด ์์ต๋๋ค. ํ์ด ํฌ์ธํฐ๋ฅผ ์ง์ฐ ์์ด ๋ฐ๋ผ๊ฐ๋๋ค.
-
์ ์ฒด ์ค์์ดํ ์ ํธ:
fullSwipeScale์ด1๋ณด๋ค ํฌ๋ฉด ์ฒซ ์ก์ ์นธ์ด ์ ์ฒด ์ค์์ดํ ๊ฑฐ๋ฆฌ์ ๋ค์ด์๋ ๋์ ๊ทธ ๋ฐฐ์จ๋ก ์ปค์ง๋๋ค. ๊ธฐ๋ณธ๊ฐ1์ ์ ํธ๊ฐ ์์ต๋๋ค. - ๋์ ์ค์ด๊ธฐ: ์ ์ฐฉ ์๊ฐ์ด ์ ํ ๋จ๊ณ ํ ํฐ์ด๋ผ ๋์ ์ค์ด๊ธฐ๋ฅผ ์ผ๋ฉด ๋ ํ๋ซํผ ๋ชจ๋ ๋ฉ์ถ ์๋ฆฌ๋ก ๊ณง์ฅ ๊ฑด๋๋๋๋ค. ๋๋๊ทธ๊ฐ ํฌ์ธํฐ๋ฅผ ๋ฐ๋ผ๊ฐ๋ ๊ฒ์ ๊ทธ๋๋ก์ ๋๋ค.
์ฌ์ฉ ๊ฐ์ด๋๋ผ์ธ (Usage Guidelines)#
Do#
์ฒซ ๋ฒ์งธ ์ก์ ์๋ ๋๋๋ฆด ์ ์๋ ๊ฐ์ฅ ํํ ๋์์ ๋๊ธฐ
SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: handleArchive,
),
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: handleDelete,
),
],
child: row,
)
์ด์ : ๊ธธ๊ฒ ๋ฏธ๋ ์ ์ค์ฒ๋ ์ฒซ ์ก์ ์ ์คํํฉ๋๋ค. ์ค์๋ก ์ผ์ด๋๋ ๋๋๋ฆด ์ ์๋ ๋์์ด์ด์ผ ํฉ๋๋ค.
Don't#
๋๋๋ฆด ์ ์๋ ๋์์ ์ ์ฒด ์ค์์ดํ์ ์ฒซ ์ก์ ์ผ๋ก ๋๊ธฐ
// โ ๊ธธ๊ฒ ๋ฐ๋ฉด ํ์ธ ์์ด ์ญ์ ๋๋ค
SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '์ญ์ ',
icon: const Icon(LucideIcons.trash2),
variant: CoreSwipeActionVariant.destructive,
onPressed: handleDelete,
),
],
child: row,
)
์ด์ : ๊ธธ๊ฒ ๋ฏธ๋ ๋์์ ํ ์์ผ๋ก ์คํฌ๋กคํ๋ค๊ฐ๋ ์ผ์ด๋ฉ๋๋ค. ์ฒซ ์ก์
์ด ๋๋๋ฆด ์ ์๋ค๋ฉด allowsFullSwipe: false ๋ก ๋ง๊ฑฐ๋, ์ญ์ ๋ค ์คํ ์ทจ์๋ฅผ ์ ๊ณตํฉ๋๋ค.
Do#
๋ชฉ๋ก์ SwipeActionScope ๋ก ๊ฐ์ธ ํ ๋ฒ์ ํ ํ๋ง ์ด๊ธฐ
SwipeActionScope(
child: Column(
children: [
for (final mail in mails) buildRow(mail),
],
),
)
์ด์ : ์ด๋ฆฐ ํ์ด ์ฌ๋ฟ์ด๋ฉด ์ด๋ ํ์ ์ก์ ์ด ๋๋ฆด์ง ์์๋ณด๊ธฐ ์ด๋ ต์ต๋๋ค. ๋ฒ์๊ฐ ์์ผ๋ฉด ํ์ ์๋ก ๋ซ์ง ์์ต๋๋ค.
Don't#
๋ผ๋ฒจ์ ๊ธธ๊ฒ ์ฐ๊ธฐ
// โ ์นธ ๋๋น(48) ์์ ํ ์ค๋ก ๋ค์ด๊ฐ์ง ์๋๋ค
CoreSwipeAction(
label: '์ฝ์ง ์์์ผ๋ก ํ์',
icon: const Icon(LucideIcons.mailOpen),
onPressed: handleMarkUnread,
)
์ด์ : ์นธ ๋๋น๋ ์ซ์๋ก ์ ํด์ ธ ์์ด ๋ผ๋ฒจ์ด ๊ธธ๋ฉด ๋ง์ค์ํ๋ก ์๋ฆฝ๋๋ค. ์ ๊ทผ ๊ฐ๋ฅํ ์ด๋ฆ์ ์๋ฆฌ์ง ์์ง๋ง ํ๋ฉด์์๋ ์ฝ์ ์ ์์ต๋๋ค. ๋์ธ ๊ธ์๋ก ์ค์ด๊ฑฐ๋ showLabels: false ์ ์์ด์ฝ์ผ๋ก ๋งํฉ๋๋ค.
Don't#
child ์์ ๊ฐ๋ก๋ก ์์ง์ด๋ ๋ค๋ฅธ ์ ์ค์ฒ๋ฅผ ๋ฃ๊ธฐ
์ด์ : ๊ฐ๋ก ์ฌ๋ผ์ด๋ ยท ๊ฐ๋ก ์คํฌ๋กค ์์ญ์ ๊ฐ์ ๊ฐ๋ก ๋๋๊ทธ๋ฅผ ๋คํฌ๋ฏ๋ก ์ด๋ ์ชฝ์ด ์ด๊ธธ์ง ์์ธกํ๊ธฐ ์ด๋ ต์ต๋๋ค. ํ ์ ์ฒด๋ฅผ ๋ฏธ๋ ์ ์ค์ฒ๊ฐ ํ์ํ๋ฉด ํ ์์๋ ๊ฐ๋ก ์ ์ค์ฒ๋ฅผ ๋์ง ์์ต๋๋ค.
์ ๊ทผ์ฑ (Accessibility)#
์ญํ #
-
Flutter: ํ์ ์ก์
๋ง๋ค ๋ง์ถค ์๋งจํฑ ์ก์
(
CustomSemanticsAction)์ด ๊ฑธ๋ฆฝ๋๋ค. ์ด๋ฆ์CoreSwipeAction.label์ด๊ณ ๋นํ์ฑ ์ก์ ์ ๋น ์ง๋๋ค. ๋ฐํ์ ๋ฒํผ์button์ญํ ์ ๊ฐ์ ๋ผ๋ฒจ์ ์ด๋ฆ์ผ๋ก ๊ฐ๊ณ , ํ๋ฉด์ ๋ณด์ด๋ ๋ผ๋ฒจ ๊ธ์๋ ์๋งจํฑ์์ ์ ์ธํด ๋ ๋ฒ ์ฝํ์ง ์์ต๋๋ค. ๋ฐํ์ ๋ซํ ํ์์๋ ์์ ฏ ํธ๋ฆฌ์ ์์ด(ํญ 0 ์ผ๋ก ์๋ ค ์์ต๋๋ค) ํค๋ณด๋๊ฐ ๋ฟ์ง๋ง, ๊ทธ ๋ฒํผ์ ๊ทธ ์ชฝ์ด ์ด๋ ค ํ๋ฉด์ ๋๋ฌ๋๊ธฐ ์ ๊น์ง ์๋งจํฑ ํธ๋ฆฌ์์ ๋น ์ ธ ์์ต๋๋ค. ํ๋ฉด์ ์๋ ๋ฒํผ์ ์คํฌ๋ฆฐ ๋ฆฌ๋๊ฐ ์ฐพ๊ฒ ํ์ง ์๊ธฐ ์ํด์์ด๊ณ , ๋ซํ ํ์ ์ก์ ์ ๋ง์ถค ์ก์ ์ผ๋ก ๊ณ ๋ฆ ๋๋ค. -
Web: ๋ฐํ์ DOM ์ ๋ ์๊ณ (
display: noneยทvisibility: hidden์ด ์๋๋ผ ๊ฐ๋ก๋ก ์๋ฆด ๋ฟ์ ๋๋ค), ๊ฐ ์ก์ ์<button>์ ๋๋ค. ์ด๋ฆ์aria-label์ด ๋ผ๋ฒจ ๋ฌธ์์ด์ ๊ทธ๋๋ก ๊ฐ์ ธ์ค๊ณ , ํ๋ฉด์ ๋ณด์ด๋ ๋ผ๋ฒจ ๊ธ์๋aria-hidden์ ๋๋ค.enabled: false์ธ ํ์๋ ๋ฐํ์ด ๋ ๋๋์ง ์์ต๋๋ค.
ํค๋ณด๋#
๋ ํ๋ซํผ์ ํค๋ณด๋ ๊ฒฝ๋ก๋ ๊ฐ์ต๋๋ค. ๋ฐ๊ธฐ๋ ํฌ์ธํฐ๋ก๋ง ๋ฟ๋ ์กฐ์์ด๋ผ, ํค๋ณด๋์๋ ์ก์ ์ ๋ฟ๋ ๊ธธ์ด ๋ฐ๋ก ์์ด์ผ ํฉ๋๋ค.
| ํค | ๋์ |
|---|---|
Tab ยท Shift+Tab |
ํ์ฑ ์ก์ ์ ๋ชจ๋ ๋ซํ ํ์์๋ ํฌ์ปค์ค๋ฅผ ๋ฐ์ต๋๋ค. ์์๋ ์์ ์ชฝ ์ก์ (์ ์ธํ ์์) โ ํ ๋ณธ๋ฌธ โ ๋ ์ชฝ ์ก์ (์ ์ธ์ ๊ฑฐ๊พธ๋ก)์ด๊ณ , ์ฝ๊ธฐ ๋ฐฉํฅ์ด ๋ฐ๋์ด๋ ๊ฐ์ต๋๋ค. ํฌ์ปค์ค๊ฐ ๋ค์ด๊ฐ๋ฉด ๊ทธ ์ชฝ์ด ์ด๋ฆฝ๋๋ค. ๋นํ์ฑ ์ก์ ์ ์ ์ง ์ง์ ์ด ์๋๋๋ค |
Enter ยท Space | ํฌ์ปค์ค๋ ์ก์ ์ ์คํํ๊ณ ํ์ ๋ซ์ต๋๋ค |
Escape |
ํฌ์ปค์ค๊ฐ ํ ์์ ์์ ๋ ์ด๋ฆฐ ํ์ ๋ซ๊ณ , ํฌ์ปค์ค๊ฐ ๋ฐํ ์์ ์์๋ค๋ฉด ํ์ผ๋ก ๋๋ ค์ค๋๋ค. ๋ซ์ ๊ฒ์ด ์์ผ๋ฉด ํค๋ฅผ ๊ฐ๋ก์ฑ์ง ์์ผ๋ฏ๋ก ํ์ ๋๋ฌ์ผ ๋ค์ด์ผ๋ก๊ทธ๋ ๊ทธ๋๋ก
Escape
๋ฅผ ๋ฐ์ต๋๋ค
|
์์๋ ์์น๊ฐ ์๋๋ผ ๊ตฌ์กฐ๋ก ์ ํฉ๋๋ค. ๋ซํ ํ์ ์ก์
์ ํญ 0 ์ผ๋ก ์๋ผ ๋๊ณ , ํ๋ณด๋ค ์ก์
์ด ๋์ผ๋ฉด ๋ ๋ฐํ์ด ์๋ก ๊ฒน์ณ ๋์ด๋ฏ๋ก ์์น๋ ์์๋ฅผ ๋งํด ์ฃผ์ง ๋ชปํฉ๋๋ค. Web ์ DOM ์์๊ฐ, Flutter ๋
FocusTraversalOrder ๊ฐ ๊ฐ์ ์์๋ฅผ ์ ํฉ๋๋ค. ํ ๋ณธ๋ฌธ์ ์๊ธฐ ์์ ์์๋ฅผ ๊ทธ๋๋ก ์งํค๊ณ ์ด ์์์์๋ ํ ์ ์ง ์ง์ ์
๋๋ค.
์คํฌ๋ฆฐ ๋ฆฌ๋#
-
Flutter: ํ์ ๋ถ์ ๋ง์ถค ์ก์
์ด ์คํฌ๋ฆฐ ๋ฆฌ๋์ ์ก์
๋ฉ๋ด์ ๋ผ๋ฒจ๋ก ๋์ต๋๋ค. ํ๋๋ฅผ ๊ณ ๋ฅด๋ฉด
onPressed๊ฐ ์คํ๋๊ณ ํ์ด ๋ซํ๋๋ค. ๊ทธ๋์ ๋๋๊ทธ๋ฅผ ํ ์ ์๋ ์ฌ์ฉ์๋ ๋ชจ๋ ํ์ฑ ์ก์ ์ ๋ฟ์ต๋๋ค. ํฌ์ปค์ค๋ฅผ ๋ฐ์ ๋ฒํผ์ ๋ ธ๋๋ ํฌ์ปค์ค ์ํ๋ฅผ ๊ฐ์ง๋ฏ๋ก ์คํฌ๋ฆฐ ๋ฆฌ๋๊ฐ ํค๋ณด๋๋ฅผ ๋ฐ๋ผ์ต๋๋ค. - Web: ์ก์ ๋ฒํผ์ ์ด๋ฆ์ ๋ผ๋ฒจ์ด๊ณ , ํฌ์ปค์ค๊ฐ ๋ฟ์ผ๋ฉด ๋ฐํ์ด ์ด๋ ค ๋ฒํผ์ด ํ๋ฉด์ ๋๋ฌ๋ฉ๋๋ค.
- ํ์ด ์ด๋ฆฌ๊ณ ๋ซํ๋ ๊ฒ ์์ฒด๋ ํต๋ณดํ์ง ์์ต๋๋ค.
ํฌ์ปค์ค ๊ด๋ฆฌ#
-
์ง์
โ ๋ฐํ์ ๋ฒํผ์ผ๋ก ํฌ์ปค์ค๊ฐ ๋ค์ด์ค๋ฉด ๊ทธ ์ชฝ์ด ์ด๋ฆฌ๊ณ , ํ์
SwipeActionScope์ ์๋ฆฌ๋ฅผ ์ฐจ์งํด ์ด๋ ค ์๋ ๋ค๋ฅธ ํ์ ๋ซ์ต๋๋ค. ํฌ์ปค์ค๊ฐ ๋ณด์ด๋ ์๋ฆฌ์ ์๋๋ก ํ๊ธฐ ์ํด์์ ๋๋ค. -
์ดํ โ ํ์ด ๋ซํ ์ฑ ์ฌ๊ฒ ๋๋ฉด, ๋ซํ๋ ๋ฐํ์ ์ก์
์ ์๋ ํฌ์ปค์ค๋ ํ์ผ๋ก ๋์์ต๋๋ค. ๋ฌด์์ด ๋ซ์๋ , ์ด๋ ํ๋ซํผ์์๋ ๊ฐ์ต๋๋ค.
Escape, ์ก์ ์คํ, ๋ฐ๊ฑฐ๋ ํ๊ธด ๋ค ๋๊ธฐ, ์ด๋ฆฐ ํ์ ๋ณธ๋ฌธ ํญ,SwipeActionScope์ ๋ค๋ฅธ ํ์ด ์์ง์ด๊ธฐ ์์ํจ, ๋ค์ ๊ทธ๋ฆฌ๊ธฐ(์๋)๊ฐ ๋ชจ๋ ๊ทธ๋ ์ต๋๋ค. ํฌ์ธํฐ๋ ํฌ์ปค์ค๋ฅผ ์ฎ๊ธฐ์ง ์๋ ๊ฒฝ์ฐ๊ฐ ์์ด(Flutter ์ ํฌ์ธํฐ, ๋ธ๋ผ์ฐ์ ์ ํฐ์น๋ก ๋ฐ๊ธฐ) ๊ทธ๋๋ก ๋๋ฉด ํฌ์ปค์ค๊ฐ ํญ 0 ์ผ๋ก ์๋ฆฐ ๋ฒํผ์ ๋จ๊ธฐ ๋๋ฌธ์ ๋๋ค. ๋ฐํ ๋ฐ์ ์๋ ํฌ์ปค์ค(๋ค๋ฅธ ํ, ํ ๋ณธ๋ฌธ์ ์ ๋ ฅ, ์๋ฌด ๋ฐ๋ ์๋ ๊ฒฝ์ฐ)์ ์ด๋ฆฐ ์ฑ ์ฌ๋ ํ์ ํฌ์ปค์ค๋ ๊ฑด๋๋ฆฌ์ง ์๊ณ , ์ก์ ์ด ์คํ๋๋ฉด์ ํฌ์ปค์ค๋ฅผ ๋ค๋ฅธ ๊ณณ(ํธ์ง ํ๋ ๋ฑ)์ผ๋ก ๋ณด๋๋ค๋ฉด ํ์ ๊ทธ๊ฒ์ ๋๊ฐ์ ธ๊ฐ์ง ์์ต๋๋ค. ํ ์์ฒด๋Tab์ ์ง ์ง์ ์ด ์๋๋ผ ํฌ์ปค์ค๋ฅผ ๋ณด๋ผ ์ ์๋ ์๋ฆฌ์ ๋๋ค(Web ์ ๋ฃจํธ์tabindex="-1", Flutter ๋ ํ์ ํฌ์ปค์ค ๋ ธ๋). ํฌ์ปค์ค๊ฐ ๋ค๋ฅธ ๊ณณ์ผ๋ก ์ฎ๊ฒจ ๊ฐ๋ ๊ฒ๋ง์ผ๋ก๋ ํ์ด ๋ซํ์ง ์์ต๋๋ค. -
๋ค์ ๊ทธ๋ ค์ ๋ซํ ๋ โ ์ก์
๊ฐ์๊ฐ ๋ฐ๋๊ฑฐ๋, ํ์ด ๋๋ ๋ฐ ์ ์๊ฒ ๋์ด(
enabled: false, ์ก์ ์ด ํ๋๋ ์์) ํ์ด ๋ซํ๊ฑฐ๋ ๋ฐํ์ด ์ฌ๋ผ์ง ๋๋ ๊ฐ์ต๋๋ค. ๊ทธ๋๋ก ๋๋ฉด ํฌ์ปค์ค๊ฐ ํญ 0 ์ผ๋ก ์๋ฆฐ ๋ฒํผ์ ๋จ๊ฑฐ๋, ๋ฒํผ์ด ์ฌ๋ผ์ง๋ฉด์ ๋ฌธ์๋ก ๋จ์ด์ง๊ธฐ ๋๋ฌธ์ ๋๋ค. ์ก์ ๊ฐ์๋ ๋ฐ ์ ์๋์ง ์ฌ๋ถ๋ ๋ฐ๋์ง ์๋ ๋ค์ ๊ทธ๋ฆฌ๊ธฐ๋ ํฌ์ปค์ค๋ฅผ ์ฎ๊ธฐ์ง ์๊ณ , ๊ฐ์ ๋ค์ ๊ทธ๋ฆฌ๊ธฐ๋ก ์ฌ๋ผ์ง๋ ํ ๋ณธ๋ฌธ์ ์ ๋ ฅ์์๋ ํ์ด ํฌ์ปค์ค๋ฅผ ๊ฐ์ ธ๊ฐ์ง ์์ต๋๋ค. Web ์ ๋ค์ ๊ทธ๋ฆฌ๋ ๋์ค์ ํฌ์ปค์ค๋ฅผ ์ฎ๊ธฐ์ง ์๊ณ ๊ทธ ๋ณ๊ฒฝ์ด ๋ฌธ์์ ๋ฐ์๋ ๋ค์ ์ฎ๊น๋๋ค. ๊ทธ ์ฌ์ด ๊ฐ์ ๋ค์ ๊ทธ๋ฆฌ๊ธฐ๊ฐ ํฌ์ปค์ค๋ฅผ ๋ค๋ฅธ ์์์ ์คฌ๋ค๋ฉด ๊ทธ ์์๊ฐ ๊ฐ์ต๋๋ค. -
๋ฐ ์ ์๋ ํ โ ์ก์
์ด ์๊ฑฐ๋ ๋นํ์ฑ์ธ ํ๋ ํฌ์ปค์ค๋ฅผ ๋ณด๋ผ ์ ์๋ ์๋ฆฌ๋ก ๋จ์ต๋๋ค. Web ์ ๊ทธ ํ์ ๋ฃจํธ์๋
tabindex="-1"์ ๋ถ์ด๊ณ Flutter ์ ํ ํฌ์ปค์ค ๋ ธ๋๋ ๋ ์์ต๋๋ค. ๊ทธ๋์ ์ด๋ฏธ ํ์ ์๋ ํฌ์ปค์ค๋ ํ์ด ๋นํ์ฑ์ด ๋์ด๋ ๊ทธ๋๋ก์ ๋๋ค. - ํธ๋ฉ โ ์์. ํฌ์ปค์ค๋ ํ ์๊ณผ ๋ฐ์ ์์ ๋กญ๊ฒ ์ค๊ฐ๋๋ค.
์๋ ค์ง ์ ์ฝ#
- ๋ฐ๊ธฐ๋ ๋์ ๋ณด์ด์ง ์๋ ์กฐ์์ ๋๋ค. ๋ง์ฐ์ค ์ฌ์ฉ์๋ ๋ฐ๊ฒฌํ๊ธฐ ์ด๋ ค์ฐ๋ฏ๋ก ๊ฐ์ ๋์์ ๋์ ๋ณด์ด๋ ๊ฒฝ๋ก๋ฅผ ํจ๊ป ๋๋ ํธ์ด ์ข์ต๋๋ค.
-
Escape๋ ํค๋ณด๋ ํฌ์ปค์ค๊ฐ ํ ์์ ์์ ๋๋ง ๋ฟ์ต๋๋ค. ๋ฐ์ด์ ์ฐ ํ์ ํฌ์ปค์ค๊ฐ ์์ผ๋ฉดEscape๋ก ๋ซ์ ์ ์๊ณ , ํญํ๊ฑฐ๋ ๋ค๋ฅธ ํ์ ๋ฐ์ด์ ๋ซ์ต๋๋ค. -
๋ซํ ํ์ ์ก์
์ ํญ 0 ์ผ๋ก ์๋ฆฐ ์ฑ ํฌ์ปค์ค๋ฅผ ๋ฐ๋ ๋
ธ๋์ด๊ธฐ ๋๋ฌธ์, ๋ฐฉํฅํค๋ก ํฌ์ปค์ค๋ฅผ ์ฎ๊ธฐ๋ ํ๊ฒฝ(๋ฐ์คํฌํฑ ยท TV ์ Flutter)์์๋ ๋ฐฉํฅํค ํ์๋ ๊ฑฐ๊ธฐ์ ๋ฟ์ต๋๋ค. ๋ฟ๋ ์๊ฐ ๊ทธ ํ์ด ์ด๋ ค ํฌ์ปค์ค๊ฐ ๋ณด์ด์ง ์๋ ์๋ฆฌ์ ๋จธ๋ฌผ์ง๋ ์์ง๋ง, ๋ชฉ๋ก์ ์๋๋ก ํ์ผ๋ฉด ํ์ด ํ๋์ฉ ์ด๋ฆฝ๋๋ค(
SwipeActionScope์์์๋ ์ ํ์ด ๋ซํ๋๋ค). ๋ธ๋ผ์ฐ์ ์์๋ ๋ฐฉํฅํค๊ฐ ํฌ์ปค์ค๋ฅผ ์ฎ๊ธฐ์ง ์์ต๋๋ค. - ํ์ ์ด๊ณ ๋ซ๋ ํ๋ก๊ทธ๋จ API ๊ฐ ์๊ณ , ์คํฌ๋กค์ด๋ ํ ๋ฐ ํญ์ผ๋ก ์ด๋ฆฐ ํ์ด ๋ซํ์ง ์์ต๋๋ค. ์ด๋ฆฐ ํ์ ํญํ๊ฑฐ๋ ๋ค๋ฅธ ํ์ ๋ฐ์ด์ ๋ซ์ต๋๋ค.
- ์ก์ ๋ฒํผ์ ํฌ๊ธฐ๋ 48 ร 48 ์ด๋ผ ์ ์ญ ์ต์ ํฐ์น ํ๊ฒ(24 ร 24)๋ณด๋ค ํฝ๋๋ค.
-
์นธ์ ๋์ด๋ ๋ฒํผ 48 ์ ๊ฐ๊ฒฉ๊ณผ ๋ผ๋ฒจ ํ ์ค์ ๋ํด ๋๋ต 66 ์ด๊ณ ๊ธ์ ๋ฐฐ์จ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋๋ค. ๋ผ๋ฒจ์ ๊ทธ๋ฆด ๋ ํ์ด ๊ทธ๋ณด๋ค ๋ฎ์ผ๋ฉด ์นธ์ด ์์๋๋ก ์๋ฆฝ๋๋ค(๋ ํ๋ซํผ ๋ชจ๋ ๊ฐ์ต๋๋ค). ๋ฎ์ ํ์๋
showLabels: false๋ก ์์ด์ฝ๋ง ๊ทธ๋ฆฌ์ธ์. ๊ทธ๋ฌ๋ฉด ์นธ์ด 48 ์ด๋ผ ๊ทธ ์ด์์ ํ์ ๋ค์ด๊ฐ๋๋ค.
์ ์ญ ์ถ(๋์ ์ค์ด๊ธฐ ยท ๊ณ ๋๋น ยท ์ ๊ฐ์ ๋ชจ๋ ยท ์๋งจํฑ ์ญํ ยท ์ต์ ํฐ์น ํ๊ฒ)์ ์ ๊ทผ์ฑ ํ์ด์ง๊ฐ ํ ๊ณณ์์ ๋ค๋ฃน๋๋ค.
ํฌ๋ก์ค ํ๋ซํผ ์ฐจ์ด์ (Platform Differences)#
๋ ํ๋ซํผ์ ์์ฑ์๋ ์ด๋ฆ ยท ์์ ยท ๊ธฐ๋ณธ๊ฐ์ด ๊ฐ์ต๋๋ค. ์ฐจ์ด๋ ๊ฐ์ ํ์ ์ ๊ฐ ํ๋ซํผ์ด ์ด๋ป๊ฒ ์ ๋ ฅ๋ฐ๊ณ ๊ทธ๋ฆฌ๋๊ฐ์ ์์ต๋๋ค.
| ํญ๋ชฉ | Flutter | Web |
|---|---|---|
| ๋๋๊ทธ ์ธ์ (framework-infra) | ์ ์ค์ฒ ๊ฒฝ์์ด ์ธ์ํ๊ณ , ๊ธฐ๊ธฐ์ ํฐ์น ์ฌ๋กญ(kTouchSlop, 18)์ ์ฝ์ต๋๋ค |
ํฌ์ธํฐ ์ด๋ฒคํธ๋ฅผ Core ์ ์ ์ค์ฒ ํ์ ์ ๋จน์
๋๋ค. 18 px ๋๊ฒ ์์ง์ด๊ณ ์ธ๋ก ์ด๋์ ๋ฐ๋ฆฌ์ง ์์ ๋ ์์ํ๋ฉฐ,
touch-action: pan-y
๋ก ์ธ๋ก ํฌ์ ๋ธ๋ผ์ฐ์ ์ ๋งก๊น๋๋ค. ๋๋๊ทธ๊ฐ ์์๋ ๋ค์์ผ ํฌ์ธํฐ๋ฅผ ๋ถ์ก์ต๋๋ค
|
| ์ ์ฐฉ ๋ชจ์ (framework-infra) | ๋๋ ์๋๋ฅผ ์ด์ด๋ฐ๋ ์๊ณ ๊ฐ์ ์คํ๋ง | CoreEasing.enter ๊ณก์ ์ CSS ์ ํ |
| ์คํฌ๋ฆฐ ๋ฆฌ๋์ ๋ฟ๋ ๋ฐฉ์ (framework-infra) | ํ์ ๋ง์ถค ์๋งจํฑ ์ก์ . ๋ฐํ์ ๋ฒํผ์ ์์ ฏ ํธ๋ฆฌ์ ๋ ์์ง๋ง ๊ทธ ์ชฝ์ด ์ด๋ ค ๋๋ฌ๋ ๋๋ง ์๋งจํฑ ํธ๋ฆฌ์ ๋ค์ด์ด | ๋ฐํ์ด DOM ์ ๋ ์๋ ์ค์ <button>, aria-label |
ํฌ์ปค์ค ์์ ยท Escape (framework-infra) |
FocusTraversalOrder ๊ฐ ์์๋ฅผ ์ ํ๊ณ , ํ์ ํฌ์ปค์ค ๋
ธ๋๊ฐ Escape ๋ฅผ ๋ฐ๊ณ ํฌ์ปค์ค๋ฅผ ๋๋ ค๋ฐ์ |
DOM ์์๊ฐ ๊ณง ์์.
keydown
์ ๋ฃจํธ์์ ๋ฐ๊ณ , ๋ฃจํธ์
tabindex="-1"
์ด ํฌ์ปค์ค๋ฅผ ๋๋ ค๋ฐ์. ๋ฐ ์ ์๋ ํ์ ๋ฃจํธ์๋ ๋ถ์
|
| ๋ซํ ํ์ ํฌ์ปค์ค ๋ฐํ (framework-infra) | ํฌ์ปค์ค๊ฐ ๋ฐํ ์์ ์์ผ๋ฉด, ๋ซ์ผ๋ผ๋ ์์ฒญ์ ๋ฐ๋ ์๊ฐ๊ณผ ๋ซํ ์ฑ ์ฌ๋ ์๊ฐ์ ํ์ ํฌ์ปค์ค ๋ ธ๋์ ํฌ์ปค์ค๋ฅผ ์์ฒญํจ |
ํ ๋ชจ๋ธ์ด ์ด๋ฆผ์์ ๋ซํ์ผ๋ก ๋ฐ๋์๋ค๊ณ ์๋ฆด ๋(๋์ ํ์ ยท ํญ ยท ๋ค๋ฅธ ํ์ ์ด๋) ํฌ์ปค์ค๊ฐ ๋ฐํ ์์ ์์๋์ง ๋ณด๊ณ , ์ง๊ธ ํ๋ ์ผ์ด ๋๋ ๋ค ํฌ์ปค์ค๊ฐ ๋น์๊ฑฐ๋ ์์ง ๋ฐํ์ ์์ผ๋ฉด ๋ฃจํธ๋ก ์ฎ๊น. ํ์ด์ง๋ฅผ ์คํฌ๋กคํ์ง ์์(
preventScroll
)
|
| ๋ฐํ ๋๋น (๋ด๋ถ ๊ตฌํ) | ํด๊ฒฐ๋ ์ซ์(๋ฐ๋ ยท ๋ฐฐ์จ ์ ์ฉ)๋ก ๊ณ์ฐ | ๋๋๊ทธ๊ฐ ์์๋ ๋ DOM ์์ ์ฐ๋ค. ๊ฐ๊ฒฉ์ด CSS ๋ณ์๋ผ ๋ฐ๋์ ๋ฐ๋ผ ์์ง์ด๊ธฐ ๋๋ฌธ |
| ์ฝ๊ธฐ ๋ฐฉํฅ (๋ด๋ถ ๊ตฌํ) | Directionality. ๋ฐฉํฅ์ด ๋ฐ๋๋ฉด ํ์ด ์ฆ์ ๋ซํ |
๋ฃจํธ ์์์ ๊ณ์ฐ๋ direction ์ ๋๋๊ทธ๊ฐ ์์๋ ๋ ์ฝ์ |
| ํ ์คํธ ์ ๋ ฅ์์ ์์ํ ๋๋ฆผ (Web ์ ์ฉ HTML ํ๋ฉด) | ํด๋น ์์ โ ์ ์ค์ฒ ๊ฒฝ์์ด ๊ฐ๋ฆ |
input
ยท
textarea
ยท
select
ยท
contenteditable
์์ ์์ํ ๋๋ฆผ์ ์ค์์ดํ๋ก ๋ณด์ง ์์. ์บ๋ฟ ์ด๋์ด๊ธฐ ๋๋ฌธ
|
| ๋๋๊ทธ ์งํ์ ํด๋ฆญ ยท ์ก์ ์ ์ด๋ฒคํธ (Web ์ ์ฉ HTML ํ๋ฉด) | ํด๋น ์์ |
๋๋๊ทธ๋ฅผ ๋์ ๋ ๋ธ๋ผ์ฐ์ ๊ฐ ๋ณด๋ด๋ ํด๋ฆญ์ ์ผํด.
child
์ ํธ์ถ์์
onClick
์ ๋ฟ์ง ์์. ์ก์
๋ฒํผ์์ ์ฌ๋ผ์จ ํด๋ฆญ ยท ํค ์
๋ ฅ๋ ํธ์ถ์์
onClick
ยท
onKeyDown
ยท
onKeyUp
์ผ๋ก ๊ฐ์ง ์์ โ ๊ทธ ํธ๋ค๋ฌ๋ ํ ๋ณธ๋ฌธ์ ์ํ ๊ฒ์ด๊ธฐ ๋๋ฌธ. ๋ณธ๋ฌธ ์์ ๋์ธ ๋ค๋ฅธ
SwipeActions
์ ์ก์
๋ ๊ฐ๋ค(Flutter ์์ ์ก์
์ ๋๋ฆผ์ ๊ฐ์ ธ๊ฐ๋ ๋ฒํผ์ด๋ผ ๋ฐ๊นฅ ํ์
onTap
์ด ์ธ๋ฆฌ์ง ์๋๋ค). ๋ฐ๊นฅ ํ ๋ณธ๋ฌธ ์์ฒด์ ํธ๋ค๋ฌ๋ ๋ณธ๋ฌธ ์์ ์ด๋ ๋ฒํผ ํด๋ฆญ์ด๋ ๋ฃ๋ฏ์ด ์ด๊ฒ๋ ๋ฃ๋๋ค โ ์ด๋ฒคํธ๋ฅผ ๋ง์ผ๋ฉด ์กฐ์ ์ ์ฒด(๋ฐ๊นฅ ํด๋ฆญ์ผ๋ก ๋ซ๋ ์ค๋ฒ๋ ์ด ๊ฐ์ ํ์ด์ง ๋ฆฌ์ค๋)์๊ฒ์ ์จ๊ธฐ๊ธฐ ๋๋ฌธ
|
| ์กฐ์ ํ๋ฉด (Web ์ ์ฉ HTML ํ๋ฉด) | key |
id
ยท
classes
ยท
css
ยท
attributes
โ ๋ฃจํธ
<div>
๋ก ์ ๋ฌ
|
๊ด๋ จ ์ปดํฌ๋ํธ (Related Components)#
- Basic: ํ ๋ณธ๋ฌธ์ผ๋ก ๊ฐ์ฅ ํํ ๋ฃ๋ ์ฌ๋กฏ ๋ ์ด์์
- Button: ์ก์ ์ด ํฉ์ฑํ๋ ๋ฒํผ. ์ก์ ์ ๋ชจ์์ ์ด ์ปดํฌ๋ํธ์ ํ ๋ง๋ฅผ ๋ฐ๋ฆ ๋๋ค
- Listing: ํ์ ์๋ ๋ชฉ๋ก ์ปจํ ์ด๋
- Gap: ํ ์ฌ์ด์ ๊ฐ๊ฒฉ
์กฐํฉ ์์ #
SwipeActionScope(
child: ListView.separated(
itemCount: mails.length,
separatorBuilder: (context, index) => const Divider(),
itemBuilder: (context, index) {
final mail = mails[index];
return SwipeActions(
trailingActions: [
CoreSwipeAction(
label: '๋ณด๊ด',
icon: const Icon(LucideIcons.archive),
onPressed: () => handleArchive(mail),
),
],
child: Basic(
leading: const Icon(LucideIcons.mail),
title: Text(mail.subject),
subtitle: Text(mail.preview),
),
);
},
),
)