Skip to content

Commit

Permalink
Chores and cleaning up after Flutter 3.7 (#838)
Browse files Browse the repository at this point in the history
* print info when packageName/bundleId is unknown

* migrate example app to webview v4.0.0
  • Loading branch information
bartekpacia authored Jan 29, 2023
1 parent cc88f3c commit 4783749
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 170 deletions.
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ scripts:
run: melos exec flutter analyze

format:
run: melos exec flutter format .
run: melos exec dart format .

test:
run: melos exec flutter test
Expand Down
27 changes: 18 additions & 9 deletions packages/patrol/example/lib/webview_screen.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebViewScreen extends StatelessWidget {
class WebViewScreen extends StatefulWidget {
const WebViewScreen({super.key, required this.title, required this.url});

final String title;
final String url;

@override
State<WebViewScreen> createState() => _WebViewScreenState();
}

class _WebViewScreenState extends State<WebViewScreen> {
late final WebViewController controller;

@override
void initState() {
super.initState();
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..loadRequest(Uri.parse(widget.url));
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: WebView(
debuggingEnabled: true,
initialUrl: url,
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (controller) => print('WebView created for $url'),
onPageFinished: (url) => print('WebView finished loading for $url'),
),
appBar: AppBar(title: Text(widget.title)),
body: WebViewWidget(controller: controller),
);
}
}
6 changes: 3 additions & 3 deletions packages/patrol/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ dependencies:
cupertino_icons: ^1.0.5
flutter:
sdk: flutter
flutter_local_notifications: ^12.0.2
flutter_local_notifications: ^13.0.0
geolocator: ^9.0.2
permission_handler: ^10.1.0
webview_flutter: ^3.0.4
permission_handler: ^10.2.0
webview_flutter: ^4.0.2

dev_dependencies:
flutter_test:
Expand Down
12 changes: 0 additions & 12 deletions packages/patrol_cli/lib/src/common/extensions/stopwatch.dart

This file was deleted.

5 changes: 2 additions & 3 deletions packages/patrol_cli/lib/src/common/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ class ProgressTask implements mason_logger.Progress {
final elapsedTime = _stopwatch.elapsed.inMilliseconds;
final displayInMilliseconds = elapsedTime < 100;
final time = displayInMilliseconds ? elapsedTime : elapsedTime / 1000;
final formattedTime = displayInMilliseconds
? '${time.toString()}ms'
: '${time.toStringAsFixed(1)}s';
final formattedTime =
displayInMilliseconds ? '${time}ms' : '${time.toStringAsFixed(1)}s';
return '${darkGray.wrap('($formattedTime)')}';
}

Expand Down
11 changes: 11 additions & 0 deletions packages/patrol_cli/lib/src/features/test/test_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,18 @@ class TestCommand extends StagedCommand<TestCommandConfig> {
}

final dynamic packageName = argResults?['package-name'];
if (packageName == null) {
_logger.detail(
'Package name not provided, Android app will not be uninstalled after tests finish',
);
}

final dynamic bundleId = argResults?['bundle-id'];
if (bundleId == null) {
_logger.detail(
'Bundle identifier not provided, iOS app will not be uninstalled after tests finish',
);
}

final dynamic wait = argResults?['wait'];
if (wait != null && int.tryParse(wait as String) == null) {
Expand Down
Loading

0 comments on commit 4783749

Please sign in to comment.