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
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(),
),
);
}
@Nash0x7E2
Nash0x7E2 / page_navigation_bug.dart
Created September 23, 2019 19:47
Sample code demonstrating back navigation bug in Flutter 1.10.5
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Nested tab bar list demo',
theme: ThemeData(
@Nash0x7E2
Nash0x7E2 / distinct_list.dart
Created October 8, 2019 15:28
Filters the duplicate items from both list. Returns a new list of type T unique items.
/// Mixin containing a helper list method
mixin ListDistinct {
/// Creates a new list with the unique elements form [listOne] and [listTwo].
/// The new list is returned with the specified type [T]
List<T> distinct<T>(List<T> listOne, List<T> listTwo) {
final List<T> _newList = <T>[];
_newList.addAll(listOne);
for (final T item in listTwo) {
if (_newList.contains(item)) {
_newList.remove(item);
// 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 / main.dart
Created April 17, 2020 00:44
Apple's Breathe Animation in Flutter
// 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:
@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(