29 lines
768 B
Dart
29 lines
768 B
Dart
|
|
import 'package:flutter/material.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() => 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,
|
|
);
|
|
}
|
|
}
|