Reputation: 1
Flutter app works as expected on android device but gives empty window on desktop. The title bar also does not match. Tested with the sample hello world from google code labs as well.
I have overidden target platforms as stated here https://github.com/flutter/flutter/wiki/Desktop-shells.
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.6.0, on Linux, locale en_IN)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[!] Android Studio (version 3.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Community Edition (version 2019.1)
[✓] Connected device (1 available)
which is fine as i am using a physical device or the host system. Flutter devices shows my host system. There are no errors while building and running (checked with verbose).
flutter run o/p: flutter run
Launching lib/main.dart on Linux in debug mode...
Building Linux application...
Flutter is taking longer than expected to report its views. Still trying...
Syncing files to device Linux...
4,551ms (!)
🔥 To hot reload changes while running, press "r". To hot restart (and rebuild
state), press "R".
An Observatory debugger and profiler on Linux is available at:
http://127.0.0.1:44463/x2_TrHddHQg=/
For a more detailed help message, press "h". To detach, press "d"; to quit,
press "q".
sample code :
import 'package:flutter/foundation.dart' show debugDefaultTargetPlatformOverride;
import 'package:flutter/material.dart';
import 'dart:io' show Platform;
void main() {
TargetPlatform targetPlatform;
if (Platform.isMacOS) {
targetPlatform = TargetPlatform.iOS;
} else if (Platform.isLinux || Platform.isWindows) {
targetPlatform = TargetPlatform.android;
}
if (targetPlatform != null) {
debugDefaultTargetPlatformOverride = targetPlatform;
}
runApp(new FriendlychatApp());
}
class FriendlychatApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Friendlychat",
home: new ChatScreen(),
);
}
}
class ChatScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Friendlychat")),
body: Center(
child: Text('Hello World'),
),
);
}
}
expected: https://i.sstatic.net/bBiRa.jpg (from android run)
actual : https://i.sstatic.net/yOHYL.jpg (from desktop run)
Upvotes: 0
Views: 490
Reputation: 21569
The fonts are missing because the app is using fonts that aren't installed on your machine (most likely Roboto given that you are using Android as your platform override), as described in the Fonts section of the desktop shells page you linked to in your question.
Upvotes: 0