mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 22:07:53 -06:00
Bugfixes, some visual updates
This commit is contained in:
@@ -130,8 +130,7 @@ class _DocumentsPageState extends State<DocumentsPage> {
|
||||
controller: _panelController,
|
||||
defaultPanelState: PanelState.CLOSED,
|
||||
minHeight: 48,
|
||||
maxHeight: MediaQuery.of(context).size.height -
|
||||
kBottomNavigationBarHeight,
|
||||
maxHeight: (MediaQuery.of(context).size.height * 3) / 4,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
@@ -193,7 +192,7 @@ class _DocumentsPageState extends State<DocumentsPage> {
|
||||
onRefresh: _onRefresh,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: 142,
|
||||
bottom: 48 + kBottomNavigationBarHeight + 48,
|
||||
), // Prevents panel from hiding scrollable content
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
@@ -211,7 +210,12 @@ class _DocumentsPageState extends State<DocumentsPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
child
|
||||
child,
|
||||
// SliverToBoxAdapter(
|
||||
// child: SizedBox(
|
||||
// height: MediaQuery.of(context).size.height / 3,
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:paperless_mobile/core/logic/error_code_localization_mapper.dart';
|
||||
import 'package:paperless_mobile/core/model/error_message.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/documents/bloc/documents_cubit.dart';
|
||||
@@ -138,12 +137,12 @@ class _DocumentFilterPanelState extends State<DocumentFilterPanel> {
|
||||
const SizedBox(
|
||||
height: 16.0,
|
||||
),
|
||||
_buildSortByChipsList(context, state),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(S.of(context).documentsFilterPageSearchLabel),
|
||||
).padded(const EdgeInsets.only(left: 8.0)),
|
||||
_buildQueryFormField(state),
|
||||
_buildSortByChipsList(context, state),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(S.of(context).documentsFilterPageAdvancedLabel),
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:paperless_mobile/features/documents/bloc/documents_cubit.dart';
|
||||
import 'package:paperless_mobile/features/documents/bloc/documents_state.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/widgets/selection/bulk_delete_confirmation_dialog.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/widgets/selection/saved_view_selection_widget.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/widgets/sort_documents_button.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/util.dart';
|
||||
|
||||
@@ -28,12 +29,14 @@ class _DocumentsPageAppBarState extends State<DocumentsPageAppBar> {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<DocumentsCubit, DocumentsState>(
|
||||
builder: (context, documentsState) {
|
||||
if (documentsState.selection.isNotEmpty) {
|
||||
final hasSelection = documentsState.selection.isNotEmpty;
|
||||
if (hasSelection) {
|
||||
return SliverAppBar(
|
||||
expandedHeight: kToolbarHeight + _flexibleAreaHeight,
|
||||
snap: true,
|
||||
floating: true,
|
||||
pinned: true,
|
||||
expandedHeight: kToolbarHeight,
|
||||
flexibleSpace: _buildFlexibleArea(false),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () =>
|
||||
@@ -51,13 +54,10 @@ class _DocumentsPageAppBarState extends State<DocumentsPageAppBar> {
|
||||
} else {
|
||||
return SliverAppBar(
|
||||
expandedHeight: kToolbarHeight + _flexibleAreaHeight,
|
||||
snap: true,
|
||||
floating: true,
|
||||
pinned: true,
|
||||
flexibleSpace: const FlexibleSpaceBar(
|
||||
background: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: SavedViewSelectionWidget(height: _flexibleAreaHeight),
|
||||
),
|
||||
),
|
||||
flexibleSpace: _buildFlexibleArea(true),
|
||||
title: BlocBuilder<DocumentsCubit, DocumentsState>(
|
||||
builder: (context, state) {
|
||||
return Text(
|
||||
@@ -65,13 +65,30 @@ class _DocumentsPageAppBarState extends State<DocumentsPageAppBar> {
|
||||
);
|
||||
},
|
||||
),
|
||||
actions: widget.actions,
|
||||
actions: [
|
||||
...widget.actions,
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFlexibleArea(bool enabled) {
|
||||
return FlexibleSpaceBar(
|
||||
background: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
//TODO: replace with sorting stuff...
|
||||
SavedViewSelectionWidget(height: 48, enabled: enabled),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onDelete(BuildContext context, DocumentsState documentsState) async {
|
||||
final shouldDelete = await showDialog<bool>(
|
||||
context: context,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:paperless_mobile/core/model/error_message.dart';
|
||||
@@ -17,9 +15,11 @@ class SavedViewSelectionWidget extends StatelessWidget {
|
||||
const SavedViewSelectionWidget({
|
||||
Key? key,
|
||||
required this.height,
|
||||
required this.enabled,
|
||||
}) : super(key: key);
|
||||
|
||||
final double height;
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -33,7 +33,7 @@ class SavedViewSelectionWidget extends StatelessWidget {
|
||||
return Text(S.of(context).savedViewsEmptyStateText);
|
||||
}
|
||||
return SizedBox(
|
||||
height: 48.0,
|
||||
height: height,
|
||||
child: ListView.separated(
|
||||
itemCount: state.value.length,
|
||||
scrollDirection: Axis.horizontal,
|
||||
@@ -44,8 +44,10 @@ class SavedViewSelectionWidget extends StatelessWidget {
|
||||
child: FilterChip(
|
||||
label: Text(state.value.values.toList()[index].name),
|
||||
selected: view.id == state.selectedSavedViewId,
|
||||
onSelected: (isSelected) =>
|
||||
_onSelected(isSelected, context, view),
|
||||
onSelected: enabled
|
||||
? (isSelected) =>
|
||||
_onSelected(isSelected, context, view)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -65,7 +67,7 @@ class SavedViewSelectionWidget extends StatelessWidget {
|
||||
),
|
||||
TextButton.icon(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () => _onCreatePressed(context),
|
||||
onPressed: enabled ? () => _onCreatePressed(context) : null,
|
||||
label: Text(S.of(context).savedViewCreateNewLabel),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -19,7 +19,7 @@ class BottomNavBar extends StatelessWidget {
|
||||
selectedIndex: selectedIndex,
|
||||
destinations: [
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.description_outlined),
|
||||
icon: const Icon(Icons.description),
|
||||
selectedIcon: Icon(
|
||||
Icons.description,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
|
||||
@@ -26,6 +26,12 @@ class InfoDrawer extends StatelessWidget {
|
||||
child: ListView(
|
||||
children: [
|
||||
DrawerHeader(
|
||||
padding: EdgeInsets.only(
|
||||
top: 8,
|
||||
left: 8,
|
||||
bottom: 0,
|
||||
right: 8,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -60,25 +66,45 @@ class InfoDrawer extends StatelessWidget {
|
||||
contentPadding: EdgeInsets.zero,
|
||||
dense: true,
|
||||
title: Text(
|
||||
state.host ?? '',
|
||||
S.of(context).appDrawerHeaderLoggedInAsText +
|
||||
(state.username ?? '?'),
|
||||
style: Theme.of(context).textTheme.bodyText2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.end,
|
||||
maxLines: 1,
|
||||
),
|
||||
isThreeLine: true,
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
state.username ?? '',
|
||||
state.host ?? '',
|
||||
style: Theme.of(context).textTheme.bodyText2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.end,
|
||||
maxLines: 1,
|
||||
),
|
||||
Text(
|
||||
'${S.of(context).serverInformationPaperlessVersionText} ${state.version} (API v${state.apiVersion})',
|
||||
style: Theme.of(context).textTheme.caption,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.end,
|
||||
maxLines: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
// title: RichText(
|
||||
|
||||
// text: TextSpan(
|
||||
// children: [
|
||||
// TextSpan(
|
||||
// text:
|
||||
// style:
|
||||
// Theme.of(context).textTheme.bodyText2,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
isThreeLine: true,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -33,43 +33,13 @@ class ScannerPage extends StatefulWidget {
|
||||
|
||||
class _ScannerPageState extends State<ScannerPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late final AnimationController _fabPulsingController;
|
||||
late final Animation _animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fabPulsingController =
|
||||
AnimationController(vsync: this, duration: const Duration(seconds: 1))
|
||||
..repeat(reverse: true);
|
||||
_animation = Tween(begin: 1.0, end: 1.2).animate(_fabPulsingController)
|
||||
..addListener(() => setState((() {})));
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_fabPulsingController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
drawer: const InfoDrawer(),
|
||||
floatingActionButton: BlocBuilder<DocumentScannerCubit, List<File>>(
|
||||
builder: (context, state) {
|
||||
final fab = FloatingActionButton(
|
||||
onPressed: () => _openDocumentScanner(context),
|
||||
child: const Icon(Icons.add_a_photo_outlined),
|
||||
);
|
||||
if (state.isEmpty) {
|
||||
return Transform.scale(
|
||||
child: fab,
|
||||
scale: _animation.value,
|
||||
);
|
||||
}
|
||||
return fab;
|
||||
},
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => _openDocumentScanner(context),
|
||||
child: const Icon(Icons.add_a_photo_outlined),
|
||||
),
|
||||
appBar: _buildAppBar(context),
|
||||
body: Padding(
|
||||
|
||||
Reference in New Issue
Block a user