Skip to content

Instantly share code, notes, and snippets.

View SEGVeenstra's full-sized avatar

Stephan E.G. Veenstra SEGVeenstra

View GitHub Profile
@SEGVeenstra
SEGVeenstra / main.dart
Last active November 2, 2024 13:33
BackdropFilter Card Example
import 'package:flutter/material.dart';
import 'dart:ui';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@SEGVeenstra
SEGVeenstra / main.dart
Last active September 24, 2024 18:17
GoRouter - reusable routes
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@SEGVeenstra
SEGVeenstra / main.dart
Created September 21, 2024 09:59
SciFiContainer
import 'package:flutter/material.dart';
import 'dart:math';
import 'package:collection/collection.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@SEGVeenstra
SEGVeenstra / main.dart
Created September 14, 2024 20:02
SciFiTetButton
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@SEGVeenstra
SEGVeenstra / main.dart
Created May 27, 2024 13:58
Circle Animation Flutter
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: Scaffold(
body: Center(
child: CircleAnimation(),
),
),
),
@SEGVeenstra
SEGVeenstra / cp_firebase_files.sh
Created February 11, 2024 08:44
Copy firebase files for Flutter Flavors
#!/bin/bash
# Check if the correct number of arguments is provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <project_root> <env>"
exit 1
fi
# Assign the project root and environment arguments
project_root="$1"
@SEGVeenstra
SEGVeenstra / main.dart
Created July 14, 2023 07:34
Nested ShellRoute problem.
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
final GlobalKey<NavigatorState> _rootNavigatorKey = GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> _homeNavigatorKey = GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> _playNavigatorKey = GlobalKey<NavigatorState>();
final myRouter = GoRouter(
initialLocation: '/home/games',
navigatorKey: _rootNavigatorKey,
@SEGVeenstra
SEGVeenstra / main.dart
Last active July 9, 2023 10:18
ReactiveTextField in Flutter
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
// This example shows a way to create a TextField with a more reactive API,
// similar to how other controls, like Slider are working.
//
// It saves you from having to mess with controllers and StatefulWidgets.
// Instead you can use your own state management solution.
//
// In this example I'm using the flutter_bloc package for managing the state,
@SEGVeenstra
SEGVeenstra / controllerless_textfield.dart
Created May 19, 2023 16:06
A TextField that is controlled by state.
import 'package:flutter/material.dart';
void main() => runApp(const StateTextFieldApp());
class StateTextFieldApp extends StatelessWidget {
const StateTextFieldApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(home: StateTextFieldPage());
@SEGVeenstra
SEGVeenstra / pages_api_example.dart
Created May 1, 2023 11:48
Example of why navigation API is not that declarative.
import 'package:flutter/material.dart';
/// README
/// This example shows that the navigator is not that declarative.
/// When back navigation happens, you need to sync your state with the
/// navigation.
/// IMO, if it was really declerative, you would update the state first, which