@@ -44,7 +44,7 @@ and display a draggable photo of a menu item.
44
44
45
45
## Press and drag
46
46
47
- ## 按压和拖动
47
+ ## 按下并拖动
48
48
49
49
Flutter provides a widget called [ ` LongPressDraggable ` ] [ ]
50
50
that provides the exact behavior that you need to begin
@@ -104,7 +104,7 @@ This `DraggingListItem` displays a photo of the
104
104
selected food item, centered beneath
105
105
the user's finger.
106
106
107
- 在这种情况下 ,当用户长按 ` MenuListItem ` widget 时,
107
+ 在本例中 ,当用户长按 ` MenuListItem ` widget 时,
108
108
` LongPressDraggable ` widget 会显示一个 ` DraggingListItem ` 。
109
109
这个 ` DraggingListItem ` 会在用户手指下方居中显示所选的食物图片。
110
110
@@ -129,7 +129,7 @@ food menu item that the user pressed on.
129
129
130
130
如果拖放操作在释放时没有传递任何信息,那么它几乎没有什么用处。
131
131
为此,` LongPressDraggable ` 提供了一个 ` data ` 参数。
132
- 在这种情况下 ,` data ` 的类型是 ` Item ` ,
132
+ 在本例中 ,` data ` 的类型是 ` Item ` ,
133
133
它包含了用户按下的菜单项的食物信息。
134
134
135
135
The ` data ` associated with a ` LongPressDraggable `
@@ -143,7 +143,7 @@ You'll implement the drop behavior next.
143
143
144
144
## Drop the draggable
145
145
146
- ## 放下可拖动组件
146
+ ## 放下拖动项
147
147
148
148
The user can drop a ` LongPressDraggable ` wherever they choose,
149
149
but dropping the draggable has no effect unless it's dropped
@@ -229,15 +229,15 @@ different decision.
229
229
230
230
当用户将一个可拖放的 widget 放在 ` DragTarget ` widget 上时,
231
231
会调用 ` onAcceptWithDetails ` 回调。这时你可以决定是否接受拖放的数据。
232
- 在示例中,项目总是会被接受和处理 。
233
- 你也可以选择检查传入的项目以做出不同的决定 。
232
+ 在本例中,数据项总是会被接受和处理 。
233
+ 你也可以选择检查传入的数据项,以做出不同的决定 。
234
234
235
235
Notice that the type of item dropped on ` DragTarget `
236
236
must match the type of the item dragged from ` LongPressDraggable ` .
237
237
If the types are not compatible, then
238
238
the ` onAcceptWithDetails ` method isn't invoked.
239
239
240
- 注意,拖放到 ` DragTarget ` 上的项目类型必须与从 ` LongPressDraggable ` 拖出的项目类型匹配 。
240
+ 注意,拖放到 ` DragTarget ` 上的数据项类型必须与从 ` LongPressDraggable ` 拖出的数据项类型匹配 。
241
241
如果类型不兼容,` onAcceptWithDetails ` 方法将不会被调用。
242
242
243
243
With a ` DragTarget ` widget configured to accept your
@@ -254,7 +254,7 @@ you update the customer's cart with the dropped menu item.
254
254
255
255
## Add a menu item to a cart
256
256
257
- ## 添加一个菜单项到购物车
257
+ ## 将菜单项添加到购物车
258
258
259
259
Each customer is represented by a ` Customer ` object,
260
260
which maintains a cart of items and a price total.
@@ -332,18 +332,18 @@ Run the app:
332
332
333
333
* Scroll through the food items.
334
334
335
- 浏览食物项列表。
335
+ 浏览食物项列表。
336
336
337
337
* Press and hold on one with your
338
338
finger or click and hold with the
339
339
mouse.
340
340
341
- 用手指长安其中一个食物项 ,或用鼠标点击并按住。
341
+ 用手指长按其中一个食物项 ,或用鼠标点击并按住。
342
342
343
343
* While holding, the food item's image
344
344
will appear above the list.
345
345
346
- 按住时,食物项的图片将出现在列表上方。
346
+ 按住时,食物项的图片将出现在列表上方。
347
347
348
348
* Drag the image and drop it on one of the
349
349
people at the bottom of the screen.
@@ -352,9 +352,9 @@ Run the app:
352
352
You can continue to add food items
353
353
and watch the charges accumulate.
354
354
355
- 将图片拖动并放到屏幕底部的某个人身上。
356
- 图片下方的文本会更新,显示该人的费用。
357
- 你可以继续添加食物项,观察费用的累积情况 。
355
+ 将图片拖动并放到屏幕底部的某个人身上。
356
+ 图片下方的文本会更新,显示该人的费用。
357
+ 你可以继续添加食物项,观察费用的累计情况 。
358
358
359
359
<!-- Start DartPad -->
360
360
0 commit comments