Skip to content

Instantly share code, notes, and snippets.

View fredgrott's full-sized avatar
👾
focusing on flutter cross platform mobile dev

Fred Grott fredgrott

👾
focusing on flutter cross platform mobile dev
View GitHub Profile
@fredgrott
fredgrott / snippet.dart
Created November 12, 2025 19:09
themeextension ex
Widget build(BuildContext context){
final light = ColorScheme.fromSeed(dynamicSchemeVariant: DynamicSchemeVariant.tonalSpot,
contrastLevel: 0.1,
seedColor: Colors.purple, brightness: Brightness.light).toM3EThemeData();
final dark = ColorScheme.fromSeed(dynamicSchemeVariant: DynamicSchemeVariant.tonalSpot,
contrastLevel: 0.1,
seedColor: Colors.purple, brightness: Brightness.dark).toM3EThemeData();
return MaterialApp(
title: "Me".
theme: light.toM3ETheme(),
@fredgrott
fredgrott / snippet.dart
Created November 9, 2025 15:30
M3E typography Emily's original code
factory M3ETypography.defaultFor(
Brightness brightness, {
String? brandFontFamily,
String? plainFontFamily,
TextTheme? baseOverride,
}) {
// 1) Start from Material 3 baseline type.
final m3 = Typography.material2021();
final TextTheme m3Base =
baseOverride ?? (brightness == Brightness.dark ? m3.white : m3.black);
@fredgrott
fredgrott / snippet.dart
Created November 9, 2025 13:38
SDK typograhy calls
factory Typography.material2021({
TargetPlatform? platform = TargetPlatform.android,
ColorScheme colorScheme = const ColorScheme.light(),
TextTheme? black,
TextTheme? white,
TextTheme? englishLike,
TextTheme? dense,
TextTheme? tall,
}) {
assert(platform != null || (black != null && white != null));
@fredgrott
fredgrott / m3e_typography.dart
Created November 8, 2025 20:09
M3ETypography
// Copyright 2025 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Modified from the Material_3_Expressive package
// MIT License by Emily Moonstone 2025
@fredgrott
fredgrott / snippet.dart
Created November 8, 2025 20:03
M3E ThemeExtension call
Widget build(BuildContext context){
final light = ColorScheme.fromSeed(dynamicSchemeVariant: DynamicSchemeVariant.tonalSpot,
contrastLevel: 0.1,
seedColor: Colors.purple, brightness: Brightness.light).toM3EThemeData();
final dark = ColorScheme.fromSeed(dynamicSchemeVariant: DynamicSchemeVariant.tonalSpot,
contrastLevel: 0.1,
seedColor: Colors.purple, brightness: Brightness.dark).toM3EThemeData();
return MaterialApp(
title: "Me".
theme: light,
@fredgrott
fredgrott / snippet.dart
Created November 8, 2025 19:58
how to do emphasizedOverride function
emphasizedOverride(birghtness) {
ColorScheme tempColorScheme = ColorScheme.fromSeed(seedColor: Colors.blue, brightness: brightness, dynamicSchemeVariant: DynamicSchemeVariant.tonalSpot, contrastLevel: 0.0,);
final Color dark = tempColorScheme.brightness == Brightness.light ? tempColorScheme.onSurface : tempColorScheme.surface;
final Color light = tempColorScheme.brightness == Brightness.light ? tempColorScheme.surface : tempColorScheme.onSurface;
return M3Emphasized(
displayLarge: GoogleFonts.name(textStyle: TextStyle(color: brightness == Brightness.light ? dark : light,
decorationColor: brightness == Brightness.light ? dark: light,),
@fredgrott
fredgrott / m3e_emphasized.dart
Created November 8, 2025 19:53
m3e emphasized text styles
// Copyright 2025 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Modified from the Material_3_Expressive package
// MIT License by Emily Moonstone 2025
@fredgrott
fredgrott / snippet.yaml
Created October 24, 2025 16:36
local lib import
dependencies:
flutter:
sdk: flutter
my_new_package:
path: ./my_new_package
@fredgrott
fredgrott / snippet.dart
Created October 24, 2025 16:32
m3e utils lib
// Copyright 2025 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/// Flutter widgets and utils that simplify usage of
/// Material Design 3 Expressive (M3X) theming available in Flutter.
///
/// To use import using a local path as I am not publishing it as
/// a public package.
///
@fredgrott
fredgrott / springs.dart
Created October 24, 2025 16:30
springs m3e motion
// Copyright 2025 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// ignore_for_file: avoid_classes_with_only_static_members
///
library;
import 'package:motor/motor.dart';