timed_widget 0.1.1
timed_widget: ^0.1.1 copied to clipboard
A collection of reusable Flutter widgets for timed interactions: delayed visibility, switchers, sequencers, animations and more.
import 'package:example/screens/timed_animated_builder_example.dart';
import 'package:example/screens/timed_builder_example.dart';
import 'package:example/screens/timed_function_example.dart';
import 'package:example/screens/timed_repeat_builder_example.dart';
import 'package:example/screens/timed_sequence_example.dart';
import 'package:example/screens/timed_switcher_example.dart';
import 'package:example/screens/timed_visibility_example_screen.dart';
import 'package:flutter/material.dart';
void main() => runApp(const TimedWidgetShowcaseApp());
class TimedWidgetShowcaseApp extends StatelessWidget {
const TimedWidgetShowcaseApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Timed Widget Showcase',
theme: ThemeData.light(useMaterial3: true),
home: const ShowcaseHome(),
debugShowCheckedModeBanner: false,
);
}
}
class ShowcaseHome extends StatelessWidget {
const ShowcaseHome({super.key});
final tabs = const [
'Visibility',
'Switcher',
'Builder',
'Function',
'Animated',
'Repeat',
'Sequence',
];
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: tabs.length,
child: Scaffold(
appBar: AppBar(
title: const Text('⏱️ Timed Widget Showcase'),
bottom: TabBar(
isScrollable: true,
tabs: tabs.map((title) => Tab(text: title)).toList(),
),
),
body: Container(
color: Colors.grey[100],
child: const TabBarView(
children: [
TimedVisibilityExample(),
TimedSwitcherExample(),
TimedBuilderExample(),
TimedFunctionExample(),
TimedAnimatedBuilderExample(),
TimedRepeatBuilderExample(),
TimedSequenceExample(),
],
),
),
),
);
}
}
// 🔹 Helper widget for layout
class ExampleScaffold extends StatelessWidget {
final String title;
final String description;
final Widget child;
const ExampleScaffold({
super.key,
required this.title,
required this.description,
required this.child,
});
@override
Widget build(BuildContext context) {
return Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 3,
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
Text(
title,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
Text(
description,
style: const TextStyle(fontSize: 14),
textAlign: TextAlign.center,
),
],
),
),
),
const SizedBox(height: 24),
child,
],
),
),
);
}
}