Skip to content

Commit

Permalink
new name
Browse files Browse the repository at this point in the history
  • Loading branch information
haoran committed Dec 8, 2020
1 parent ce2dc1f commit d75a014
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .idea/code_gen.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/router_gen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library router_gen;
export 'src/annotation/router.dart';
export 'src/annotation/router_table.dart';
export 'src/annotation/router_args.dart';
export 'src/annotation/router_arg.dart';
4 changes: 2 additions & 2 deletions lib/src/annotation/router.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class PageRouter {
class Router {
final bool isIndex;
final String path;
const PageRouter({this.path = "",this.isIndex = false});
const Router({this.path = "",this.isIndex = false});
}
4 changes: 4 additions & 0 deletions lib/src/annotation/router_arg.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class RouterArg {
final bool required;
const RouterArg({this.required = false});
}
4 changes: 0 additions & 4 deletions lib/src/annotation/router_args.dart

This file was deleted.

4 changes: 2 additions & 2 deletions lib/src/generator/router_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:source_gen/source_gen.dart';

import '../annotation/router.dart';

class RouterGenerator extends GeneratorForAnnotation<PageRouter> {
class RouterGenerator extends GeneratorForAnnotation<Router> {
static RouterCollector collector = RouterCollector();

@override
Expand All @@ -31,7 +31,7 @@ class RouterGenerator extends GeneratorForAnnotation<PageRouter> {
for (FieldElement e in ((element as ClassElement).fields)) {
List<ElementAnnotation> fieldAnnotationList = e.metadata;
fieldAnnotationList.forEach((element) {
if(element.toString().startsWith("@RouterArgs")){
if(element.toString().startsWith("@RouterArg")){
Argument argument = Argument();
argument.isRequired = element.computeConstantValue().getField("required").toBoolValue();
argument.name = e.name;
Expand Down

0 comments on commit d75a014

Please sign in to comment.