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", "request": "launch",
"type": "dart", "type": "dart",
"flutterMode": "profile" "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 => bool get isDesktop =>
(Platform.isLinux || Platform.isMacOS || Platform.isWindows); (Platform.isLinux || Platform.isMacOS || Platform.isWindows);
bool get isMacWin => (Platform.isMacOS || Platform.isWindows);
class WindowButtons extends StatelessWidget { class WindowButtons extends StatelessWidget {
@override @override

View file

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