mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 06:07:48 -06:00
118 lines
4.8 KiB
Dart
118 lines
4.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_paperless_mobile/features/settings/bloc/application_settings_cubit.dart';
|
|
import 'package:flutter_paperless_mobile/di_initializer.dart';
|
|
import 'package:flutter_paperless_mobile/features/labels/correspondent/bloc/correspondents_cubit.dart';
|
|
import 'package:flutter_paperless_mobile/features/labels/document_type/bloc/document_type_cubit.dart';
|
|
import 'package:flutter_paperless_mobile/features/documents/bloc/documents_cubit.dart';
|
|
import 'package:flutter_paperless_mobile/features/settings/view/settings_page.dart';
|
|
import 'package:flutter_paperless_mobile/features/login/bloc/authentication_cubit.dart';
|
|
import 'package:flutter_paperless_mobile/features/scan/bloc/document_scanner_cubit.dart';
|
|
import 'package:flutter_paperless_mobile/features/labels/tags/bloc/tags_cubit.dart';
|
|
import 'package:flutter_paperless_mobile/generated/l10n.dart';
|
|
import 'package:flutter_paperless_mobile/util.dart';
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
|
import 'package:flutter_paperless_mobile/extensions/flutter_extensions.dart';
|
|
|
|
class InfoDrawer extends StatelessWidget {
|
|
const InfoDrawer({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Drawer(
|
|
child: ListView(
|
|
children: [
|
|
DrawerHeader(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Image.asset(
|
|
"assets/logos/paperless_logo_white.png",
|
|
height: 32,
|
|
width: 32,
|
|
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
|
).padded(const EdgeInsets.only(right: 8.0)),
|
|
Text(
|
|
S.of(context).appTitleText,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.headline5!
|
|
.copyWith(color: Theme.of(context).colorScheme.onPrimaryContainer),
|
|
),
|
|
],
|
|
),
|
|
Align(
|
|
alignment: Alignment.bottomRight,
|
|
child: BlocBuilder<AuthenticationCubit, AuthenticationState>(
|
|
builder: (context, state) {
|
|
return Text(
|
|
state.authentication?.serverUrl.replaceAll(RegExp(r'https?://'), "") ?? "",
|
|
textAlign: TextAlign.end,
|
|
style: TextStyle(color: Theme.of(context).colorScheme.onPrimaryContainer),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).colorScheme.primaryContainer,
|
|
),
|
|
),
|
|
ListTile(
|
|
leading: const Icon(Icons.settings),
|
|
title: Text(
|
|
S.of(context).appDrawerSettingsLabel,
|
|
),
|
|
onTap: () => Navigator.of(context).push(
|
|
MaterialPageRoute(
|
|
builder: (context) => BlocProvider.value(
|
|
value: getIt<ApplicationSettingsCubit>(),
|
|
child: const SettingsPage(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const Divider(),
|
|
ListTile(
|
|
leading: const Icon(Icons.bug_report),
|
|
title: Text(S.of(context).appDrawerReportBugLabel),
|
|
onTap: () {
|
|
launchUrlString("https://github.com/astubenbord/paperless-mobile/issues/new");
|
|
},
|
|
),
|
|
const Divider(),
|
|
AboutListTile(
|
|
icon: const Icon(Icons.info),
|
|
applicationIcon: const ImageIcon(AssetImage("assets/logos/paperless_logo_green.png")),
|
|
applicationName: "Paperless Mobile",
|
|
applicationVersion: kPackageInfo.version + "+" + kPackageInfo.buildNumber,
|
|
aboutBoxChildren: [
|
|
Text('${S.of(context).aboutDialogDevelopedByText} Anton Stubenbord'),
|
|
],
|
|
child: Text(S.of(context).appDrawerAboutLabel),
|
|
),
|
|
const Divider(),
|
|
ListTile(
|
|
leading: const Icon(Icons.logout),
|
|
title: Text(S.of(context).appDrawerLogoutLabel),
|
|
onTap: () {
|
|
// Clear all bloc data
|
|
BlocProvider.of<AuthenticationCubit>(context).logout();
|
|
getIt<DocumentsCubit>().reset();
|
|
getIt<CorrespondentCubit>().reset();
|
|
getIt<DocumentTypeCubit>().reset();
|
|
getIt<TagCubit>().reset();
|
|
getIt<DocumentScannerCubit>().reset();
|
|
},
|
|
),
|
|
const Divider(),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|