-
Notifications
You must be signed in to change notification settings - Fork 314
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
Showing
9 changed files
with
127 additions
and
5 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
example/assets/fair/lib_fair_widget_fairbinding_fair_binding_sample.fair.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
example/assets/fair/lib_fair_widget_fairbinding_fair_binding_sample.fair.json
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,39 @@ | ||
{ | ||
"className": "Scaffold", | ||
"na": { | ||
"appBar": { | ||
"className": "AppBar", | ||
"na": { | ||
"title": { | ||
"className": "Text", | ||
"pa": [ | ||
"FairBinding 注解演示" | ||
] | ||
} | ||
} | ||
}, | ||
"body": { | ||
"className": "Center", | ||
"na": { | ||
"child": { | ||
"className": "Column", | ||
"na": { | ||
"mainAxisAlignment": "#(MainAxisAlignment.center)", | ||
"children": [ | ||
{ | ||
"className": "Text", | ||
"pa": [ | ||
"Hello World!" | ||
] | ||
}, | ||
{ | ||
"className": "FairBindingWidget" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"methodMap": {} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
29 changes: 29 additions & 0 deletions
29
example/lib/fair_widget/fairbinding/fair_binding_sample.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,29 @@ | ||
import 'package:example/fair_widget/fairbinding/fair_binding_widget.dart'; | ||
import 'package:fair/fair.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
@FairPatch() | ||
class FairBindingSample extends StatelessWidget { | ||
const FairBindingSample({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('FairBinding 注解演示'), | ||
), | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
const Text( | ||
'Hello World!', | ||
), | ||
// 引用本地自定义的 FairBindingWidget | ||
FairBindingWidget(), | ||
], | ||
), | ||
) | ||
); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
example/lib/fair_widget/fairbinding/fair_binding_widget.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,22 @@ | ||
import 'package:fair/fair.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
/// 本地自定义的 Widget。 | ||
class FairBindingWidget extends StatefulWidget { | ||
const FairBindingWidget({Key? key}) : super(key: key); | ||
|
||
@override | ||
_FairBindingWidgetState createState() => _FairBindingWidgetState(); | ||
} | ||
|
||
class _FairBindingWidgetState extends State<FairBindingWidget> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
child: Padding( | ||
padding: EdgeInsets.all(15), | ||
child: Text('我是一个本地自定义 Widget'), | ||
), | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Generated by Fair on 2022-05-31 13:02:55.553046. | ||
import 'package:example/fair_widget/fairbinding/fair_binding_widget.dart'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:fair/fair.dart'; | ||
import 'package:fair_version/fair_version.dart'; | ||
|
||
class AppGeneratedModule extends GeneratedModule { | ||
@override | ||
Map<String, dynamic> components() { | ||
return { | ||
'FairBindingWidget': (props) => FairBindingWidget( | ||
key: props['key'], | ||
), | ||
}; | ||
} | ||
|
||
@override | ||
Map<String, bool> mapping() { | ||
return const { | ||
'FairBindingWidget': true, | ||
}; | ||
} | ||
} |