gtk_application 0.0.3+1 copy "gtk_application: ^0.0.3+1" to clipboard
gtk_application: ^0.0.3+1 copied to clipboard

discontinuedreplaced by: gtk
PlatformLinux

Listen to remote GtkApplication instances' command-line arguments and file open requests.

example/lib/main.dart

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

void main() => runApp(const MaterialApp(home: MyHomePage()));

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('gtk_application'),
      ),
      body: GtkApplication(
        onCommandLine: (args) {
          showDialog(
            context: context,
            builder: (context) => AlertDialog(
              title: const Text('command-line'),
              content: Text(args.toString()),
              actions: [
                OutlinedButton(
                  onPressed: Navigator.of(context).pop,
                  child: const Text('Close'),
                ),
              ],
            ),
          );
        },
        onOpen: (files, hint) {
          showDialog(
            context: context,
            builder: (context) => AlertDialog(
              title: Text('open $hint'),
              content: Column(
                children: files.map((f) => Text(f)).toList(),
              ),
              actions: [
                OutlinedButton(
                  onPressed: Navigator.of(context).pop,
                  child: const Text('Close'),
                ),
              ],
            ),
          );
        },
      ),
    );
  }
}
6
likes
130
pub points
0%
popularity

Publisher

verified publisherjpnurmi.dev

Listen to remote GtkApplication instances' command-line arguments and file open requests.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MPL-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on gtk_application