Skip to content

Commit fc85e1c

Browse files
committed
feat: Tampilkan note dari setiap track yang ada note-nya di halaman report screenshot
Note-nya ditampilkan dalam bentuk tooltip.
1 parent cb5a55f commit fc85e1c

File tree

1 file changed

+77
-51
lines changed

1 file changed

+77
-51
lines changed

lib/feature/presentation/page/report_screenshot/report_screenshot_page.dart

Lines changed: 77 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -808,71 +808,97 @@ class _ReportScreenshotPageState extends State<ReportScreenshotPage> {
808808
}
809809

810810
final trackId = element.id;
811+
final note = element.note ?? '';
811812
return Align(
812813
alignment: Alignment.center,
813814
child: Padding(
814815
padding: EdgeInsets.only(top: heightImage),
815816
child: Row(
816817
mainAxisSize: MainAxisSize.max,
817-
mainAxisAlignment: MainAxisAlignment.end,
818+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
818819
children: [
819-
Material(
820-
borderRadius: BorderRadius.circular(999),
821-
child: InkWell(
822-
borderRadius: BorderRadius.circular(999),
823-
onTap: () {
824-
if (trackId == null) {
825-
widgetHelper.showSnackBar(
826-
context,
827-
'track_id_invalid'.tr(),
828-
);
829-
return;
830-
}
820+
note.isEmpty
821+
? Container()
822+
: Tooltip(
823+
message: note,
824+
child: Padding(
825+
padding: const EdgeInsets.all(8.0),
826+
child: FaIcon(
827+
FontAwesomeIcons.penToSquare,
828+
color: Theme.of(context).colorScheme.primary,
829+
size: 14,
830+
),
831+
),
832+
),
833+
buildWidgetIconDelete(
834+
const FaIcon(
835+
FontAwesomeIcons.trashCan,
836+
color: Colors.red,
837+
size: 14,
838+
),
839+
onTap: () {
840+
if (trackId == null) {
841+
widgetHelper.showSnackBar(
842+
context,
843+
'track_id_invalid'.tr(),
844+
);
845+
return;
846+
}
831847

832-
showDialog<bool?>(
833-
context: context,
834-
builder: (context) {
835-
return AlertDialog(
836-
title: Text('title_delete_track'.tr()),
837-
content: Text('content_delete_track'.tr()),
838-
actions: [
839-
TextButton(
840-
onPressed: () => context.pop(false),
841-
child: Text('cancel'.tr()),
842-
),
843-
TextButton(
844-
onPressed: () => context.pop(true),
845-
style: TextButton.styleFrom(
846-
foregroundColor: Colors.red,
847-
),
848-
child: Text('delete'.tr()),
848+
showDialog<bool?>(
849+
context: context,
850+
builder: (context) {
851+
return AlertDialog(
852+
title: Text('title_delete_track'.tr()),
853+
content: Text('content_delete_track'.tr()),
854+
actions: [
855+
TextButton(
856+
onPressed: () => context.pop(false),
857+
child: Text('cancel'.tr()),
858+
),
859+
TextButton(
860+
onPressed: () => context.pop(true),
861+
style: TextButton.styleFrom(
862+
foregroundColor: Colors.red,
849863
),
850-
],
851-
);
852-
},
853-
).then((value) {
854-
if (value != null && value) {
855-
trackingBloc.add(
856-
DeleteTrackUserTrackingEvent(
857-
trackId: trackId,
864+
child: Text('delete'.tr()),
858865
),
859-
);
860-
}
861-
});
862-
},
863-
child: const Padding(
864-
padding: EdgeInsets.all(8.0),
865-
child: FaIcon(
866-
FontAwesomeIcons.trashCan,
867-
color: Colors.red,
868-
size: 14,
869-
),
870-
),
871-
),
866+
],
867+
);
868+
},
869+
).then((value) {
870+
if (value != null && value) {
871+
trackingBloc.add(
872+
DeleteTrackUserTrackingEvent(
873+
trackId: trackId,
874+
),
875+
);
876+
}
877+
});
878+
},
872879
),
873880
],
874881
),
875882
),
876883
);
877884
}
885+
886+
Widget buildWidgetIconDelete(
887+
Widget icon, {
888+
Function()? onTap,
889+
ValueChanged<bool>? onHover,
890+
}) {
891+
return Material(
892+
borderRadius: BorderRadius.circular(999),
893+
child: InkWell(
894+
borderRadius: BorderRadius.circular(999),
895+
onTap: onTap,
896+
onHover: onHover,
897+
child: Padding(
898+
padding: const EdgeInsets.all(8.0),
899+
child: icon,
900+
),
901+
),
902+
);
903+
}
878904
}

0 commit comments

Comments
 (0)