Skip to content

Commit 19deabf

Browse files
committed
chore: update in app webview
1 parent b1fbba6 commit 19deabf

File tree

4 files changed

+10
-29
lines changed

4 files changed

+10
-29
lines changed

analysis_options.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ linter:
88
- always_declare_return_types
99
- always_put_control_body_on_new_line
1010
# - always_put_required_named_parameters_first # not useful for Flutter widgets
11-
- always_require_non_null_named_parameters
1211
#- always_specify_types # This would enforce to write types literally everywhere.
1312
- annotate_overrides
1413
#- avoid_annotating_with_dynamic # Explicit annotation of dynamic as type is preferable. Also exclusive with type_annotate_public_apis
@@ -30,8 +29,6 @@ linter:
3029
- avoid_renaming_method_parameters
3130
- avoid_relative_lib_imports
3231
- avoid_return_types_on_setters
33-
- avoid_returning_null
34-
- avoid_returning_null_for_future
3532
- avoid_returning_null_for_void
3633
- avoid_returning_this
3734
- avoid_setters_without_getters
@@ -62,7 +59,6 @@ linter:
6259
#- flutter_style_todos # Flutter todos are to verbose for our requirements.
6360
- hash_and_equals
6461
- implementation_imports
65-
- invariant_booleans
6662
- iterable_contains_unrelated_type
6763
# - join_return_with_assignment # leads to less readable code IMHO
6864
- library_names
@@ -93,7 +89,6 @@ linter:
9389
- prefer_const_literals_to_create_immutables
9490
- prefer_constructors_over_static_methods
9591
- prefer_contains
96-
- prefer_equal_for_default_values
9792
- prefer_expression_function_bodies
9893
- prefer_final_fields
9994
- prefer_final_in_for_each

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Example for enough_mail_flutter usage.
33
homepage: https://github.com/enough-software/enough_mail_flutter
44

55
environment:
6-
sdk: ">=2.7.0 <3.0.0"
6+
sdk: ">=2.12.0 <4.0.0"
77
flutter: ">=1.17.0"
88

99
dependencies:

lib/src/mime_message_viewer.dart

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
import 'dart:typed_data';
32

43
import 'package:enough_mail/enough_mail.dart';
54
import 'package:enough_mail_html/enough_mail_html.dart';
@@ -154,8 +153,6 @@ class _HtmlViewerState extends State<_HtmlMimeMessageViewer> {
154153
bool _isHtmlMessage = true;
155154
bool _isLoading = true;
156155

157-
late InAppWebViewController _controller;
158-
159156
@override
160157
void initState() {
161158
_generateHtml(widget.config.blockExternalImages,
@@ -262,28 +259,17 @@ class _HtmlViewerState extends State<_HtmlMimeMessageViewer> {
262259
Widget _buildWebView() {
263260
final htmlData = _htmlData;
264261
if (htmlData == null) {
265-
return Container();
262+
return const SizedBox.shrink();
266263
}
267-
// final theme = Theme.of(context);
268-
// final backgroundColor = theme.brightness == Brightness.dark
269-
// ? theme.colorScheme.background
270-
// : null;
264+
271265
return InAppWebView(
272266
key: ValueKey(htmlData),
273-
initialOptions: InAppWebViewGroupOptions(
274-
crossPlatform: InAppWebViewOptions(
275-
useShouldOverrideUrlLoading: true,
276-
transparentBackground: true,
277-
),
278-
ios: IOSInAppWebViewOptions(),
279-
android: AndroidInAppWebViewOptions(
280-
forceDark: widget.config.enableDarkMode
281-
? AndroidForceDark.FORCE_DARK_ON
282-
: AndroidForceDark.FORCE_DARK_OFF,
283-
),
267+
initialSettings: InAppWebViewSettings(
268+
useShouldOverrideUrlLoading: true,
269+
transparentBackground: true,
270+
forceDark: widget.config.enableDarkMode ? ForceDark.ON : ForceDark.AUTO,
284271
),
285272
onWebViewCreated: (controller) async {
286-
_controller = controller;
287273
if (kDebugMode) {
288274
print('loading html $htmlData');
289275
}

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: enough_mail_flutter
22
description: Widgets for email apps that use the `enough_mail` library. Licensed commercially friendly under MPL 2.0.
3-
version: 2.0.0
3+
version: 2.1.0
44
homepage: https://github.com/enough-software/enough_mail_flutter
55

66
environment:
7-
sdk: '>=2.12.0 <3.0.0'
7+
sdk: '>=2.12.0 <4.0.0'
88
flutter: ">=2.0.0"
99

1010
dependencies:
@@ -13,7 +13,7 @@ dependencies:
1313
enough_media: ^2.2.0
1414
flutter:
1515
sdk: flutter
16-
flutter_inappwebview: ^6.0.0-beta.22
16+
flutter_inappwebview: '^6.0.0-beta.24+1'
1717
url_launcher: ^6.1.2
1818

1919
dependency_overrides:

0 commit comments

Comments
 (0)