flutter_app_badger_tizen 0.1.0 copy "flutter_app_badger_tizen: ^0.1.0" to clipboard
flutter_app_badger_tizen: ^0.1.0 copied to clipboard

Tizen implementation of the flutter_app_badger plugin

example/lib/main.dart

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

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

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

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

  initPlatformState() async {
    String appBadgeSupported;
    try {
      bool res = await FlutterAppBadger.isAppBadgeSupported();
      if (res) {
        appBadgeSupported = 'Supported';
      } else {
        appBadgeSupported = 'Not supported';
      }
    } on Exception {
      appBadgeSupported = 'Failed to get badge support.';
    }

    setState(() {
      _appBadgeSupported = appBadgeSupported;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SizedBox.expand(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Text('Badge supported: $_appBadgeSupported\n'),
              ElevatedButton(
                child: const Text('Add badge'),
                onPressed: () {
                  _addBadge();
                },
              ),
              ElevatedButton(
                  child: const Text('Remove badge'),
                  onPressed: () {
                    _removeBadge();
                  }),
            ],
          ),
        ),
      ),
    );
  }

  void _addBadge() {
    FlutterAppBadger.updateBadgeCount(1);
  }

  void _removeBadge() {
    FlutterAppBadger.removeBadge();
  }
}
0
likes
120
points
23
downloads

Publisher

verified publishertizen.org

Weekly Downloads

Tizen implementation of the flutter_app_badger plugin

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_app_badger_tizen