Skip to content

Instantly share code, notes, and snippets.

@andyduke
andyduke / main.dart
Created November 22, 2020 11:02
Flutter Responsive MasterDetail Prototype
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Home(),
),
);
}
@andyduke
andyduke / main.dart
Created November 6, 2020 14:57
AnimatedPageRoute proto 1
import 'package:flutter/material.dart';
// --- route_provider.dart
class RouteProvider extends InheritedWidget {
final TransitionRoute route;
RouteProvider({
Key key,
@required this.route,
@andyduke
andyduke / main.dart
Created October 23, 2020 16:05
Flutter AppTheme concept v4
import 'package:flutter/material.dart';
// --- app_theme.dart
abstract class AppTheme {}
class AppThemeProvider extends InheritedWidget {
final AppTheme theme;
AppThemeProvider({
@andyduke
andyduke / main.dart
Last active May 19, 2020 07:42
Flutter: find ancestor by key
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class DataProvider<T, K> extends StatefulWidget {
final K dataKey;
final T data;
@andyduke
andyduke / main.dart
Created April 24, 2020 19:51
Flutter: Partial animation of the page when navigating
import 'package:flutter/material.dart';
// import 'package:flutter/scheduler.dart' show timeDilation;
void main() {
// timeDilation = 10.0;
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@andyduke
andyduke / transitions_fun.dart
Created April 24, 2020 07:28 — forked from slightfoot/transitions_fun.dart
Fun with Route Animations - by Simon Lightfoot - #HumpDayQandA - 8th Janurary 2020
// 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:
@andyduke
andyduke / main.dart
Last active February 13, 2020 14:52
Dart Sass Mapped Importer prototype
void main() {
final mask = '~/{lib}/kits/{package}/lib';
final replacer = '/Assets/{package}/Kits/{lib}/src';
// print(RegExp.escape(mask));
final maskPrepared = '^' + RegExp.escape(mask).replaceAllMapped(RegExp(r'\\\{(.*?)\\\}'), (m) => '(?<${m.group(1)}>.*?)') + '(?<__tail__>.*?)\$';
final regex = RegExp(maskPrepared);
@andyduke
andyduke / main.dart
Last active July 28, 2019 13:45
Dart: sort order sync priority v2
import 'dart:collection';
class Record {
int id;
String name;
int position;
double priority;
String guid;
@andyduke
andyduke / main.dart
Last active July 28, 2019 13:20
Dart: sort order sync priority
class Record {
int id;
String name;
int position;
double priority;
Record({this.id, this.name, this.position, this.priority});
@andyduke
andyduke / main.dart
Last active April 14, 2019 22:40
Flutter Theme prototype v3
class Color {
final int value;
const Color(this.value);
}
class AppTheme {