first implementation finished

This commit is contained in:
Fabian Freund
2024-04-22 11:21:01 +02:00
parent 1a13ca0795
commit 0e1972242a
102 changed files with 7192 additions and 55 deletions
@@ -0,0 +1,30 @@
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:kagi_bang_bang/features/web_view/domain/entities/web_view_page.dart';
import 'package:kagi_bang_bang/features/web_view/domain/repositories/web_view.dart';
import 'package:kagi_bang_bang/features/web_view/presentation/widgets/web_view.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'switch_new_tab.g.dart';
@riverpod
class SwitchNewTabController extends _$SwitchNewTabController {
@override
FutureOr<void> build() {}
Future<void> add(Uri url) async {
state = const AsyncLoading();
state = await AsyncValue.guard(
() async {
final newTab = WebViewPage(
url: WebUri.uri(url),
);
ref
.read(webViewRepositoryProvider.notifier)
.addTab(WebView(tab: newTab));
ref.read(webViewTabControllerProvider.notifier).showTab(newTab.key);
},
);
}
}
@@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'switch_new_tab.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$switchNewTabControllerHash() =>
r'acc20371e95db182cfc5cdc924a289ff56981692';
/// See also [SwitchNewTabController].
@ProviderFor(SwitchNewTabController)
final switchNewTabControllerProvider =
AutoDisposeAsyncNotifierProvider<SwitchNewTabController, void>.internal(
SwitchNewTabController.new,
name: r'switchNewTabControllerProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$switchNewTabControllerHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$SwitchNewTabController = AutoDisposeAsyncNotifier<void>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member