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

outdated

A new flutter plugin project.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:flutter_siri_suggestions/flutter_siri_suggestions.dart';

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

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

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

  void initSuggestions() async {
    FlutterSiriSuggestions.instance.buildActivity(FlutterSiriActivity(
        "Open App 👨‍💻",
        isEligibleForSearch: true,
        isEligibleForPrediction: true,
        contentDescription: "Did you enjoy that?",
        suggestedInvocationPhrase: "open my app"));

    FlutterSiriSuggestions.instance.configure(
        onLaunch: (Map<String, dynamic> message) async {
      //Awaken from Siri Suggestion

      ///// TO DO : do something!
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Siri Suggestions Sample'),
        ),
        body: Center(
          child: Text('Hey man! It\'s me, Bart Simpson! 🙋‍♂️'),
        ),
      ),
    );
  }
}