Skip to content

Commit e3f1f05

Browse files
committed
Flutter upgrade
1 parent 02dd222 commit e3f1f05

File tree

6 files changed

+9
-176
lines changed

6 files changed

+9
-176
lines changed

lib/ui/app/document_grid.dart

+5-19
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:flutter/foundation.dart';
55
import 'package:flutter/material.dart';
66

77
// Package imports:
8-
import 'package:cached_network_image/cached_network_image.dart';
98
import 'package:flutter_redux/flutter_redux.dart';
109
import 'package:http/http.dart';
1110
import 'package:image_cropper/image_cropper.dart';
@@ -452,26 +451,13 @@ class DocumentPreview extends StatelessWidget {
452451
fit: BoxFit.cover,
453452
);
454453
} else {
455-
return CachedNetworkImage(
456-
height: height,
454+
return Image.network(
455+
'${cleanApiUrl(state.credentials.url)}/documents/${document.hash}',
456+
key: ValueKey(document.preview),
457457
width: double.infinity,
458+
height: height,
458459
fit: BoxFit.cover,
459-
key: ValueKey(document.preview),
460-
imageUrl:
461-
'${cleanApiUrl(state.credentials.url)}/documents/${document.hash}',
462-
//imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
463-
httpHeaders: {'X-API-TOKEN': state.credentials.token},
464-
placeholder: (context, url) => Container(
465-
height: height,
466-
child: Center(
467-
child: CircularProgressIndicator(),
468-
),
469-
),
470-
errorWidget: (context, url, Object? error) => Text(
471-
'$error: $url',
472-
maxLines: 6,
473-
overflow: TextOverflow.ellipsis,
474-
));
460+
headers: {'X-API-TOKEN': state.credentials.token});
475461
}
476462
}
477463

lib/ui/app/resources/cached_image.dart

+4-20
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:flutter/foundation.dart';
33
import 'package:flutter/material.dart';
44

55
// Package imports:
6-
import 'package:cached_network_image/cached_network_image.dart';
76
import 'package:flutter_redux/flutter_redux.dart';
87

98
// Project imports:
@@ -37,28 +36,13 @@ class CachedImage extends StatelessWidget {
3736
);
3837
}
3938

40-
// TODO remove this
41-
if (kIsWeb) {
42-
return Image.network(
43-
url!,
44-
width: width,
45-
height: height,
46-
key: ValueKey(
47-
url! + (apiToken != null ? apiToken!.substring(0, 8) : '')),
48-
fit: BoxFit.contain,
49-
headers: apiToken != null ? {'X-API-TOKEN': apiToken!} : null,
50-
);
51-
}
52-
53-
return CachedNetworkImage(
39+
return Image.network(
40+
url!,
5441
width: width,
5542
height: height,
5643
key: ValueKey(url! + (apiToken != null ? apiToken!.substring(0, 8) : '')),
57-
imageUrl: url!,
58-
placeholder: (context, url) => Center(child: CircularProgressIndicator()),
59-
errorWidget: (context, url, Object? error) =>
60-
Image.asset('assets/images/icon.png', width: 32, height: 30),
61-
httpHeaders: apiToken != null ? {'X-API-TOKEN': apiToken!} : null,
44+
fit: BoxFit.contain,
45+
headers: apiToken != null ? {'X-API-TOKEN': apiToken!} : null,
6246
);
6347
}
6448
}

lib/utils/markdown.dart

-69
Original file line numberDiff line numberDiff line change
@@ -31,75 +31,6 @@ MutableDocument deserializeMarkdownToDocument(String markdown) {
3131
return MutableDocument(nodes: nodeVisitor.content);
3232
}
3333

34-
String serializeDocumentToMarkdown(Document doc) {
35-
final StringBuffer buffer = StringBuffer();
36-
37-
bool isFirstLine = true;
38-
for (int i = 0; i < doc.nodes.length; ++i) {
39-
final node = doc.nodes[i];
40-
41-
if (!isFirstLine) {
42-
// Create a new line to encode the given node.
43-
buffer.writeln('');
44-
} else {
45-
isFirstLine = false;
46-
}
47-
48-
if (node is ImageNode) {
49-
buffer.write('![${node.altText}](${node.imageUrl})');
50-
} else if (node is HorizontalRuleNode) {
51-
buffer.write('---');
52-
} else if (node is ListItemNode) {
53-
final indent = List.generate(node.indent + 1, (index) => ' ').join('');
54-
final symbol = node.type == ListItemType.unordered ? '*' : '1.';
55-
56-
buffer.write('$indent$symbol ${node.text.toMarkdown()}');
57-
58-
final nodeBelow = i < doc.nodes.length - 1 ? doc.nodes[i + 1] : null;
59-
if (nodeBelow != null && (nodeBelow is! ListItemNode)) {
60-
// This list item is the last item in the list. Add an extra
61-
// blank line after it.
62-
buffer.writeln('');
63-
}
64-
} else if (node is ParagraphNode) {
65-
final Attribution? blockType = node.getMetadataValue('blockType');
66-
67-
if (blockType == header1Attribution) {
68-
buffer.write('# ${node.text.toMarkdown()}');
69-
} else if (blockType == header2Attribution) {
70-
buffer.write('## ${node.text.toMarkdown()}');
71-
} else if (blockType == header3Attribution) {
72-
buffer.write('### ${node.text.toMarkdown()}');
73-
} else if (blockType == header4Attribution) {
74-
buffer.write('#### ${node.text.toMarkdown()}');
75-
} else if (blockType == header5Attribution) {
76-
buffer.write('##### ${node.text.toMarkdown()}');
77-
} else if (blockType == header6Attribution) {
78-
buffer.write('###### ${node.text.toMarkdown()}');
79-
} else if (blockType == blockquoteAttribution) {
80-
// TODO: handle multiline
81-
buffer.write('> ${node.text.toMarkdown()}');
82-
} else if (blockType == codeAttribution) {
83-
buffer //
84-
..writeln('```') //
85-
..writeln(node.text.toMarkdown()) //
86-
..write('```');
87-
} else {
88-
buffer.write(node.text.toMarkdown());
89-
}
90-
91-
// Separates paragraphs with blank lines.
92-
// If we are at the last node we don't add a trailing
93-
// blank line.
94-
if (i != doc.nodes.length - 1) {
95-
buffer.writeln();
96-
}
97-
}
98-
}
99-
100-
return buffer.toString();
101-
}
102-
10334
/// Converts structured markdown to a list of [DocumentNode]s.
10435
///
10536
/// To use [_MarkdownToDocument], obtain a series of markdown

