
import 'package:flutter/material.dart';
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart';

class ListItemNavigator extends StatelessWidget {
  const ListItemNavigator({super.key, required this.icon, required this.text, required this.target, this.onLongPress, this.arrow = true});

  final IconData icon;
  final String text;
  final bool arrow;

  final Widget target;

  final GestureLongPressCallback? onLongPress;

  @override
  Widget build(BuildContext context) {
    onTabAction() => pushScreen(context, withNavBar: false, screen: target); //Navigator.push(context, MaterialPageRoute(builder: (context) => target));
    onLongPressAction() => onLongPress;

    return ListTile(
      leading: Icon(icon),
      title: Text(text),
      trailing: arrow ? const Icon(Icons.arrow_right) : null,
      onTap: onTabAction,
      onLongPress: onLongPressAction,
    );
  }
}
