Files
plezy/lib/widgets/loading_indicator_box.dart
T

24 lines
1.0 KiB
Dart
Raw Normal View History

2026-04-26 02:34:09 +02:00
import 'package:flutter/material.dart';
/// Square `CircularProgressIndicator(strokeWidth: 2)` sized to fit inside a
/// button or status row. The default 18×18 matches the
/// [FilledButton.icon] / [OutlinedButton.icon] icon slot; bump [size] for
/// list-row or app-bar contexts.
///
/// Centralises the `SizedBox(width:.., height:.., child:
/// CircularProgressIndicator(strokeWidth: 2))` pattern that previously
/// appeared inline in every async button.
class LoadingIndicatorBox extends StatelessWidget {
final double size;
const LoadingIndicatorBox({super.key, this.size = 18});
/// Full-screen centered spinner sized to fill the remaining space inside a
/// [CustomScrollView]. Replaces inline
/// `SliverFillRemaining(child: Center(child: CircularProgressIndicator()))`.
static const Widget sliver = SliverFillRemaining(child: Center(child: CircularProgressIndicator()));
2026-04-26 02:34:09 +02:00
@override
Widget build(BuildContext context) =>
SizedBox(width: size, height: size, child: const CircularProgressIndicator(strokeWidth: 2));
}