Skip to content

Instantly share code, notes, and snippets.

class DeeplinkExample extends StatefulWidget {
@override
_DeeplinkExampleState createState() => _DeeplinkExampleState();
}
class _DeeplinkExampleState extends State<DeeplinkExample> {
late NavStackController _controller;
@override
void initState() {
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// Basic structure for inkwell effect
// renders: http://screens.gskinner.com/shawn/vxKbE9nX0x.mp4
class _ButtonTest extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// results: http://screens.gskinner.com/shawn/7BMqIUaAVi.mp4
import 'package:flutter/material.dart';
import 'package:focusable_control_builder/focusable_control_builder.dart';
class InkwellDemoTest extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Column(
import os
org = "com.example"
name = "app_name"
cmd = "flutter create --org " + org + " --project-name " + name + " .";
packages = [
"cached_network_image",
"collection",
"copy_with_extension",
"equatable",
class UrlRouter extends RouterDelegate<String> with ChangeNotifier, PopNavigatorRouterDelegateMixin {
UrlRouter({String url = '/', this.onGeneratePages, this.builder, this.onPopPage, this.onChanging}) {
_initialUrl = url;
assert(onGeneratePages != null || builder != null,
'UrlRouter expects you to implement `builder` or `onGeneratePages` (or both)');
}
/// This delegat analagous to MaterialApp.routes / onGenerateRoute
final List<Page<dynamic>> Function(UrlRouter router)? onGeneratePages;
/// Example usage
///
/// One shot:
// GTweener.fade(from: .9, to: 1, child: const FlutterLogo()),
///
/// Or use a key for future control
// final _tweenKey = GlobalKey<GTweenerState>();
// ...
// return GTweener.fade(key: _tweenKey, child: const FlutterLogo()),
class Benchmark extends StatefulWidget {
const Benchmark({Key? key}) : super(key: key);
@override
_BenchmarkState createState() => _BenchmarkState();
}
class _BenchmarkState extends State<Benchmark> {
double _tweenSliderValue = .2;
bool _enableRendering = false;
bool _useGTween = false;
@esDotDev
esDotDev / state_view_pattern.dart
Last active August 5, 2023 12:52
Shows a simple way to separate logic and ui code using a `StatefulWidget` + a private `StatelessWidget`.
/// 1. The public facing widget, configuration options live here
class MyWidget extends StatefulWidget {
@override
_MyWidgetState createState() => _MyWidgetState();
}
/// 2. The state / controller / bloc / view controller
/// event handlers and helper methods can live here
class _MyWidgetState extends State<MyWidget> {
void _handlePressed() => print('todo');
@override