Renamed desktop.dart to adaptive.dart

- Added Attach to Device to launch settings
- Fallback to standard flutter desktop window on Linux
This commit is contained in:
Tony Bark 2021-06-08 16:52:38 -04:00
parent 6f3938e848
commit dd34e59e94
3 changed files with 27 additions and 15 deletions

5
.vscode/launch.json vendored
View file

@ -14,6 +14,11 @@
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "Flutter: Attach to Device",
"type": "dart",
"request": "attach"
}
]
}

View file

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
bool get isDesktop =>
(Platform.isLinux || Platform.isMacOS || Platform.isWindows);
bool get isMacWin => (Platform.isMacOS || Platform.isWindows);
class WindowButtons extends StatelessWidget {
@override

View file

@ -1,6 +1,6 @@
import 'dart:math';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:bullseye/desktop.dart';
import 'package:bullseye/adaptive.dart';
import 'package:flutter/material.dart';
@ -96,20 +96,26 @@ class _GamePageState extends State<GamePage> {
}
Widget desktopContainer() {
return Column(children: [
Container(
height: 50,
child: WindowTitleBarBox(
child: Row(
children: [
Expanded(
child: MoveWindow(
child: Score(
totalScore: _model.totalScore, round: _model.round)))
],
))),
Expanded(child: gameContainer()),
]);
var score = Score(totalScore: _model.totalScore, round: _model.round);
// Fallback to standard Flutter window on Linux while retaining the score toolbar.
// Rendering on Linux isn't quite perfect yet, but it's better than nothing.
if (isMacWin) {
return Column(children: [
Container(
height: 50,
child: WindowTitleBarBox(
child: Row(
children: [Expanded(child: MoveWindow(child: score))],
))),
Expanded(child: gameContainer()),
]);
} else {
return Column(children: [
Container(height: 50, child: score),
Expanded(child: gameContainer()),
]);
}
}
@override