update routes; small polishments
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'package:bang_navigator/core/routing/dialog_page.dart';
|
import 'package:bang_navigator/core/routing/dialog_page.dart';
|
||||||
import 'package:bang_navigator/features/about/presentation/screens/about.dart';
|
import 'package:bang_navigator/features/about/presentation/screens/about.dart';
|
||||||
import 'package:bang_navigator/features/bangs/presentation/screens/bang.dart';
|
import 'package:bang_navigator/features/bangs/presentation/screens/categories.dart';
|
||||||
|
import 'package:bang_navigator/features/bangs/presentation/screens/list.dart';
|
||||||
import 'package:bang_navigator/features/bangs/presentation/screens/search.dart';
|
import 'package:bang_navigator/features/bangs/presentation/screens/search.dart';
|
||||||
import 'package:bang_navigator/features/chat_archive/presentation/screens/detail.dart';
|
import 'package:bang_navigator/features/chat_archive/presentation/screens/detail.dart';
|
||||||
import 'package:bang_navigator/features/chat_archive/presentation/screens/list.dart';
|
import 'package:bang_navigator/features/chat_archive/presentation/screens/list.dart';
|
||||||
@@ -19,16 +20,26 @@ part 'routes.g.dart';
|
|||||||
name: 'AboutRoute',
|
name: 'AboutRoute',
|
||||||
path: 'about',
|
path: 'about',
|
||||||
),
|
),
|
||||||
TypedGoRoute<BangRoute>(
|
TypedGoRoute<BangCategoriesRoute>(
|
||||||
name: 'BangRoute',
|
name: 'BangRoute',
|
||||||
path: 'bangs',
|
path: 'bangs',
|
||||||
routes: [
|
routes: [
|
||||||
TypedGoRoute<BangSearchRoute>(
|
TypedGoRoute<BangCategoryRoute>(
|
||||||
name: 'BangSearchRoute',
|
name: 'BangCategoryRoute',
|
||||||
path: 'search',
|
path: ':category',
|
||||||
|
routes: [
|
||||||
|
TypedGoRoute<BangSubCategoryRoute>(
|
||||||
|
name: 'BangSubCategoryRoute',
|
||||||
|
path: ':subCategory',
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
TypedGoRoute<BangSearchRoute>(
|
||||||
|
name: 'BangSearchRoute',
|
||||||
|
path: 'bang_search',
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
class KagiRoute extends GoRouteData {
|
class KagiRoute extends GoRouteData {
|
||||||
@@ -45,10 +56,36 @@ class AboutRoute extends GoRouteData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BangRoute extends GoRouteData {
|
class BangCategoriesRoute extends GoRouteData {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, GoRouterState state) {
|
Widget build(BuildContext context, GoRouterState state) {
|
||||||
return const BangScreen();
|
return const BangCategoriesScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BangCategoryRoute extends GoRouteData {
|
||||||
|
final String category;
|
||||||
|
|
||||||
|
const BangCategoryRoute({required this.category});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, GoRouterState state) {
|
||||||
|
return BangListScreen(category: category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BangSubCategoryRoute extends GoRouteData {
|
||||||
|
final String category;
|
||||||
|
final String subCategory;
|
||||||
|
|
||||||
|
const BangSubCategoryRoute({
|
||||||
|
required this.category,
|
||||||
|
required this.subCategory,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, GoRouterState state) {
|
||||||
|
return BangListScreen(category: category, subCategory: subCategory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,27 @@ RouteBase get $kagiRoute => GoRouteData.$route(
|
|||||||
GoRouteData.$route(
|
GoRouteData.$route(
|
||||||
path: 'bangs',
|
path: 'bangs',
|
||||||
name: 'BangRoute',
|
name: 'BangRoute',
|
||||||
factory: $BangRouteExtension._fromState,
|
factory: $BangCategoriesRouteExtension._fromState,
|
||||||
routes: [
|
routes: [
|
||||||
GoRouteData.$route(
|
GoRouteData.$route(
|
||||||
path: 'search',
|
path: ':category',
|
||||||
name: 'BangSearchRoute',
|
name: 'BangCategoryRoute',
|
||||||
factory: $BangSearchRouteExtension._fromState,
|
factory: $BangCategoryRouteExtension._fromState,
|
||||||
|
routes: [
|
||||||
|
GoRouteData.$route(
|
||||||
|
path: ':subCategory',
|
||||||
|
name: 'BangSubCategoryRoute',
|
||||||
|
factory: $BangSubCategoryRouteExtension._fromState,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
GoRouteData.$route(
|
||||||
|
path: 'bang_search',
|
||||||
|
name: 'BangSearchRoute',
|
||||||
|
factory: $BangSearchRouteExtension._fromState,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -71,8 +83,9 @@ extension $AboutRouteExtension on AboutRoute {
|
|||||||
void replace(BuildContext context) => context.replace(location);
|
void replace(BuildContext context) => context.replace(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension $BangRouteExtension on BangRoute {
|
extension $BangCategoriesRouteExtension on BangCategoriesRoute {
|
||||||
static BangRoute _fromState(GoRouterState state) => BangRoute();
|
static BangCategoriesRoute _fromState(GoRouterState state) =>
|
||||||
|
BangCategoriesRoute();
|
||||||
|
|
||||||
String get location => GoRouteData.$location(
|
String get location => GoRouteData.$location(
|
||||||
'/bangs',
|
'/bangs',
|
||||||
@@ -88,11 +101,51 @@ extension $BangRouteExtension on BangRoute {
|
|||||||
void replace(BuildContext context) => context.replace(location);
|
void replace(BuildContext context) => context.replace(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension $BangCategoryRouteExtension on BangCategoryRoute {
|
||||||
|
static BangCategoryRoute _fromState(GoRouterState state) => BangCategoryRoute(
|
||||||
|
category: state.pathParameters['category']!,
|
||||||
|
);
|
||||||
|
|
||||||
|
String get location => GoRouteData.$location(
|
||||||
|
'/bangs/${Uri.encodeComponent(category)}',
|
||||||
|
);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension $BangSubCategoryRouteExtension on BangSubCategoryRoute {
|
||||||
|
static BangSubCategoryRoute _fromState(GoRouterState state) =>
|
||||||
|
BangSubCategoryRoute(
|
||||||
|
category: state.pathParameters['category']!,
|
||||||
|
subCategory: state.pathParameters['subCategory']!,
|
||||||
|
);
|
||||||
|
|
||||||
|
String get location => GoRouteData.$location(
|
||||||
|
'/bangs/${Uri.encodeComponent(category)}/${Uri.encodeComponent(subCategory)}',
|
||||||
|
);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
extension $BangSearchRouteExtension on BangSearchRoute {
|
extension $BangSearchRouteExtension on BangSearchRoute {
|
||||||
static BangSearchRoute _fromState(GoRouterState state) => BangSearchRoute();
|
static BangSearchRoute _fromState(GoRouterState state) => BangSearchRoute();
|
||||||
|
|
||||||
String get location => GoRouteData.$location(
|
String get location => GoRouteData.$location(
|
||||||
'/bangs/search',
|
'/bang_search',
|
||||||
);
|
);
|
||||||
|
|
||||||
void go(BuildContext context) => context.go(location);
|
void go(BuildContext context) => context.go(location);
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class KagiScreen extends HookConsumerWidget {
|
|||||||
const Divider(),
|
const Divider(),
|
||||||
MenuItemButton(
|
MenuItemButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await context.push(BangRoute().location);
|
await context.push(BangCategoriesRoute().location);
|
||||||
},
|
},
|
||||||
leadingIcon: const Icon(MdiIcons.exclamationThick),
|
leadingIcon: const Icon(MdiIcons.exclamationThick),
|
||||||
child: const Text('Bangs'),
|
child: const Text('Bangs'),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class AppBarTitle extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final activeWebView = ref.watch(webViewTabControllerProvider);
|
final activeWebView = ref.watch(webViewTabControllerProvider);
|
||||||
if (activeWebView == null) {
|
if (activeWebView == null) {
|
||||||
return SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
final page = useValueListenable(activeWebView.page);
|
final page = useValueListenable(activeWebView.page);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
class _InputField extends ConsumerWidget {
|
class _InputField extends ConsumerWidget {
|
||||||
final TextEditingController? controller;
|
final TextEditingController? controller;
|
||||||
|
|
||||||
const _InputField({required this.controller, super.key});
|
const _InputField({required this.controller});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class SettingsScreen extends HookConsumerWidget {
|
|||||||
_buildSection(theme, 'Bangs'),
|
_buildSection(theme, 'Bangs'),
|
||||||
ButtonListTile(
|
ButtonListTile(
|
||||||
title: 'Icon Cache',
|
title: 'Icon Cache',
|
||||||
subtitle: 'Stores favicons for Bangs',
|
subtitle: 'Stored favicons for Bangs',
|
||||||
button: FilledButton.icon(
|
button: FilledButton.icon(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await ref
|
await ref
|
||||||
@@ -215,7 +215,7 @@ class SettingsScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
ButtonListTile(
|
ButtonListTile(
|
||||||
title: 'Bang Frequencies',
|
title: 'Bang Frequencies',
|
||||||
subtitle: 'Tracks Bang usage for recommendation history',
|
subtitle: 'Tracked usage for Bang recommendations',
|
||||||
button: FilledButton.icon(
|
button: FilledButton.icon(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await ref
|
await ref
|
||||||
|
|||||||
+10
-10
@@ -349,10 +349,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: file_picker
|
name: file_picker
|
||||||
sha256: "29c90806ac5f5fb896547720b73b17ee9aed9bba540dc5d91fe29f8c5745b10a"
|
sha256: "2ca051989f69d1b2ca012b2cf3ccf78c70d40144f0861ff2c063493f7c8c3d45"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.0.3"
|
version: "8.0.5"
|
||||||
fixnum:
|
fixnum:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -442,10 +442,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_markdown
|
name: flutter_markdown
|
||||||
sha256: "9921f9deda326f8a885e202b1e35237eadfc1345239a0f6f0f1ff287e047547f"
|
sha256: ff76a9300a06ad1f2b394e54c0b4beaaf6a95f95c98540c918b870221499bb10
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.1"
|
version: "0.7.2"
|
||||||
flutter_material_design_icons:
|
flutter_material_design_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -567,10 +567,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: go_router
|
name: go_router
|
||||||
sha256: abec47eb8c8c36ebf41d0a4c64dbbe7f956e39a012b3aafc530e951bdc12fe3f
|
sha256: cdae1b9c8bd7efadcef6112e81c903662ef2ce105cbd220a04bbb7c3425b5554
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "14.1.4"
|
version: "14.2.0"
|
||||||
go_router_builder:
|
go_router_builder:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -847,10 +847,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: platform
|
name: platform
|
||||||
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.4"
|
version: "3.1.5"
|
||||||
plugin_platform_interface:
|
plugin_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1284,10 +1284,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: "360c4271613beb44db559547d02f8b0dc044741d0eeb9aa6ccdb47e8ec54c63a"
|
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "14.2.3"
|
version: "14.2.4"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
Reference in New Issue
Block a user