Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
amantoux committed Nov 6, 2022
0 parents commit d17769a
Show file tree
Hide file tree
Showing 88 changed files with 10,124 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Flutter_Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]


env:
GIPHY_API_KEY: ${{secrets.GIPHY_API_KEY}}

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Restore packages
run: flutter pub get

- name: Analyze
run: flutter analyze

- name: Run tests
run: flutter test --coverage


75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
/coverage

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 13860a7d23c564ec9ff38a44661d21160c3f7b1e
channel: master

project_type: package
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### 1.0.0

* Initial release
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2020 Bazo SPA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

161 changes: 161 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Giphy Selector

## Overview

Inspired by [giphy_get](https://github.com/bazookon/giphy_get)

This package allow to get gifs, sticker or emojis from [GIPHY](https://www.giphy.com/) in pure dart
code using [Giphy SDK](https://developers.giphy.com/docs/sdk) design guidelines.

<img src="https://github.com/bazookon/giphy_get/raw/main/example/assets/demo/giphy_get_widget.gif" width="360" />

## Getting Started

Important! you must register your app at [Giphy Develepers](https://developers.giphy.com/dashboard/)
and get your APIKEY

## Localizations

Currently english, french and spanish is supported.

```dart
void runApp() {
return MaterialApp(
title: 'Giphy Get Demo',
localizationsDelegates: [
// Default Delegates
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
// Add this line
GiphyGetUILocalizations.delegate
],
supportedLocales: [
//Your supported languages
Locale('en', ''),
Locale('es', ''),
Locale('fr', ''),
],
home: MyHomePage(title: 'Giphy Get Demo'),
);
}
```

### Get only Gif

This is for get gif without wrapper and tap to more

```dart
import 'package:giphy_get/giphy_get.dart';
GiphyGif gif = await GiphyGet.getGif(
context: context, //Required
apiKey: "your api key HERE", //Required.
lang: GiphyLanguage.english, //Optional - Language for query.
randomID: "abcd", // Optional - An ID/proxy for a specific user.
tabColor:Colors.teal, // Optional- default accent color.
);
```

### Options

| Value | Type | Description | Default |
|--------------|--------|------------------------------------------------------------------------------------------------------------------|---------------------------------|
| `lang` | String | Use [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code or use GiphyLanguage constants | `GiphyLanguage.english` |
| `randomID` | String | An ID/proxy for a specific user. | `null` |
| `searchText` | String | Input search hint, we recommend use [flutter_18n package](https://pub.dev/packages/flutter_i18n) for translation | `"Search GIPHY"` |
| `tabColor` | Color | Color for tabs and loading progress, | `Theme.of(context).accentColor` |

### [Get Random ID](https://developers.giphy.com/docs/api/endpoint#random-id)

```dart
Futurew<void> doSomeThing() async {
GiphyClient giphyClient = GiphyClient(apiKey: 'YOUR API KEY');
String randomId = await giphyClient.getRandomId();
}
```

# Widgets

Optional but this widget is required if you get more gif's of user or view on Giphy following Giphy
Design guidelines

![giphy](https://developers.giphy.com/branch/master/static/[email protected])

## GiphyGifWidget

Parameters

| Value | Type | Description | Default |
|----------------------------|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------|------------------|
| `gif` required | GiphyGif | GiphyGif object from stream or JSON | |
| `giphyGetWrapper` required | GiphyGetWrapper | selector instance used to find more by author | null |
| `showGiphyLabel` | bool | show or hide `Powered by GIPHY`label at bottom | true |
| `borderRadius` | BorderRadius | add border radius to image | null |
| `imageAlignment` | Alignment | this widget is a [Stack](https://api.flutter.dev/flutter/widgets/Stack-class.html) with Image and tap buttons this property adjust alignment | Alignment.center |

## GiphyGetWrapper

Parameters

| Value | Type | Description | Default |
|--------------------------|----------|-------------------------------------------------------------|---------|
| `giphy_api_key` required | String | Your Giphy API KEY | null |
| `builder` | function | return Stream\<GiphyGif\> and Instance of GiphyGetWrapper | null |

## Available methods

```dart
void getGif(String queryText, BuildContext context);
```

```dart
void build(BuildContext context) {
return GiphyGetWrapper(
giphy_api_key: 'REPLACE_WITH YOUR_API_KEY',
// Builder with Stream<GiphyGif> and Instance of GiphyGetWrapper
builder: (stream, giphyGetWrapper) =>
StreamBuilder<GiphyGif>(
stream: stream,
builder: (context, snapshot) {
return Scaffold(
body: snapshot.hasData
? SizedBox(
// GiphyGifWidget with tap to more
child: GiphyGifWidget(
imageAlignment: Alignment.center,
gif: snapshot.data,
giphyGetWrapper: giphyGetWrapper,
borderRadius: BorderRadius.circular(30),
showGiphyLabel: true,
),
)
: Text("No GIF"),
floatingActionButton: FloatingActionButton(
onPressed: () async {
//Open Giphy Sheet
giphyGetWrapper.getGif('', context);
},
tooltip: 'Open Sticker',
child: Icon(Icons.insert_emoticon),
),
);
}
)
);
}
```

## Using the example

First export your giphy api key

```terminal
export GIPHY_API_KEY=YOUR_GIPHY_API_KEY
```

and then run.

## Contrib

Feel free to make any PR's
21 changes: 21 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
use_build_context_synchronously: false
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Binary file added assets/img/GIPHY_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/GIPHY_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/poweredby_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/poweredby_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

flutter test --coverage test
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html
1 change: 1 addition & 0 deletions example/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TEST=true
42 changes: 42 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

Loading

0 comments on commit d17769a

Please sign in to comment.