-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cat-voices): Import proposal (#1929)
* feat: downloader service working with generic data, not only with Uri's * feat: export proposal * feat: export/import proposal * fix: dialog export * fix: confirm dialog buttons are opposite * chore: cleanup * fix: to lower case * feat: import proposal * chore: cleanup * chore: logs * style: reformat * fix: route settings for upload file dialog * chore: review adjustments * chore: cleanup
- Loading branch information
Showing
18 changed files
with
294 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 29 additions & 5 deletions
34
catalyst_voices/apps/voices/lib/pages/workspace/header/import_proposal_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,40 @@ | ||
part of 'workspace_header.dart'; | ||
|
||
class _ImportProposalButton extends StatelessWidget { | ||
class _ImportProposalButton extends StatefulWidget { | ||
const _ImportProposalButton(); | ||
|
||
@override | ||
State<_ImportProposalButton> createState() => _ImportProposalButtonState(); | ||
} | ||
|
||
class _ImportProposalButtonState extends State<_ImportProposalButton> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return VoicesOutlinedButton( | ||
onTap: () { | ||
// TODO(dtscalac): import proposal | ||
unawaited(const ProposalBuilderDraftRoute().push(context)); | ||
}, | ||
onTap: _importProposal, | ||
child: Text(context.l10n.importProposal), | ||
); | ||
} | ||
|
||
Future<void> _importProposal() async { | ||
final proposal = await _ImportProposalDialog.show(context); | ||
if (proposal != null && mounted) { | ||
context.read<WorkspaceBloc>().add(ImportProposalEvent(proposal)); | ||
} | ||
} | ||
} | ||
|
||
class _ImportProposalDialog { | ||
static Future<Uint8List?> show(BuildContext context) async { | ||
final file = await VoicesUploadFileDialog.show( | ||
context, | ||
routeSettings: const RouteSettings(name: '/import-proposal'), | ||
title: context.l10n.proposalImportDialogTitle, | ||
itemNameToUpload: context.l10n.proposal, | ||
info: context.l10n.proposalImportDialogDescription, | ||
allowedExtensions: [ProposalDocument.exportFileExt], | ||
); | ||
|
||
return file?.bytes; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
catalyst_voices/apps/voices/lib/pages/workspace/header/workspace_header.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.