getGif static method
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,
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,
),
),
),
);
}