macos/Flutter/GeneratedPluginRegistrant.swift

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import share_plus
2020
import shared_preferences_foundation
2121
import sign_in_with_apple
2222
import smart_auth
23-
import sqflite
2423
import url_launcher_macos
2524
import widget_kit_plugin
2625
import window_manager
@@ -41,7 +40,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
4140
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
4241
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
4342
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
44-
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
4543
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
4644
WidgetKitPlugin.register(with: registry.registrar(forPlugin: "WidgetKitPlugin"))
4745
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))

pubspec.lock

-64
Original file line numberDiff line numberDiff line change
@@ -155,30 +155,6 @@ packages:
155155
url: "https://pub.dev"
156156
source: hosted
157157
version: "8.8.0"
158-
cached_network_image:
159-
dependency: "direct main"
160-
description:
161-
name: cached_network_image
162-
sha256: f98972704692ba679db144261172a8e20feb145636c617af0eb4022132a6797f
163-
url: "https://pub.dev"
164-
source: hosted
165-
version: "3.3.0"
166-
cached_network_image_platform_interface:
167-
dependency: transitive
168-
description:
169-
name: cached_network_image_platform_interface
170-
sha256: "56aa42a7a01e3c9db8456d9f3f999931f1e05535b5a424271e9a38cabf066613"
171-
url: "https://pub.dev"
172-
source: hosted
173-
version: "3.0.0"
174-
cached_network_image_web:
175-
dependency: transitive
176-
description:
177-
name: cached_network_image_web
178-
sha256: "759b9a9f8f6ccbb66c185df805fac107f05730b1dab9c64626d1008cca532257"
179-
url: "https://pub.dev"
180-
source: hosted
181-
version: "1.1.0"
182158
characters:
183159
dependency: transitive
184160
description:
@@ -440,14 +416,6 @@ packages:
440416
description: flutter
441417
source: sdk
442418
version: "0.0.0"
443-
flutter_cache_manager:
444-
dependency: transitive
445-
description:
446-
name: flutter_cache_manager
447-
sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
448-
url: "https://pub.dev"
449-
source: hosted
450-
version: "3.3.1"
451419
flutter_colorpicker:
452420
dependency: "direct main"
453421
description:
@@ -993,14 +961,6 @@ packages:
993961
url: "https://pub.dev"
994962
source: hosted
995963
version: "2.0.2"
996-
octo_image:
997-
dependency: transitive
998-
description:
999-
name: octo_image
1000-
sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d"
1001-
url: "https://pub.dev"
1002-
source: hosted
1003-
version: "2.0.0"
1004964
overflow_view:
1005965
dependency: "direct main"
1006966
description:
@@ -1527,22 +1487,6 @@ packages:
15271487
url: "https://pub.dev"
15281488
source: hosted
15291489
version: "1.10.0"
1530-
sqflite:
1531-
dependency: transitive
1532-
description:
1533-
name: sqflite
1534-
sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a"
1535-
url: "https://pub.dev"
1536-
source: hosted
1537-
version: "2.3.0"
1538-
sqflite_common:
1539-
dependency: transitive
1540-
description:
1541-
name: sqflite_common
1542-
sha256: bb4738f15b23352822f4c42a531677e5c6f522e079461fd240ead29d8d8a54a6
1543-
url: "https://pub.dev"
1544-
source: hosted
1545-
version: "2.5.0+2"
15461490
stack_trace:
15471491
dependency: transitive
15481492
description:
@@ -1618,14 +1562,6 @@ packages:
16181562
url: "https://pub.dev"
16191563
source: hosted
16201564
version: "0.3.1"
1621-
synchronized:
1622-
dependency: transitive
1623-
description:
1624-
name: synchronized
1625-
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
1626-
url: "https://pub.dev"
1627-
source: hosted
1628-
version: "3.1.0"
16291565
term_glyph:
16301566
dependency: transitive
16311567
description:

pubspec.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ dependencies:
3939
built_value: ^8.1.2
4040
built_collection: ^5.1.0
4141
memoize: ^3.0.0
42-
#cached_network_image: 3.0.0 # imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
43-
cached_network_image: ^3.3.0
4442
url_launcher: ^6.0.20
4543
share_plus: ^7.1.0
4644
intl: 0.17.0

0 commit comments

Comments
 (0)