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.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
@fredgrott
fredgrott / snippet.dart
Created October 20, 2025 18:37
motor, individual phase per motion
import 'package:motor/motor.dart';
final complexSequence = MotionSequence<AppState, ButtonStyle>.statesWithMotions({
.loading: (loadingStyle, .smoothSpring()),
.error: (errorStyle, .bouncySpring()), // Extra bounce for attention
.success: (successStyle, .curved(Duration(seconds: 2), Curves.ease)),
});
@fredgrott
fredgrott / snippet.dart
Created October 20, 2025 18:30
motor, sequence animation widget
import 'pacakge:motor/motor.dart';
enum LoadingState { idle, spinning, complete }
SequenceMotionBuilder<LoadingState, double>(
sequence: .states({
.idle: 0.0,
.spinning: 2 * pi,
.complete: 2 * pi,
}, motion: .smoothSpring()),
@fredgrott
fredgrott / snippet.dart
Created October 20, 2025 18:29
motor, spanning sequencing
import 'package:motor/motor.dart';
final logoSequence = MotionSequence.spanning({
0.0: LogoState(opacity: 0), // Start (0% of total time)
1.0: LogoState(opacity: 1), // 50% of total time
2.0: LogoState(opacity: 1, text: 1), // 100% of total time
}, motion: .linear(Duration(seconds: 2)));