Skip to content

Commit

Permalink
Update Landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Stubenbord committed Aug 1, 2023
1 parent b79375c commit 8e5eb5a
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 158 deletions.
73 changes: 39 additions & 34 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PODS:
- DKPhotoGallery/Resource (0.0.17):
- SDWebImage
- SwiftyGif
- edge_detection (1.1.1):
- edge_detection (1.1.2):
- Flutter
- WeScan
- file_picker (0.0.1):
Expand All @@ -48,14 +48,16 @@ PODS:
- Flutter
- flutter_native_splash (0.0.1):
- Flutter
- flutter_pdfview (1.0.2):
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
- fluttertoast (0.0.2):
- Flutter
- Toast
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- in_app_review (0.2.0):
- Flutter
- integration_test (0.0.1):
- Flutter
- local_auth_ios (0.0.1):
Expand All @@ -67,9 +69,9 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- pdfx (1.0.0):
- permission_handler_apple (9.1.1):
- Flutter
- permission_handler_apple (9.0.4):
- printing (1.0.0):
- Flutter
- ReachabilitySwift (5.0.0)
- receive_sharing_intent (0.0.1):
Expand All @@ -79,16 +81,15 @@ PODS:
- SDWebImage/Core (5.13.5)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- SwiftyGif (5.4.3)
- Toast (4.0.0)
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter
- WeScan (1.7.0)

