zir_semantic_search 0.0.7 copy "zir_semantic_search: ^0.0.7" to clipboard
zir_semantic_search: ^0.0.7 copied to clipboard

Zir AI semantic search.

example/lib/main.dart

import "dart:convert";
import "package:flutter/material.dart";
import "package:zir_semantic_search/zir_semantic_search.dart";
import "./search_box.dart";

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

class InitialApp extends StatefulWidget {
  @override
  _InitialApp createState() => _InitialApp();
}

class _InitialApp extends State<InitialApp> {
  var results = new Map();
  GlobalKey<SearchBox> _myKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "My App",
      home: Scaffold(
        body: Center(
          child: Column(
            children: [
              Padding(
                padding: EdgeInsets.only(top: 30),
                child: ZirSearchBox(
                  key: _myKey,
                  apiKey: 'zqt_cKg6-jmMWbiFViZw_6fEPl2JITLhXVk0jg3TQg',
                  corpusId: [234],
                  customerId: 1890073338,
                  image: "assets/images/logo.png",
                  results: 20,
                  offset: 0,
                  callback: (value) {
                    // printing received respose
                    print(res);
                    setState(() {
                      results = value;
                    });
                  },
                ),
              ),
              Container(
                width: 400,
                child: Row(
                  children: [
                    ActionChip(
                       label: Text("Thinking of watching a movie?"),
                        onPressed: () async {
                          final res = await _myKey.currentState!.runSearch("What movies are playing today?");
                          // print received respose
                          print(res);
                          setState(() {
                            results = res;
                          });
                        }),
                    ActionChip(
                        label: Text("How about some coffee?"),
                        onPressed: () async {
                          final res = await _myKey.currentState!.runSearch("What is the highest rated coffee shop near me?");
                          // print received respose
                          print(res);
                          setState(() {
                            results = res;
                          });
                        }),
                  ],
                ),
              ),
              SearchApp() // another widget using ZirSearchBox
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
90
pub points
0%
popularity

Publisher

unverified uploader

Zir AI semantic search.

Homepage

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter, http

More

Packages that depend on zir_semantic_search