Skip to content

Instantly share code, notes, and snippets.

💙
Fluttering

Simon Lightfoot slightfoot

💙
Fluttering
Block or report user

Report or block slightfoot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@slightfoot
slightfoot / fling_physics.dart
Last active Nov 13, 2019
Fling PageScrollPhysics for Flutter
View fling_physics.dart
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// 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:
@slightfoot
slightfoot / lru_cache.dart
Last active Nov 13, 2019
Time Aware Least Recently Used Cache - by Simon Lightfoot http://en.wikipedia.org/wiki/Cache_algorithms#LRU
View lru_cache.dart
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// 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 example_web.dart
import 'package:flutter_web/material.dart';
import 'package:flutter_web_ui/ui.dart' as ui;
void main() async {
await ui.webOnlyInitializePlatform();
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
@slightfoot
slightfoot / terminal_progress_bar.dart
Created Oct 31, 2019
Little example of creating a coloured terminal progress bar in Dart.
View terminal_progress_bar.dart
import 'dart:io' show stdout;
Future<void> main() async {
print('\n\x1b[38;5;39mBUILDING CODE\x1b[0m');
for (int j = 0; j < 3; j++) {
for (int i = 0; i <= 100; i++) {
drawProgressBar(i / 100.0, 20);
await Future.delayed(const Duration(milliseconds: 25));
}
}
@slightfoot
slightfoot / sliver_scroll.dart
Last active Nov 5, 2019
Example of having a layout with nested scrolling tabs with Slivers.
View sliver_scroll.dart
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// 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:
@slightfoot
slightfoot / main.dart
Last active Nov 16, 2019
Firebase Login/Logout Example - by Simon Lightfoot
View main.dart
/*
This example uses the following packages:
firebase_auth: 0.14.0+5
google_sign_in: 4.0.7
provider: 3.1.0+1
Make sure you have setup your project with Firebase by following these instructions:
1. Follow Option 1 instructions here up to Step 3
@slightfoot
slightfoot / single_top.dart
Last active Oct 31, 2019
Recreating Android Single-Top Activity behaviour with Flutter Route's - by Simon Lightfoot
View single_top.dart
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// 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 overlay_elevation.dart
import 'package:flutter/material.dart';
class OverlayElevation {
static const e1 = OverlayElevation._(0.05);
static const e2 = OverlayElevation._(0.07);
static const e3 = OverlayElevation._(0.08);
static const e4 = OverlayElevation._(0.09);
static const e6 = OverlayElevation._(0.11);
@slightfoot
slightfoot / map_widget.dart
Last active Sep 14, 2019
Map Widget Example
View map_widget.dart
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/physics.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
@slightfoot
slightfoot / page_turn.dart
Created Sep 9, 2019
Page Turn Effect - By Simon Lightfoot. Replicating this behaviour. https://www.youtube.com/watch?v=JqvtZwIJMLo
View page_turn.dart
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// 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:
You can’t perform that action at this time.