Skip to content

Instantly share code, notes, and snippets.

View hawkkiller's full-sized avatar
🎯
Focusing

Michael Lazebny hawkkiller

🎯
Focusing
View GitHub Profile
@hawkkiller
hawkkiller / cool_animated_switcher.dart
Last active December 5, 2025 07:58
This is a cool sliding transition for widgets. It's inspired by the wolt_modal_sheet package, which has the same animation but is coupled with the Bottom Sheet/Pages API. This implementation should be also more performant and less fragile.
import 'package:flutter/material.dart';
/// A widget that transitions between two children using a fade and slide animation.
class PageTransitionSwitcher extends StatelessWidget {
const PageTransitionSwitcher({
required this.child,
this.isForwardMove = true,
super.key,
});
@hawkkiller
hawkkiller / bloc.dart
Last active March 31, 2025 13:01
A good looking BLoC that conforms to design principles and manages the state correctly.
import 'package:bloc/bloc.dart';
class UserProfile {
UserProfile({
required this.name,
this.age,
});
final String name;
final int? age;
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
class AnimatedEdgeSlide extends SingleChildRenderObjectWidget {
const AnimatedEdgeSlide({
required Widget super.child,
required this.positionAnimation,
super.key,
});
@hawkkiller
hawkkiller / badge.dart
Created May 20, 2024 14:11
Dead simple badge using custom single child layout
class RecommendedBadge extends StatelessWidget {
const RecommendedBadge({super.key});
@override
Widget build(BuildContext context) => DecoratedBox(
decoration: BoxDecoration(
color: Colors.of(context).tertiary,
borderRadius: BorderRadius.circular(4),
),
child: Padding(
@hawkkiller
hawkkiller / main.dart
Last active March 20, 2024 13:31
Full code for app that uses Popup
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:popups_showcase/popup.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@hawkkiller
hawkkiller / popup.dart
Last active December 11, 2023 13:57
A widget that shows a popup relative to a target widget.
import 'package:flutter/material.dart';
/// A widget that shows a popup relative to a target widget.
///
/// The popup is declaratively shown/hidden using an [OverlayPortalController].
///
/// It is positioned relative to the target widget using the [followerAnchor] and [targetAnchor] properties.
class Popup extends StatefulWidget {
const Popup({
required this.child,
@hawkkiller
hawkkiller / eventloop.dart
Created August 3, 2023 14:50
Event Loop unloading
import 'dart:async';
import 'package:crypto/crypto.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatefulWidget {
@hawkkiller
hawkkiller / main.dart
Last active July 8, 2023 12:33
Open-closed principle violation example
sealed class Shape {}
class Circle extends Shape {
Circle(this.radius);
final double radius;
}
class Rectangle extends Shape {
Rectangle(this.width, this.height);
@hawkkiller
hawkkiller / cronjob.yaml
Created April 29, 2023 10:45
mysql backup to s3
{{ if .Values.mysql.backup.enabled }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Release.Name }}-mysql-backup
spec:
schedule: {{ .Values.mysql.backup.schedule | quote }}
jobTemplate:
spec:
ttlSecondsAfterFinished: {{ .Values.mysql.backup.ttlSecondsAfterFinished }}
@hawkkiller
hawkkiller / animatable_textfield.dart
Last active August 12, 2022 20:21
A textfield that contain animated widget. Like telegram new update has. A breakthrough in mobile engineering as Durov said ✌️
import 'package:flutter/material.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override