Skip to content

Commit

Permalink
feat(#203): On the parent page, displayed child name upon longpress o…
Browse files Browse the repository at this point in the history
…n the child image.
  • Loading branch information
ckelwin committed Oct 14, 2023
1 parent d06ba26 commit 7ffdc65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/app/pages/parent_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class _ParentPageState extends State<ParentPage>
).p4,
const SizedBox(
height: 150,
).p4
).p4,
],
),
),
Expand Down Expand Up @@ -288,6 +288,14 @@ class _ParentPageState extends State<ParentPage>
return Kids(
imageLocation: data[index]?.image,
imageCaption: data[index]?.name,
onLongPress: () {
final snackBar = SnackBar(
content: Text(data[index]!.name),
duration: const Duration(milliseconds: 500),
behavior: SnackBarBehavior.floating,
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
onPressed: () =>
ChildDetailsPage.show(context, data[index]!),
);
Expand Down
3 changes: 3 additions & 0 deletions lib/common_widgets/child_horizontal_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ class Kids extends StatelessWidget {
this.imageLocation,
this.imageCaption,
Key? key,
this.onLongPress,
this.onPressed,
}) : super(key: key);
final String? imageLocation;
final String? imageCaption;
final VoidCallback? onLongPress;
final VoidCallback? onPressed;

@override
Widget build(BuildContext context) {
return InkWell(
onLongPress: onLongPress,
onTap: onPressed,
child: imageLocation != null || imageCaption != null
? Container(
Expand Down

0 comments on commit 7ffdc65

Please sign in to comment.