buildDrawerOption method
Widget
buildDrawerOption({
- required BuildContext context,
- required String text,
- TextStyle? textStyle,
- Widget? icon,
Builds a single drawer option with text and optional icon.
The option is rendered as a ListTile that closes the drawer and executes the navigation callback when tapped.
Implementation
Widget buildDrawerOption({
required BuildContext context,
required String text,
required Function() navigateTo,
TextStyle? textStyle,
Widget? icon,
}) {
return ListTile(
leading: icon,
title: Text(
text,
style: textStyle ??
Theme.of(context).textTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.w500,
),
),
onTap: () {
Navigator.pop(context);
navigateTo();
},
);
}