Shimmer-Ladeanimation für FlutterFlow zum direkten Einsetzen. Fünf Layout-Presets, Farben und Tempo frei anpassbar, keine Abhängigkeiten.
Live-Vorschau
listItem preset
card preset
Was drin ist
listItem, card, profile, text und custom, alle sofort einsetzbar, ohne Layout-Code zu schreiben.
Übergib eine beliebige Grund- und Highlight-Farbe. Standard ist ein schlichter grauer Shimmer, der zu jedem App-Theme passt.
Steuere das Tempo der Animation über shimmerSpeed (ms). Langsamer für mehr Ruhe, schneller für mehr Tempo.
Setze lineCount für die Presets text und custom. Die letzte Zeile wird automatisch kürzer, damit es wie ein echter Absatz aussieht.
Mit animate: false wird das Skeleton zum statischen Platzhalter, praktisch für Storyboards oder Vorschauen.
Aktiviere showAvatar im Preset custom, um neben den Textzeilen einen runden Platzhalter anzuzeigen. Ideal für Chat- oder Feed-Einträge.
Einbau
Öffne dein FlutterFlow-Projekt → Custom Code → Custom Widgets → "+ Add Widget". Füge den kompletten Dart-Code von unten ein.
Setze in der FlutterFlow-Oberfläche layoutPreset auf einen dieser Werte: listItem, card, profile, text, custom. Passe Farben und Tempo an dein Design an.
SkeletonLoader(
width: double.infinity,
height: 80,
layoutPreset: 'listItem',
shimmerSpeed: 1200,
)Pack das Widget in ein Conditional-Widget. Zeig den SkeletonLoader, solange deine Daten laden, und wechsle zum echten Inhalt, sobald die Daten da sind.
// Show skeleton while loading
if (isLoading) {
return SkeletonLoader(layoutPreset: 'card');
}
// Show real content when ready
return YourContentWidget();API-Referenz
| Parameter | Typ | Standard | Beschreibung |
|---|---|---|---|
| width | double? | null | Breite des Widgets. Standard ist die Breite des Elternelements. |
| height | double? | null | Höhe des Widgets. Standard ist die Höhe des Inhalts. |
| layoutPreset | String | 'listItem' | Darzustellendes Layout. Einer dieser Werte: listItem, card, profile, text, custom. |
| lineCount | int | 3 | Anzahl der Textzeilen. Wird von den Presets text und custom genutzt. |
| baseColor | Color? | grey.shade300 | Grundfarbe des Shimmers. |
| highlightColor | Color? | grey.shade100 | Highlight-Farbe des Shimmers (der helle Lichtstreifen). |
| shimmerSpeed | int | 1500 | Dauer der Animation in Millisekunden. |
| borderRadius | double | 8.0 | Eckenradius aller rechteckigen Platzhalter. |
| showAvatar | bool | false | Zeigt einen runden Avatar-Platzhalter. Nur im Preset custom. |
| avatarSize | double | 48.0 | Durchmesser des Avatar-Kreises in Pixeln. |
| lineSpacing | double | 12.0 | Vertikaler Abstand zwischen den Textzeilen. |
| animate | bool | true | Auf false setzen, um die Shimmer-Animation anzuhalten. |
Zum Kopieren
Avatar und zwei Textzeilen. Passt zu User-Feeds, Chatlisten oder Suchergebnissen.
SkeletonLoader(
width: double.infinity,
height: 80,
layoutPreset: 'listItem',
avatarSize: 48,
shimmerSpeed: 1200,
)Bildfläche, Titel, zwei Textzeilen und Buttons. Gut für Content-Karten.
SkeletonLoader(
width: double.infinity,
height: 320,
layoutPreset: 'card',
borderRadius: 12,
shimmerSpeed: 1500,
)Großer zentrierter Avatar, Name, Bio und Statistikzeile. Für Profilseiten.
SkeletonLoader(
width: double.infinity,
height: 260,
layoutPreset: 'profile',
avatarSize: 72,
shimmerSpeed: 1800,
)Nur Textzeilen. Gut für Artikelvorschauen, Beschreibungen oder andere textlastige Inhalte.
SkeletonLoader(
width: double.infinity,
height: 100,
layoutPreset: 'text',
lineCount: 4,
lineSpacing: 10,
)Kompletter Code
Kopiere die ganze Datei in FlutterFlow → Custom Code → Custom Widgets.
// Automatic FlutterFlow imports
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
class SkeletonLoader extends StatefulWidget {
const SkeletonLoader({
super.key,
this.width,
this.height,
this.layoutPreset = 'listItem',
this.lineCount = 3,
this.baseColor,
this.highlightColor,
this.shimmerSpeed = 1500,
this.borderRadius = 8.0,
this.showAvatar = false,
this.avatarSize = 48.0,
this.lineSpacing = 12.0,
this.animate = true,
});
final double? width;
final double? height;
final String layoutPreset;
final int lineCount;
final Color? baseColor;
final Color? highlightColor;
final int shimmerSpeed;
final double borderRadius;
final bool showAvatar;
final double avatarSize;
final double lineSpacing;
final bool animate;
@override
State<SkeletonLoader> createState() => _SkeletonLoaderState();
}
class _SkeletonLoaderState extends State<SkeletonLoader>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
Color get _baseColor => widget.baseColor ?? Colors.grey.shade300;
Color get _highlightColor => widget.highlightColor ?? Colors.grey.shade100;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: widget.shimmerSpeed),
);
_animation = Tween<double>(begin: -2, end: 2).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeInOutSine),
);
if (widget.animate) {
_controller.repeat();
}
}
@override
void didUpdateWidget(SkeletonLoader oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.animate && !_controller.isAnimating) {
_controller.repeat();
} else if (!widget.animate && _controller.isAnimating) {
_controller.stop();
}
if (widget.shimmerSpeed != oldWidget.shimmerSpeed) {
_controller.duration = Duration(milliseconds: widget.shimmerSpeed);
if (_controller.isAnimating) {
_controller.repeat();
}
}
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
Widget _buildBone({
double? width,
double height = 16,
bool isCircle = false,
double? radius,
}) {
final effectiveRadius = radius ?? widget.borderRadius;
return AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Container(
width: isCircle ? height : width,
height: height,
decoration: BoxDecoration(
shape: isCircle ? BoxShape.circle : BoxShape.rectangle,
borderRadius:
isCircle ? null : BorderRadius.circular(effectiveRadius),
gradient: widget.animate
? LinearGradient(
begin: Alignment(_animation.value - 1, 0),
end: Alignment(_animation.value + 1, 0),
colors: [
_baseColor,
_highlightColor,
_baseColor,
],
stops: const [0.0, 0.5, 1.0],
)
: null,
color: widget.animate ? null : _baseColor,
),
);
},
);
}
Widget _buildTextLines() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: List.generate(widget.lineCount, (index) {
final isLast = index == widget.lineCount - 1;
return Padding(
padding: EdgeInsets.only(
bottom: index < widget.lineCount - 1 ? widget.lineSpacing : 0,
),
child: _buildBone(
width: isLast ? 150 : double.infinity,
height: 14,
),
);
}),
);
}
Widget _buildListItem() {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_buildBone(height: widget.avatarSize, isCircle: true),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
_buildBone(width: 180, height: 16),
SizedBox(height: widget.lineSpacing),
_buildBone(width: 120, height: 12),
],
),
),
],
);
}
Widget _buildCard() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
_buildBone(
width: double.infinity,
height: 180,
radius: widget.borderRadius,
),
const SizedBox(height: 16),
_buildBone(width: 200, height: 18),
SizedBox(height: widget.lineSpacing),
_buildBone(width: double.infinity, height: 13),
SizedBox(height: widget.lineSpacing * 0.6),
_buildBone(width: 250, height: 13),
const SizedBox(height: 16),
Row(
children: [
_buildBone(width: 80, height: 32, radius: 16),
const SizedBox(width: 12),
_buildBone(width: 80, height: 32, radius: 16),
],
),
],
);
}
Widget _buildProfile() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
_buildBone(height: widget.avatarSize * 1.8, isCircle: true),
const SizedBox(height: 16),
_buildBone(width: 160, height: 20),
SizedBox(height: widget.lineSpacing),
_buildBone(width: 220, height: 13),
SizedBox(height: widget.lineSpacing * 0.6),
_buildBone(width: 180, height: 13),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildStatBlock(),
const SizedBox(width: 32),
_buildStatBlock(),
const SizedBox(width: 32),
_buildStatBlock(),
],
),
],
);
}
Widget _buildStatBlock() {
return Column(
children: [
_buildBone(width: 40, height: 18),
const SizedBox(height: 6),
_buildBone(width: 56, height: 11),
],
);
}
Widget _buildCustom() {
if (widget.showAvatar) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildBone(height: widget.avatarSize, isCircle: true),
const SizedBox(width: 16),
Expanded(child: _buildTextLines()),
],
);
}
return _buildTextLines();
}
@override
Widget build(BuildContext context) {
Widget content;
switch (widget.layoutPreset.toLowerCase()) {
case 'listitem':
content = _buildListItem();
break;
case 'card':
content = _buildCard();
break;
case 'profile':
content = _buildProfile();
break;
case 'text':
content = _buildTextLines();
break;
case 'custom':
default:
content = _buildCustom();
break;
}
return Container(
width: widget.width,
height: widget.height,
padding: const EdgeInsets.all(16),
child: content,
);
}
}Aus der Praxis
Nutze einen ListView.builder mit 3 bis 5 SkeletonLoader-Einträgen, um eine ganze ladende Seite zu simulieren. Nutzer empfinden das als schneller als einen einzelnen Spinner.
Setze baseColor auf eine leicht getönte Variante deines Hintergrunds. Für dunkle Themes: Colors.grey.shade800 / Colors.grey.shade600.
1200 ms wirkt schnell und modern, 2000 ms ruhig und hochwertig. Wähle das Tempo passend zum Charakter deiner App.
Gib deinem SkeletonLoader feste Werte für width und height, die zu den echten Inhalten passen. So springt nichts, wenn die Daten laden.
Kostenlos und Open Source
Eine schlanke Custom Function für FlutterFlow, die jeden String sicher auf eine maximale Zeichenzahl kürzt und bei Bedarf automatisch „...“ anhängt.
Ein Custom Widget für FlutterFlow, das jedes Child-Widget mit einem frei anpassbaren gepunkteten oder gestrichelten Rahmen umgibt. Der native Container von FlutterFlow kann das nicht, dieses Widget schließt die Lücke.
Ein produktionsreifes Avatar-Widget, das ein Profilbild zeigt, wenn eines vorhanden ist, und sonst sauber auf gestaltete Initialen zurückfällt, wie bei Google, Slack und Microsoft Teams. Derselbe Name bekommt immer dieselbe Farbe.
Ein 3D-Flip-Card-Widget mit flüssigen Animationen für FlutterFlow. Ein Tipp dreht die Karte und zeigt die Rückseite. Farben, Text, Richtung und Tempo sind frei anpassbar.
Du planst eine App?
Wir bauen komplette Apps für Gründer und Unternehmen, mit Festpreis pro Meilenstein. Buch dir ein kostenloses 30-Minuten-Gespräch über deine Idee.
Erstgespräch buchen