Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Tinkering with Flutter, Dart and everything Apple

Neevash Ramdial (Nash) Nash0x7E2

🎯
Tinkering with Flutter, Dart and everything Apple
View GitHub Profile
@Nash0x7E2
Nash0x7E2 / Allow-multiple-gestures.dart
Last active Apr 20, 2021
Sample code on how to enable gesture pass through so that both the parent and the child widget receive the gesture.
View Allow-multiple-gestures.dart
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
//Main function. The entry point for your Flutter app.
void main() {
runApp(
MaterialApp(
home: Scaffold(
body: DemoApp(),
),
@Nash0x7E2
Nash0x7E2 / multiple-scrollables.dart
Created Mar 12, 2019
Sample code for having a horizontal list within a vertical list view in Flutter.
View multiple-scrollables.dart
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 / responsive-layout.dart
Last active Jan 5, 2021
Mainly used for Flutter web, builds the correct child depending on the width of the screen.
View responsive-layout.dart
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 / resizing_chat.dart
Last active Jan 3, 2021
Resizing chat build with Flutter and @GetStream
View resizing_chat.dart
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 / date-interval.dart
Created Sep 22, 2020
Handy little util for calculating time intervals between two DateTime in Dart.
View date-interval.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 / app_bar_flutter_coffee_example.dart
Last active Sep 13, 2020
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.
View app_bar_flutter_coffee_example.dart
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 / main.dart
Created Apr 17, 2020
Apple's Breathe Animation in Flutter
View main.dart
// MIT License
//
// Copyright (c) 2020 Neevash Ramdial
//
// 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:
View property-table.md
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.
View custom_route_flutter.dart
// MIT License
//
// Copyright (c) 2019 Neevash Ramdial
//
// 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:
@Nash0x7E2
Nash0x7E2 / page_view_indicator.dart
Created Jul 19, 2018
A modified version of a page view indicator for @flutter. Based on code originally created by @collinjackson
View page_view_indicator.dart
import 'dart:math';
import 'package:flutter/material.dart';
class PageViewIndicator extends StatefulWidget {
PageViewIndicator({
this.controller,
this.pageCount,
this.color: Colors.lightBlueAccent,
});