system_shortcuts 0.2.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 93

system_shortcuts #

A flutter plugin to use system shortcuts.

Thanks to Rody Davis for IOS implementation.

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

Make this import #

import 'package:system_shortcuts/SystemShortcutsFlutter.dart';

Functions #

Press home button using this function. #

await SystemShortcuts.home();// perform a home button tap in android

Press back button using this function #

await SystemShortcuts.back();// perform a back button tap in android

Press volume Down in using this function #

await SystemShortcuts.volDown();// perform a volume down button click

Press volume Down in using this function #

await SystemShortcuts.volUp();// perform a volume up button click

Toggle WIFI using this function #

await SystemShortcuts.wifi();// toggle wifi in android

Toggle BLUETOOTH using this function #

await SystemShortcuts.bluetooth();// toggle bluetooth in android

Getters #

Get current WIFI state #

await SystemShortcuts.checkWifi;// return true/false

Get current BLUETOOTH state #

await SystemShortcuts.checkBluetooth;// return true/false

Usage #

FlatButton(
  child: Text("Home"),
  onPressed: () async {
    await SystemShortcuts.home();
  },
),
FlatButton(
  child: Text("Check Wifi"),
  onPressed: () async {
    bool wifi = await SystemShortcuts.checkWifi;
  },
),

All Contibutors : #

Rody Davis - IOS Implementation

Thorben Markmann - Plugin V2 embedding, Updation lib dependencies.

0.2.3 #

  • Bug Fixes Thanks to Alex-Evo for the Contibution.

0.2.2 #

  • Readme Updates

0.2.1 #

0.2.0 #

  • iOS Support. Thanks to Rody Davis for IOS implementation.

0.1.1 #

AndroidX issues resolved migrations done

0.1.0 #

Version Upgrade

0.0.7 #

Added async library to system_shortcuts.dart file.

0.0.6 #

Added license.

0.0.5 #

Updated dart doc documentation in system_shortcuts.dart file

0.0.4 #

Updated description

0.0.3 #

Example readme update

0.0.2 #

Removed the deprecated airplane mode error

0.0.1 #

Press home, back , volume up, volume Down buttons via flutter app and control your apps orientation(Portrait and Landscape).

example/lib/main.dart

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

void main() => runApp(Main());

class Main extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('System Shortcuts'),
        ),
        body: MyApp(),
      ),
    );
  }
}

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Body();
  }
}

class Body extends StatelessWidget {
  const Body({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
        child: ListView(
      children: <Widget>[
        FlatButton(
          child: Text("Home"),
          onPressed: () async {
            await SystemShortcuts.home();
          },
        ),
        FlatButton(
          child: Text("Back"),
          onPressed: () async {
            await SystemShortcuts.back();
          },
        ),
        FlatButton(
          child: Text("VolDown"),
          onPressed: () async {
            await SystemShortcuts.volDown();
          },
        ),
        FlatButton(
          child: Text("VolUp"),
          onPressed: () async {
            await SystemShortcuts.volUp();
          },
        ),
        FlatButton(
          child: Text("Landscape"),
          onPressed: () async {
            await SystemShortcuts.orientLandscape();
          },
        ),
        FlatButton(
          child: Text("Portrait"),
          onPressed: () async {
            await SystemShortcuts.orientPortrait();
          },
        ),
        FlatButton(
          child: Text("Wifi"),
          onPressed: () async {
            await SystemShortcuts.wifi();
          },
        ),
        FlatButton(
          child: Text("Check Wifi"),
          onPressed: () async {
            bool b = await SystemShortcuts.checkWifi;
            Scaffold.of(context).showSnackBar(
              SnackBar(
                content: Text("Wifi Turned On Check - $b"),
                duration: Duration(seconds: 2),
              ),
            );
          },
        ),
        FlatButton(
          child: Text("Bluetooth"),
          onPressed: () async {
            await SystemShortcuts.bluetooth();
          },
        ),
        FlatButton(
          child: Text("Check Bluetooth"),
          onPressed: () async {
            bool b = await SystemShortcuts.checkBluetooth;
            Scaffold.of(context).showSnackBar(
              SnackBar(
                content: Text("Bluetooth Turned On Check - $b"),
                duration: Duration(seconds: 2),
              ),
            );
          },
        ),
      ],
    ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  system_shortcuts: ^0.2.3

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:system_shortcuts/system_shortcuts.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
87
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
93
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform ios

Because of import path [package:system_shortcuts/system_shortcuts.dart] that declares support for platforms: android

Package does not support Flutter platform linux

Because of import path [package:system_shortcuts/system_shortcuts.dart] that declares support for platforms: android

Package does not support Flutter platform macos

Because of import path [package:system_shortcuts/system_shortcuts.dart] that declares support for platforms: android

Package does not support Flutter platform web

Because of import path [package:system_shortcuts/system_shortcuts.dart] that declares support for platforms: android

Package does not support Flutter platform windows

Because of import path [package:system_shortcuts/system_shortcuts.dart] that declares support for platforms: android

Package not compatible with SDK dart

because of import path [system_shortcuts] that is in a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8