Merge pull request #374 from alibaba/master

merge code
This commit is contained in:
hanxu317317
2019-09-19 14:23:42 +08:00
committed by GitHub
21 changed files with 331 additions and 57 deletions

19
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,19 @@
#### What does this PR do?
[TrelloCard/Issue/Story](LINK_TO_STORY)
##### Why are we doing this? Any context or related work?
#### Where should a reviewer start?
#### Manual testing steps?
#### Screenshots
---
#### Database changes
#### Deployment instructions
#### New ENV variables

View File

@ -0,0 +1,19 @@
#### What does this PR do?
[TrelloCard/Issue/Story](LINK_TO_STORY)
##### Why are we doing this? Any context or related work?
#### Where should a reviewer start?
#### Manual testing steps?
#### Screenshots
---
#### Database changes
#### Deployment instructions
#### New ENV variables

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at zhu.yan@alibaba-inc.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

1
CONTRIBUTING.md Normal file
View File

@ -0,0 +1 @@
[Flutter Go 共建](https://github.com/alibaba/flutter-go/blob/master/docs/contribute.md)

View File

@ -15,13 +15,9 @@ typedef void OnSubmit(String value);
///搜索结果内容显示面板
class MaterialSearchResult<T> extends StatelessWidget {
const MaterialSearchResult({
Key key,
this.value,
this.text,
this.icon,
this.onTap
}) : super(key: key);
const MaterialSearchResult(
{Key key, this.value, this.text, this.icon, this.onTap})
: super(key: key);
final String value;
final VoidCallback onTap;
@ -30,7 +26,6 @@ class MaterialSearchResult<T> extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new InkWell(
onTap: this.onTap,
child: new Container(
@ -38,8 +33,14 @@ class MaterialSearchResult<T> extends StatelessWidget {
padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0),
child: new Row(
children: <Widget>[
new Container(width: 30.0, margin: EdgeInsets.only(right: 10), child: new Icon(icon)) ?? null,
new Expanded(child: new Text(value, style: Theme.of(context).textTheme.subhead)),
new Container(
width: 30.0,
margin: EdgeInsets.only(right: 10),
child: new Icon(icon)) ??
null,
new Expanded(
child: new Text(value,
style: Theme.of(context).textTheme.subhead)),
new Text(text, style: Theme.of(context).textTheme.subhead)
],
),
@ -124,6 +125,7 @@ class _MaterialSearchState<T> extends State<MaterialSearch> {
}
Timer _resultsTimer;
Future _getResultsDebounced() async {
if (_results.length == 0) {
setState(() {
@ -164,6 +166,7 @@ class _MaterialSearchState<T> extends State<MaterialSearch> {
super.dispose();
_resultsTimer?.cancel();
}
Widget buildBody(List results) {
if (_criteria.isEmpty) {
return History();
@ -171,16 +174,11 @@ class _MaterialSearchState<T> extends State<MaterialSearch> {
return new Center(
child: new Padding(
padding: const EdgeInsets.only(top: 50.0),
child: new CircularProgressIndicator()
)
);
child: new CircularProgressIndicator()));
}
if (results.isNotEmpty) {
var content = new SingleChildScrollView(
child: new Column(
children: results
)
);
var content =
new SingleChildScrollView(child: new Column(children: results));
return content;
}
return Center(child: Text("暂无数据"));
@ -241,7 +239,7 @@ class _MaterialSearchState<T> extends State<MaterialSearch> {
],
),
body: buildBody(results),
);
);
}
}
@ -405,34 +403,35 @@ class SearchInput extends StatelessWidget {
}
// wigdet干掉.=> componets
class History extends StatefulWidget {
const History() : super();
@override
_History createState() => _History();
_History createState() => _History();
}
// AppBar 默认的实例,有状态
class _History extends State<History> {
SearchHistoryList searchHistoryList = new SearchHistoryList();
bool refreshFlag;
@override
void initState() {
super.initState();
this.refreshFlag = true;
}
@override
void dispose() {
super.dispose();
}
buildChips(BuildContext context) {
List<Widget> list = [];
List<SearchHistory> historyList = searchHistoryList.getList();
print("historyList> $historyList");
Color bgColor = Theme.of(context).primaryColor;
historyList.forEach((SearchHistory value) {
Widget icon = CircleAvatar(
backgroundColor: bgColor,
child: Text(
@ -445,20 +444,28 @@ class _History extends State<History> {
}
String targetRouter = value.targetRouter;
list.add(
InkWell(
onTap: () {
Application.router.navigateTo(context, "${targetRouter.toLowerCase()}", transition: TransitionType.inFromRight);
},
child: Chip(
avatar: icon,
label: Text("${value.name}"),
),
)
);
list.add(InkWell(
onTap: () {
Application.router.navigateTo(
context, "${targetRouter.toLowerCase()}",
transition: TransitionType.inFromRight);
},
child: Chip(
avatar: icon,
label: Text("${value.name}"),
),
));
});
return list;
}
_clearHistory() {
searchHistoryList.clear();
this.setState(() {
this.refreshFlag = !this.refreshFlag;
});
}
@override
Widget build(BuildContext context) {
List<Widget> childList = buildChips(context);
@ -470,25 +477,38 @@ class _History extends State<History> {
return Column(
children: <Widget>[
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.fromLTRB(12.0, 12, 12, 0),
child: InkWell(
onLongPress: () {
searchHistoryList.clear();
},
child: Text('历史搜索'),
),
),
alignment: Alignment.centerLeft,
padding: EdgeInsets.fromLTRB(12.0, 12, 12, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
onLongPress: () {
searchHistoryList.clear();
},
child: Text('历史搜索'),
),
GestureDetector(
onTap: _clearHistory,
child: Container(
child: new Icon(Icons.delete,
size: 24.0, color: Theme.of(context).accentColor),
width: 30,
height: 30,
),
)
],
)),
Container(
padding: EdgeInsets.only(left: 10),
alignment: Alignment.topLeft,
child: Wrap(
spacing: 6.0, // gap between adjacent chips
runSpacing: 0.0, // gap between lines
children: childList
),
spacing: 6.0, // gap between adjacent chips
runSpacing: 0.0, // gap between lines
children: childList),
)
],
);
}
}
}

