settings_panel_android 0.1.3

Flutter Android iOS

Launch Android's Settings.Panel right from your Flutter app. Android-only plugin.

example/lib/main.dart

import 'dart:io' show Platform;

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

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

class SettingsPanelExampleApp extends StatelessWidget {
  final _scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        key: _scaffoldKey,
        appBar: AppBar(
          title: const Text('Settings Panel example app'),
        ),
        body: ListView(
          children: SettingsPanelAction.values.map<Widget>((v) {
            return FlatButton(
              onPressed: () async {
                if (!Platform.isAndroid) {
                  showAndroidOnlyWarning();
                  return;
                }
                final successful = await SettingsPanel.display(v);
                if (!successful) {
                  showUnsuccessfulWarning();
                }
              },
              child: Text('$v'),
            );
          }).toList(),
        ),
      ),
    );
  }

  showUnsuccessfulWarning() {
    _scaffoldKey.currentState.showSnackBar(
      SnackBar(
        content: Text(
            'Could not display settings panel. Functionality requires API level 29 (Android 10) or more.'),
      ),
    );
  }

  showAndroidOnlyWarning() {
    _scaffoldKey.currentState.showSnackBar(
      SnackBar(
        content: Text('This plugin only works on Android'),
      ),
    );
  }
}
3
likes
90
pub points
38%
popularity

Publisher

dartside.dev

Launch Android's Settings.Panel right from your Flutter app. Android-only plugin.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on settings_panel_android