Loader improvements (#6615)
diff --git a/packages/flutter/bin/loader/loader_app.dart b/packages/flutter/bin/loader/loader_app.dart
index ad2ec4e..fd1a895 100644
--- a/packages/flutter/bin/loader/loader_app.dart
+++ b/packages/flutter/bin/loader/loader_app.dart
@@ -22,7 +22,9 @@
return new Column(
children: <Widget>[
new Flexible(
- child: new Container() // TODO(ianh): replace this with our logo in a Center box
+ child: new Center(
+ child: new FlutterLogo(size: 100.0),
+ ),
),
new Flexible(
child: new Builder(
@@ -38,21 +40,21 @@
children.add(new Center(child: new CircularProgressIndicator(value: progressMax > 0 ? progress / progressMax : null)));
}
return new Block(children: children);
- }
- )
+ },
+ ),
),
new Flexible(
child: new Block(
- padding: new EdgeInsets.symmetric(horizontal: 16.0),
+ padding: new EdgeInsets.symmetric(horizontal: 24.0),
children: <Widget>[ new Text(explanation, textAlign: TextAlign.center) ]
- )
+ ),
),
- ]
+ ],
);
- }
- )
- )
- )
+ },
+ ),
+ ),
+ ),
);
connectionTimeout = new Timer(const Duration(seconds: 8), () {
setState(() {
@@ -82,6 +84,17 @@
});
}
);
+ registerStringServiceExtension(
+ name: 'loaderShowExplanation',
+ getter: () => explanation,
+ setter: (String value) {
+ connectionTimeout?.cancel();
+ connectionTimeout = null;
+ setState(() {
+ explanation = value;
+ });
+ }
+ );
registerNumericServiceExtension(
name: 'loaderSetProgress',
getter: () => progress,
diff --git a/packages/flutter_tools/lib/src/hot.dart b/packages/flutter_tools/lib/src/hot.dart
index 4e4f4a0..eee0591 100644
--- a/packages/flutter_tools/lib/src/hot.dart
+++ b/packages/flutter_tools/lib/src/hot.dart
@@ -263,6 +263,7 @@
return 3;
}
_loaderShowMessage('Connecting...', progress: 0);
+ _loaderShowExplanation('You can use hot reload to update your app on the fly, without restarting it.');
bool devfsResult = await _updateDevFS(
progressReporter: (int progress, int max) {
if (progress % 10 == 0)
@@ -340,6 +341,10 @@
}
}
+ void _loaderShowExplanation(String explanation) {
+ currentView.uiIsolate.flutterLoaderShowExplanation(explanation);
+ }
+
DevFS _devFS;
Future<Uri> _initDevFS() {
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index 2940ac4..e1f8fa2 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -809,6 +809,13 @@
}).catchError((dynamic error) => null);
}
+ void flutterLoaderShowExplanation(String explanation) {
+ // Invoke loaderShowExplanation; ignore any returned errors.
+ invokeRpcRaw('ext.flutter.loaderShowExplanation', <String, dynamic> {
+ 'value': explanation
+ }).catchError((dynamic error) => null);
+ }
+
void flutterLoaderSetProgress(double progress) {
// Invoke loaderSetProgress; ignore any returned errors.
invokeRpcRaw('ext.flutter.loaderSetProgress', <String, dynamic>{