-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b703db
commit 6fc9375
Showing
12 changed files
with
168 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
arb-dir: lib/l10n | ||
template-arb-file: app_de.arb | ||
output-localization-file: app_localizations.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import 'dart:io'; | ||
import 'dart:ui'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_localizations/flutter_localizations.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:path/path.dart' as path; | ||
import 'package:window_size/window_size.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
|
||
import 'repository/repository.dart'; | ||
import 'ui/routes.dart'; | ||
|
||
class JulogApp extends ConsumerStatefulWidget { | ||
const JulogApp({super.key}); | ||
|
||
@override | ||
ConsumerState<ConsumerStatefulWidget> createState() => _JulogAppState(); | ||
} | ||
|
||
class _JulogAppState extends ConsumerState<JulogApp> { | ||
// ignore: unused_field | ||
late final AppLifecycleListener _lifecycleListener; | ||
|
||
@override | ||
void initState() { | ||
_lifecycleListener = AppLifecycleListener( | ||
onDetach: _handleShutdown, | ||
onExitRequested: _handleShutdown, | ||
); | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final router = ref.watch(routerProvider); | ||
final filename = | ||
ref.watch(repositoryProvider.select((value) => value?.filename)); | ||
final file = filename != null ? path.basename(filename) : null; | ||
final String title; | ||
if (file == null) { | ||
title = "julog"; | ||
} else { | ||
title = "$file - julog"; | ||
} | ||
if (Platform.isLinux || Platform.isMacOS || Platform.isLinux) { | ||
setWindowTitle(title); | ||
} | ||
return MaterialApp.router( | ||
routerConfig: router, | ||
title: title, | ||
supportedLocales: const [Locale("de")], | ||
localizationsDelegates: const [ | ||
AppLocalizations.delegate, | ||
GlobalMaterialLocalizations.delegate, | ||
GlobalWidgetsLocalizations.delegate, | ||
GlobalCupertinoLocalizations.delegate, | ||
], | ||
); | ||
} | ||
|
||
Future<AppExitResponse> _handleShutdown() async { | ||
ref.read(repositoryProvider.notifier).dispose(); | ||
return AppExitResponse.exit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"@@locale": "de", | ||
"itemDetailDetail": "Detail", | ||
"itemDetailEmptyHint": "Klicke ein Listenelement links an, um dir die Details anzusehen." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters