Skip to content

Instantly share code, notes, and snippets.

View rydmike's full-sized avatar

Rydmike rydmike

View GitHub Profile
@rydmike
rydmike / analysis_options.yaml
Last active February 10, 2026 06:52
RydMike lints v2.6.0 - Personal preferences and starting point for Dart & Flutter linter rules setup.
# RydMike LINTER Preferences v2.6.0
#
# Get this file here: https://gist.github.com/rydmike/fdb53ddd933c37d20e6f3188a936cd4c
#
# We include and activate all_lint_rules, then below we disable the not used or desired ones.
# You can find a list of all lint rules to put in your all_lint_rules.yaml file here:
# https://dart.dev/tools/linter-rules/all
#
# This version is updated for Flutter 3.38 and Dart 3.10.
#
@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 / 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
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
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 / platform_is.dart
Last active February 4, 2025 14:40
Flutter Universal Platform Check - That Works on Web too
import 'universal_platform_web.dart'
if (dart.library.io) 'universal_platform_vm.dart';
/// A universal platform checker.
///
/// Can be used to check active physical Flutter platform on all platforms.
///
/// To check what host platform the app is running on use:
///
/// * PlatformIs.android
@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 / all_lint_rules.yaml
Last active June 28, 2024 11:04
List of ALL Dart & Flutter linter rules
linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_require_non_null_named_parameters
- always_specify_types
- always_use_package_imports
- annotate_overrides
- avoid_annotating_with_dynamic