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 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';
@fredgrott
fredgrott / curves.dart
Created October 24, 2025 16:29
curves flutter legacy 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;
@fredgrott
fredgrott / snippet.dart
Created October 20, 2025 19:36
motor, sequence motion controller
import 'package:motor/motor.dart';
final controller = SequenceMotionController<ButtonState, Offset>(
motion: Motion.smoothSpring(),
vsync: this,
converter: MotionConverter.offset,
initialValue: Offset.zero,
);
final sequence = MotionSequence.states({
@fredgrott
fredgrott / snippet.dart
Created October 20, 2025 18:56
motor, base controller class
import 'package:motor/motor.dart';
final controller = MotionController(
motion: CupertinoMotion.bouncy(), // or Motion.duration(), etc.
vsync: this,
);
@fredgrott
fredgrott / snippet.dart
Created October 20, 2025 18:39
motor, advance phase motion
import 'package:motor/motor.dart';
final controller = PhaseMotionController<ButtonState, Offset>(
motion: .smoothSpring(),
vsync: this,
converter: .offset,
initialValue: .zero,
);
// Play a sequence