mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
48 lines
1.2 KiB
Dart
48 lines
1.2 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:PiliPlus/common/widgets/custom_arc.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class LoadingWidget extends StatelessWidget {
|
|
const LoadingWidget({
|
|
super.key,
|
|
this.msg = 'loading...',
|
|
required this.progress,
|
|
});
|
|
|
|
///loading msg
|
|
final String msg;
|
|
final RxDouble progress;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final onSurfaceVariant = theme.colorScheme.onSurfaceVariant;
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
|
decoration: BoxDecoration(
|
|
color: theme.dialogTheme.backgroundColor,
|
|
borderRadius: const BorderRadius.all(Radius.circular(15)),
|
|
),
|
|
child: Column(
|
|
spacing: 20,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
//loading animation
|
|
Obx(
|
|
() => Arc(
|
|
size: 40,
|
|
color: onSurfaceVariant,
|
|
strokeWidth: 3,
|
|
sweepAngle: progress.value * 2 * pi,
|
|
),
|
|
),
|
|
//msg
|
|
Text(msg, style: TextStyle(color: onSurfaceVariant)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|