Fixes
This commit is contained in:
@@ -79,7 +79,10 @@ class Bookmarks extends _$Bookmarks {
|
||||
routes: [
|
||||
GoRoute(
|
||||
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: [
|
||||
GoRoute(
|
||||
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();
|
||||
}
|
||||
|
||||
void clearSelectedBookmark() {
|
||||
state.selectedBookmark = null;
|
||||
ref.notifyListeners();
|
||||
}
|
||||
|
||||
void selectBookmark(Bookmark bookmark, double width) {
|
||||
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
|
||||
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
|
||||
|
||||
@@ -143,7 +143,10 @@ class FilteredBookmarks extends _$FilteredBookmarks {
|
||||
routes: [
|
||||
GoRoute(
|
||||
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();
|
||||
}
|
||||
|
||||
void clearSelectedBookmark() {
|
||||
state.selectedBookmark = null;
|
||||
ref.notifyListeners();
|
||||
}
|
||||
|
||||
void selectBookmark(Bookmark bookmark, double width) {
|
||||
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
|
||||
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'package:riverpod_annotation/riverpod_annotation.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';
|
||||
|
||||
part 'webview.provider.g.dart';
|
||||
@@ -51,4 +54,11 @@ class WebView extends _$WebView {
|
||||
ref.invalidateSelf();
|
||||
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/config/sizes.dart';
|
||||
import 'package:linkdy/constants/global_keys.dart';
|
||||
import 'package:linkdy/models/data/bookmarks.dart';
|
||||
import 'package:linkdy/i18n/strings.g.dart';
|
||||
@@ -30,9 +31,19 @@ class WebViewScreen extends HookConsumerWidget {
|
||||
[bookmark],
|
||||
);
|
||||
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 3,
|
||||
leading: width > Sizes.tabletBreakpoint
|
||||
? CloseButton(
|
||||
onPressed: () {
|
||||
ref.read(webViewProvider.notifier).closeWebviewSplit();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
: null,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user