everything build but untested & migration not finished

This commit is contained in:
Fabian Freund
2024-10-09 13:27:42 +02:00
parent 37d2c84d7f
commit 2c71eeb670
132 changed files with 3790 additions and 2817 deletions
@@ -21,14 +21,14 @@ class BrowserIcon with FastEquatable {
final image =
await tryDecodeImage(bytes).then((image) => image!.toEquatable());
return BrowserIcon._(
return BrowserIcon(
image: image,
dominantColor: dominantColor,
source: source,
);
}
BrowserIcon._({
BrowserIcon({
required this.image,
required this.dominantColor,
required this.source,
@@ -0,0 +1,29 @@
import 'package:fast_equatable/fast_equatable.dart';
class FindResultState with FastEquatable {
final int activeMatchOrdinal;
final int numberOfMatches;
final bool isDoneCounting;
FindResultState({
required this.activeMatchOrdinal,
required this.numberOfMatches,
required this.isDoneCounting,
});
factory FindResultState.$default() => FindResultState(
activeMatchOrdinal: -1,
numberOfMatches: 0,
isDoneCounting: false,
);
@override
List<Object?> get hashParameters => [
activeMatchOrdinal,
numberOfMatches,
isDoneCounting,
];
@override
bool get cacheHash => true;
}
@@ -1,6 +1,10 @@
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:fast_equatable/fast_equatable.dart';
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:lensai/data/models/web_page_info.dart';
import 'package:lensai/domain/entities/equatable_image.dart';
import 'package:lensai/features/geckoview/domain/entities/browser_icon.dart';
import 'package:lensai/features/geckoview/domain/entities/find_result_state.dart';
import 'package:lensai/features/geckoview/domain/entities/history_state.dart';
import 'package:lensai/features/geckoview/domain/entities/readerable_state.dart';
import 'package:lensai/features/geckoview/domain/entities/security_state.dart';
@@ -8,16 +12,28 @@ import 'package:lensai/features/geckoview/domain/entities/security_state.dart';
part 'tab_state.g.dart';
@CopyWith()
class TabState with FastEquatable {
class TabState with FastEquatable implements WebPageInfo {
@CopyWithField(immutable: true)
final String id;
final String? contextId;
@override
final Uri url;
@override
final String title;
final EquatableImage? icon;
@override
BrowserIcon? get favicon => (icon != null)
? BrowserIcon(
image: icon!,
dominantColor: null,
source: IconSource.memory,
)
: null;
final EquatableImage? thumbnail;
final int progress;
@@ -29,6 +45,7 @@ class TabState with FastEquatable {
final SecurityState securityInfoState;
final HistoryState historyState;
final ReaderableState readerableState;
final FindResultState findResultState;
TabState({
required this.id,
@@ -44,6 +61,7 @@ class TabState with FastEquatable {
required this.securityInfoState,
required this.historyState,
required this.readerableState,
required this.findResultState,
});
factory TabState.$default(String tabId) => TabState(
@@ -60,6 +78,7 @@ class TabState with FastEquatable {
securityInfoState: SecurityState.$default(),
historyState: HistoryState.$default(),
readerableState: ReaderableState.$default(),
findResultState: FindResultState.$default(),
);
@override
@@ -80,5 +99,6 @@ class TabState with FastEquatable {
securityInfoState,
historyState,
readerableState,
findResultState,
];
}
@@ -31,6 +31,8 @@ abstract class _$TabStateCWProxy {
TabState readerableState(ReaderableState readerableState);
TabState findResultState(FindResultState findResultState);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TabState(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
@@ -50,6 +52,7 @@ abstract class _$TabStateCWProxy {
SecurityState? securityInfoState,
HistoryState? historyState,
ReaderableState? readerableState,
FindResultState? findResultState,
});
}
@@ -98,6 +101,10 @@ class _$TabStateCWProxyImpl implements _$TabStateCWProxy {
TabState readerableState(ReaderableState readerableState) =>
this(readerableState: readerableState);
@override
TabState findResultState(FindResultState findResultState) =>
this(findResultState: findResultState);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TabState(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
@@ -119,6 +126,7 @@ class _$TabStateCWProxyImpl implements _$TabStateCWProxy {
Object? securityInfoState = const $CopyWithPlaceholder(),
Object? historyState = const $CopyWithPlaceholder(),
Object? readerableState = const $CopyWithPlaceholder(),
Object? findResultState = const $CopyWithPlaceholder(),
}) {
return TabState(
id: _value.id,
@@ -174,6 +182,11 @@ class _$TabStateCWProxyImpl implements _$TabStateCWProxy {
? _value.readerableState
// ignore: cast_nullable_to_non_nullable
: readerableState as ReaderableState,
findResultState: findResultState == const $CopyWithPlaceholder() ||
findResultState == null
? _value.findResultState
// ignore: cast_nullable_to_non_nullable
: findResultState as FindResultState,
);
}
}