added about dialog
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// A dialog page with Material entrance and exit animations, modal barrier color,
|
||||||
|
/// and modal barrier behavior (dialog is dismissible with a tap on the barrier).
|
||||||
|
class DialogPage<T> extends Page<T> {
|
||||||
|
final Offset? anchorPoint;
|
||||||
|
final Color? barrierColor;
|
||||||
|
final bool barrierDismissible;
|
||||||
|
final String? barrierLabel;
|
||||||
|
final bool useSafeArea;
|
||||||
|
final CapturedThemes? themes;
|
||||||
|
final WidgetBuilder builder;
|
||||||
|
|
||||||
|
const DialogPage({
|
||||||
|
required this.builder,
|
||||||
|
this.anchorPoint,
|
||||||
|
this.barrierColor = Colors.black54,
|
||||||
|
this.barrierDismissible = true,
|
||||||
|
this.barrierLabel,
|
||||||
|
this.useSafeArea = true,
|
||||||
|
this.themes,
|
||||||
|
super.key,
|
||||||
|
super.name,
|
||||||
|
super.arguments,
|
||||||
|
super.restorationId,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Route<T> createRoute(BuildContext context) => DialogRoute<T>(
|
||||||
|
context: context,
|
||||||
|
settings: this,
|
||||||
|
builder: builder,
|
||||||
|
anchorPoint: anchorPoint,
|
||||||
|
barrierColor: barrierColor,
|
||||||
|
barrierDismissible: barrierDismissible,
|
||||||
|
barrierLabel: barrierLabel,
|
||||||
|
useSafeArea: useSafeArea,
|
||||||
|
themes: themes,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:bang_navigator/core/routing/dialog_page.dart';
|
||||||
|
import 'package:bang_navigator/features/about/presentation/screens/about.dart';
|
||||||
import 'package:bang_navigator/features/search_browser/presentation/screens/browser.dart';
|
import 'package:bang_navigator/features/search_browser/presentation/screens/browser.dart';
|
||||||
import 'package:bang_navigator/features/settings/data/repositories/settings_repository.dart';
|
import 'package:bang_navigator/features/settings/data/repositories/settings_repository.dart';
|
||||||
import 'package:bang_navigator/features/settings/presentation/screens/settings.dart';
|
import 'package:bang_navigator/features/settings/presentation/screens/settings.dart';
|
||||||
@@ -9,6 +11,11 @@ part 'routes.g.dart';
|
|||||||
|
|
||||||
@TypedGoRoute<KagiRoute>(
|
@TypedGoRoute<KagiRoute>(
|
||||||
path: '/',
|
path: '/',
|
||||||
|
routes: [
|
||||||
|
TypedGoRoute<AboutRoute>(
|
||||||
|
path: 'about',
|
||||||
|
),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
class KagiRoute extends GoRouteData {
|
class KagiRoute extends GoRouteData {
|
||||||
KagiRoute();
|
KagiRoute();
|
||||||
@@ -41,3 +48,10 @@ class SettingsRoute extends GoRouteData {
|
|||||||
return const SettingsScreen();
|
return const SettingsScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AboutRoute extends GoRouteData {
|
||||||
|
@override
|
||||||
|
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||||
|
return DialogPage(builder: (_) => const AboutDialogScreen());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ List<RouteBase> get $appRoutes => [
|
|||||||
RouteBase get $kagiRoute => GoRouteData.$route(
|
RouteBase get $kagiRoute => GoRouteData.$route(
|
||||||
path: '/',
|
path: '/',
|
||||||
factory: $KagiRouteExtension._fromState,
|
factory: $KagiRouteExtension._fromState,
|
||||||
|
routes: [
|
||||||
|
GoRouteData.$route(
|
||||||
|
path: 'about',
|
||||||
|
factory: $AboutRouteExtension._fromState,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
extension $KagiRouteExtension on KagiRoute {
|
extension $KagiRouteExtension on KagiRoute {
|
||||||
@@ -33,6 +39,23 @@ extension $KagiRouteExtension on KagiRoute {
|
|||||||
void replace(BuildContext context) => context.replace(location);
|
void replace(BuildContext context) => context.replace(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension $AboutRouteExtension on AboutRoute {
|
||||||
|
static AboutRoute _fromState(GoRouterState state) => AboutRoute();
|
||||||
|
|
||||||
|
String get location => GoRouteData.$location(
|
||||||
|
'/about',
|
||||||
|
);
|
||||||
|
|
||||||
|
void go(BuildContext context) => context.go(location);
|
||||||
|
|
||||||
|
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
|
||||||
|
|
||||||
|
void pushReplacement(BuildContext context) =>
|
||||||
|
context.pushReplacement(location);
|
||||||
|
|
||||||
|
void replace(BuildContext context) => context.replace(location);
|
||||||
|
}
|
||||||
|
|
||||||
RouteBase get $settingsRoute => GoRouteData.$route(
|
RouteBase get $settingsRoute => GoRouteData.$route(
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
factory: $SettingsRouteExtension._fromState,
|
factory: $SettingsRouteExtension._fromState,
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
part 'package_info_repository.g.dart';
|
||||||
|
|
||||||
|
@Riverpod(keepAlive: true)
|
||||||
|
Future<PackageInfo> packageInfo(PackageInfoRef ref) {
|
||||||
|
return PackageInfo.fromPlatform();
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'package_info_repository.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
String _$packageInfoHash() => r'f7bd90882137aac7a9f28e9d10eae6efeee8c9d0';
|
||||||
|
|
||||||
|
/// See also [packageInfo].
|
||||||
|
@ProviderFor(packageInfo)
|
||||||
|
final packageInfoProvider = FutureProvider<PackageInfo>.internal(
|
||||||
|
packageInfo,
|
||||||
|
name: r'packageInfoProvider',
|
||||||
|
debugGetCreateSourceHash:
|
||||||
|
const bool.fromEnvironment('dart.vm.product') ? null : _$packageInfoHash,
|
||||||
|
dependencies: null,
|
||||||
|
allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef PackageInfoRef = FutureProviderRef<PackageInfo>;
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import 'package:bang_navigator/features/about/data/repositories/package_info_repository.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
|
class AboutDialogScreen extends HookConsumerWidget {
|
||||||
|
const AboutDialogScreen();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final packageInfo = ref.watch(
|
||||||
|
packageInfoProvider.select(
|
||||||
|
//During startup we make sure
|
||||||
|
(value) => value.value!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return AboutDialog(
|
||||||
|
applicationIcon: SizedBox.square(
|
||||||
|
dimension: IconTheme.of(context).size,
|
||||||
|
child: Image.asset('assets/icon/icon.png'),
|
||||||
|
),
|
||||||
|
applicationName: packageInfo.appName,
|
||||||
|
applicationVersion: packageInfo.version,
|
||||||
|
applicationLegalese: 'Copyright © Fabian Freund, 2024',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -215,6 +215,14 @@ class KagiScreen extends HookConsumerWidget {
|
|||||||
leadingIcon: const Icon(MdiIcons.text),
|
leadingIcon: const Icon(MdiIcons.text),
|
||||||
child: const Text('Summarizer'),
|
child: const Text('Summarizer'),
|
||||||
),
|
),
|
||||||
|
const Divider(),
|
||||||
|
MenuItemButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await context.push(AboutRoute().location);
|
||||||
|
},
|
||||||
|
leadingIcon: const Icon(Icons.info),
|
||||||
|
child: const Text('About'),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ part of 'sharing_intent.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$sharingIntentStreamHash() =>
|
String _$sharingIntentStreamHash() =>
|
||||||
r'6fca6ca6b4ac983397245a09cb61144cd5a4715d';
|
r'4b285bac1537aa03007a6e932ddb50f24b2db873';
|
||||||
|
|
||||||
/// See also [sharingIntentStream].
|
/// See also [sharingIntentStream].
|
||||||
@ProviderFor(sharingIntentStream)
|
@ProviderFor(sharingIntentStream)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:bang_navigator/core/logger.dart';
|
import 'package:bang_navigator/core/logger.dart';
|
||||||
import 'package:bang_navigator/core/providers.dart';
|
import 'package:bang_navigator/core/providers.dart';
|
||||||
|
import 'package:bang_navigator/features/about/data/repositories/package_info_repository.dart';
|
||||||
import 'package:bang_navigator/features/search_browser/domain/services/session.dart';
|
import 'package:bang_navigator/features/search_browser/domain/services/session.dart';
|
||||||
import 'package:bang_navigator/features/settings/data/repositories/settings_repository.dart';
|
import 'package:bang_navigator/features/settings/data/repositories/settings_repository.dart';
|
||||||
import 'package:bang_navigator/presentation/hooks/on_initialization.dart';
|
import 'package:bang_navigator/presentation/hooks/on_initialization.dart';
|
||||||
@@ -37,6 +38,8 @@ void main() async {
|
|||||||
builder: (context, ref, child) {
|
builder: (context, ref, child) {
|
||||||
useOnInitialization(
|
useOnInitialization(
|
||||||
() async {
|
() async {
|
||||||
|
await ref.read(packageInfoProvider.future);
|
||||||
|
|
||||||
final settings =
|
final settings =
|
||||||
await ref.read(settingsRepositoryProvider.future);
|
await ref.read(settingsRepositoryProvider.future);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Foundation
|
|||||||
|
|
||||||
import flutter_inappwebview_macos
|
import flutter_inappwebview_macos
|
||||||
import flutter_secure_storage_macos
|
import flutter_secure_storage_macos
|
||||||
|
import package_info_plus
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
import share_plus
|
import share_plus
|
||||||
import shared_preferences_foundation
|
import shared_preferences_foundation
|
||||||
@@ -15,6 +16,7 @@ import url_launcher_macos
|
|||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
|
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
|
||||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||||
|
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
|
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
|
|||||||
@@ -161,6 +161,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.1"
|
version: "0.4.1"
|
||||||
|
clock:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: clock
|
||||||
|
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
code_builder:
|
code_builder:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -683,6 +691,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.0"
|
||||||
|
package_info_plus:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: package_info_plus
|
||||||
|
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "8.0.0"
|
||||||
|
package_info_plus_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_platform_interface
|
||||||
|
sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ dependencies:
|
|||||||
http: ^1.2.1
|
http: ^1.2.1
|
||||||
logger: ^2.2.0
|
logger: ^2.2.0
|
||||||
mime: ^1.0.5
|
mime: ^1.0.5
|
||||||
|
package_info_plus: ^8.0.0
|
||||||
riverpod: ^2.5.1
|
riverpod: ^2.5.1
|
||||||
riverpod_annotation: ^2.3.5
|
riverpod_annotation: ^2.3.5
|
||||||
rxdart: ^0.27.7
|
rxdart: ^0.27.7
|
||||||
@@ -54,6 +55,8 @@ dev_dependencies:
|
|||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
assets:
|
||||||
|
- assets/icon/icon.png
|
||||||
|
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
android: "launcher_icon"
|
android: "launcher_icon"
|
||||||
|
|||||||
Reference in New Issue
Block a user