Skip to content

Instantly share code, notes, and snippets.

View preetjdp's full-sized avatar
:shipit:
Brainstorming

Preet Parekh preetjdp

:shipit:
Brainstorming
View GitHub Profile
class NearByPeople {
List<User> nearbyPeople;
NearByPeople({@required this.nearbyPeople});
List<BuddyLocation> nearByLocationPoints() {
return nearbyPeople.map((person) => person.location).toList();
}
Set<Marker> nearbyMarkers(BuildContext context) {
List<BuddyLocation> nearbyLocationPoints = nearByLocationPoints();
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class FlexibleSpaceBar extends StatefulWidget {
/// Creates a flexible space bar.
///
/// Most commonly used in the [AppBar.flexibleSpace] field.
const FlexibleSpaceBar({
Key key,
this.title,
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@preetjdp
preetjdp / background-swoosh-animation.dart
Created May 13, 2020 07:20
Simple Example of doing a swoosh animation with Flutter
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(home: Scaffold(body: BackgroundAnimation())));
}
class BackgroundAnimation extends StatefulWidget {
@override
_BackgroundAnimationState createState() => _BackgroundAnimationState();
}
Future<String> getLocalityNameFromLocation(BuddyLocation location) async {
GoogleMapsGeocoding geo = GoogleMapsGeocoding(apiKey: "API_KEY");
GeocodingResponse geoCodingResponse = await geo.searchByLocation(location.gMapslocation);
List<AddressComponent> results = geoCodingResponse.results
.expand((result) => result.addressComponents
.where((result) => result.types.contains('sublocality_level_2')))
.toList();
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:math' as math;
import 'package:auto_size_text/auto_size_text.dart';
import 'dart:ui' as ui;
class ObodoAppBar extends StatelessWidget {
final String title;
final List<Widget> actions;
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:ui';
import 'package:flutter/material.dart';
void main() => runApp(Magnifier(child:MyApp()));
class MyApp extends StatelessWidget {
@preetjdp
preetjdp / createTestClient.ts
Last active December 28, 2020 00:43
Allows to test Apollo GraphQL Server
/**
* The following file is an amalgamation of [Apollo Server Testing](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-testing/src/createTestClient.ts)
* and [apollo-server-integration-testing](https://github.com/zapier/apollo-server-integration-testing),
* this allows the use of `headers` while making a request
*
* Credits to the original authors
*/
import express from 'express';
import { convertNodeHttpToRequest, runHttpQuery } from 'apollo-server-core';