Skip to content

Instantly share code, notes, and snippets.

View theindianappguy's full-sized avatar
:octocat:
Working...

Sanskar Tiwari theindianappguy

:octocat:
Working...
View GitHub Profile
@theindianappguy
theindianappguy / search_bar_wallapaper_app_fluter.dart
Created May 18, 2020 08:58
Search Bar for Wallpaper App FLutter by Sanskar Tiwari (theindianappguy)
Container(
decoration: BoxDecoration(
color: Color(0xfff5f8fd),
borderRadius: BorderRadius.circular(30),
),
margin: EdgeInsets.symmetric(horizontal: 24),
padding: EdgeInsets.symmetric(horizontal: 24),
child: Row(
children: <Widget>[
Expanded(
Container(
height: 80,
child: ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 24),
itemCount: categories.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
/// Create List Item tile
return CategoriesTile(
class PhotosModel {
String url;
String photographer;
String photographerUrl;
int photographerId;
SrcModel src;
PhotosModel(
{this.url,
this.photographer,
class CategoriesTile extends StatelessWidget {
final String imgUrls, categorie;
CategoriesTile({@required this.imgUrls, @required this.categorie});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Navigator.push(
getTrendingWallpaper() async {
await http.get(
"https://api.pexels.com/v1/curated?per_page=$noOfImageToLoad&page=1",
headers: {"Authorization": apiKEY}).then((value) {
//print(value.body);
Map<String, dynamic> jsonData = jsonDecode(value.body);
jsonData["photos"].forEach((element) {
//print(element);
PhotosModel photosModel = new PhotosModel();
import 'package:wallpaper/models/categorie_model.dart';
String apiKEY = "[API_KEY]";
List<CategorieModel> getCategories() {
List<CategorieModel> categories = new List();
CategorieModel categorieModel = new CategorieModel();
//
categorieModel.imgUrl =
Widget wallpapersList({List<WallpaperModel> wallpapers, context}){
return Container(
child: GridView.count(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 16),
physics: ClampingScrollPhysics(),
crossAxisCount: 2,
childAspectRatio: 0.6,
mainAxisSpacing: 6.0,
crossAxisSpacing: 6.0,
InkWell(
onTap: () {
if (searchController.text != "") {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SearchView(
search: searchController.text,
)));
}
Widget brandName() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize : MainAxisSize.min
children: <Widget>[
Text(
"Wallpaper",
style: TextStyle(color: Colors.black87, fontFamily: 'Overpass'),
),
Text(
getSearchWallpaper(String searchQuery) async {
await http.get(
"https://api.pexels.com/v1/search?query=$searchQuery&per_page=30&page=1",
headers: {"Authorization": apiKEY}).then((value) {
//print(value.body);
Map<String, dynamic> jsonData = jsonDecode(value.body);
jsonData["photos"].forEach((element) {
//print(element);
PhotosModel photosModel = new PhotosModel();