showTab method
void
showTab(})
Implementation
void showTab(String? url, {bool refresh = false, String? dependency, String? title, bool? closeable, String? icon}) {
// String template = uri.host;
var uri = URI.parse(url);
if (uri == null) return;
var id = uri.url.toLowerCase();
if (id == 'previous') return showPreviousTab();
if (id == 'next') return showNextTab();
if (id == 'first') return showFirstTab();
if (id == 'last') return showLastTab();
// get tab by matching id
var tab = tabs.firstWhereOrNull((tab) => tab.url == uri.url);
// New Tab
if (tab == null || refresh) {
// title
title = title ?? uri.queryParameters['title'] ?? uri.page.toString();
// icon
icon = icon ?? uri.queryParameters['icon'];
// closeable
closeable = closeable ?? toBool(uri.queryParameters['closeable']) ?? true;
// build tab
tab = TabModel(this, id, url: uri.url, title: title, closeable: closeable, icon: icon, dependency: dependency);
tabs.add(tab);
// add framework child
tab.children ??= [];
tab.children!.add(FrameworkModel.fromUrl(tab, uri.url, dependency: dependency));
}
// set the current index
index = tabs.indexOf(tab);
}