Fixes
This commit is contained in:
@@ -79,7 +79,10 @@ class Bookmarks extends _$Bookmarks {
|
|||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: _webViewRoute,
|
path: _webViewRoute,
|
||||||
builder: (context, state) => WebViewScreen(bookmark: state.extra as Bookmark),
|
pageBuilder: (context, state) => CustomTransitionPage(
|
||||||
|
child: WebViewScreen(bookmark: state.extra as Bookmark),
|
||||||
|
transitionsBuilder: (context, animation, secondaryAnimation, child) => child,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -83,7 +83,10 @@ class SearchBookmarks extends _$SearchBookmarks {
|
|||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: _webViewRoute,
|
path: _webViewRoute,
|
||||||
builder: (context, state) => WebViewScreen(bookmark: state.extra as Bookmark),
|
pageBuilder: (context, state) => CustomTransitionPage(
|
||||||
|
child: WebViewScreen(bookmark: state.extra as Bookmark),
|
||||||
|
transitionsBuilder: (context, animation, secondaryAnimation, child) => child,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -123,6 +126,11 @@ class SearchBookmarks extends _$SearchBookmarks {
|
|||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearSelectedBookmark() {
|
||||||
|
state.selectedBookmark = null;
|
||||||
|
ref.notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void selectBookmark(Bookmark bookmark, double width) {
|
void selectBookmark(Bookmark bookmark, double width) {
|
||||||
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
|
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
|
||||||
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
|
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
|
||||||
|
|||||||
@@ -143,7 +143,10 @@ class FilteredBookmarks extends _$FilteredBookmarks {
|
|||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: _webViewRoute,
|
path: _webViewRoute,
|
||||||
builder: (context, state) => WebViewScreen(bookmark: state.extra as Bookmark),
|
pageBuilder: (context, state) => CustomTransitionPage(
|
||||||
|
child: WebViewScreen(bookmark: state.extra as Bookmark),
|
||||||
|
transitionsBuilder: (context, animation, secondaryAnimation, child) => child,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -174,6 +177,11 @@ class FilteredBookmarks extends _$FilteredBookmarks {
|
|||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearSelectedBookmark() {
|
||||||
|
state.selectedBookmark = null;
|
||||||
|
ref.notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void selectBookmark(Bookmark bookmark, double width) {
|
void selectBookmark(Bookmark bookmark, double width) {
|
||||||
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
|
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
|
||||||
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
|
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
|
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
||||||
|
import 'package:linkdy/screens/bookmarks/provider/search_bookmarks.provider.dart';
|
||||||
|
import 'package:linkdy/screens/filtered_bookmarks/provider/filtered_bookmarks.provider.dart';
|
||||||
import 'package:linkdy/screens/webview/model/webview.model.dart';
|
import 'package:linkdy/screens/webview/model/webview.model.dart';
|
||||||
|
|
||||||
part 'webview.provider.g.dart';
|
part 'webview.provider.g.dart';
|
||||||
@@ -51,4 +54,11 @@ class WebView extends _$WebView {
|
|||||||
ref.invalidateSelf();
|
ref.invalidateSelf();
|
||||||
state.webViewController.loadRequest(Uri.parse(url));
|
state.webViewController.loadRequest(Uri.parse(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void closeWebviewSplit() {
|
||||||
|
ref.read(bookmarksProvider.notifier).clearSelectedBookmark();
|
||||||
|
ref.read(searchBookmarksProvider.notifier).clearSelectedBookmark();
|
||||||
|
ref.read(filteredBookmarksProvider.notifier).clearSelectedBookmark();
|
||||||
|
ref.notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:share_plus/share_plus.dart';
|
|||||||
|
|
||||||
import 'package:linkdy/screens/webview/provider/webview.provider.dart';
|
import 'package:linkdy/screens/webview/provider/webview.provider.dart';
|
||||||
|
|
||||||
|
import 'package:linkdy/config/sizes.dart';
|
||||||
import 'package:linkdy/constants/global_keys.dart';
|
import 'package:linkdy/constants/global_keys.dart';
|
||||||
import 'package:linkdy/models/data/bookmarks.dart';
|
import 'package:linkdy/models/data/bookmarks.dart';
|
||||||
import 'package:linkdy/i18n/strings.g.dart';
|
import 'package:linkdy/i18n/strings.g.dart';
|
||||||
@@ -30,9 +31,19 @@ class WebViewScreen extends HookConsumerWidget {
|
|||||||
[bookmark],
|
[bookmark],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final width = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 3,
|
elevation: 3,
|
||||||
|
leading: width > Sizes.tabletBreakpoint
|
||||||
|
? CloseButton(
|
||||||
|
onPressed: () {
|
||||||
|
ref.read(webViewProvider.notifier).closeWebviewSplit();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: null,
|
||||||
title: Column(
|
title: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user