DEPENDENCIES:
Expand All @@ -100,20 +101,21 @@ DEPENDENCIES:
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_pdfview (from `.symlinks/plugins/flutter_pdfview/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
- open_filex (from `.symlinks/plugins/open_filex/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- pdfx (from `.symlinks/plugins/pdfx/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- printing (from `.symlinks/plugins/printing/ios`)
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -143,10 +145,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_pdfview:
:path: ".symlinks/plugins/flutter_pdfview/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
local_auth_ios:
Expand All @@ -156,54 +160,55 @@ EXTERNAL SOURCES:
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
pdfx:
:path: ".symlinks/plugins/pdfx/ios"
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
printing:
:path: ".symlinks/plugins/printing/ios"
receive_sharing_intent:
:path: ".symlinks/plugins/receive_sharing_intent/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
edge_detection: fa02aa120e00d87ada0ca2430b6c6087a501b1e9
edge_detection: b4fb239b018cefa79515a024d0bf3e559336de4e
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
flutter_pdfview: 25f53dd6097661e6395b17de506e6060585946bd
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
local_auth_ios: 0d333dde7780f669e66f19d2ff6005f3ea84008d
integration_test: 13825b8a9334a850581300559b8839134b124670
local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
pdfx: 7b876b09de8b7a0bf444a4f82b439ffcff4ee1ec
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
printing: 233e1b73bd1f4a05615548e9b5a324c98588640b
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
SDWebImage: 23d714cd599354ee7906dbae26dff89b421c4370
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: fb12c43172927bb5cf75aeebd073f883801f1993
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
WeScan: fed582f6c38014d529afb5aa9ffd1bad38fc72b7

PODFILE CHECKSUM: 7daa35cc908d9fba025075df27cb57a1ba1ebf13

COCOAPODS: 1.11.3
COCOAPODS: 1.12.0
61 changes: 35 additions & 26 deletions lib/features/landing/view/landing_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/database/tables/local_user_account.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
Expand All @@ -9,12 +8,10 @@ import 'package:paperless_mobile/features/document_search/view/sliver_search_bar
import 'package:paperless_mobile/features/landing/view/widgets/expansion_card.dart';
import 'package:paperless_mobile/features/landing/view/widgets/mime_types_pie_chart.dart';
import 'package:paperless_mobile/features/saved_view/cubit/saved_view_cubit.dart';
import 'package:paperless_mobile/features/saved_view_details/view/saved_view_details_preview.dart';
import 'package:paperless_mobile/features/saved_view_details/view/saved_view_preview.dart';
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
import 'package:paperless_mobile/routes/routes.dart';
import 'package:paperless_mobile/routes/typed/branches/documents_route.dart';
import 'package:paperless_mobile/routes/typed/branches/inbox_route.dart';
import 'package:fl_chart/fl_chart.dart';

class LandingPage extends StatefulWidget {
const LandingPage({super.key});
Expand Down Expand Up @@ -45,7 +42,7 @@ class _LandingPageState extends State<LandingPage> {
slivers: [
SliverToBoxAdapter(
child: Text(
"Welcome to Paperless Mobile, ${currentUser.fullName ?? currentUser.username}!",
"Welcome, ${currentUser.fullName ?? currentUser.username}!",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
Expand All @@ -54,17 +51,34 @@ class _LandingPageState extends State<LandingPage> {
).padded(24),
),
SliverToBoxAdapter(child: _buildStatisticsCard(context)),
SliverPadding(
padding: const EdgeInsets.fromLTRB(16, 16, 0, 8),
sliver: SliverToBoxAdapter(
child: Text(
"Saved Views",
style: Theme.of(context).textTheme.titleMedium,
),
),
),
BlocBuilder<SavedViewCubit, SavedViewState>(
builder: (context, state) {
return state.maybeWhen(
loaded: (savedViews) {
final dashboardViews = savedViews.values
.where((element) => element.showOnDashboard)
.toList();
if (dashboardViews.isEmpty) {
return const SliverToBoxAdapter(
child: Text("No views"),
);
}
return SliverList.builder(
itemBuilder: (context, index) {
return SavedViewDetailsPreview(
savedView: savedViews.values.elementAt(index),
return SavedViewPreview(
savedView: dashboardViews.elementAt(index),
);
},
itemCount: savedViews.length,
itemCount: dashboardViews.length,
);
},
orElse: () => const SliverToBoxAdapter(
Expand All @@ -83,6 +97,7 @@ class _LandingPageState extends State<LandingPage> {
}

Widget _buildStatisticsCard(BuildContext context) {
final currentUser = context.read<LocalUserAccount>().paperlessUser;
return FutureBuilder<PaperlessServerStatisticsModel>(
future: context.read<PaperlessServerStatsApi>().getServerStatistics(),
builder: (context, snapshot) {
Expand Down Expand Up @@ -118,19 +133,13 @@ class _LandingPageState extends State<LandingPage> {
child: ListTile(
shape: Theme.of(context).cardTheme.shape,
titleTextStyle: Theme.of(context).textTheme.labelLarge,
title: Text("Documents in inbox:"),
onTap: () {
InboxRoute().go(context);
},
trailing: Chip(
padding: EdgeInsets.symmetric(
horizontal: 4,
vertical: 2,
),
labelPadding: EdgeInsets.symmetric(horizontal: 4),
label: Text(
stats.documentsInInbox.toString(),
),
title: const Text("Documents in inbox:"),
onTap: currentUser.canViewTags && currentUser.canViewDocuments
? () => InboxRoute().go(context)
: null,
trailing: Text(
stats.documentsInInbox.toString(),
style: Theme.of(context).textTheme.labelLarge,
),
),
),
Expand All @@ -139,16 +148,16 @@ class _LandingPageState extends State<LandingPage> {
child: ListTile(
shape: Theme.of(context).cardTheme.shape,
titleTextStyle: Theme.of(context).textTheme.labelLarge,
title: Text("Total documents:"),
title: const Text("Total documents:"),
onTap: () {
DocumentsRoute().go(context);
},
trailing: Chip(
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 2,
),
labelPadding: EdgeInsets.symmetric(horizontal: 4),
labelPadding: const EdgeInsets.symmetric(horizontal: 4),
label: Text(
stats.documentsTotal.toString(),
),
Expand All @@ -160,13 +169,13 @@ class _LandingPageState extends State<LandingPage> {
child: ListTile(
shape: Theme.of(context).cardTheme.shape,
titleTextStyle: Theme.of(context).textTheme.labelLarge,
title: Text("Total characters:"),
title: const Text("Total characters:"),
trailing: Chip(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 2,
),
labelPadding: EdgeInsets.symmetric(horizontal: 4),
labelPadding: const EdgeInsets.symmetric(horizontal: 4),
label: Text(
stats.totalChars.toString(),
),
Expand Down
11 changes: 9 additions & 2 deletions lib/features/landing/view/widgets/expansion_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ class ExpansionCard extends StatelessWidget {
final Widget title;
final Widget content;

const ExpansionCard({super.key, required this.title, required this.content});
final bool initiallyExpanded;

const ExpansionCard({
super.key,
required this.title,
required this.content,
this.initiallyExpanded = false,
});

@override
Widget build(BuildContext context) {
Expand All @@ -23,7 +30,7 @@ class ExpansionCard extends StatelessWidget {
),
child: ExpansionTile(
backgroundColor: Theme.of(context).colorScheme.surface,
initiallyExpanded: true,
initiallyExpanded: initiallyExpanded,
title: title,
children: [content],
),
Expand Down
17 changes: 5 additions & 12 deletions lib/features/landing/view/widgets/mime_types_pie_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class _MimeTypesPieChartState extends State<MimeTypesPieChart> {
),
),
Wrap(
alignment: WrapAlignment.start,
alignment: WrapAlignment.spaceAround,
spacing: 8,
runSpacing: 8,
children: [
Expand Down Expand Up @@ -126,25 +126,18 @@ class _MimeTypesPieChartState extends State<MimeTypesPieChart> {
for (int i = 0; i < widget.statistics.fileTypeCounts.length; i++) {
final type = widget.statistics.fileTypeCounts[i];
final isTouched = i == _touchedIndex;
final fontSize = isTouched ? 24.0 : 16.0;
final fontSize = isTouched ? 18.0 : 16.0;
final radius = isTouched ? 60.0 : 50.0;
const shadows = [
Shadow(color: Colors.black, blurRadius: 2),
];
final color = colorShades[i % colorShades.length];
final textColor =
color.computeLuminance() > 0.5 ? Colors.black : Colors.white;
final percentage = type.count / widget.statistics.documentsTotal * 100;
yield PieChartSectionData(
color: colorShades[i % colorShades.length],
value: type.count.toDouble(),
title: ((type.count / widget.statistics.documentsTotal) * 100)
.toStringAsFixed(1) +
"%",
title: percentage.toStringAsFixed(1) + "%",
radius: radius,
titleStyle: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.bold,
color: textColor,
color: Colors.black,
),
);
}
Expand Down
Loading

0 comments on commit 8e5eb5a

Please sign in to comment.