1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Add desktop window setup to isolate_example (#1041)

This commit is contained in:
Miguel Beltran
2022-03-04 00:01:53 +01:00
committed by GitHub
parent aa6aef0ef6
commit b2daccca71
3 changed files with 39 additions and 1 deletions

View File

@@ -12,13 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart';
import 'data_transfer_page.dart';
import 'infinite_process_page.dart';
import 'performance_page.dart';
void main() {
setupWindow();
runApp(
const MaterialApp(
home: HomePage(),
@@ -26,6 +31,17 @@ void main() {
);
}
const double kWindowWidth = 1024;
const double kWindowHeight = 800;
void setupWindow() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
WidgetsFlutterBinding.ensureInitialized();
setWindowTitle('Isolate Example');
setWindowMinSize(const Size(kWindowWidth, kWindowHeight));
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);