View File

@ -185,7 +185,7 @@ class _WidgetDemoState extends State<WidgetDemo> {
new IconButton(
tooltip: 'goBack home',
onPressed: () {
Navigator.popUntil(context, ModalRoute.withName(Routes.home));
Navigator.popUntil(context, ModalRoute.withName(Routes.root));
},
icon: Icon(Icons.home),
),

View File

@ -203,6 +203,7 @@ void _startupJpush() async {
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final provider = new Provider();
await provider.init(true);
sp = await SpUtil.getInstance();

View File

@ -73,7 +73,7 @@ class SearchHistoryList {
}
add(SearchHistory item) {
print("_searchHistoryList> ${_searchHistoryList.length}");
print("add item to serach history ${item.targetRouter}");
for (SearchHistory value in _searchHistoryList) {
if (value.name == item.name) {
return;

View File

@ -1 +1 @@
[{"name":"demoName","screenShot":"","author":"yourName","email":"yourEmail","desc":"这是一个测试的标准demo","id":"1a29aa8e_32ae_4241_9c8a_5c9e1f92b096"},{"name":"local","screenShot":"","author":"ab","email":"email","desc":"ags","id":"2c1d57d0_42ae_4241_9c8a_5c9e1f92b096"}]
[{"name":"RangeSlider","screenShot":"","author":"RangeSlider","email":"hanxu317@qq.com","desc":"RangeSlider widget demo","id":"e5f958bc_52ae_4241_9c8a_5c9e1f92b096"},{"name":"demoName","screenShot":"","author":"yourName","email":"yourEmail","desc":"这是一个测试的标准demo","id":"1a29aa8e_32ae_4241_9c8a_5c9e1f92b096"},{"name":"local","screenShot":"","author":"ab","email":"email","desc":"ags","id":"2c1d57d0_42ae_4241_9c8a_5c9e1f92b096"}]

View File

@ -0,0 +1,8 @@
{
"name": "RangeSlider",
"screenShot": "",
"author":"RangeSlider",
"email": "hanxu317@qq.com",
"desc": "RangeSlider widget demo",
"id": "e5f958bc_52ae_4241_9c8a_5c9e1f92b096"
}

View File

@ -0,0 +1,15 @@
//
// Created with flutter go cli
// User: RangeSlider
// Time: 2019-09-12 15:11:05.512158
// email: hanxu317@qq.com
// desc: RangeSlider widget demo
//
import 'src/index.dart';
var demoWidgets = [
new Demo()
];

View File

@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
class Demo extends StatefulWidget {
@override
_State createState() => _State();
}
class _State extends State<Demo> {
RangeValues valuess = RangeValues(20.0, 50.0);
@override
Widget build(BuildContext context) {
return RangeSlider(
values: valuess,
//实际进度的位置
inactiveColor: Colors.black12,
//进度中不活动部分的颜色
labels: RangeLabels('12', '23'),
min: 0.0,
max: 100.0,
divisions: 1000,
activeColor: Colors.blue,
//进度中活动部分的颜色
onChanged: (rangeValues) {
setState(() {
valuess = rangeValues;
});
},
);
}
}

View File

@ -1,6 +1,8 @@
import 'RangeSlider_RangeSlider_e5f958bc_52ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardDemo_RangeSlider_e5f958bc_52ae_4241_9c8a_5c9e1f92b096;
import 'demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096;
import 'local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardDemo_local_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096;
var demoObjects = {
'e5f958bc_52ae_4241_9c8a_5c9e1f92b096': StandardDemo_RangeSlider_e5f958bc_52ae_4241_9c8a_5c9e1f92b096.demoWidgets,
'1a29aa8e_32ae_4241_9c8a_5c9e1f92b096': StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096.demoWidgets,
'2c1d57d0_42ae_4241_9c8a_5c9e1f92b096': StandardDemo_local_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096.demoWidgets
};

View File

@ -1 +1 @@
[{"name":"local","screenShot":"","author":"hnaxu","title":"本地","email":"hanxu@qq.com","desc":"desc","id":"5d7178d0_42ae_4241_9c8a_5c9e1f92b096"},{"name":"test","screenShot":"","author":"abc","title":"ya","email":"adsf.com","desc":"desc","id":"84f38e00_42ae_4241_9c8a_5c9e1f92b096"},{"name":"standard","screenShot":"","author":"sanfan","title":"介绍页","email":"hanxu317@qq.com","desc":"desc","id":"ee4feb8e_32ae_4241_9c8a_5c9e1f92b096"},{"name":"standard_for_slider","screenShot":"","author":"sanfan","title":"slider组件","email":"hanxu@qq.com","desc":"slider, new Slider","id":"8ab2b5c2_42ae_4241_9c8a_5c9e1f92b096"}]
[{"name":"local","screenShot":"","author":"hnaxu","title":"本地","email":"hanxu@qq.com","desc":"desc","id":"5d7178d0_42ae_4241_9c8a_5c9e1f92b096"},{"name":"test","screenShot":"","author":"abc","title":"ya","email":"adsf.com","desc":"desc","id":"84f38e00_42ae_4241_9c8a_5c9e1f92b096"},{"name":"standard","screenShot":"","author":"sanfan","title":"介绍页","email":"hanxu317@qq.com","desc":"desc","id":"ee4feb8e_32ae_4241_9c8a_5c9e1f92b096"},{"name":"standard_for_slider","screenShot":"","author":"sanfan","title":"slider组件","email":"hanxu@qq.com","desc":"slider, new Slider","id":"8ab2b5c2_42ae_4241_9c8a_5c9e1f92b096"},{"name":"RangeSlider","screenShot":"","author":"hanxu","title":"RangeSlider","email":"hanxu317@qq.com","desc":"RangeSlider widget","id":"cbffbf7c_52ae_4241_9c8a_5c9e1f92b096"}]

View File

@ -0,0 +1,10 @@
{
"name": "RangeSlider",
"screenShot": "",
"author":"hanxu",
"title":"RangeSlider",
"email": "hanxu317@qq.com",
"desc": "RangeSlider widget",
"id": "cbffbf7c_52ae_4241_9c8a_5c9e1f92b096"
}

View File

@ -0,0 +1,36 @@
String getMd() {
return """
# RangeSlider
> 用来选择范围性的数据
slider 用来选择连续性的或者非连续性的数据. 默认是在一段最大值最小值间做任意值的选择. 如果你想选择间隔性的值, 例如0.0到50.0间,选择10, 15,...50.0这样的值, 给divisions设定一个非空的整数5,, 去分割区间范围.
### **基本用法**
关于slider有以下的术语:
* **thumb** 滑块 用户可以水平拖拽移动的区域
* **track** 滑轨 thumb 可以滑动的线条区域
* **value indicator** 值指示器 当用户拖拽thumb的时候. 显示用户当前所选的属性值
* **active** 选中区
* **inactive** 非选中区
如果**onChanged**属性为空或者**min** .. **max**给出的范围 为空例如如果min等于max则将禁用滑块。
滑块小部件本身不保持任何状态State。相反当滑块状态发生变化时窗口小部件会调用 **onChanged** 回调。大多数使用滑块的小部件将侦听 **onChanged** 回调并使用新值重建滑块以更新滑块的视觉外观。要知道值何时开始更改,或何时更改,请设置可选回调**onChangeStart**或**onChangeEnd**。
默认情况下滑块将尽可能宽垂直居中。当给定无限制约束时它将尝试使轨道宽144像素每边有边距并垂直收缩。
### 实例展示
[demo:e5f958bc_52ae_4241_9c8a_5c9e1f92b096]""";
}

View File

@ -0,0 +1,30 @@
# RangeSlider
> 用来选择范围性的数据
slider 用来选择连续性的或者非连续性的数据. 默认是在一段最大值最小值间做任意值的选择. 如果你想选择间隔性的值, 例如0.0到50.0间,选择10, 15,...50.0这样的值, 给divisions设定一个非空的整数5,, 去分割区间范围.
### **基本用法**
关于slider有以下的术语:
* **thumb** 滑块 用户可以水平拖拽移动的区域
* **track** 滑轨 thumb 可以滑动的线条区域
* **value indicator** 值指示器 当用户拖拽thumb的时候. 显示用户当前所选的属性值
* **active** 选中区
* **inactive** 非选中区
如果**onChanged**属性为空或者**min** .. **max**给出的范围 为空例如如果min等于max则将禁用滑块。
滑块小部件本身不保持任何状态State。相反当滑块状态发生变化时窗口小部件会调用 **onChanged** 回调。大多数使用滑块的小部件将侦听 **onChanged** 回调并使用新值重建滑块以更新滑块的视觉外观。要知道值何时开始更改,或何时更改,请设置可选回调**onChangeStart**或**onChangeEnd**。
默认情况下滑块将尽可能宽垂直居中。当给定无限制约束时它将尝试使轨道宽144像素每边有边距并垂直收缩。
### 实例展示
[demo:e5f958bc_52ae_4241_9c8a_5c9e1f92b096]

View File

@ -3,6 +3,7 @@ import 'local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart' as Standard
import 'test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_test_84f38e00_42ae_4241_9c8a_5c9e1f92b096;
import 'standard_sanfan_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096;
import 'standard_for_slider_sanfan_8ab2b5c2_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_standard_for_slider_8ab2b5c2_42ae_4241_9c8a_5c9e1f92b096;
import 'RangeSlider_hanxu_cbffbf7c_52ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_RangeSlider_cbffbf7c_52ae_4241_9c8a_5c9e1f92b096;
class StandardPages {
Map<String, String> standardPages;
Map<String, String> getPages() {
@ -15,6 +16,8 @@ class StandardPages {
"ee4feb8e_32ae_4241_9c8a_5c9e1f92b096" : StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096.getMd()
,
"8ab2b5c2_42ae_4241_9c8a_5c9e1f92b096" : StandardPage_standard_for_slider_8ab2b5c2_42ae_4241_9c8a_5c9e1f92b096.getMd()
,
"cbffbf7c_52ae_4241_9c8a_5c9e1f92b096" : StandardPage_RangeSlider_cbffbf7c_52ae_4241_9c8a_5c9e1f92b096.getMd()
};
}
List<Map<String, String>> getLocalList() {
@ -27,6 +30,8 @@ class StandardPages {
{ "id": "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096", "name": "standard", "email": "hanxu317@qq.com", "author": "sanfan"}
,
{ "id": "8ab2b5c2_42ae_4241_9c8a_5c9e1f92b096", "name": "standard_for_slider", "email": "hanxu@qq.com", "author": "sanfan"}
,
{ "id": "cbffbf7c_52ae_4241_9c8a_5c9e1f92b096", "name": "RangeSlider", "email": "hanxu317@qq.com", "author": "hanxu"}
];
}

View File

@ -25,6 +25,8 @@ import 'package:flutter_go/model/search_history.dart';
import 'package:flutter_go/resources/widget_name_to_icon.dart';
import 'package:flutter_go/model/user_info.dart';
class AppPage extends StatefulWidget {
final UserInformation userInfo;
@ -96,10 +98,10 @@ class _MyHomePageState extends State<AppPage>
void onWidgetTap(WidgetPoint widgetPoint, BuildContext context) {
String targetName = widgetPoint.name;
searchHistoryList.add(
SearchHistory(name: targetName, targetRouter: widgetPoint.routerName));
print("searchHistoryList1 ${searchHistoryList.toString()}");
String targetRouter = widgetPoint.routerName;
searchHistoryList.add(
SearchHistory(name: targetName, targetRouter: targetRouter));
print("searchHistoryList1 ${searchHistoryList.toString()}");
Application.router.navigateTo(context, targetRouter.toLowerCase(),
transition: TransitionType.inFromRight);
}

View File

@ -137,7 +137,7 @@ class _LoginPageState extends State<LoginPage> {
if (value.isEmpty) {
return "登录名不可为空!";
}
return ' ';
return null;
},
onSaved: (value) {
setState(() {
@ -180,7 +180,7 @@ class _LoginPageState extends State<LoginPage> {
if (value == null || value.isEmpty) {
return "密码不可为空!";
}
return '';
return null;
},
onSaved: (value) {
setState(() {

View File

@ -34,7 +34,7 @@ const String _textFieldText2 = """### **进阶用法**
""";
class Demo extends StatefulWidget {
static const String routeName = 'elements/Form/Input/TextField';
static const String routeName = 'element/Form/Input/TextField';
@override
_DemoState createState() => _DemoState();