createAppBarConfig static method
- required String title,
- required String appVersion,
- required bool isVersionLoaded,
- required VoidCallback onRefresh,
- required VoidCallback onSearch,
- required VoidCallback onSettings,
- required VoidCallback onLogout,
- required WidgetRef ref,
- VoidCallback? onVersionInfo,
Creates a MovieStar-specific AppBar configuration.
Implementation
static SolidAppBarConfig createAppBarConfig({
required String title,
required String appVersion,
required bool isVersionLoaded,
required VoidCallback onRefresh,
required VoidCallback onSearch,
required VoidCallback onSettings,
required VoidCallback onLogout,
required WidgetRef ref,
VoidCallback? onVersionInfo,
}) {
return SolidAppBarConfig(
title: title,
narrowScreenThreshold: NavigationConstants.narrowScreenThreshold,
veryNarrowScreenThreshold: NavigationConstants.veryNarrowScreenThreshold,
versionConfig: isVersionLoaded
? SolidVersionConfig(
version: appVersion,
changelogUrl:
'https://github.com/anusii/moviestar/blob/dev/CHANGELOG.md',
tooltip: '''
**Version:** This is the current version of the MovieStar app. If
the version is out of date then the text will be red. You can tap on
the version to view the app's Change Log to determine if it is worth
updating your version.
''',
)
: null,
actions: [
SolidAppBarAction(
icon: Icons.refresh,
onPressed: onRefresh,
tooltip: '''
**Refresh:** Tap here to refresh all movie data and reload the latest
information from the movie database.
''',
),
SolidAppBarAction(
icon: Icons.search,
onPressed: onSearch,
tooltip: '''
**Search:** Tap here to search for movies by title, genre, or other
criteria.
''',
),
SolidAppBarAction(
icon: Icons.settings,
onPressed: onSettings,
hideOnVeryNarrowScreen: true,
tooltip: '''
**Settings:** Tap here to view and manage your MovieStar account
settings.
''',
),
SolidAppBarAction(
icon: Icons.logout,
onPressed: onLogout,
hideOnVeryNarrowScreen: true,
tooltip: '''
**Logout:** Tap here to securely log out of your MovieStar account.
This will clear your current session and return you to the login
screen.
''',
),
],
themeConfig: SolidThemeConfig(
lightModeTooltip: '''
**Theme Toggle:** Tap here to switch to light theme.
''',
darkModeTooltip: '''
**Theme Toggle:** Tap here to switch to dark theme.
''',
onToggle: () async {
await ref.read(themeModeProvider.notifier).toggleTheme();
},
),
overflowItems: [
SolidOverflowMenuItem(
id: 'theme',
icon: Icons.dark_mode,
label: 'Toggle Theme',
onSelected: () async {
await ref.read(themeModeProvider.notifier).toggleTheme();
},
),
SolidOverflowMenuItem(
id: 'settings',
icon: Icons.settings,
label: 'Settings',
onSelected: onSettings,
),
if (isVersionLoaded && onVersionInfo != null)
SolidOverflowMenuItem(
id: 'version',
icon: Icons.info,
label: 'Version Info',
onSelected: onVersionInfo,
),
SolidOverflowMenuItem(
id: 'logout',
icon: Icons.logout,
label: 'Logout',
onSelected: onLogout,
),
],
);
}