Skip to content

Instantly share code, notes, and snippets.

@davidhicks980
davidhicks980 / alignment_draft.raw_menu_anchor.dart
Last active November 6, 2024 11:53
Alignment demo using the RawMenuAnchor draft component. WARNING: This demo is meant to be viewed in DartPad, and may be exceptionally sloppy.
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// @docImport 'package:flutter/material.dart';
library;
import 'dart:async';
import 'dart:ui' as ui;
@davidhicks980
davidhicks980 / main.dart
Last active May 22, 2024 17:05
Layered stack menu
import 'package:flutter/material.dart';
void main() => runApp(const OverlayApp());
class OverlayApp extends StatelessWidget {
const OverlayApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
@davidhicks980
davidhicks980 / main.dart
Last active February 23, 2024 05:36
Decomposable Menu Item
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
void main() => runApp(const Main());
class Main extends StatefulWidget {
const Main({super.key});
@davidhicks980
davidhicks980 / main.dart
Last active January 24, 2024 17:06
sparkling-flash-8427
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Flutter code sample for [MenuAnchor].
void main() => runApp(const MenuApp());
class MenuApp extends StatelessWidget {
const MenuApp({super.key});
@davidhicks980
davidhicks980 / main.dart
Last active January 24, 2024 17:07
sparkling-flash-8427
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Flutter code sample for [MenuAnchor].
void main() => runApp(const MenuApp());
class MenuApp extends StatelessWidget {
const MenuApp({super.key});
@davidhicks980
davidhicks980 / color_with_hsl_extension.dart
Last active January 5, 2023 07:32
Color extension: hue, saturation, lightness
import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart';
extension ColorWithHSL on Color {
HSLColor get hsl => HSLColor.fromColor(this);
/// Returns a copy of this color with the [hue] parameter replaced with
/// the given value.
///
/// [saturation] should be between `0.0` and `1.0`.
@davidhicks980
davidhicks980 / main.dart
Last active December 31, 2022 11:34
Flutter: Listen to page transition status
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const PageTransitionDemo());
}
/// Demonstrates how to show a widget after a page is finished transitioning
class PageTransitionDemo extends StatelessWidget {
const PageTransitionDemo({super.key});