upgrade flutter
This commit is contained in:
@@ -271,6 +271,10 @@
|
||||
android:name="io.flutter.embedding.android.EnableImpeller"
|
||||
android:value="false" />
|
||||
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.EnableHcpp"
|
||||
android:value="true" />
|
||||
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
# This builtInKotlin flag was added automatically by Flutter migrator
|
||||
android.builtInKotlin=false
|
||||
# This newDsl flag was added automatically by Flutter migrator
|
||||
android.newDsl=false
|
||||
|
||||
@@ -21,28 +21,54 @@ import 'dart:convert';
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
final Map<String, IconData> _mdiIconsByName = Map.unmodifiable({
|
||||
for (final iconData in MdiIcons.values)
|
||||
if (iconData.mdiMetadata case final metadata?) metadata.name: iconData,
|
||||
});
|
||||
|
||||
final Map<int, IconData> _mdiIconsByCodePoint = Map.unmodifiable({
|
||||
for (final iconData in MdiIcons.values) iconData.codePoint: iconData,
|
||||
});
|
||||
|
||||
class IconDataJsonConverter
|
||||
implements JsonConverter<IconData, Map<String, dynamic>> {
|
||||
const IconDataJsonConverter();
|
||||
|
||||
@override
|
||||
IconData fromJson(Map<String, dynamic> json) {
|
||||
return IconData(
|
||||
json['codePoint'] as int,
|
||||
fontFamily: json['fontFamily'] as String?,
|
||||
fontPackage: json['fontPackage'] as String?,
|
||||
);
|
||||
if (json['name'] case final String name) {
|
||||
final iconData = _mdiIconsByName[name];
|
||||
if (iconData != null) {
|
||||
return iconData;
|
||||
}
|
||||
}
|
||||
|
||||
final codePoint = json['codePoint'];
|
||||
if (codePoint is int) {
|
||||
final iconData = _mdiIconsByCodePoint[codePoint];
|
||||
if (iconData != null) {
|
||||
return iconData;
|
||||
}
|
||||
}
|
||||
|
||||
throw FormatException('Unknown MDI icon data: $json');
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson(IconData iconData) {
|
||||
return <String, dynamic>{
|
||||
'codePoint': iconData.codePoint,
|
||||
'fontFamily': iconData.fontFamily,
|
||||
'fontPackage': iconData.fontPackage,
|
||||
};
|
||||
final metadata = iconData.mdiMetadata;
|
||||
if (metadata == null) {
|
||||
throw ArgumentError.value(
|
||||
iconData,
|
||||
'iconData',
|
||||
'Icon is not an MDI icon',
|
||||
);
|
||||
}
|
||||
|
||||
return <String, dynamic>{'name': metadata.name};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,11 +83,6 @@ class IconDataTypeConverter implements TypeConverter<IconData, String> {
|
||||
|
||||
@override
|
||||
String toSql(IconData value) {
|
||||
assert(
|
||||
value.fontFamily != null,
|
||||
'Font family must be provided to identify icon',
|
||||
);
|
||||
|
||||
return jsonEncode(const IconDataJsonConverter().toJson(value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:weblibre/core/database_registry.dart';
|
||||
import 'package:weblibre/core/filesystem.dart';
|
||||
import 'package:weblibre/features/bangs/data/database/database.dart';
|
||||
@@ -33,14 +32,9 @@ part 'providers.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
BangDatabase bangDatabase(Ref ref) {
|
||||
final db = BangDatabase(
|
||||
LazyDatabase(() async {
|
||||
LazyDatabase(() {
|
||||
final file = File(p.join(filesystem.profileDatabasesDir.path, 'bang.db'));
|
||||
|
||||
// Also work around limitations on old Android versions
|
||||
if (Platform.isAndroid) {
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
|
||||
return NativeDatabase.createInBackground(file);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -48,4 +48,4 @@ final class BangDatabaseProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$bangDatabaseHash() => r'0369d508def140a32c08c0551cefed57b1ca4b26';
|
||||
String _$bangDatabaseHash() => r'89fc1c6fe4100d32a50314ac8ab98af2eba96cfd';
|
||||
|
||||
+1
-5
@@ -56,11 +56,7 @@ TabViewReorderResult? buildTabViewReorderResult({
|
||||
final reordered = visibleItems.toList();
|
||||
final movingItem = reordered.removeAt(oldIndex);
|
||||
|
||||
var insertIndex = newIndex;
|
||||
if (insertIndex > oldIndex) {
|
||||
insertIndex -= 1;
|
||||
}
|
||||
insertIndex = insertIndex.clamp(0, reordered.length);
|
||||
final insertIndex = newIndex.clamp(0, reordered.length);
|
||||
reordered.insert(insertIndex, movingItem);
|
||||
|
||||
if (!hierarchical) {
|
||||
|
||||
+1
-1
@@ -432,7 +432,7 @@ class _TabListView extends HookConsumerWidget {
|
||||
onReorderStart: (index) {
|
||||
ref.read(willAcceptDropProvider.notifier).clear();
|
||||
},
|
||||
onReorder: (oldIndex, newIndex) async {
|
||||
onReorderItem: (oldIndex, newIndex) async {
|
||||
//Suggestions are at the end and not reorderable, so skip
|
||||
if (oldIndex >= primaryRows.length) {
|
||||
return;
|
||||
|
||||
+1
-2
@@ -77,8 +77,7 @@ class SearchModuleOrder extends _$SearchModuleOrder {
|
||||
void reorder(int oldIndex, int newIndex) {
|
||||
final list = [...state];
|
||||
final item = list.removeAt(oldIndex);
|
||||
final insertIndex = newIndex > oldIndex ? newIndex - 1 : newIndex;
|
||||
list.insert(insertIndex, item);
|
||||
list.insert(newIndex, item);
|
||||
state = list;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ final class SearchModuleOrderProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$searchModuleOrderHash() => r'245c933174b1808b2cb27c4c375fac4edd12d727';
|
||||
String _$searchModuleOrderHash() => r'fde46e0a0998152340801cb323335a2f4a0f3557';
|
||||
|
||||
final class SearchModuleOrderFamily extends $Family
|
||||
with
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ class SearchModuleReorderView extends ConsumerWidget {
|
||||
),
|
||||
SliverReorderableList(
|
||||
itemCount: entries.length,
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
onReorderItem: (oldIndex, newIndex) {
|
||||
ref
|
||||
.read(searchModuleOrderProvider(group).notifier)
|
||||
.reorder(oldIndex, newIndex);
|
||||
|
||||
@@ -23,7 +23,6 @@ import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:weblibre/core/database_registry.dart';
|
||||
import 'package:weblibre/core/filesystem.dart';
|
||||
import 'package:weblibre/data/database/functions/lexo_rank_functions.dart';
|
||||
@@ -35,14 +34,9 @@ part 'providers.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
TabDatabase tabDatabase(Ref ref) {
|
||||
final db = TabDatabase(
|
||||
LazyDatabase(() async {
|
||||
LazyDatabase(() {
|
||||
final file = File(p.join(filesystem.profileDatabasesDir.path, 'tab.db'));
|
||||
|
||||
// Also work around limitations on old Android versions
|
||||
if (Platform.isAndroid) {
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
|
||||
return NativeDatabase.createInBackground(
|
||||
file,
|
||||
setup: (database) {
|
||||
|
||||
@@ -48,4 +48,4 @@ final class TabDatabaseProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$tabDatabaseHash() => r'983f15b87d8d8bdd52b45d79fe78a1cb4b241f6e';
|
||||
String _$tabDatabaseHash() => r'f850fbe52b2c68c801040c89cf48cadc04a9a6cc';
|
||||
|
||||
+1
-5
@@ -216,11 +216,7 @@ class ContainerRepository extends _$ContainerRepository {
|
||||
) async {
|
||||
if (containers.isEmpty || oldIndex == newIndex) return;
|
||||
|
||||
var targetIndex = newIndex;
|
||||
if (targetIndex > oldIndex) {
|
||||
targetIndex -= 1;
|
||||
}
|
||||
targetIndex = targetIndex.clamp(0, containers.length - 1);
|
||||
final targetIndex = newIndex.clamp(0, containers.length - 1);
|
||||
if (targetIndex == oldIndex) return;
|
||||
|
||||
final movingContainer = containers[oldIndex];
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ final class ContainerRepositoryProvider
|
||||
}
|
||||
|
||||
String _$containerRepositoryHash() =>
|
||||
r'8db0f2a08ee5a67123f9c110ef7edf4c574992c4';
|
||||
r'14c77b4f3ed21d9511d5bf507db013b02a122595';
|
||||
|
||||
abstract class _$ContainerRepository extends $Notifier<void> {
|
||||
void build();
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ class ContainerListScreen extends HookConsumerWidget {
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 96),
|
||||
sliver: SliverReorderableList(
|
||||
itemCount: containers.length,
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
onReorderItem: (oldIndex, newIndex) {
|
||||
unawaited(
|
||||
repository.reorderContainer(containers, oldIndex, newIndex),
|
||||
);
|
||||
|
||||
@@ -23,7 +23,6 @@ import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:weblibre/core/database_registry.dart';
|
||||
import 'package:weblibre/core/filesystem.dart';
|
||||
import 'package:weblibre/data/database/functions/lexo_rank_functions.dart';
|
||||
@@ -34,15 +33,11 @@ part 'providers.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
TopSiteDatabase topSiteDatabase(Ref ref) {
|
||||
final db = TopSiteDatabase(
|
||||
LazyDatabase(() async {
|
||||
LazyDatabase(() {
|
||||
final file = File(
|
||||
p.join(filesystem.profileDatabasesDir.path, 'top_site.db'),
|
||||
);
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
|
||||
return NativeDatabase.createInBackground(
|
||||
file,
|
||||
setup: (database) {
|
||||
|
||||
@@ -49,4 +49,4 @@ final class TopSiteDatabaseProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$topSiteDatabaseHash() => r'a5afe9a807174ae3382931612b25f959efccdded';
|
||||
String _$topSiteDatabaseHash() => r'1bba4ea77ccd1e5f32717ac9875796216db77706';
|
||||
|
||||
@@ -37,7 +37,7 @@ Future<bool> ensureProxyStartedForContainer(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ContainerData container,
|
||||
) async {
|
||||
) {
|
||||
return ensureProxyStartedForConnection(
|
||||
context,
|
||||
ref,
|
||||
@@ -117,6 +117,9 @@ Future<bool> _maybeStartSingboxProxy(
|
||||
ref,
|
||||
proxyConnectionId,
|
||||
);
|
||||
|
||||
if (!context.mounted) return false;
|
||||
|
||||
final shouldStart = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
|
||||
@@ -24,7 +24,6 @@ import 'package:drift/native.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:weblibre/core/database_registry.dart';
|
||||
import 'package:weblibre/core/filesystem.dart';
|
||||
import 'package:weblibre/features/quotes/data/database/database.dart';
|
||||
@@ -51,10 +50,6 @@ QuotesDatabase quotesDatabase(Ref ref) {
|
||||
flush: true,
|
||||
);
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
|
||||
return NativeDatabase.createInBackground(file);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -48,4 +48,4 @@ final class QuotesDatabaseProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$quotesDatabaseHash() => r'14491e3de1a188138b329776e1f4d83101b2ba13';
|
||||
String _$quotesDatabaseHash() => r'4f30fb578102516febbd6c56ca53051dd34e84bb';
|
||||
|
||||
+3
-7
@@ -120,7 +120,7 @@ class ContextualToolbarSettingsScreen extends HookConsumerWidget {
|
||||
else
|
||||
SliverReorderableList(
|
||||
itemCount: visibleConfigs.length,
|
||||
onReorder: (oldIndex, newIndex) => _onReorder(
|
||||
onReorderItem: (oldIndex, newIndex) => _onReorder(
|
||||
visibleConfigs,
|
||||
oldIndex,
|
||||
newIndex,
|
||||
@@ -158,7 +158,7 @@ class ContextualToolbarSettingsScreen extends HookConsumerWidget {
|
||||
else
|
||||
SliverReorderableList(
|
||||
itemCount: hiddenConfigs.length,
|
||||
onReorder: (oldIndex, newIndex) => _onReorder(
|
||||
onReorderItem: (oldIndex, newIndex) => _onReorder(
|
||||
hiddenConfigs,
|
||||
oldIndex,
|
||||
newIndex,
|
||||
@@ -185,11 +185,7 @@ class ContextualToolbarSettingsScreen extends HookConsumerWidget {
|
||||
int oldIndex,
|
||||
int newIndex,
|
||||
) {
|
||||
var targetIndex = newIndex;
|
||||
if (targetIndex > oldIndex) {
|
||||
targetIndex -= 1;
|
||||
}
|
||||
targetIndex = targetIndex.clamp(0, configs.length - 1);
|
||||
final targetIndex = newIndex.clamp(0, configs.length - 1);
|
||||
return (movedId: configs[oldIndex].buttonId, targetIndex: targetIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import 'package:drift/native.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:weblibre/core/database_registry.dart';
|
||||
import 'package:weblibre/core/filesystem.dart';
|
||||
import 'package:weblibre/features/small_web/data/database/database.dart';
|
||||
@@ -36,15 +35,11 @@ part 'providers.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
SmallWebDatabase smallWebDatabase(Ref ref) {
|
||||
final db = SmallWebDatabase(
|
||||
LazyDatabase(() async {
|
||||
LazyDatabase(() {
|
||||
final file = File(
|
||||
p.join(filesystem.profileDatabasesDir.path, 'small_web.db'),
|
||||
);
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
|
||||
return NativeDatabase.createInBackground(file);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -53,7 +53,7 @@ final class SmallWebDatabaseProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$smallWebDatabaseHash() => r'e199e8c1261e8152110fb99f883fed1e550ffdc6';
|
||||
String _$smallWebDatabaseHash() => r'4c514677f7944612515ccadfe8ad7ec3a9075f3f';
|
||||
|
||||
@ProviderFor(kagiCategories)
|
||||
final kagiCategoriesProvider = KagiCategoriesProvider._();
|
||||
|
||||
@@ -24,7 +24,6 @@ import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:riverpod/experimental/persist.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:weblibre/core/database_registry.dart';
|
||||
import 'package:weblibre/core/filesystem.dart';
|
||||
import 'package:weblibre/data/database/functions/lexo_rank_functions.dart';
|
||||
@@ -36,14 +35,9 @@ part 'providers.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
UserDatabase userDatabase(Ref ref) {
|
||||
final db = UserDatabase(
|
||||
LazyDatabase(() async {
|
||||
LazyDatabase(() {
|
||||
final file = File(p.join(filesystem.profileDatabasesDir.path, 'user.db'));
|
||||
|
||||
// Also work around limitations on old Android versions
|
||||
if (Platform.isAndroid) {
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
|
||||
return NativeDatabase.createInBackground(
|
||||
file,
|
||||
setup: (database) {
|
||||
|
||||
@@ -48,7 +48,7 @@ final class UserDatabaseProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$userDatabaseHash() => r'05386a087a53dedd5f51859f45eb93ecf449c3c4';
|
||||
String _$userDatabaseHash() => r'6751fe70be0d590d529e99b44140076174122acc';
|
||||
|
||||
@ProviderFor(riverpodDatabaseStorage)
|
||||
final riverpodDatabaseStorageProvider = RiverpodDatabaseStorageProvider._();
|
||||
|
||||
@@ -23,7 +23,6 @@ import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:weblibre/core/database_registry.dart';
|
||||
import 'package:weblibre/core/filesystem.dart';
|
||||
import 'package:weblibre/features/web_feed/data/database/database.dart';
|
||||
@@ -33,14 +32,9 @@ part 'providers.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
FeedDatabase feedDatabase(Ref ref) {
|
||||
final db = FeedDatabase(
|
||||
LazyDatabase(() async {
|
||||
LazyDatabase(() {
|
||||
final file = File(p.join(filesystem.profileDatabasesDir.path, 'feed.db'));
|
||||
|
||||
// Also work around limitations on old Android versions
|
||||
if (Platform.isAndroid) {
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
|
||||
return NativeDatabase.createInBackground(file);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -48,4 +48,4 @@ final class FeedDatabaseProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$feedDatabaseHash() => r'1ecae87a3de5b2d43136fdb73411727b0b217621';
|
||||
String _$feedDatabaseHash() => r'393798ca8a5c04a9a8fdb7e864552542024b9456';
|
||||
|
||||
@@ -18,8 +18,8 @@ dependencies:
|
||||
crypto: ^3.0.7
|
||||
cryptography_flutter: ^2.3.4
|
||||
device_info_plus: ^13.1.0
|
||||
drift: ^2.31.0
|
||||
drift_dev: ^2.31.0
|
||||
drift: ^2.33.0
|
||||
drift_dev: ^2.33.0
|
||||
dynamic_color: ^1.8.1
|
||||
exceptions: ^0.6.1
|
||||
fading_scroll: ^0.9.1
|
||||
@@ -35,7 +35,7 @@ dependencies:
|
||||
flutter_mozilla_components:
|
||||
path: ../../packages/flutter_mozilla_components
|
||||
flutter_reorderable_grid_view: ^5.6.0
|
||||
flutter_secure_storage: ^10.2.0
|
||||
flutter_secure_storage: ^10.3.0
|
||||
flutter_singbox_proxy:
|
||||
path: ../../packages/flutter_singbox_proxy
|
||||
flutter_slidable: ^4.0.3
|
||||
@@ -50,7 +50,7 @@ dependencies:
|
||||
html: ^0.15.6
|
||||
http: ^1.6.0
|
||||
intl: ^0.20.2
|
||||
json_annotation: ^4.11.0
|
||||
json_annotation: ^4.12.0
|
||||
lexo_rank:
|
||||
git:
|
||||
url: https://github.com/FaFre/lexo_rank.git
|
||||
@@ -104,8 +104,7 @@ dependencies:
|
||||
socks5_proxy: ^2.1.1
|
||||
speech_to_text_dialog:
|
||||
path: ../../packages/speech_to_text_dialog
|
||||
sqlite3: ^2.9.4
|
||||
sqlite3_flutter_libs: "0.5.41"
|
||||
sqlite3: ^3.3.1
|
||||
supabase: ^2.10.6
|
||||
synchronized: ^3.4.0+1
|
||||
text_scroll: ^0.2.1
|
||||
@@ -125,10 +124,10 @@ dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
go_router_builder: ^4.3.0
|
||||
json_serializable: ^6.13.0
|
||||
json_serializable: ^6.14.0
|
||||
lint: ^2.8.0
|
||||
mockito: ^5.6.4
|
||||
riverpod_generator: ^4.0.3
|
||||
riverpod_generator: ^4.0.4-dev.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
+27
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:weblibre/features/geckoview/features/tabs/data/models/container_data.dart';
|
||||
import 'package:weblibre/features/proxy/data/proxy_connection.dart';
|
||||
@@ -30,4 +31,30 @@ void main() {
|
||||
expect(tor.usesTorProxy, isTrue);
|
||||
});
|
||||
});
|
||||
|
||||
group('ContainerMetadata icon serialization', () {
|
||||
test('stores MDI icon names', () {
|
||||
final metadata = ContainerMetadata.withDefaults(
|
||||
iconData: MdiIcons.folderOutline,
|
||||
);
|
||||
|
||||
final json = metadata.toJson();
|
||||
final restored = ContainerMetadata.fromJson(json);
|
||||
|
||||
expect(json['iconData'], <String, dynamic>{'name': 'folder-outline'});
|
||||
expect(restored.iconData, MdiIcons.folderOutline);
|
||||
});
|
||||
|
||||
test('restores legacy code point JSON as a const MDI icon', () {
|
||||
final restored = ContainerMetadata.fromJson({
|
||||
'iconData': <String, dynamic>{
|
||||
'codePoint': MdiIcons.folderOutline.codePoint,
|
||||
'fontFamily': MdiIcons.folderOutline.fontFamily,
|
||||
'fontPackage': MdiIcons.folderOutline.fontPackage,
|
||||
},
|
||||
});
|
||||
|
||||
expect(identical(restored.iconData, MdiIcons.folderOutline), isTrue);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user