Skip to content

Instantly share code, notes, and snippets.

Avatar
💙
Fluttering

Simon Lightfoot slightfoot

💙
Fluttering
View GitHub Profile
@slightfoot
slightfoot / pixel_issue.dart
Last active May 15, 2022
Material/PhysicalModel offset issue
View pixel_issue.dart
import 'package:flutter/material.dart';
void main() => runApp(ExampleApp());
class ExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Column(
children: [
@slightfoot
slightfoot / downloadable_image.dart
Last active May 5, 2022
Downloadable Image :: Flutter Web - by Simon Lightfoot
View downloadable_image.dart
import 'dart:convert';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'dart:html' as html;
import 'package:flutter/material.dart';
typedef PlatformViewFactory = html.Element Function(int viewId);
bool registerViewFactory(String viewTypeId, PlatformViewFactory factory) {
// ignore: undefined_prefixed_name
@slightfoot
slightfoot / bottom_nested_nav.dart
Created May 4, 2022
Bottom Nested Nav - by Simon Lightfoot :: #HumpdayQandA :: 4th May 2022
View bottom_nested_nav.dart
import 'package:flutter/material.dart';
void main() {
runApp(const App());
}
@immutable
class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
@slightfoot
slightfoot / humpday_stack_theming.dart
Created Apr 27, 2022
Humpday Stack Themeing - by Simon Lightfoot - 27/04/2022
View humpday_stack_theming.dart
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
enum AppThemeType {
darkTheme,
lightTheme,
}
extension AppThemeTypeExt on AppThemeType {
ThemeData get theme {
@slightfoot
slightfoot / sidebar.dart
Created Apr 20, 2022
Sidebar Example for Humpday - by Simon Lightfoot - 20/04/2022
View sidebar.dart
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData.dark(),
home: const Home(),
));
@slightfoot
slightfoot / compile.dart
Created Apr 20, 2022
Runs dart to compiles more dart code into a executable file - by Simon Lightfoot
View compile.dart
import 'dart:io';
import 'dart:typed_data';
import 'package:path/path.dart' as path;
final Directory binDir = File(Platform.resolvedExecutable).parent;
final String executableSuffix = Platform.isWindows ? '.exe' : '';
final String dartAotRuntime = path.join(binDir.path, 'dartaotruntime$executableSuffix');
@slightfoot
slightfoot / magic_text.dart
Created Apr 15, 2022
MagicText :: by Simon Lightfoot
View magic_text.dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
typedef MagicTextLayer = Widget Function(BuildContext context, RenderParagraph paragraph);
void main() {
runApp(const MaterialApp(
debugShowCheckedModeBanner: false,
home: Home(),
@slightfoot
slightfoot / bottom_nav.dart
Created Apr 13, 2022
Bottom Nav Example from HumpdayQandA :: 13th April :: by Simon Lightfoot
View bottom_nav.dart
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
@immutable
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@slightfoot
slightfoot / index.html
Created Feb 20, 2022
WebGL Example for Dartpad issue missing dart:web_gl
View index.html
<canvas id="output"></canvas>
@slightfoot
slightfoot / bottom_expandy_nav.dart
Created Nov 23, 2021
Bottom Expandy Nav - by Simon Lightfoot 23/11/2021
View bottom_expandy_nav.dart
// MIT License
//
// Copyright (c) 2021 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: