Skip to content

Commit

Permalink
feat: update example
Browse files Browse the repository at this point in the history
  • Loading branch information
foxsofter committed May 24, 2024
1 parent 344bc6b commit c661837
Show file tree
Hide file tree
Showing 62 changed files with 314 additions and 208 deletions.
4 changes: 2 additions & 2 deletions example/lib/src/biz/biz1/biz1.context.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -11,7 +11,7 @@ extension Biz1Context on ModuleContext {
int get intValue =>
get<int>('intValue') ?? (throw ArgumentError('intValue not exists'));

bool setIntValue(int value) => set<int>('intValue', value);
bool setIntValue(final int value) => set<int>('intValue', value);

/// remove an int value.remove an int value.remove an int value.
///
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/biz/biz1/biz1.route.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -13,7 +13,7 @@ import 'flutter7/flutter7.route.dart';
import 'flutter9/flutter9.route.dart';

class Biz1Route extends NavigatorRouteNode {
factory Biz1Route(NavigatorRouteNode parent) =>
factory Biz1Route(final NavigatorRouteNode parent) =>
_instance ??= Biz1Route._(parent);

Biz1Route._(super.parent);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/biz/biz1/flutter1/flutter1.context.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand Down
10 changes: 5 additions & 5 deletions example/lib/src/biz/biz1/flutter1/flutter1.route.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -9,7 +9,7 @@ import 'package:flutter_thrio/flutter_thrio.dart';
import 'home/home.route.dart';

class Flutter1Route extends NavigatorRouteNode {
factory Flutter1Route(NavigatorRouteNode parent) =>
factory Flutter1Route(final NavigatorRouteNode parent) =>
_instance ??= Flutter1Route._(parent);

Flutter1Route._(super.parent);
Expand All @@ -23,15 +23,15 @@ class Flutter1Route extends NavigatorRouteNode {

/// 通知 flutter1
///
Future<bool> flutter1({required int intValue}) => ThrioNavigator.notify(
Future<bool> flutter1({required final int intValue}) => ThrioNavigator.notify(
url: url,
name: 'flutter1',
params: intValue,
);

/// get people
///
Future<People?> getPeople({int? intValue}) =>
Future<People?> getPeople({final int? intValue}) =>
ThrioNavigator.act<Map<String, dynamic>, People>(
url: url,
action: 'getPeople{intValue?}',
Expand All @@ -42,7 +42,7 @@ class Flutter1Route extends NavigatorRouteNode {

/// get string
///
Future<String?> getString({required bool boolValue}) =>
Future<String?> getString({required final bool boolValue}) =>
ThrioNavigator.act<Map<String, dynamic>, String>(
url: url,
action: 'getString{boolValue}',
Expand Down
17 changes: 10 additions & 7 deletions example/lib/src/biz/biz1/flutter1/home/home.context.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -14,7 +14,8 @@ extension HomeContext on ModuleContext {

String get stringKeyBiz1OrDefault => get<String>('stringKeyBiz1') ?? 'weewr';

bool setStringKeyBiz1(String value) => set<String>('stringKeyBiz1', value);
bool setStringKeyBiz1(final String value) =>
set<String>('stringKeyBiz1', value);

String? removeStringKeyBiz1() => remove<String>('stringKeyBiz1');

Expand All @@ -34,7 +35,8 @@ extension HomeContext on ModuleContext {
get<int>('intKeyRootModule') ??
(throw ArgumentError('intKeyRootModule not exists'));

bool setIntKeyRootModule(int value) => set<int>('intKeyRootModule', value);
bool setIntKeyRootModule(final int value) =>
set<int>('intKeyRootModule', value);

Stream<int> get onIntKeyRootModule =>
on<int>('intKeyRootModule') ??
Expand All @@ -44,7 +46,8 @@ extension HomeContext on ModuleContext {
onWithNull<int>('intKeyRootModule') ??
(throw ArgumentError('intKeyRootModule stream not exists'));

Stream<int> onIntKeyRootModuleWithInitial({required int initialValue}) =>
Stream<int> onIntKeyRootModuleWithInitial(
{required final int initialValue}) =>
on<int>('intKeyRootModule', initialValue: initialValue) ??
(throw ArgumentError('intKeyRootModule stream not exists'));

Expand All @@ -53,10 +56,10 @@ extension HomeContext on ModuleContext {

People? get peopleOrNull => get<People>('people');

People getPeopleOrDefault({required People defaultValue}) =>
People getPeopleOrDefault({required final People defaultValue}) =>
get<People>('people') ?? defaultValue;

bool setPeople(People value) => set<People>('people', value);
bool setPeople(final People value) => set<People>('people', value);

People? removePeople() => remove<People>('people');

Expand All @@ -67,7 +70,7 @@ extension HomeContext on ModuleContext {
onWithNull<People>('people') ??
(throw ArgumentError('people stream not exists'));

Stream<People> onPeopleWithInitial({required People initialValue}) =>
Stream<People> onPeopleWithInitial({required final People initialValue}) =>
on<People>('people', initialValue: initialValue) ??
(throw ArgumentError('people stream not exists'));
}
28 changes: 18 additions & 10 deletions example/lib/src/biz/biz1/flutter1/home/home.route.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//

import 'package:flutter_thrio/flutter_thrio.dart';

class HomeRoute extends NavigatorRouteLeaf {
factory HomeRoute(NavigatorRouteNode parent) =>
factory HomeRoute(final NavigatorRouteNode parent) =>
_instance ??= HomeRoute._(parent);

HomeRoute._(super.parent);
Expand All @@ -23,10 +23,12 @@ class HomeRoute extends NavigatorRouteLeaf {
/// 测试 集合 传参
///
Future<TPopParams?> push<TPopParams>({
List<String> strList = const <String>[],
Map<String, dynamic> goodMap = const <String, dynamic>{},
bool animated = true,
NavigatorIntCallback? result,
final List<String> strList = const <String>[],
final Map<String, dynamic> goodMap = const <String, dynamic>{},
final bool animated = true,
final NavigatorIntCallback? result,
final String? fromURL,
final String? innerURL,
}) =>
ThrioNavigator.push<Map<String, dynamic>, TPopParams>(
url: url,
Expand All @@ -36,6 +38,8 @@ class HomeRoute extends NavigatorRouteLeaf {
},
animated: animated,
result: result,
fromURL: fromURL,
innerURL: innerURL,
);

/// `strList` hello, this is a list.
Expand All @@ -45,10 +49,12 @@ class HomeRoute extends NavigatorRouteLeaf {
/// 测试 集合 传参
///
Future<TPopParams?> pushSingle<TPopParams>({
List<String> strList = const <String>[],
Map<String, dynamic> goodMap = const <String, dynamic>{},
bool animated = true,
NavigatorIntCallback? result,
final List<String> strList = const <String>[],
final Map<String, dynamic> goodMap = const <String, dynamic>{},
final bool animated = true,
final NavigatorIntCallback? result,
final String? fromURL,
final String? innerURL,
}) =>
ThrioNavigator.pushSingle<Map<String, dynamic>, TPopParams>(
url: url,
Expand All @@ -58,5 +64,7 @@ class HomeRoute extends NavigatorRouteLeaf {
},
animated: animated,
result: result,
fromURL: fromURL,
innerURL: innerURL,
);
}
2 changes: 1 addition & 1 deletion example/lib/src/biz/biz1/flutter1/home/home.state.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// ignore_for_file: avoid_as

Expand Down
6 changes: 3 additions & 3 deletions example/lib/src/biz/biz1/flutter1/home/module.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -12,14 +12,14 @@ class Module with ThrioModule, ModuleParamScheme, ModulePageBuilder {
String get key => 'home';

@override
void onPageBuilderSetting(ModuleContext moduleContext) =>
void onPageBuilderSetting(final ModuleContext moduleContext) =>
pageBuilder = (settings) => HomePage(
moduleContext: moduleContext,
settings: settings,
);

@override
void onParamSchemeRegister(ModuleContext moduleContext) {
void onParamSchemeRegister(final ModuleContext moduleContext) {
registerParamScheme('stringKeyBiz1');
}
}
22 changes: 11 additions & 11 deletions example/lib/src/biz/biz1/flutter1/module.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -10,12 +10,12 @@ import 'home/module.dart' as home;

class Module with ThrioModule, ModuleRouteAction {
@override
void onRouteActionRegister(ModuleContext moduleContext) {
void onRouteActionRegister(final ModuleContext moduleContext) {
registerRouteAction('getPeople{intValue?}', <TParams, TResult>(
url,
action,
queryParams, {
params,
final url,
final action,
final queryParams, {
final params,
}) {
final result = onGetPeople(
moduleContext,
Expand All @@ -33,10 +33,10 @@ class Module with ThrioModule, ModuleRouteAction {
});

registerRouteAction('getString{boolValue}', <TParams, TResult>(
url,
action,
queryParams, {
params,
final url,
final action,
final queryParams, {
final params,
}) {
final result = onGetString(
moduleContext,
Expand All @@ -58,7 +58,7 @@ class Module with ThrioModule, ModuleRouteAction {
String get key => 'flutter1';

@override
void onModuleRegister(ModuleContext moduleContext) {
void onModuleRegister(final ModuleContext moduleContext) {
registerModule(home.Module(), moduleContext);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -11,8 +11,8 @@ typedef Flutter1NotifyCallback = void Function({int intValue});
class Flutter1Notify extends NavigatorPageNotify {
Flutter1Notify({
super.key,
required Flutter1NotifyCallback onNotify,
int? intValue,
required final Flutter1NotifyCallback onNotify,
final int? intValue,
required super.child,
}) : super(
name: 'flutter1',
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/biz/biz1/flutter11/flutter11.context.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand Down
24 changes: 16 additions & 8 deletions example/lib/src/biz/biz1/flutter11/flutter11.route.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//

import 'package:flutter_thrio/flutter_thrio.dart';

class Flutter11Route extends NavigatorRouteLeaf {
factory Flutter11Route(NavigatorRouteNode parent) =>
factory Flutter11Route(final NavigatorRouteNode parent) =>
_instance ??= Flutter11Route._(parent);

Flutter11Route._(super.parent);
Expand All @@ -17,26 +17,34 @@ class Flutter11Route extends NavigatorRouteLeaf {
String get name => 'flutter11';

Future<TPopParams?> push<TParams, TPopParams>({
TParams? params,
bool animated = true,
NavigatorIntCallback? result,
final TParams? params,
final bool animated = true,
final NavigatorIntCallback? result,
final String? fromURL,
final String? innerURL,
}) =>
ThrioNavigator.push<TParams, TPopParams>(
url: url,
params: params,
animated: animated,
result: result,
fromURL: fromURL,
innerURL: innerURL,
);

Future<TPopParams?> pushSingle<TParams, TPopParams>({
TParams? params,
bool animated = true,
NavigatorIntCallback? result,
final TParams? params,
final bool animated = true,
final NavigatorIntCallback? result,
final String? fromURL,
final String? innerURL,
}) =>
ThrioNavigator.pushSingle<TParams, TPopParams>(
url: url,
params: params,
animated: animated,
result: result,
fromURL: fromURL,
innerURL: innerURL,
);
}
2 changes: 1 addition & 1 deletion example/lib/src/biz/biz1/flutter11/flutter11.state.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// ignore_for_file: avoid_as

Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/biz/biz1/flutter11/module.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand All @@ -12,7 +12,7 @@ class Module with ThrioModule, ModulePageBuilder {
String get key => 'flutter11';

@override
void onPageBuilderSetting(ModuleContext moduleContext) =>
void onPageBuilderSetting(final ModuleContext moduleContext) =>
pageBuilder = (settings) => Flutter11Page(
moduleContext: moduleContext,
settings: settings,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/biz/biz1/flutter3/flutter3.context.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 foxsofter.
// Copyright (c) 2024 foxsofter.
//
// Do not edit this file.
//
Expand Down
Loading

0 comments on commit c661837

Please sign in to comment.