Skip to content

Commit

Permalink
Remove content copy on page creation
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Oct 3, 2023
1 parent 09c68ac commit 93c4c99
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
20 changes: 13 additions & 7 deletions app/lib/bloc/document_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,24 @@ class DocumentBloc extends ReplayBloc<DocumentEvent, DocumentState> {
on<PageAdded>((event, emit) async {
final current = state;
if (current is! DocumentLoadSuccess) return;
final (newData, pageName) = current.data.addPage(event.page, event.index);
final page = DocumentPage(backgrounds: current.page.backgrounds);
final (newData, pageName) = current.data.addPage(page, event.index);
return _saveState(
emit,
current.copyWith(data: newData, pageName: pageName),
current.copyWith(data: newData, page: page, pageName: pageName),
null,
);
).then((value) {
current.currentIndexCubit
.loadElements(current.data, current.assetService, page);
refresh();
});
});
on<PageChanged>((event, emit) async {
final current = state;
if (current is! DocumentLoadSuccess) return;
final data = current.data.setPage(current.page, current.pageName);
final page = current.data.getPage(event.pageName);
if (page == null) return;
current.currentIndexCubit
.loadElements(current.data, current.assetService, page);
refresh();
return _saveState(
emit,
current.copyWith(
Expand All @@ -85,7 +87,11 @@ class DocumentBloc extends ReplayBloc<DocumentEvent, DocumentState> {
pageName: event.pageName,
),
null,
);
).then((value) {
current.currentIndexCubit
.loadElements(current.data, current.assetService, page);
refresh();
});
});
on<PageReordered>((event, emit) async {
final current = state;
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class _UtilitiesViewState extends State<_UtilitiesView>
[PhosphorIconsLight.eye, AppLocalizations.of(context).view],
[PhosphorIconsLight.camera, AppLocalizations.of(context).camera],
]
.map((e) => HorizontalTab(icon: PhosphorIcon(e[0]), label: Text(e[1])))
.map((e) =>
HorizontalTab(icon: PhosphorIcon(e[0]), label: Text(e[1])))
.toList(),
),
const SizedBox(height: 8),
Expand Down
3 changes: 2 additions & 1 deletion app/lib/views/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class _HomePageState extends State<HomePage> {
const SizedBox(height: 64),
LayoutBuilder(builder: (context, constraints) {
final isDesktop = constraints.maxWidth > 1000;
final height = isDesktop ? 100.0 : 300.0;
final height = isDesktop ? 120.0 : 300.0;
return AnimatedContainer(
height: showBanner ? height : 0,
duration: const Duration(milliseconds: 300),
Expand Down Expand Up @@ -282,6 +282,7 @@ class _HeaderHomeView extends StatelessWidget {
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
AppLocalizations.of(context).welcome,
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/73.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* Use center tab alignment
* Make spacer tool realtime
* Fix markdown newlines ([#501](https://github.com/LinwoodDev/Butterfly/issues/501))
* Fix home page header on low density
* Update to flutter master (Fix windows issues)
* Unify tabs
* Remove content copy on page creation

View all changes in the blog: https://linwood.dev/butterfly/2.0.0-beta.8

1 comment on commit 93c4c99

@vercel
Copy link

@vercel vercel bot commented on 93c4c99 Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.