import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AppLoadingView extends StatelessWidget {
  const AppLoadingView({super.key, this.message = '加载中', this.size});

  final String message;
  final double? size;

  @override
  Widget build(BuildContext context) {
    final effectiveSize = size ?? 24.r;
    return Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          SizedBox.square(
            dimension: effectiveSize,
            child: CircularProgressIndicator(strokeWidth: 2.4.r),
          ),
          SizedBox(height: 12.h),
          Text(
            message,
            style: Theme.of(context).textTheme.bodyMedium?.copyWith(
              color: Theme.of(context).colorScheme.onSurfaceVariant,
            ),
          ),
        ],
      ),
    );
  }
}
