buildOpenLinkButton method

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

Menu bar action.

Implementation

Widget buildOpenLinkButton(
    {required BuildContext context,
    required WidgetRef ref,
    required AppModel appModel}) {
  return FloatingSearchBarAction(
    child: JidoujishoIconButton(
      size: Theme.of(context).textTheme.titleLarge?.fontSize,
      tooltip: t.open_url,
      icon: Icons.add_link,
      onTap: () async {
        await showDialog(
          context: context,
          builder: (context) => MokuroLinkDialogPage(
            onRead: (url) async {
              await Navigator.of(context).push(
                MaterialPageRoute(
                  builder: (context) => MokuroCatalogBrowsePage(
                    item: null,
                    catalog: MokuroCatalog(
                      name: '',
                      url: url.toString(),
                      order: -1,
                    ),
                  ),
                ),
              );

              Navigator.pop(context);
            },
          ),
        );
      },
    ),
  );
}