Files
SpotiFLAC-Mobile/lib/widgets/app_loading_indicator.dart
T
zarzet 0a21b07bb5 feat(mornye): Cupertino buttons, menus and activity indicator
ExpressiveButton draws a CupertinoButton in Mornye, AppMenuButton and the lyrics options open the Mornye context menu (Material gets an anchored M3 popup), the view toggle is a segmented control and AppLoadingIndicator draws the activity indicator. Destructive actions use the error color in Material and system red in Mornye.
2026-11-22 02:14:38 +07:00

53 lines
1.5 KiB
Dart

import 'package:cupertino_ui/cupertino_ui.dart' show CupertinoActivityIndicator;
import 'package:material_ui/material_ui.dart';
import 'package:material_3_expressive/material_3_expressive.dart';
import 'package:mornye/theme/material_expressive.dart';
import 'package:mornye/theme/mornye_theme.dart';
/// Indeterminate loading only. Downloads/analysis keep their real progress.
class AppLoadingIndicator extends StatelessWidget {
const AppLoadingIndicator({
super.key,
this.size = 32,
this.color,
this.semanticLabel,
this.strokeWidth = 3,
});
final double size;
final Color? color;
final String? semanticLabel;
/// Stroke of the fallback circular indicator.
final double strokeWidth;
@override
Widget build(BuildContext context) {
final animate =
!MediaQuery.disableAnimationsOf(context) &&
TickerMode.valuesOf(context).enabled;
return SizedBox.square(
dimension: size,
child: !context.isMornye
? MaterialExpressiveScope(
child: FittedBox(
child: M3ELoadingIndicator(
size: 48,
color: color,
rotationTurns: animate ? null : 0,
semanticLabel: semanticLabel,
),
),
)
: Semantics(
label: semanticLabel,
child: CupertinoActivityIndicator(
radius: (size / 2).clamp(5.0, 20.0),
color: color,
animating: animate,
),
),
);
}
}