|
|
|
@ -2,10 +2,15 @@
|
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:window_size/window_size.dart';
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
setupWindow();
|
|
|
|
|
runApp(
|
|
|
|
|
// Provide the model to all widgets within the app. We're using
|
|
|
|
|
// ChangeNotifierProvider because that's a simple way to rebuild
|
|
|
|
@ -23,6 +28,25 @@ void main() {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const double windowWidth = 360;
|
|
|
|
|
const double windowHeight = 640;
|
|
|
|
|
|
|
|
|
|
void setupWindow() {
|
|
|
|
|
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
|
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
setWindowTitle('Provider Counter');
|
|
|
|
|
setWindowMinSize(const Size(windowWidth, windowHeight));
|
|
|
|
|
setWindowMaxSize(const Size(windowWidth, windowHeight));
|
|
|
|
|
getCurrentScreen().then((screen) {
|
|
|
|
|
setWindowFrame(Rect.fromCenter(
|
|
|
|
|
center: screen!.frame.center,
|
|
|
|
|
width: windowWidth,
|
|
|
|
|
height: windowHeight,
|
|
|
|
|
));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Simplest possible model, with just one field.
|
|
|
|
|
///
|
|
|
|
|
/// [ChangeNotifier] is a class in `flutter:foundation`. [Counter] does
|
|
|
|
|