Skip to content

Instantly share code, notes, and snippets.

View Nash0x7E2's full-sized avatar
🎯
Tinkering with Flutter, Dart and everything Apple

Neevash Ramdial (Nash) Nash0x7E2

🎯
Tinkering with Flutter, Dart and everything Apple
View GitHub Profile
Property/Callback Description
onTapDown OnTapDown is fired everytime the user makes contact with the screen.
onTapUp When the user stops touching the screen, onTapUp is called.
onTap When the screen is briefly touched, onTap is triggered.
onTapCancel When a user touches the screen but does not complete the Tap, this event is fired.
onDoubleTap onDoubleTap is called when the screen is touched twice in quick succession.
@Nash0x7E2
Nash0x7E2 / app_bar_flutter_coffee_example.dart
Last active September 13, 2020 01:07
Sample code for meant to demonstrating writing simple widget test for your applications. Code used as part of an upcoming Flutter testing talk by @mkiisoft and myself.
import 'package:flutter/material.dart';
const kBreakpoint = 860.0;
extension Width on BuildContext {
double get width => MediaQuery.of(this).size.width;
}
void main() {
runApp(
@Nash0x7E2
Nash0x7E2 / date-interval.dart
Created September 22, 2020 15:53
Handy little util for calculating time intervals between two DateTime in Dart.
void main() {
calculateDateInterval(DateTime(2020, 09, 22, 11, 00), DateTime(2020, 09, 22, 16, 00), 0.75);
}
void calculateDateInterval(
final DateTime startTime,
final DateTime endTime,
final double intervalInHours,
) {
final workingHours = endTime.difference(startTime).inHours;
@Nash0x7E2
Nash0x7E2 / resizing_chat.dart
Last active January 3, 2021 17:36
Resizing chat build with Flutter and @GetStream
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import './responsive_builder.dart';
// This sample uses GetStream for chat. To get started, please see https://getstream.io/chat/flutter/tutorial/
Future<void> main() async {
final Client streamClient = Client("YOUR-STREAM-KEY", persistenceEnabled: false);
await streamClient.setUser(
User(
@Nash0x7E2
Nash0x7E2 / responsive-layout.dart
Last active January 5, 2021 23:34
Mainly used for Flutter web, builds the correct child depending on the width of the screen.
import 'package:flutter_web/material.dart';
class ResponsiveLayout extends StatelessWidget {
const ResponsiveLayout({
Key key,
@required this.largeChild,
this.mediumChild,
this.smallChild,
this.largeBreakPoint = 1200.0,
this.mediumBreakPoint = 800.0,
@Nash0x7E2
Nash0x7E2 / multiple-scrollables.dart
Created March 12, 2019 00:43
Sample code for having a horizontal list within a vertical list view in Flutter.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
@Nash0x7E2
Nash0x7E2 / animating_text.dart
Created May 31, 2021 03:46
Animating text made in Flutter. As text appear on screen, they animate between a start and ending color. Demo can be found here: https://twitter.com/Nash0x7E2/status/1399194632626520067?s=20
import 'package:flutter/material.dart';
void main() {
runApp(TexColDemo());
}
class TexColDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'package:flutter/material.dart';
class ItemTextStyle {
const ItemTextStyle({
@required this.initialStyle,
@required this.animatedStyle,
});
final TextStyle initialStyle;
final TextStyle animatedStyle;
import 'package:flutter/cupertino.dart' show CupertinoPageRoute;
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: HomePage(),
),
);
}
import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
void main() {
runApp(const App());
}