mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 18:08:07 -06:00
feat: Add saved views to landing page
This commit is contained in:
@@ -8,6 +8,8 @@ import 'package:paperless_mobile/features/app_drawer/view/app_drawer.dart';
|
||||
import 'package:paperless_mobile/features/document_search/view/sliver_search_bar.dart';
|
||||
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/generated/l10n/app_localizations.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/documents_route.dart';
|
||||
@@ -52,6 +54,27 @@ class _LandingPageState extends State<LandingPage> {
|
||||
).padded(24),
|
||||
),
|
||||
SliverToBoxAdapter(child: _buildStatisticsCard(context)),
|
||||
BlocBuilder<SavedViewCubit, SavedViewState>(
|
||||
builder: (context, state) {
|
||||
return state.maybeWhen(
|
||||
loaded: (savedViews) {
|
||||
return SliverList.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return SavedViewDetailsPreview(
|
||||
savedView: savedViews.values.elementAt(index),
|
||||
);
|
||||
},
|
||||
itemCount: savedViews.length,
|
||||
);
|
||||
},
|
||||
orElse: () => const SliverToBoxAdapter(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
|
||||
class ExpansionCard extends StatelessWidget {
|
||||
final Widget title;
|
||||
@@ -10,7 +9,7 @@ class ExpansionCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: EdgeInsets.all(16),
|
||||
margin: const EdgeInsets.all(16),
|
||||
child: Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
dividerColor: Colors.transparent,
|
||||
@@ -23,6 +22,7 @@ class ExpansionCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: ExpansionTile(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
initiallyExpanded: true,
|
||||
title: title,
|
||||
children: [content],
|
||||
|
||||
Reference in New Issue
Block a user