⏱️ timed_widget

A flexible and lightweight Flutter package that provides time-based UI building blocks β€” including delayed visibility, timed switchers, animated builders, scheduled sequences, and more.

Ideal for onboarding flows, staggered animations, tutorial steps, micro-interactions, and other UI effects that rely on timing.


✨ Features

  • Show or hide widgets after a delay
  • Switch between two widgets with timing & animation
  • Run a function after a specified delay
  • Rebuild widgets repeatedly on a timer
  • Animate widgets using AnimationController with duration + curve
  • Trigger a sequence of widget displays with custom delay per step
  • Manage widget visibility in groups or sequences
  • Use mixin utilities to manage Timer lifecycle cleanly

πŸ“¦ Installation

Add to your pubspec.yaml:

dependencies:
  timed_widget: ^0.1.0

Then import:

import 'package:timed_widget/timed_widget.dart';

🧩 Available Widgets

Widget/Class Purpose
TimedVisibility Show/hide a widget after a delay, optionally reverse or loop
TimedSwitcher Switch between two widgets after a delay, animated
TimedBuilder Conditionally build a widget after a delay (bool isElapsed)
TimedFunction Execute a callback once after a delay
TimedRepeatBuilder Periodically rebuild a widget with tick counter
TimedAnimatedBuilder Animate a value (0.0 β†’ 1.0) over time
TimedSequence Step-based widget display with delays and optional controller
TimedVisibilityController Imperative control for TimedVisibility
TimedGroupController Start/reset multiple TimedVisibility widgets at once
TimedSequenceController External control of sequence progression or reset
TimedMixin Mixin for stateful widgets to safely manage timers

πŸš€ Example

TimedVisibility(
  delay: Duration(seconds: 2),
  reverseAfter: Duration(seconds: 3),
  loop: true,
  child: Text('Hello after 2 seconds!'),
);
TimedFunction(
  delay: Duration(milliseconds: 500),
  onElapsed: () => print('Half a second passed!'),
);
TimedSequence(
  steps: [
    TimedStep(delay: Duration(seconds: 1), child: Text('Step 1')),
    TimedStep(delay: Duration(seconds: 2), child: Text('Step 2')),
  ],
);

πŸ“· Demo

Demo Demo


πŸ§ͺ Testing & Safety

  • All widgets clean up internal timers via dispose
  • mounted checks are in place before state updates
  • Custom controller objects help manage state externally
  • Includes assert validation for all durations

πŸ“ License

MIT License. See LICENSE.


πŸ™Œ Contributing

Pull requests are welcome. Feel free to open issues for ideas, bugs, or enhancements.


Libraries

timed_widget
A lightweight Flutter package for time-based UI building blocks.