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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user