quick_settings_tile 0.0.1 copy "quick_settings_tile: ^0.0.1" to clipboard
quick_settings_tile: ^0.0.1 copied to clipboard

PlatformAndroid

A powerful and easy-to-use Flutter package for creating custom Quick Settings Tiles on Android devices. Add interactive tiles to your app that users can access directly from their device's quick setti [...]

Quick Settings Tile #

Banner

A powerful and easy-to-use Flutter package for creating custom Quick Settings Tiles on Android devices. Add interactive tiles to your app that users can access directly from their device's quick settings panel.

Demo

✨ Features #

  • 🎯 Create custom Quick Settings Tiles for Android
  • πŸ”„ Update tile state dynamically
  • 🎨 Customize tile icon, label, and subtitle
  • πŸ“± Support for active/inactive states
  • πŸš€ Simple and intuitive API
  • ⚑ Lightweight with minimal dependencies

πŸ“‹ Requirements #

  • Flutter SDK: >=2.12.0
  • Android: API level 24 (Android 7.0) or higher
  • Kotlin version: 1.7.0 or higher

πŸ“¦ Installation #

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

dependencies:
  quick_settings_tile: ^1.0.0

Then run:

flutter pub get

πŸ”§ Android Setup #

1. Update AndroidManifest.xml #

Add the following permission and service declaration inside the <application> tag:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application>
        <!-- Your existing code -->
        
        <service
            android:name=".QuickSettingsTileService"
            android:exported="true"
            android:icon="@drawable/ic_tile"
            android:label="@string/tile_label"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>
    </application>
</manifest>

2. Update build.gradle #

Ensure your android/app/build.gradle has minimum SDK version 24:

android {
    defaultConfig {
        minSdkVersion 24
        // other configurations
    }
}

πŸš€ Usage #

Basic Example #

import 'package:quick_settings_tile/quick_settings_tile.dart';

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

class _MyAppState extends State<MyApp> {
  final QuickSettingsTile _qsTile = QuickSettingsTile();
  bool _isActive = false;

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

  Future<void> _initializeTile() async {
    await _qsTile.initialize();
    
    // Listen to tile clicks
    _qsTile.onTileClicked(() {
      setState(() {
        _isActive = !_isActive;
      });
      _updateTile();
    });
  }

  Future<void> _updateTile() async {
    await _qsTile.updateTile(
      label: _isActive ? 'Active' : 'Inactive',
      state: _isActive ? TileState.active : TileState.inactive,
      subtitle: _isActive ? 'Tap to deactivate' : 'Tap to activate',
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Quick Settings Tile Demo')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Tile Status: ${_isActive ? "Active" : "Inactive"}'),
              SizedBox(height: 20),
              ElevatedButton(
                onPressed: () {
                  setState(() {
                    _isActive = !_isActive;
                  });
                  _updateTile();
                },
                child: Text('Toggle Tile'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

πŸ“– API Reference #

QuickSettingsTile Class #

Methods

  • initialize() - Initialize the Quick Settings Tile
  • updateTile({String? label, TileState? state, String? subtitle}) - Update tile appearance and state
  • onTileClicked(Function callback) - Register a callback for tile click events
  • getTileState() - Get current tile state
  • dispose() - Clean up resources

TileState Enum

  • TileState.active - Tile is in active state
  • TileState.inactive - Tile is in inactive state
  • TileState.unavailable - Tile is unavailable

🎨 Customization #

Custom Icons #

Place your custom tile icon in android/app/src/main/res/drawable/ic_tile.xml or ic_tile.png

Custom Labels #

Update android/app/src/main/res/values/strings.xml:

<resources>
    <string name="tile_label">My Custom Tile</string>
</resources>

🀝 Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License #

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author #

Puneet Sharma

πŸ™ Acknowledgments #

  • Thanks to the Flutter community for inspiration and support
  • Built with ❀️ for Flutter developers

πŸ“± Platform Support #

Platform Support
Android βœ… Yes
iOS ❌ No
Web ❌ No
Windows ❌ No
macOS ❌ No
Linux ❌ No

πŸ› Issues and Feedback #

Please file issues, bugs, or feature requests in our issue tracker.

⭐ Show Your Support #

If this package helped you, please give it a ⭐ on GitHub!


Made with ❀️ by Puneet Sharma

2
likes
150
points
142
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful and easy-to-use Flutter package for creating custom Quick Settings Tiles on Android devices. Add interactive tiles to your app that users can access directly from their device's quick settings panel.

Homepage
Repository (GitHub)
View/report issues

Topics

#quick-settings #tile #android #flutter #quick-settings-tile

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on quick_settings_tile

Packages that implement quick_settings_tile