Skip to content

Commit

Permalink
Refresh parent on all route exept searchBar and open bundle image in …
Browse files Browse the repository at this point in the history
…dialog
  • Loading branch information
pixelshot91 committed Jan 3, 2024
1 parent 454e23b commit d36c963
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ extension DirectoryExt on Directory {
File joinFile(String f) => File(path.join(this.path, f));
}

final externalDeviceRepo = Directory('/media/phone/storage/emulated/0/Android/data/fr.pimoid.booky/files');
// final externalDeviceRepo = Directory('/media/phone/storage/emulated/0/Android/data/fr.pimoid.booky/files');
final externalDeviceRepo = Directory('/home/julien/Perso/LeBonCoin/chain_automatisation/booky/extra/mock_data/basic/');

// final externalDeviceRepo = Directory('/home/julien/Perso/LeBonCoin/chain_automatisation/booky/extra/mock_data/basic/');
extension ItemStateExt on ItemState {
String get loc {
switch (this) {
Expand Down
52 changes: 35 additions & 17 deletions lib/enrichment/bundle_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,11 @@ class _BundleSelectionState extends State<BundleSelection> with RouteAware {
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.camera),
onPressed: () => Navigator.push(context,
MaterialPageRoute<void>(builder: (context) => CameraWidgetInit(ShootMultipleBundle(widget.repo))))),
onPressed: () async {
await Navigator.push(context,
MaterialPageRoute<void>(builder: (context) => CameraWidgetInit(ShootMultipleBundle(widget.repo))));
_refreshBundleList();
}),
body: FutureWidget(
future: _listBundles(),
builder: (bundles) {
Expand Down Expand Up @@ -432,15 +435,16 @@ class _BundleSelectionState extends State<BundleSelection> with RouteAware {
key: const PageStorageKey('BundleWidget'),
widget.repo,
bundle,
refreshParent: () => setState(() {}),
refreshParent: _refreshBundleList,
downloadMetadataForBundles: _downloadMetadataForBundles,
),
onTap: () {
Navigator.push(
onTap: () async {
await Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) =>
BooksMetadataCollectingWidget(step: MetadataCollectingStep(bundle: bundle))));
_refreshBundleList();
},
)))
.toList(),
Expand Down Expand Up @@ -468,6 +472,10 @@ class _BundleSelectionState extends State<BundleSelection> with RouteAware {
style: const TextStyle(fontSize: 30, color: Colors.grey),
));
}

void _refreshBundleList() {
setState(() {});
}
}

class ProgressIndicator extends StatelessWidget {
Expand Down Expand Up @@ -630,21 +638,27 @@ class _ActionButtons extends StatelessWidget {
label: 'Edit bundle',
onPressed: () {
// Pushing a new route here synchronously does nothing as the PopUpMenuButton called a Navigator.pop immediately after to close the PopUpMenu
Future(() => Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) => CameraWidgetInit(EditOneBundle(bundle.directory)))));
Future(() async {
await Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) => CameraWidgetInit(EditOneBundle(bundle.directory))));
refreshParent();
});
},
),
_popUpMenuIconText(
icon: Icons.image_search,
label: 'ISBN decoding',
onPressed: () {
// Pushing a new route here synchronously does nothing as the PopUpMenuButton called a Navigator.pop immediately after to close the PopUpMenu
Future(() => Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) => ISBNDecodingWidget(step: ISBNDecodingStep(bundle: bundle)))));
Future(() async {
await Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) => ISBNDecodingWidget(step: ISBNDecodingStep(bundle: bundle))));
refreshParent();
});
},
),
_popUpMenuIconText(
Expand Down Expand Up @@ -703,10 +717,14 @@ class _ActionButtons extends StatelessWidget {
],
),
IconButton(
onPressed: () => Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) => BooksMetadataCollectingWidget(step: MetadataCollectingStep(bundle: bundle)))),
onPressed: () async {
await Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) =>
BooksMetadataCollectingWidget(step: MetadataCollectingStep(bundle: bundle))));
refreshParent();
},
icon: const Icon(Icons.send),
iconSize: 30,
),
Expand Down

0 comments on commit d36c963

Please sign in to comment.