Skip to content

Instantly share code, notes, and snippets.

View rydmike's full-sized avatar

Rydmike rydmike

View GitHub Profile
@rydmike
rydmike / proposal.md
Created November 25, 2025 22:04
Feature Request: Decoration-Aware ShapeBorder for Material Components

Feature Request: Decoration-Aware ShapeBorder for Material Components

Summary

Enable Material components (Card, Dialog, TextField, Chip, etc.) to render full decoration styling (gradients, multiple shadows, inner shadows, images) through their existing shape property by introducing a new ShapeBorder subclass that carries decoration data and modifying the Material widget to render it.


Use Case

@rydmike
rydmike / main.dart
Created November 9, 2025 15:16
Two ways of comparing if two generics are of same type in Dart. There is a slight diff between these ways that may be important in some cases.
/// Check whether two types are the same type in Dart when working with
/// generic types.
///
/// Uses the same definition as the language specification for when two
/// types are the same. Currently the same as mutual sub-typing.
bool sameTypes<S, V>() {
void func<X extends S>() {}
// Dart spec says this is only true if S and V are "the same type".
return func is void Function<X extends V>();
}
@rydmike
rydmike / main.dart
Created February 16, 2025 11:47
Theme context issue: 2 move home to own widget
import 'package:flutter/material.dart';
ThemeData getLightTheme() => ThemeData(
brightness: Brightness.light,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.light,
),
);
@rydmike
rydmike / main.dart
Last active February 16, 2025 11:54
Theme context issue: 1 use builder
import 'package:flutter/material.dart';
ThemeData getLightTheme() => ThemeData(
brightness: Brightness.light,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.light,
),
);
@rydmike
rydmike / color_extension.dart
Last active February 16, 2025 11:52
Legacy int API extensions on Color.
import 'dart:ui';
/// Legacy int API extensions on [Color].
///
/// Convenience [Color] sRGB extensions that can be used as none deprecated
/// replacements for `alpha`, `red`, `green`, `blue` and `value` they are
/// called [alpha8bit], [red8bit], [green8bit], [blue8bit] and [value32bit].
/// You can use them to avoid using the deprecated color properties.
extension LegacyIntColorExtensions on Color {
/// A 32 bit value representing this color.
@rydmike
rydmike / main.dart
Last active October 7, 2024 20:05
Flutter BubbleTabs example
import 'package:flutter/material.dart';
// Flutter code sample for [BubbleTabs].
//
// Available as gist:
// https://gist.github.com/rydmike/f77c8ff139f13c9d0e7a231c69cb375b
// And DartPad:
// https://dartpad.dev/?id=f77c8ff139f13c9d0e7a231c69cb375b
// Related to this tweet:
// https://x.com/RydMike/status/1843380238258184605
@rydmike
rydmike / main.dart
Created October 6, 2024 11:48
Gist to test and show MenuItemButton push to new screen
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Flutter code sample for [MenuBar].
void main() => runApp(const MenuBarApp());
/// A class for consolidating the definition of menu entries.
///
/// This sort of class is not required, but illustrates one way that defining
@rydmike
rydmike / main.dart
Last active June 9, 2024 06:30
Flutter example on how to show hide animate a button next to a text field
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@rydmike
rydmike / main.dart
Created November 8, 2023 15:49
Test of shadow issue on PageView using elevated Card with ContinuousRectangleBorder wrappers
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@rydmike
rydmike / main.dart
Created November 8, 2023 15:07
Test of shadow issue on PageView using elevated Card wrappers
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});