Skip to content

Commit

Permalink
Move background button from project settings to top corner button and…
Browse files Browse the repository at this point in the history
… improve grid files view
  • Loading branch information
CodeDoctorDE committed Jan 1, 2025
1 parent 887cfa9 commit bfa7f40
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 28 deletions.
23 changes: 5 additions & 18 deletions app/lib/selections/file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _UtilitiesViewState extends State<_UtilitiesView>

@override
void initState() {
_tabController = TabController(length: 3, vsync: this);
_tabController = TabController(length: 2, vsync: this);

_tabController.addListener(_onTabChange);

Expand Down Expand Up @@ -97,7 +97,6 @@ class _UtilitiesViewState extends State<_UtilitiesView>
isScrollable: true,
tabs: <List<dynamic>>[
[PhosphorIconsLight.file, AppLocalizations.of(context).file],
[PhosphorIconsLight.book, AppLocalizations.of(context).page],
[PhosphorIconsLight.camera, AppLocalizations.of(context).camera],
]
.map((e) =>
Expand Down Expand Up @@ -259,8 +258,8 @@ class _UtilitiesViewState extends State<_UtilitiesView>
filled: true,
suffixIcon: IconButton(
icon: Icon(showPassword
? PhosphorIconsLight.eye
: PhosphorIconsLight.eyeSlash),
? PhosphorIconsLight.eyeSlash
: PhosphorIconsLight.eye),
onPressed: () => setState(
() =>
showPassword = !showPassword,
Expand All @@ -285,8 +284,8 @@ class _UtilitiesViewState extends State<_UtilitiesView>
filled: true,
suffixIcon: IconButton(
icon: Icon(showConfirmPassword
? PhosphorIconsLight.eye
: PhosphorIconsLight.eyeSlash),
? PhosphorIconsLight.eyeSlash
: PhosphorIconsLight.eye),
onPressed: () => setState(
() => showConfirmPassword =
!showConfirmPassword,
Expand Down Expand Up @@ -334,18 +333,6 @@ class _UtilitiesViewState extends State<_UtilitiesView>
)
],
),
Column(children: [
MenuItemButton(
leadingIcon: const PhosphorIcon(PhosphorIconsLight.image),
shortcut: const SingleActivator(LogicalKeyboardKey.keyB,
control: true),
onPressed: () {
Actions.maybeInvoke<BackgroundIntent>(
context, BackgroundIntent(context));
},
child: Text(AppLocalizations.of(context).background),
),
]),
Column(
children: [
OffsetPropertyView(
Expand Down
11 changes: 11 additions & 0 deletions app/lib/views/app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:math';

import 'package:butterfly/actions/background.dart';
import 'package:butterfly/actions/change_path.dart';
import 'package:butterfly/actions/settings.dart';
import 'package:butterfly/actions/svg_export.dart';
Expand Down Expand Up @@ -388,6 +389,16 @@ class _MainPopupMenu extends StatelessWidget {
),
),
const Divider(),
MenuItemButton(
leadingIcon: const PhosphorIcon(PhosphorIconsLight.image),
shortcut: const SingleActivator(LogicalKeyboardKey.keyB,
control: true),
onPressed: () {
Actions.maybeInvoke<BackgroundIntent>(
context, BackgroundIntent(context));
},
child: Text(AppLocalizations.of(context).background),
),
SubmenuButton(
menuChildren: [
MenuItemButton(
Expand Down
26 changes: 16 additions & 10 deletions app/lib/views/files/grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ class FileEntityGridItem extends StatelessWidget {
final settingsCubit = fileSystem.settingsCubit;
final remote = settingsCubit.getRemote(entity.location.remote);
final documentSystem = fileSystem.buildDocumentSystem(remote);
final leading = PhosphorIcon(
icon,
color: colorScheme.outline,
size: 48,
final leading = Align(
alignment: Alignment.bottomCenter,
child: PhosphorIcon(
icon,
color: colorScheme.outline,
size: 48,
),
);
return Card(
elevation: 5,
Expand All @@ -59,7 +62,7 @@ class FileEntityGridItem extends StatelessWidget {
horizontal: 0,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(12),
side: active
? BorderSide(
color: colorScheme.primaryContainer,
Expand All @@ -86,10 +89,10 @@ class FileEntityGridItem extends StatelessWidget {
child: Container(
height: 96,
padding: const EdgeInsets.only(
left: 8,
right: 8,
top: 16,
bottom: 8,
left: 4,
right: 4,
top: 4,
bottom: 2,
),
child: thumbnail != null
? AspectRatio(
Expand Down Expand Up @@ -127,7 +130,10 @@ class FileEntityGridItem extends StatelessWidget {
const SizedBox(height: 8),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.symmetric(
vertical: 4,
horizontal: 12,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.stretch,
Expand Down
6 changes: 6 additions & 0 deletions docs/src/content/docs/docs/v2/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Additionally you can capture a thumbnail from the current viewport to see it in

## Page

:::note

This tab was removed in the nightly release.
Please use the background menu item in the top left corner menu
:::

Here are all page specific properties. Currently you can find the background setting here.

## View
Expand Down
2 changes: 2 additions & 0 deletions metadata/en-US/changelogs/127.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
* Add size property
* Move grid into own tool
* Add offset property
* Move background button from project settings to top corner button
* Add password protected notes ([#771](https://github.com/LinwoodDev/Butterfly/issues/771))
* Add option to import svg as text ([#596](https://github.com/LinwoodDev/Butterfly/issues/596))
* Improve grid files view
* Fix undo/redo tools not showing status correctly
* Fix grid not working correctly
* Fix capture thumbnail uses wrong position
Expand Down

0 comments on commit bfa7f40

Please sign in to comment.