Flutter upgrade
This commit is contained in:
parent
02dd22238e
commit
e3f1f052df
|
|
@ -5,7 +5,6 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// Package imports:
|
// Package imports:
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:image_cropper/image_cropper.dart';
|
import 'package:image_cropper/image_cropper.dart';
|
||||||
|
|
@ -452,26 +451,13 @@ class DocumentPreview extends StatelessWidget {
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return CachedNetworkImage(
|
return Image.network(
|
||||||
height: height,
|
|
||||||
width: double.infinity,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
key: ValueKey(document.preview),
|
|
||||||
imageUrl:
|
|
||||||
'${cleanApiUrl(state.credentials.url)}/documents/${document.hash}',
|
'${cleanApiUrl(state.credentials.url)}/documents/${document.hash}',
|
||||||
//imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
key: ValueKey(document.preview),
|
||||||
httpHeaders: {'X-API-TOKEN': state.credentials.token},
|
width: double.infinity,
|
||||||
placeholder: (context, url) => Container(
|
|
||||||
height: height,
|
height: height,
|
||||||
child: Center(
|
fit: BoxFit.cover,
|
||||||
child: CircularProgressIndicator(),
|
headers: {'X-API-TOKEN': state.credentials.token});
|
||||||
),
|
|
||||||
),
|
|
||||||
errorWidget: (context, url, Object? error) => Text(
|
|
||||||
'$error: $url',
|
|
||||||
maxLines: 6,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// Package imports:
|
// Package imports:
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
|
|
||||||
// Project imports:
|
// Project imports:
|
||||||
|
|
@ -37,28 +36,13 @@ class CachedImage extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
if (kIsWeb) {
|
|
||||||
return Image.network(
|
return Image.network(
|
||||||
url!,
|
url!,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
key: ValueKey(
|
key: ValueKey(url! + (apiToken != null ? apiToken!.substring(0, 8) : '')),
|
||||||
url! + (apiToken != null ? apiToken!.substring(0, 8) : '')),
|
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
headers: apiToken != null ? {'X-API-TOKEN': apiToken!} : null,
|
headers: apiToken != null ? {'X-API-TOKEN': apiToken!} : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CachedNetworkImage(
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
key: ValueKey(url! + (apiToken != null ? apiToken!.substring(0, 8) : '')),
|
|
||||||
imageUrl: url!,
|
|
||||||
placeholder: (context, url) => Center(child: CircularProgressIndicator()),
|
|
||||||
errorWidget: (context, url, Object? error) =>
|
|
||||||
Image.asset('assets/images/icon.png', width: 32, height: 30),
|
|
||||||
httpHeaders: apiToken != null ? {'X-API-TOKEN': apiToken!} : null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,75 +31,6 @@ MutableDocument deserializeMarkdownToDocument(String markdown) {
|
||||||
return MutableDocument(nodes: nodeVisitor.content);
|
return MutableDocument(nodes: nodeVisitor.content);
|
||||||
}
|
}
|
||||||
|
|
||||||
String serializeDocumentToMarkdown(Document doc) {
|
|
||||||
final StringBuffer buffer = StringBuffer();
|
|
||||||
|
|
||||||
bool isFirstLine = true;
|
|
||||||
for (int i = 0; i < doc.nodes.length; ++i) {
|
|
||||||
final node = doc.nodes[i];
|
|
||||||
|
|
||||||
if (!isFirstLine) {
|
|
||||||
// Create a new line to encode the given node.
|
|
||||||
buffer.writeln('');
|
|
||||||
} else {
|
|
||||||
isFirstLine = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node is ImageNode) {
|
|
||||||
buffer.write('');
|
|
||||||
} else if (node is HorizontalRuleNode) {
|
|
||||||
buffer.write('---');
|
|
||||||
} else if (node is ListItemNode) {
|
|
||||||
final indent = List.generate(node.indent + 1, (index) => ' ').join('');
|
|
||||||
final symbol = node.type == ListItemType.unordered ? '*' : '1.';
|
|
||||||
|
|
||||||
buffer.write('$indent$symbol ${node.text.toMarkdown()}');
|
|
||||||
|
|
||||||
final nodeBelow = i < doc.nodes.length - 1 ? doc.nodes[i + 1] : null;
|
|
||||||
if (nodeBelow != null && (nodeBelow is! ListItemNode)) {
|
|
||||||
// This list item is the last item in the list. Add an extra
|
|
||||||
// blank line after it.
|
|
||||||
buffer.writeln('');
|
|
||||||
}
|
|
||||||
} else if (node is ParagraphNode) {
|
|
||||||
final Attribution? blockType = node.getMetadataValue('blockType');
|
|
||||||
|
|
||||||
if (blockType == header1Attribution) {
|
|
||||||
buffer.write('# ${node.text.toMarkdown()}');
|
|
||||||
} else if (blockType == header2Attribution) {
|
|
||||||
buffer.write('## ${node.text.toMarkdown()}');
|
|
||||||
} else if (blockType == header3Attribution) {
|
|
||||||
buffer.write('### ${node.text.toMarkdown()}');
|
|
||||||
} else if (blockType == header4Attribution) {
|
|
||||||
buffer.write('#### ${node.text.toMarkdown()}');
|
|
||||||
} else if (blockType == header5Attribution) {
|
|
||||||
buffer.write('##### ${node.text.toMarkdown()}');
|
|
||||||
} else if (blockType == header6Attribution) {
|
|
||||||
buffer.write('###### ${node.text.toMarkdown()}');
|
|
||||||
} else if (blockType == blockquoteAttribution) {
|
|
||||||
// TODO: handle multiline
|
|
||||||
buffer.write('> ${node.text.toMarkdown()}');
|
|
||||||
} else if (blockType == codeAttribution) {
|
|
||||||
buffer //
|
|
||||||
..writeln('```') //
|
|
||||||
..writeln(node.text.toMarkdown()) //
|
|
||||||
..write('```');
|
|
||||||
} else {
|
|
||||||
buffer.write(node.text.toMarkdown());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Separates paragraphs with blank lines.
|
|
||||||
// If we are at the last node we don't add a trailing
|
|
||||||
// blank line.
|
|
||||||
if (i != doc.nodes.length - 1) {
|
|
||||||
buffer.writeln();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return buffer.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Converts structured markdown to a list of [DocumentNode]s.
|
/// Converts structured markdown to a list of [DocumentNode]s.
|
||||||
///
|
///
|
||||||
/// To use [_MarkdownToDocument], obtain a series of markdown
|
/// To use [_MarkdownToDocument], obtain a series of markdown
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import share_plus
|
||||||
import shared_preferences_foundation
|
import shared_preferences_foundation
|
||||||
import sign_in_with_apple
|
import sign_in_with_apple
|
||||||
import smart_auth
|
import smart_auth
|
||||||
import sqflite
|
|
||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
import widget_kit_plugin
|
import widget_kit_plugin
|
||||||
import window_manager
|
import window_manager
|
||||||
|
|
@ -41,7 +40,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
|
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
|
||||||
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
|
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
|
||||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
|
||||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||||
WidgetKitPlugin.register(with: registry.registrar(forPlugin: "WidgetKitPlugin"))
|
WidgetKitPlugin.register(with: registry.registrar(forPlugin: "WidgetKitPlugin"))
|
||||||
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
|
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
|
||||||
|
|
|
||||||
64
pubspec.lock
64
pubspec.lock
|
|
@ -155,30 +155,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.8.0"
|
version: "8.8.0"
|
||||||
cached_network_image:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: cached_network_image
|
|
||||||
sha256: f98972704692ba679db144261172a8e20feb145636c617af0eb4022132a6797f
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.3.0"
|
|
||||||
cached_network_image_platform_interface:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: cached_network_image_platform_interface
|
|
||||||
sha256: "56aa42a7a01e3c9db8456d9f3f999931f1e05535b5a424271e9a38cabf066613"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.0.0"
|
|
||||||
cached_network_image_web:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: cached_network_image_web
|
|
||||||
sha256: "759b9a9f8f6ccbb66c185df805fac107f05730b1dab9c64626d1008cca532257"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.0"
|
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -440,14 +416,6 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
flutter_cache_manager:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: flutter_cache_manager
|
|
||||||
sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.3.1"
|
|
||||||
flutter_colorpicker:
|
flutter_colorpicker:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -993,14 +961,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.2"
|
||||||
octo_image:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: octo_image
|
|
||||||
sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.0"
|
|
||||||
overflow_view:
|
overflow_view:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -1527,22 +1487,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.10.0"
|
||||||
sqflite:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: sqflite
|
|
||||||
sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.3.0"
|
|
||||||
sqflite_common:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: sqflite_common
|
|
||||||
sha256: bb4738f15b23352822f4c42a531677e5c6f522e079461fd240ead29d8d8a54a6
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.5.0+2"
|
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -1618,14 +1562,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.1"
|
version: "0.3.1"
|
||||||
synchronized:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: synchronized
|
|
||||||
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.1.0"
|
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@ dependencies:
|
||||||
built_value: ^8.1.2
|
built_value: ^8.1.2
|
||||||
built_collection: ^5.1.0
|
built_collection: ^5.1.0
|
||||||
memoize: ^3.0.0
|
memoize: ^3.0.0
|
||||||
#cached_network_image: 3.0.0 # imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
|
||||||
cached_network_image: ^3.3.0
|
|
||||||
url_launcher: ^6.0.20
|
url_launcher: ^6.0.20
|
||||||
share_plus: ^7.1.0
|
share_plus: ^7.1.0
|
||||||
intl: 0.17.0
|
intl: 0.17.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue