buildSettingsButton method

Widget buildSettingsButton(
  1. {required BuildContext context,
  2. required WidgetRef ref,
  3. required AppModel appModel}
)

Allows user to close the floating search bar of a media type tab page when open.

Implementation

Widget buildSettingsButton({
  required BuildContext context,
  required WidgetRef ref,
  required AppModel appModel,
}) {
  int port = getPortForLanguage(appModel.targetLanguage);

  return FloatingSearchBarAction(
    showIfOpened: true,
    child: JidoujishoIconButton(
      size: Theme.of(context).textTheme.titleLarge?.fontSize,
      tooltip: t.settings,
      icon: Icons.settings,
      onTap: () {
        appModel.openMedia(
          context: context,
          ref: ref,
          mediaSource: this,
          item: MediaItem(
            mediaIdentifier: 'http://localhost:$port/settings.html',
            title: '',
            mediaTypeIdentifier: ReaderTtuSource.instance.mediaType.uniqueKey,
            mediaSourceIdentifier: ReaderTtuSource.instance.uniqueKey,
            position: 0,
            duration: 1,
            canDelete: false,
            canEdit: true,
          ),
        );
      },
    ),
  );
}