From 93c4c99042b6b01116895945f795e4c0abe7f58a Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Tue, 3 Oct 2023 17:47:11 +0200 Subject: [PATCH] Remove content copy on page creation --- app/lib/bloc/document_bloc.dart | 20 ++++++++++++------- app/lib/selections/utilities.dart | 3 ++- app/lib/views/home.dart | 3 ++- .../metadata/android/en-US/changelogs/73.txt | 2 ++ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/lib/bloc/document_bloc.dart b/app/lib/bloc/document_bloc.dart index ce66c621c515..aaf0214abd35 100644 --- a/app/lib/bloc/document_bloc.dart +++ b/app/lib/bloc/document_bloc.dart @@ -61,12 +61,17 @@ class DocumentBloc extends ReplayBloc { on((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((event, emit) async { final current = state; @@ -74,9 +79,6 @@ class DocumentBloc extends ReplayBloc { 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( @@ -85,7 +87,11 @@ class DocumentBloc extends ReplayBloc { pageName: event.pageName, ), null, - ); + ).then((value) { + current.currentIndexCubit + .loadElements(current.data, current.assetService, page); + refresh(); + }); }); on((event, emit) async { final current = state; diff --git a/app/lib/selections/utilities.dart b/app/lib/selections/utilities.dart index ae28ea689a7a..1e5f7dfea60c 100644 --- a/app/lib/selections/utilities.dart +++ b/app/lib/selections/utilities.dart @@ -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), diff --git a/app/lib/views/home.dart b/app/lib/views/home.dart index fcf8af74ff35..4ff2f2d8d847 100644 --- a/app/lib/views/home.dart +++ b/app/lib/views/home.dart @@ -137,7 +137,7 @@ class _HomePageState extends State { 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), @@ -282,6 +282,7 @@ class _HeaderHomeView extends StatelessWidget { Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.center, children: [ Text( AppLocalizations.of(context).welcome, diff --git a/fastlane/metadata/android/en-US/changelogs/73.txt b/fastlane/metadata/android/en-US/changelogs/73.txt index 14834a4ef24d..c4be7b59da1b 100644 --- a/fastlane/metadata/android/en-US/changelogs/73.txt +++ b/fastlane/metadata/android/en-US/changelogs/73.txt @@ -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 \ No newline at end of file