flutter_giphy_picker 1.0.12 copy "flutter_giphy_picker: ^1.0.12" to clipboard
flutter_giphy_picker: ^1.0.12 copied to clipboard

A Flutter package for interacting with the Giphy API and a full-featured GIF picker UI, enabling seamless search and selection of GIFs, stickers, and emojis.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_giphy_picker/giphy_ui.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() {
  runApp(const MyApp());
}

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

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

class _MyApp extends State<MyApp> {
  ThemeMode themeMode = ThemeMode.system;

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Giphy Test',
      localizationsDelegates: const [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const [
        Locale("en"),
        Locale("fr"),
      ],
      locale: const Locale("fr"),
      themeMode: themeMode,
      darkTheme: ThemeData.dark(),
      theme: ThemeData.light(),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Test Flutter Giphy'),
          actions: [
            TextButton(
              onPressed: () {
                setState(() {
                  if (themeMode == ThemeMode.system) {
                    themeMode = ThemeMode.light;
                  } else if (themeMode == ThemeMode.light) {
                    themeMode = ThemeMode.dark;
                  } else {
                    themeMode = ThemeMode.system;
                  }
                });
              },
              child: const Text("ThemeMode"),
            ),
          ],
        ),
        body: const TestApp(),
      ),
    );
  }
}

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

  @override
  State<TestApp> createState() => _TestApp();
}

class _TestApp extends State<TestApp> {
  GiphyResult? gifUrl;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        if (gifUrl != null)
          Center(
            child: Image.network(
              gifUrl!.url,
              fit: BoxFit.contain,
            ),
          ),
        Center(
          child: TextButton(
            onPressed: () async {
              final config = GiphyUIConfig(
                apiKey: "YOUR_API_KEY",
                useSafeArea: true,
                useAlertDialog: MediaQuery.sizeOf(context).width > 600,
              );

              final result = await showGiphyPicker(
                context,
                config,
              );

              setState(() {
                gifUrl = result;
              });
            },
            child: const Text("Open giphy UI"),
          ),
        ),
      ],
    );
  }
}
5
likes
160
points
220
downloads

Publisher

verified publisherpieteraerens.eu

Weekly Downloads

A Flutter package for interacting with the Giphy API and a full-featured GIF picker UI, enabling seamless search and selection of GIFs, stickers, and emojis.

Homepage
Repository (GitHub)

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, flutter_localizations, flutter_staggered_grid_view, focus_detector_v2, http, intl, shared_preferences

More

Packages that depend on flutter_giphy_picker