feat(proj): init
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:please_pay_me/theme/tokens.dart';
|
||||
|
||||
/// Native iOS spinner.
|
||||
class AppSpinner extends StatelessWidget {
|
||||
const AppSpinner({super.key, this.radius = 12, this.color});
|
||||
|
||||
final double radius;
|
||||
final Color? color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoActivityIndicator(
|
||||
radius: radius,
|
||||
color: color == null ? null : AppColors.of(context, color!),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// iOS progress bar: 4pt capsule track.
|
||||
class AppProgressBar extends StatelessWidget {
|
||||
const AppProgressBar({
|
||||
super.key,
|
||||
required this.value,
|
||||
this.color = AppColors.accent,
|
||||
this.height = 4,
|
||||
});
|
||||
|
||||
/// 0..1
|
||||
final double value;
|
||||
final Color color;
|
||||
final double height;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(AppRadii.capsule),
|
||||
child: SizedBox(
|
||||
height: height,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => Stack(
|
||||
children: [
|
||||
Container(color: AppColors.of(context, AppColors.systemGray5)),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
curve: Curves.easeOut,
|
||||
width: constraints.maxWidth * value.clamp(0.0, 1.0),
|
||||
color: AppColors.of(context, color),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user