Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
49 changes: 21 additions & 28 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:fire_scribe/app_scaffold.dart';
import 'package:fire_scribe/app_theme.dart';
import 'package:fire_scribe/dashboard/dashboard_route.dart';
import 'package:fire_scribe/l10n/app_localizations.dart';
import 'package:fire_scribe/l10n/cubit/localization_cubit.dart';
import 'package:fire_scribe/l10n/supported_locales.dart';
Expand All @@ -12,9 +11,7 @@ import 'package:get_it/get_it.dart';
import 'package:go_router/go_router.dart';

class App extends StatelessWidget {
const App({
super.key,
});
const App({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -24,35 +21,33 @@ class App extends StatelessWidget {
navigatorKey: GetIt.instance<GlobalKey<NavigatorState>>(),
routes: $appRoutes,
errorBuilder: (context, state) {
return AppScaffold(
child: _AppErrorPage(),
);
return AppScaffold(child: _AppErrorPage());
},
);

return BlocProvider(
create: (final context) => LocalizationCubit(
sharedPreferences: GetIt.instance(),
),
create:
(final context) =>
LocalizationCubit(sharedPreferences: GetIt.instance()),
child: BlocBuilder<LocalizationCubit, LocalizationCubitState>(
buildWhen: (final _, final current) => current.when(
initial: () => false,
locale: (final _) => true,
),
buildWhen:
(final _, final current) =>
current.when(initial: () => false, locale: (final _) => true),
builder: (final context, final state) {
return state.when(
initial: () => const SizedBox(),
locale: (final locale) => MaterialApp.router(
title: S.of(context).appTitle,
theme: appTheme,
debugShowCheckedModeBanner: false,
supportedLocales: supportedLocales,
locale: locale,
localizationsDelegates: S.delegates,
routeInformationProvider: router.routeInformationProvider,
routeInformationParser: router.routeInformationParser,
routerDelegate: router.routerDelegate,
),
locale:
(final locale) => MaterialApp.router(
title: S.of(context).appTitle,
theme: appTheme,
debugShowCheckedModeBanner: false,
supportedLocales: supportedLocales,
locale: locale,
localizationsDelegates: S.delegates,
routeInformationProvider: router.routeInformationProvider,
routeInformationParser: router.routeInformationParser,
routerDelegate: router.routerDelegate,
),
);
},
),
Expand Down Expand Up @@ -80,9 +75,7 @@ class _AppErrorPage extends StatelessWidget {
SizedBox(height: 10),
ElevatedButton(
onPressed: () => GoRouter.of(context).refresh(),
child: Text(
S.of(context).refresh,
),
child: Text(S.of(context).refresh),
),
],
),
Expand Down
58 changes: 21 additions & 37 deletions lib/app_drawer_menu.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import 'package:fire_scribe/dashboard/dashboard_route.dart';
import 'package:fire_scribe/l10n/app_localizations.dart';
import 'package:fire_scribe/license/license_routes.dart';
import 'package:fire_scribe/routes.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
Expand All @@ -14,18 +12,14 @@ class AppDrawerMenu extends StatelessWidget {
elevation: 2,
shadowColor: Theme.of(context).colorScheme.shadow,
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 22,
),
padding: const EdgeInsets.symmetric(vertical: 22),
child: ListView(
physics: ClampingScrollPhysics(),
children: [
InkWell(
onTap: () => DashboardRoute().go(context),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8,
),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Image.asset(
'assets/app/logo.png',
width: 52,
Expand All @@ -40,16 +34,17 @@ class AppDrawerMenu extends StatelessWidget {
title: S.of(context).server,
route: DashboardRoute().location,
),
AppDrawerMenuItemData(
icon: Symbols.import_export,
title: S.of(context).importExport,
route: ImportExportRoute().location,
),
AppDrawerMenuItemData(
icon: Symbols.license,
title: S.of(context).thirdPartyLicenses,
route: ThirdPartyLicensesRoute().location,
),
].map(
(item) => AppDrawerMenuItem(
data: item,
),
),
].map((item) => AppDrawerMenuItem(data: item)),
],
),
),
Expand All @@ -60,10 +55,7 @@ class AppDrawerMenu extends StatelessWidget {
class AppDrawerMenuItem extends StatelessWidget {
final AppDrawerMenuItemData data;

const AppDrawerMenuItem({
super.key,
required this.data,
});
const AppDrawerMenuItem({super.key, required this.data});
@override
Widget build(BuildContext context) {
final location = GoRouterState.of(context).uri;
Expand All @@ -78,32 +70,24 @@ class AppDrawerMenuItem extends StatelessWidget {
child: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 4.0,
),
padding: EdgeInsets.symmetric(vertical: 4.0),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
decoration: isSelected
? BoxDecoration(
color: Theme.of(context)
.colorScheme
.primaryContainer
.withValues(alpha: 0.3),
borderRadius: BorderRadius.circular(24),
)
: null,
child: Icon(
data.icon,
fill: 1,
size: 24,
),
decoration:
isSelected
? BoxDecoration(
color: Theme.of(
context,
).colorScheme.primaryContainer.withValues(alpha: 0.3),
borderRadius: BorderRadius.circular(24),
)
: null,
child: Icon(data.icon, fill: 1, size: 24),
),
),
SizedBox(width: 4),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.0,
),
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
data.title,
textAlign: TextAlign.center,
Expand Down
16 changes: 0 additions & 16 deletions lib/dashboard/dashboard_route.dart

This file was deleted.

Loading
Loading