Skip to content

Commit

Permalink
Fix asset select dialog overflows on too many assets
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jun 18, 2024
1 parent cbeb957 commit 4ff3ef4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 50 deletions.
99 changes: 49 additions & 50 deletions app/lib/dialogs/packs/select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,57 +45,56 @@ class SelectPackAssetDialog extends StatelessWidget {
final bloc = context.read<DocumentBloc>();
return BlocBuilder<DocumentBloc, DocumentState>(builder: (context, state) {
if (state is! DocumentLoaded) return const SizedBox();
return AlertDialog(
title: Row(
children: [
Flexible(child: Text(AppLocalizations.of(context).selectAsset)),
const SizedBox(width: 8),
IconButton(
icon: const PhosphorIcon(PhosphorIconsLight.plusCircle),
tooltip: AppLocalizations.of(context).addAsset,
onPressed: () async {
final result = await showDialog<PackAssetLocation>(
context: context,
builder: (context) => BlocProvider.value(
value: bloc,
child: const AssetDialog(),
),
);
if (result == null) return;
if (context.mounted) {
final pack = state.data.getPack(result.pack);
if (pack == null) return;
bloc.add(
PackUpdated(pack.name!, _createAsset(pack, result.name)));
Navigator.of(context).pop(result);
}
},
),
],
),
content: SizedBox(
return SizedBox(
width: 300,
height: 300,
child: Column(
mainAxisSize: MainAxisSize.min,
children: _getAssets(state.data)
.map((e) => ListTile(
title: Text(e.name),
subtitle: Text(e.pack),
onTap: () => Navigator.of(context).pop(e),
selected: e == selected,
))
.toList(),
),
),
scrollable: true,
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(AppLocalizations.of(context).cancel),
),
],
);
height: 500,
child: AlertDialog(
title: Row(
children: [
Flexible(child: Text(AppLocalizations.of(context).selectAsset)),
const SizedBox(width: 8),
IconButton(
icon: const PhosphorIcon(PhosphorIconsLight.plusCircle),
tooltip: AppLocalizations.of(context).addAsset,
onPressed: () async {
final result = await showDialog<PackAssetLocation>(
context: context,
builder: (context) => BlocProvider.value(
value: bloc,
child: const AssetDialog(),
),
);
if (result == null) return;
if (context.mounted) {
final pack = state.data.getPack(result.pack);
if (pack == null) return;
bloc.add(PackUpdated(
pack.name!, _createAsset(pack, result.name)));
Navigator.of(context).pop(result);
}
},
),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: _getAssets(state.data)
.map((e) => ListTile(
title: Text(e.name),
subtitle: Text(e.pack),
onTap: () => Navigator.of(context).pop(e),
selected: e == selected,
))
.toList(),
),
scrollable: true,
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(AppLocalizations.of(context).cancel),
),
],
));
});
}
}
1 change: 1 addition & 0 deletions metadata/en-US/changelogs/109.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Fix spacer has no help page
* Fix utilities state on undo/redo ([#721](https://github.com/LinwoodDev/Butterfly/issues/721))
* Fix select and eye dropper temporary tool already gets removed before doing the action
* Fix asset select dialog overflows on too many assets
* Upgrade AGB to 8.5.0 in android

Read more here: https://linwood.dev/butterfly/2.2.0-beta.0

0 comments on commit 4ff3ef4

Please sign in to comment.