desktop_window 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 70

desktop_window #

Flutter plugin for Flutter desktop(macOS only) to change window size.

Usage #

import 'package:desktop_window/desktop_window.dart';

Future testWindowFunctions() async {
    Size size = await DesktopWindow.getWindowSize();
    print(size);
    await DesktopWindow.setWindowSize(Size(500,500));

    await DesktopWindow.setMinWindowSize(Size(400,400));
    await DesktopWindow.setMaxWindowSize(Size(800,800));

    await DesktopWindow.resetMaxWindowSize();
    await DesktopWindow.toggleFullScreen();

}

0.1.0 - 2020/05/25 #

  • add setMaxWindowSize, setMinWindowSize
  • add toggleFullScreen

0.0.1 - 2020/05/25 #

  • initial release

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:desktop_window/desktop_window.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _windowSize = 'Unknown';

  @override
  void initState() {
    super.initState();
  }

  Future _getWindowSize() async {
    var size = await DesktopWindow.getWindowSize();
    setState(() {
      _windowSize = '${size.width} x ${size.height}';
    });
  }

  @override
  Widget build(BuildContext context) {
    // MediaQuery.of(context).size;
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('desktop_window example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('$_windowSize\n'),
              RaisedButton(
                onPressed: _getWindowSize,
                child: Text("getWindowSize"),
              ),
              RaisedButton(
                onPressed: () async {
                  await DesktopWindow.setMinWindowSize(Size(300, 400));
                },
                child: Text("setMinWindowSize(300,400)"),
              ),
              RaisedButton(
                onPressed: () async {
                  await DesktopWindow.setMaxWindowSize(Size(800, 800));
                },
                child: Text("setMaxWindowSize(800,800)"),
              ),
              RaisedButton(
                onPressed: () async {
                  var size = await DesktopWindow.getWindowSize();
                  await DesktopWindow.setWindowSize(
                      Size(size.width - 50, size.height - 50));
                  await _getWindowSize();
                },
                child: Text("Smaller"),
              ),
              RaisedButton(
                onPressed: () async {
                  var size = await DesktopWindow.getWindowSize();
                  await DesktopWindow.setWindowSize(
                      Size(size.width + 50, size.height + 50));
                  await _getWindowSize();
                },
                child: Text("Larger"),
              ),
              RaisedButton(
                onPressed: () async {
                  await DesktopWindow.resetMaxWindowSize();
                  await DesktopWindow.toggleFullScreen();
                },
                child: Text("toggleFullScreen"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  desktop_window: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:desktop_window/desktop_window.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:desktop_window/desktop_window.dart that declares support for platforms: macos

Package does not support Flutter platform ios

Because:

  • package:desktop_window/desktop_window.dart that declares support for platforms: macos

Package does not support Flutter platform linux

Because:

  • package:desktop_window/desktop_window.dart that declares support for platforms: macos

Package does not support Flutter platform web

Because:

  • package:desktop_window/desktop_window.dart that declares support for platforms: macos

Package does not support Flutter platform windows

Because:

  • package:desktop_window/desktop_window.dart that declares support for platforms: macos

Package not compatible with SDK dart

Because:

  • desktop_window that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

9 out of 9 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test