Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
step_brogress_bar.dart
Go to the documentation of this file.
1import 'package:flutter/material.dart';
2import 'package:flutter_screenutil/flutter_screenutil.dart';
3
4class SimpleProgressBar extends StatelessWidget {
5 final int totalSteps;
6 final int currentStep;
7
8 const SimpleProgressBar({
9 super.key,
10 required this.totalSteps,
11 required this.currentStep,
12 }) : assert(totalSteps > 0),
13 assert(currentStep >= 0 && currentStep <= totalSteps);
14
15 @override
16 Widget build(BuildContext context) {
17 final double progress = currentStep / totalSteps;
18 final int percentage = (progress * 100).round();
19
20 return Column(
21 crossAxisAlignment: CrossAxisAlignment.start,
22 children: [
23 Container(
24 width: double.infinity,
25 height: 8.sp,
26 decoration: BoxDecoration(
27 color: Theme.of(context).highlightColor.withOpacity(0.11),
28 borderRadius: BorderRadius.circular(80),
29 ),
30 child: FractionallySizedBox(
31 alignment: Alignment.centerLeft,
32 widthFactor: progress,
33 child: Container(
34 decoration: BoxDecoration(
35 color: Theme.of(context).colorScheme.primary,
36 borderRadius: BorderRadius.circular(80),
37 ),
38 ),
39 ),
40 ),
41 SizedBox(height: 10.sp),
42 Padding(
43 padding: const EdgeInsets.only(bottom: 8.0),
44 child: Text(
45 'Completed $percentage%',
46 style: Theme.of(context).textTheme.displaySmall?.copyWith(
47 color: Theme.of(context).hintColor.withOpacity(0.6),
48 fontSize: 11.sp,
49 ),
50 ),
51 ),
52 ],
53 );
54 }
55}
final Widget child
final double progress
const SimpleProgressBar({ super.key, required this.totalSteps, required this.currentStep, }) override Widget build(BuildContext context)
final double percentage