getGif static method

Future<GiphyGif?> getGif({
  1. required BuildContext context,
  2. required String apiKey,
  3. String rating = GiphyRating.g,
  4. String lang = GiphyLanguage.english,
  5. String randomID = "",
  6. String searchText = "",
  7. String queryText = "",
  8. bool modal = true,
  9. bool showGIFs = true,
  10. bool showStickers = true,
  11. bool showEmojis = true,
  12. Color? tabColor,
  13. Color? textSelectedColor,
  14. Color? textUnselectedColor,
  15. int debounceTimeInMilliseconds = 350,
  16. TabTopBuilder? tapTopBuilder,
  17. TabBottomBuilder? tabBottomBuilder,
  18. SearchAppBarBuilder? searchAppBarBuilder,
})

Implementation

static Future<GiphyGif?> getGif({
  required BuildContext context,
  required String apiKey,
  String rating = GiphyRating.g,
  String lang = GiphyLanguage.english,
  String randomID = "",
  String searchText = "",
  String queryText = "",
  bool modal = true,
  bool showGIFs = true,
  bool showStickers = true,
  bool showEmojis = true,
  Color? tabColor,
  Color? textSelectedColor,
  Color? textUnselectedColor,
  int debounceTimeInMilliseconds = 350,
  TabTopBuilder? tapTopBuilder,
  TabBottomBuilder? tabBottomBuilder,
  SearchAppBarBuilder? searchAppBarBuilder,
}) {
  if (apiKey == "") {
    throw Exception("apiKey must be not null or not empty");
  }

  return showModalBottomSheet<GiphyGif>(
    clipBehavior: Clip.antiAlias,
    shape: Theme.of(context).bottomSheetTheme.shape ??
        RoundedRectangleBorder(
          borderRadius: BorderRadius.vertical(
            top: Radius.circular(10.0),
          ),
        ),
    isScrollControlled: true,
    context: context,
    builder: (ctx) => MultiProvider(
      providers: [
        ChangeNotifierProvider(
          create: (ctx) => AppBarProvider(
            queryText = queryText,
            debounceTimeInMilliseconds,
          ),
        ),
        ChangeNotifierProvider(
          create: (ctx) => SheetProvider(),
        ),
        ChangeNotifierProvider(
          create: (ctx) => TabProvider(
            apiKey: apiKey,
            randomID: randomID,
            tabColor: tabColor ?? Theme.of(context).colorScheme.secondary,
            textSelectedColor: textSelectedColor ??
                Theme.of(context).textTheme.titleSmall?.color,
            textUnselectedColor: textUnselectedColor ??
                Theme.of(context).textTheme.bodySmall?.color,
            searchText: searchText,
            rating: rating,
            lang: lang,
          ),
        )
      ],
      child: SafeArea(
        child: MainView(
          showGIFs: showGIFs,
          showStickers: showStickers,
          showEmojis: showEmojis,
          tabTopBuilder: tapTopBuilder,
          tabBottomBuilder: tabBottomBuilder,
          searchAppBarBuilder: searchAppBarBuilder,
        ),
      ),
    ),
  );
}