Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
fix: dont update ui for received files
Browse files Browse the repository at this point in the history
  • Loading branch information
iamalper committed Sep 10, 2023
1 parent 517d579 commit e2b67a8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/screens/receive_page.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:weepy/files_riverpod.dart';
import 'package:weepy/models.dart';

import '../classes/exceptions.dart';
import '../constants.dart';
import 'package:flutter/material.dart';
import '../classes/receiver.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

enum _UiState { loading, listening, downloading, complete, error }

Expand All @@ -21,14 +23,14 @@ class ReceivePage extends StatelessWidget {
}
}

class ReceivePageInner extends StatefulWidget {
class ReceivePageInner extends ConsumerStatefulWidget {
const ReceivePageInner({super.key});

@override
State<ReceivePageInner> createState() => _ReceivePageInnerState();
ConsumerState<ReceivePageInner> createState() => _ReceivePageInnerState();
}

class _ReceivePageInnerState extends State<ReceivePageInner>
class _ReceivePageInnerState extends ConsumerState<ReceivePageInner>
with TickerProviderStateMixin {
late AnimationController _downloadAnimC;
late Receiver _receiveClass;
Expand All @@ -52,7 +54,8 @@ class _ReceivePageInnerState extends State<ReceivePageInner>
_receiveClass = Receiver(
downloadAnimC: _downloadAnimC,
onDownloadStart: () => uiStatus = _UiState.downloading,
onAllFilesDownloaded: (files) {
onAllFilesDownloaded: (files) async {
await ref.read(filesProvider.notifier).addFiles(files);
_files = files;
uiStatus = _UiState.complete;
},
Expand Down

0 comments on commit e2b67a8

Please sign in to comment.