Files
plezy/lib/widgets/loading_indicator_box.dart

24 lines
1.0 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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()));
@override
Widget build(BuildContext context) =>
SizedBox(width: size, height: size, child: const CircularProgressIndicator(strokeWidth: 2));
}