An open-source cross-platform alternative to AirDrop
feat: add file status and speed info
Tien Do Namc57eaad8fe26
diff --git a/assets/i18n/strings.i18n.json b/assets/i18n/strings.i18n.jsonindex 970e3ae9..50087852 100644--- a/assets/i18n/strings.i18n.json+++ b/assets/i18n/strings.i18n.json@@ -7,9 +7,12 @@"close": "Close","decline": "Decline","done": "Done",+ "error": "Error","hide": "Hide","offline": "Offline","online": "Online",+ "queue": "Queue",+ "skipped": "Skipped","unknown": "Unknown"},"receive": {@@ -68,13 +71,14 @@"rejected": "The recipient has rejected the request."},"progressPage": {- "title": {- "total": "Total progress",- "count": {- "one": "{curr} / {n} file",- "other": "{curr} / {n} files"- },- "size": "{curr} / {n}"+ "titleSending": "Sending files",+ "titleReceiving": "Receiving files",+ "total": {+ "title": "Total progress",+ "titleWithTime": "@:progressPage.total.title ({time})",+ "count": "Files: {curr} / {n}",+ "size": "Size: {curr} / {n}",+ "speed": "Speed: {speed}/s"}}}diff --git a/assets/i18n/strings_de.i18n.json b/assets/i18n/strings_de.i18n.jsonindex 1011473f..99ea33fc 100644--- a/assets/i18n/strings_de.i18n.json+++ b/assets/i18n/strings_de.i18n.json@@ -7,9 +7,12 @@"close": "Schließen","decline": "Ablehnen","done": "Fertig",+ "error": "Fehler","hide": "Verstecken","offline": "Offline","online": "Online",+ "queue": "Warteschlange",+ "skipped": "Übersprungen","unknown": "Unbekannt"},"receive": {@@ -68,13 +71,14 @@"rejected": "Der Empfänger hat die Anfrage abgelehnt."},"progressPage": {- "title": {- "total": "Gesamtfortschritt",- "count": {- "one": "{curr} / {n} Datei",- "other": "{curr} / {n} Dateien"- },- "size": "{curr} / {n}"+ "titleSending": "Sende Dateien",+ "titleReceiving": "Empfange Dateien",+ "total": {+ "title": "Gesamtfortschritt",+ "titleWithTime": "@:progressPage.total.title ({time})",+ "count": "Dateien: {curr} / {n}",+ "size": "Größe: {curr} / {n}",+ "speed": "Geschwindigkeit: {speed}/s"}}}diff --git a/lib/model/file_status.dart b/lib/model/file_status.dartnew file mode 100644index 00000000..c61c1ffa--- /dev/null+++ b/lib/model/file_status.dart@@ -0,0 +1,9 @@+/// Status of one single file during file transfer.+/// Both receiver and sender should share the same information.+enum FileStatus {+ queue,+ skipped,+ sending,+ failed,+ finished,+}diff --git a/lib/model/send/send_state.dart b/lib/model/send/send_state.dartindex 44bad425..de9da1e3 100644--- a/lib/model/send/send_state.dart+++ b/lib/model/send/send_state.dart@@ -12,6 +12,8 @@ class SendState with _$SendState {required SessionStatus status,required Device target,required Map<String, SendingFile> files, // file id as key+ required int? startTime,+ required int? endTime,required CancelToken? cancelToken,}) = _SendState;}diff --git a/lib/model/send/sending_file.dart b/lib/model/send/sending_file.dartindex bc44e83f..d0a0519a 100644--- a/lib/model/send/sending_file.dart+++ b/lib/model/send/sending_file.dart@@ -1,5 +1,6 @@import 'package:freezed_annotation/freezed_annotation.dart';import 'package:localsend_app/model/dto/file_dto.dart';+import 'package:localsend_app/model/file_status.dart';part 'sending_file.freezed.dart';@@ -7,6 +8,7 @@ part 'sending_file.freezed.dart';class SendingFile with _$SendingFile {const factory SendingFile({required FileDto file,+ required FileStatus status,required String? token,required String? path, // android, iOS, desktoprequired List<int>? bytes, // webdiff --git a/lib/model/server/receive_state.dart b/lib/model/server/receive_state.dartindex 36ee5a53..dfd6c854 100644--- a/lib/model/server/receive_state.dart+++ b/lib/model/server/receive_state.dart@@ -13,6 +13,8 @@ class ReceiveState with _$ReceiveState {required SessionStatus status,required Device sender,required Map<String, ReceivingFile> files,+ required int? startTime,+ required int? endTime,required StreamController<bool>? responseHandler, // use this to accept / decline the request}) = _ReceiveState;}diff --git a/lib/model/server/receiving_file.dart b/lib/model/server/receiving_file.dartindex 4c8ffe13..97208b1a 100644--- a/lib/model/server/receiving_file.dart+++ b/lib/model/server/receiving_file.dart@@ -1,5 +1,6 @@import 'package:freezed_annotation/freezed_annotation.dart';import 'package:localsend_app/model/dto/file_dto.dart';+import 'package:localsend_app/model/file_status.dart';part 'receiving_file.freezed.dart';@@ -7,6 +8,7 @@ part 'receiving_file.freezed.dart';class ReceivingFile with _$ReceivingFile {const factory ReceivingFile({required FileDto file,+ required FileStatus status,required String? token,required String? tempPath, // file is saved to a temporary path first}) = _ReceivingFile;diff --git a/lib/model/session_status.dart b/lib/model/session_status.dartindex c8496f02..e09977f8 100644--- a/lib/model/session_status.dart+++ b/lib/model/session_status.dart@@ -1,8 +1,11 @@+/// Status of one file transfer.+/// Both receiver and sender should share the same information.enum SessionStatus {waiting, // wait for receiver response (wait for decline / accept)declined, // receiver declined the request (end of session)sending, // files are being sentfinished, // all files sent (end of session)+ finishedWithErrors, // finished but some files could not be sent (end of session)canceledBySender, // cancellation by sender (end of session)canceledByReceiver, // cancellation by receiver (end of session)-}\ No newline at end of file+}diff --git a/lib/pages/progress_page.dart b/lib/pages/progress_page.dartindex d1185d47..d9f2e190 100644--- a/lib/pages/progress_page.dart+++ b/lib/pages/progress_page.dart@@ -2,14 +2,15 @@ import 'package:flutter/material.dart';import 'package:flutter_riverpod/flutter_riverpod.dart';import 'package:localsend_app/gen/strings.g.dart';import 'package:localsend_app/model/dto/file_dto.dart';+import 'package:localsend_app/model/file_status.dart';import 'package:localsend_app/model/session_status.dart';import 'package:localsend_app/provider/network/send_provider.dart';import 'package:localsend_app/provider/network/server_provider.dart';import 'package:localsend_app/provider/progress_provider.dart';import 'package:localsend_app/routes.dart';import 'package:localsend_app/util/file_size_helper.dart';-import 'package:localsend_app/widget/device_bage.dart';-import 'package:localsend_app/widget/list_tile/custom_list_tile.dart';+import 'package:localsend_app/util/file_speed_helper.dart';+import 'package:localsend_app/widget/custom_progress_bar.dart';class ProgressPage extends ConsumerStatefulWidget {const ProgressPage({Key? key}) : super(key: key);@@ -23,6 +24,8 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {List<FileDto> _files = []; // also contains declined files (files without token)Set<String> _filesWithToken = {};+ bool _advanced = false;+@overridevoid initState() {super.initState();@@ -60,6 +63,18 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {);}+ final startTime = receiveState?.startTime ?? sendState?.startTime;+ final endTime = receiveState?.endTime ?? sendState?.endTime;+ final int? speedInBytes;+ final String? remainingTime;+ if (startTime != null && currBytes >= 500 * 1024) {+ speedInBytes = getFileSpeed(start: startTime, end: endTime ?? DateTime.now().millisecondsSinceEpoch, bytes: currBytes);+ remainingTime = getRemainingTime(bytesPerSeconds: speedInBytes, remainingBytes: _totalBytes - currBytes);+ } else {+ speedInBytes = null;+ remainingTime = null;+ }+return Scaffold(body: Stack(children: [@@ -70,10 +85,16 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {left: 15,right: 30,),- itemCount: _files.length,+ itemCount: _files.length + 1,itemBuilder: (context, index) {- final file = _files[index];- final progress = progressNotifier.getProgress(file.id);+ if (index == 0) {+ // title+ return Text(receiveState != null ? t.progressPage.titleReceiving : t.progressPage.titleSending, style: Theme.of(context).textTheme.headline6);+ }++ final file = _files[index - 1];+ final fileStatus = receiveState?.files[file.id]?.status ?? sendState!.files[file.id]!.status;+return Padding(padding: const EdgeInsets.symmetric(vertical: 10),child: Row(@@ -98,19 +119,15 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {Text(' (${file.size.asReadableFileSize})', style: const TextStyle(fontSize: 16)),],),- if (progress == 1)- Text(t.general.done, style: TextStyle(color: Theme.of(context).colorScheme.tertiaryContainer))- else+ if (fileStatus == FileStatus.sending)Padding(padding: const EdgeInsets.only(top: 5),- child: ClipRRect(- borderRadius: BorderRadius.circular(10),- child: LinearProgressIndicator(- value: progress,- minHeight: 10,- ),+ child: CustomProgressBar(+ progress: progressNotifier.getProgress(file.id),),- ),+ )+ else+ Text(fileStatus.label, style: TextStyle(color: fileStatus.getColor(context))),],),),@@ -123,45 +140,84 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {child: Align(alignment: Alignment.bottomCenter,child: Padding(- padding: const EdgeInsets.only(left: 15, right: 15, bottom: 20),- child: CustomListTile(- padding: const EdgeInsets.only(left: 15, right: 15, bottom: 15, top: 5),- title: Text(t.progressPage.title.total, style: const TextStyle(fontSize: 20)),- subTitle: Wrap(- runSpacing: 10,- spacing: 10,- children: [- DeviceBadge(- color: Theme.of(context).colorScheme.tertiaryContainer,- label: t.progressPage.title.count(- curr: progressNotifier.getFinishedCount(),- n: _filesWithToken.length,+ padding: const EdgeInsets.only(left: 10, right: 10, bottom: 10),+ child: Card(+ child: Padding(+ padding: const EdgeInsets.only(left: 15, right: 15, bottom: 5, top: 10),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ endTime != null || remainingTime == null+ ? t.progressPage.total.title+ : t.progressPage.total.titleWithTime(+ time: remainingTime,+ ),+ style: const TextStyle(fontSize: 20)),+ const SizedBox(height: 5),+ CustomProgressBar(+ progress: _totalBytes == 0 ? 0 : currBytes / _totalBytes,+ borderRadius: 5,+ color: Theme.of(context).colorScheme.tertiaryContainer,),- ),- DeviceBadge(- color: Theme.of(context).colorScheme.tertiaryContainer,- label: t.progressPage.title.size(- curr: currBytes.asReadableFileSize,- n: _totalBytes == double.maxFinite.toInt() ? '-' : _totalBytes.asReadableFileSize,+ AnimatedCrossFade(+ crossFadeState: _advanced ? CrossFadeState.showSecond : CrossFadeState.showFirst,+ duration: const Duration(milliseconds: 200),+ alignment: Alignment.topLeft,+ firstChild: Container(),+ secondChild: Padding(+ padding: const EdgeInsets.only(top: 10, bottom: 5),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(t.progressPage.total.count(+ curr: progressNotifier.getFinishedCount(),+ n: _filesWithToken.length,+ )),+ Text(t.progressPage.total.size(+ curr: currBytes.asReadableFileSize,+ n: _totalBytes == double.maxFinite.toInt() ? '-' : _totalBytes.asReadableFileSize,+ )),+ if (speedInBytes != null)+ Text(t.progressPage.total.speed(+ speed: speedInBytes.asReadableFileSize,+ )),+ ],+ ),+ ),),- ),- ],- ),- trailing: status == SessionStatus.finished- ? TextButton.icon(- onPressed: () {- if (receiveState != null) {- ref.read(serverProvider.notifier).closeSession();- } else if (sendState != null) {- ref.read(sendProvider.notifier).cancel();- }- ref.read(progressProvider.notifier).reset();- const HomeRoute().go(context);- },- icon: const Icon(Icons.check_circle),- label: Text(t.general.done),+ const SizedBox(height: 5),+ Row(+ mainAxisAlignment: MainAxisAlignment.end,+ children: [+ TextButton.icon(+ style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.onSurface),+ onPressed: () {+ setState(() => _advanced = !_advanced);+ },+ icon: const Icon(Icons.info),+ label: Text(_advanced ? t.general.hide : t.general.advanced),+ ),+ TextButton.icon(+ style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.onSurface),+ onPressed: () {+ if (receiveState != null) {+ ref.read(serverProvider.notifier).closeSession();+ } else if (sendState != null) {+ ref.read(sendProvider.notifier).cancel();+ }+ ref.read(progressProvider.notifier).reset();+ const HomeRoute().go(context);+ },+ icon: const Icon(Icons.check_circle),+ label: Text(t.general.done),+ ),+ ],)- : null,+ ],+ ),+ ),),),),@@ -171,3 +227,35 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {);}}++extension on FileStatus {+ String get label {+ switch (this) {+ case FileStatus.queue:+ return t.general.queue;+ case FileStatus.skipped:+ return t.general.skipped;+ case FileStatus.sending:+ return ''; // progress bar will be showed here+ case FileStatus.failed:+ return t.general.error;+ case FileStatus.finished:+ return t.general.done;+ }+ }++ Color getColor(BuildContext context) {+ switch (this) {+ case FileStatus.queue:+ return Theme.of(context).colorScheme.tertiaryContainer;+ case FileStatus.skipped:+ return Colors.grey;+ case FileStatus.sending:+ return Theme.of(context).colorScheme.tertiaryContainer;+ case FileStatus.failed:+ return Colors.orange;+ case FileStatus.finished:+ return Theme.of(context).colorScheme.tertiaryContainer;+ }+ }+}diff --git a/lib/provider/network/send_provider.dart b/lib/provider/network/send_provider.dartindex 65729145..df271b55 100644--- a/lib/provider/network/send_provider.dart+++ b/lib/provider/network/send_provider.dart@@ -9,6 +9,7 @@ import 'package:localsend_app/model/device.dart';import 'package:localsend_app/model/dto/file_dto.dart';import 'package:localsend_app/model/dto/info_dto.dart';import 'package:localsend_app/model/dto/send_request_dto.dart';+import 'package:localsend_app/model/file_status.dart';import 'package:localsend_app/model/send/send_state.dart';import 'package:localsend_app/model/send/sending_file.dart';import 'package:localsend_app/model/session_status.dart';@@ -27,6 +28,7 @@ final sendProvider = StateNotifierProvider<SendNotifier, SendState?>((ref) {class SendNotifier extends StateNotifier<SendState?> {final Ref _ref;+SendNotifier(this._ref) : super(null);Future<void> sendRequest({@@ -53,12 +55,15 @@ class SendNotifier extends StateNotifier<SendState?> {size: file.size,fileType: file.name.guessFileType(),),+ status: FileStatus.queue,token: null,path: kIsWeb ? null : file.path,bytes: file.bytes,),);})),+ startTime: null,+ endTime: null,cancelToken: cancelToken,);@@ -71,8 +76,7 @@ class SendNotifier extends StateNotifier<SendState?> {deviceType: originDevice.deviceType,),files: {- for (final file in requestState.files.values)- file.file.id: file.file,+ for (final file in requestState.files.values) file.file.id: file.file,},);@@ -91,7 +95,8 @@ class SendNotifier extends StateNotifier<SendState?> {final responseMap = response.data as Map;final sendingFiles = {for (final file in requestState.files.values)- file.file.id: responseMap.containsKey(file.file.id) ? file.copyWith(token: responseMap[file.file.id]) : file,+ file.file.id:+ responseMap.containsKey(file.file.id) ? file.copyWith(token: responseMap[file.file.id]) : file.copyWith(status: FileStatus.skipped),};// ignore: use_build_context_synchronously@@ -114,6 +119,14 @@ class SendNotifier extends StateNotifier<SendState?> {}Future<void> _send(Device target, Map<String, SendingFile> files) async {+ if (state == null) {+ return;+ }++ bool hasError = false;++ state = state?.copyWith(startTime: DateTime.now().millisecondsSinceEpoch);+for (final file in files.values) {final token = file.token;if (token == null) {@@ -121,7 +134,9 @@ class SendNotifier extends StateNotifier<SendState?> {}print('Sending ${file.file.fileName}');+ state = state?.withFileStatus(file.file.id, FileStatus.sending);+ bool hasErrorForFile = false;try {await Dio().post(ApiRoute.send.target(target, query: {@@ -131,20 +146,30 @@ class SendNotifier extends StateNotifier<SendState?> {options: Options(headers: {'Content-Length': file.file.size,- }+ },),data: file.path != null ? File(file.path!).openRead() : file.bytes!,onSendProgress: (curr, total) {_ref.read(progressProvider.notifier).setProgress(file.file.id, curr / total);- }+ },);} on DioError catch (e) {+ hasErrorForFile = true;+ hasError = true;print(e);+ } catch (e, st) {+ hasErrorForFile = true;+ hasError = true;+ print(e);+ print(st);}++ state = state?.withFileStatus(file.file.id, hasErrorForFile ? FileStatus.failed : FileStatus.finished);}state = state?.copyWith(- status: SessionStatus.finished,+ status: hasError ? SessionStatus.finishedWithErrors : SessionStatus.finished,+ endTime: DateTime.now().millisecondsSinceEpoch,);print('Files sent successfully.');}@@ -161,3 +186,11 @@ class SendNotifier extends StateNotifier<SendState?> {} catch (_) {}}}++extension on SendState {+ SendState withFileStatus(String fileId, FileStatus status) {+ return copyWith(+ files: {...files}..update(fileId, (file) => file.copyWith(status: status)),+ );+ }+}diff --git a/lib/provider/network/server_provider.dart b/lib/provider/network/server_provider.dartindex bbb4a457..c9ebde66 100644--- a/lib/provider/network/server_provider.dart+++ b/lib/provider/network/server_provider.dart@@ -7,6 +7,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';import 'package:localsend_app/main.dart';import 'package:localsend_app/model/dto/info_dto.dart';import 'package:localsend_app/model/dto/send_request_dto.dart';+import 'package:localsend_app/model/file_status.dart';import 'package:localsend_app/model/server/receive_state.dart';import 'package:localsend_app/model/server/receiving_file.dart';import 'package:localsend_app/model/server/server_state.dart';@@ -121,10 +122,13 @@ class ServerNotifier extends StateNotifier<ServerState?> {for (final file in dto.files.values)file.id: ReceivingFile(file: file,+ status: FileStatus.queue,token: null,tempPath: null,),},+ startTime: null,+ endTime: null,responseHandler: streamController,),);@@ -135,10 +139,11 @@ class ServerNotifier extends StateNotifier<ServerState?> {// Delayed response (waiting for user's decision)final result = await streamController.stream.first;if (result) {- return Response.ok(jsonEncode({- for (final file in state!.receiveState!.files.values)- file.file.id: file.token,- }), headers: {'Content-Type': 'application/json'});+ return Response.ok(+ jsonEncode({+ for (final file in state!.receiveState!.files.values) file.file.id: file.token,+ }),+ headers: {'Content-Type': 'application/json'});} else {return Response.badRequest();}@@ -168,6 +173,13 @@ class ServerNotifier extends StateNotifier<ServerState?> {}// begin of actual file transfer+ state = state?.copyWith(+ receiveState: receiveState.copyWith(+ files: {...receiveState.files}..update(fileId, (_) => receivingFile.copyWith(status: FileStatus.sending)),+ startTime: receiveState.startTime ?? DateTime.now().millisecondsSinceEpoch,+ ),+ );+final destinationPath = await _digestFilePath(dir: destinationDir,fileName: receivingFile.file.fileName,@@ -185,7 +197,13 @@ class ServerNotifier extends StateNotifier<ServerState?> {}},);+ state = state?.copyWith(+ receiveState: state?.receiveState?.withFileStatus(fileId, FileStatus.finished),+ );} catch (e, st) {+ state = state?.copyWith(+ receiveState: state?.receiveState?.withFileStatus(fileId, FileStatus.failed),+ );print(e);print(st);}@@ -195,22 +213,23 @@ class ServerNotifier extends StateNotifier<ServerState?> {final progressNotifier = _ref.read(progressProvider.notifier);progressNotifier.setProgress(fileId, 1);- if (receiveState.files.values.every((f) => f.token == null || progressNotifier.getProgress(f.file.id) == 1)) {+ if (state!.receiveState!.files.values+ .every((f) => f.status == FileStatus.finished || f.status == FileStatus.skipped || f.status == FileStatus.failed)) {+ final hasError = state!.receiveState!.files.values.any((f) => f.status == FileStatus.failed);state = state?.copyWith(- receiveState: receiveState.copyWith(- status: SessionStatus.finished,+ receiveState: state!.receiveState!.copyWith(+ status: hasError ? SessionStatus.finishedWithErrors : SessionStatus.finished,+ endTime: DateTime.now().millisecondsSinceEpoch,),);print('Received all files.');}- return Response.ok('');+ return state?.receiveState?.files[fileId]?.status == FileStatus.finished ? Response.ok('') : Response.internalServerError();});router.post(ApiRoute.cancel.path, (Request request) {- final ip = request.context['shelf.io.connection_info'] as HttpConnectionInfo;-- if (state?.receiveState?.sender.ip == ip.remoteAddress.address) {+ if (state?.receiveState?.sender.ip == request.ip) {_cancelBySender();}@@ -246,6 +265,7 @@ class ServerNotifier extends StateNotifier<ServerState?> {for (final file in receiveState.files.values)file.file.id: ReceivingFile(file: file.file,+ status: fileIds.contains(file.file.id) ? FileStatus.queue : FileStatus.skipped,token: fileIds.contains(file.file.id) ? _uuid.v4() : null,tempPath: null,),@@ -303,3 +323,9 @@ Future<String> _digestFilePath({required String dir, required String fileName})} while (await File(destinationPath).exists());return destinationPath;}++extension on ReceiveState {+ ReceiveState withFileStatus(String fileId, FileStatus status) {+ return copyWith(files: {...files}..update(fileId, (file) => file.copyWith(status: status)));+ }+}diff --git a/lib/theme.dart b/lib/theme.dartindex f3df9817..76383729 100644--- a/lib/theme.dart+++ b/lib/theme.dart@@ -35,6 +35,13 @@ ThemeData getTheme(Brightness brightness) {);}+extension ThemeDataExt on ThemeData {+ /// This is the actual [cardColor] being used.+ Color get cardColorWithElevation {+ return ElevationOverlay.applySurfaceTint(cardColor, colorScheme.surfaceTint, 1);+ }+}+extension InputDecorationThemeExt on InputDecorationTheme {BorderRadius get borderRadius => _borderRadius;}diff --git a/lib/util/file_speed_helper.dart b/lib/util/file_speed_helper.dartnew file mode 100644index 00000000..fa0203b8--- /dev/null+++ b/lib/util/file_speed_helper.dart@@ -0,0 +1,28 @@+/// Returns bytes per second+int getFileSpeed({+ required int start,+ required int end,+ required int bytes,+}) {+ final deltaTime = end - start;+ return (1000 * bytes) ~/ deltaTime; // multiply by 1000 to convert millis to seconds+}++/// Returns remaining time in m:ss+String getRemainingTime({+ required int bytesPerSeconds,+ required int remainingBytes,+}) {+ final totalSeconds = _getRemainingTime(bytesPerSeconds: bytesPerSeconds, remainingBytes: remainingBytes);+ final minutes = totalSeconds ~/ 60;+ final seconds = totalSeconds % 60;+ return '$minutes:${seconds.toString().padLeft(2, '0')}';+}++/// Returns remaining time in seconds+int _getRemainingTime({+ required int bytesPerSeconds,+ required int remainingBytes,+}) {+ return remainingBytes ~/ bytesPerSeconds;+}diff --git a/lib/widget/custom_progress_bar.dart b/lib/widget/custom_progress_bar.dartnew file mode 100644index 00000000..442ae6d8--- /dev/null+++ b/lib/widget/custom_progress_bar.dart@@ -0,0 +1,21 @@+import 'package:flutter/material.dart';++class CustomProgressBar extends StatelessWidget {+ final double progress;+ final double borderRadius;+ final Color? color;++ const CustomProgressBar({required this.progress, this.borderRadius = 10, this.color});++ @override+ Widget build(BuildContext context) {+ return ClipRRect(+ borderRadius: BorderRadius.circular(borderRadius),+ child: LinearProgressIndicator(+ value: progress,+ color: color,+ minHeight: 10,+ ),+ );+ }+}