Initial commit
This commit is contained in:
28
lib/widget/ListItem.dart
Normal file
28
lib/widget/ListItem.dart
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ListItemNavigator extends StatelessWidget {
|
||||
const ListItemNavigator({Key? key, required this.icon, required this.text, required this.target, this.onLongPress, this.arrow = true}) : super(key: key);
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user