Finished inbox, fixed reverse sort order, bloc refactorings

This commit is contained in:
Anton Stubenbord
2022-11-30 01:24:28 +01:00
parent 50190f035e
commit b1db2a1209
27 changed files with 1144 additions and 632 deletions

View File

@@ -4,12 +4,18 @@ import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
class DocumentsListLoadingWidget extends StatelessWidget {
final List<Widget> above;
final List<Widget> below;
static const tags = [" ", " ", " "];
static const titleLengths = <double>[double.infinity, 150.0, 200.0];
static const correspondentLengths = <double>[200.0, 300.0, 150.0];
static const fontSize = 16.0;
const DocumentsListLoadingWidget({super.key});
const DocumentsListLoadingWidget({
super.key,
this.above = const [],
this.below = const [],
});
@override
Widget build(BuildContext context) {
@@ -27,58 +33,67 @@ class DocumentsListLoadingWidget extends StatelessWidget {
highlightColor: Theme.of(context).brightness == Brightness.light
? Colors.grey[100]!
: Colors.grey[600]!,
child: ListView.builder(
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
final r = Random(index);
final tagCount = r.nextInt(tags.length + 1);
final correspondentLength = correspondentLengths[
r.nextInt(correspondentLengths.length - 1)];
final titleLength =
titleLengths[r.nextInt(titleLengths.length - 1)];
return ListTile(
isThreeLine: true,
leading: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Container(
color: Colors.white,
height: 50,
width: 35,
),
),
title: Container(
padding: const EdgeInsets.symmetric(vertical: 2.0),
width: correspondentLength,
height: fontSize,
color: Colors.white,
),
subtitle: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
padding: const EdgeInsets.symmetric(vertical: 2.0),
height: fontSize,
width: titleLength,
color: Colors.white,
),
Wrap(
spacing: 2.0,
children: List.generate(
tagCount,
(index) => InputChip(
label: Text(tags[r.nextInt(tags.length)]),
),
child: Column(
children: [
...above,
Expanded(
child: ListView.builder(
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
final r = Random(index);
final tagCount = r.nextInt(tags.length + 1);
final correspondentLength = correspondentLengths[
r.nextInt(correspondentLengths.length - 1)];
final titleLength =
titleLengths[r.nextInt(titleLengths.length - 1)];
return ListTile(
isThreeLine: true,
leading: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Container(
color: Colors.white,
height: 50,
width: 35,
),
),
],
),
title: Container(
padding: const EdgeInsets.symmetric(vertical: 2.0),
width: correspondentLength,
height: fontSize,
color: Colors.white,
),
subtitle: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
padding:
const EdgeInsets.symmetric(vertical: 2.0),
height: fontSize,
width: titleLength,
color: Colors.white,
),
Wrap(
spacing: 2.0,
children: List.generate(
tagCount,
(index) => InputChip(
label: Text(tags[r.nextInt(tags.length)]),
),
),
),
],
),
),
);
},
itemCount: 25,
),
);
},
itemCount: 25,
),
...below,
],
),
),
),

View File

@@ -1,9 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:paperless_mobile/core/model/github_error_report.model.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
@@ -18,8 +15,8 @@ class ErrorReportPage extends StatefulWidget {
class _ErrorReportPageState extends State<ErrorReportPage> {
final GlobalKey<FormBuilderState> _formKey = GlobalKey();
static const String shortDescriptionKey = "shortDescription";
static const String longDescriptionKey = "longDescription";
static const String shortDescriptionKey = 'shortDescription';
static const String longDescriptionKey = 'longDescription';
bool _stackTraceCopied = false;
@override
@@ -27,11 +24,11 @@ class _ErrorReportPageState extends State<ErrorReportPage> {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(
title: Text("Report error"),
title: const Text('Report error'),
actions: [
TextButton(
onPressed: _onSubmit,
child: Text("Submit"),
child: const Text('Submit'),
),
],
),
@@ -40,31 +37,31 @@ class _ErrorReportPageState extends State<ErrorReportPage> {
child: ListView(
children: [
Text(
"""Oops, an error has occurred!
'''Oops, an error has occurred!
In order to improve the app and prevent messages like these, it is greatly appreciated if you report this error with a description of what happened and the actions leading up to this window.
Please fill the fields below and create a new issue in GitHub. Thanks!
Note: If you have the GitHub Android app installed, the descriptions will not be taken into account! Skip these here and fill them in the GitHub issues form after submitting this report.""",
Note: If you have the GitHub Android app installed, the descriptions will not be taken into account! Skip these here and fill them in the GitHub issues form after submitting this report.''',
style: Theme.of(context).textTheme.bodyMedium,
).padded(),
Text(
"Description",
'Description',
style: Theme.of(context).textTheme.subtitle1,
).padded(),
FormBuilderTextField(
name: shortDescriptionKey,
decoration: const InputDecoration(
label: Text("Short Description"),
label: Text('Short Description'),
hintText:
"Please provide a brief description of what went wrong."),
'Please provide a brief description of what went wrong.'),
).padded(),
FormBuilderTextField(
name: shortDescriptionKey,
maxLines: null,
keyboardType: TextInputType.multiline,
decoration: const InputDecoration(
label: Text("Detailled Description"),
label: Text('Detailled Description'),
hintText:
"Please describe the exact actions taken that caused this error. Provide as much details as possible.",
'Please describe the exact actions taken that caused this error. Provide as much details as possible.',
),
).padded(),
if (widget.stackTrace != null) ...[
@@ -72,19 +69,19 @@ Note: If you have the GitHub Android app installed, the descriptions will not be
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Stack Trace",
'Stack Trace',
style: Theme.of(context).textTheme.subtitle1,
).padded(
const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0)),
TextButton.icon(
label: const Text("Copy"),
label: const Text('Copy'),
icon: const Icon(Icons.copy),
onPressed: _copyStackTrace,
),
],
),
Text(
"Since stack traces cannot be attached to the GitHub issue url, please copy the content of the stackTrace and paste it in the issue description. This will greatly increase the chance of quickly resolving the issue!",
'Since stack traces cannot be attached to the GitHub issue url, please copy the content of the stackTrace and paste it in the issue description. This will greatly increase the chance of quickly resolving the issue!',
style: Theme.of(context).textTheme.caption,
).padded(),
Text(
@@ -107,7 +104,7 @@ Note: If you have the GitHub Android app installed, the descriptions will not be
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
"Stack trace copied to clipboard.",
'Stack trace copied to clipboard.',
),
duration: Duration(seconds: 2),
),
@@ -123,25 +120,25 @@ Note: If you have the GitHub Android app installed, the descriptions will not be
final continueSubmission = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: const Text("Continue without stack trace?"),
title: const Text('Continue without stack trace?'),
content: const Text(
"It seems you have not yet copied the stack trace. The stack trace provides valuable insights into where an error came from and how it could be fixed. Are you sure you want to continue without providing the stack trace?",
'It seems you have not yet copied the stack trace. The stack trace provides valuable insights into where an error came from and how it could be fixed. Are you sure you want to continue without providing the stack trace?',
),
actionsAlignment: MainAxisAlignment.end,
actions: [
TextButton(
child: const Text("Yes, continue"),
child: const Text('Yes, continue'),
onPressed: () => Navigator.pop(context, true),
),
TextButton(
child: const Text("No, copy stack trace"),
child: const Text('No, copy stack trace'),
onPressed: () {
_copyStackTrace();
Navigator.pop(context, true);
},
),
TextButton(
child: const Text("Cancel"),
child: const Text('Cancel'),
onPressed: () => Navigator.pop(context, false),
),
],