mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-03 14:09:04 +08:00
46
README.md
46
README.md
@ -1,9 +1,37 @@
|
||||
# Flutter Go
|
||||
Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.md) | [中文简体](https://github.com/alibaba/flutter-go/blob/master/README.md)
|
||||
## Flutter Go
|
||||
|
||||

|
||||
|
||||
> 帮助开发者快速上手 Flutter **Flutter Go 1.0 Android版已正式发布**
|
||||
> 一个帮助开发者快速上手的 `APP`
|
||||
|
||||
## 最新动态
|
||||
### 🔥 `Flutter Go 2.0` 即将发布
|
||||
> Flutter Go 2.0 秉承年初发布的 [The Flutter-Go Roadmap(路线图) for 2019](https://github.com/alibaba/flutter-go#the-flutter-go-roadmap%E8%B7%AF%E7%BA%BF%E5%9B%BE-for-2019) 已经做了新版本的迭代,新版本如下新功能:
|
||||
|
||||
<h6>注:✔是本次发布内容</h6>
|
||||
|
||||
- [x] [ `Flutter Go` 官方网站 ](https://flutter-go.pub/website/) (官方消息,发布,学习)
|
||||
- [x] [ `Flutter Go web` 版本](https://github.com/alibaba/flutter-go/tree/web/flutter-go-web-0.0.1) (web 版本学习帮助)
|
||||
- [线上预览版 ](https://flutter-go.pub/flutter_go_web/)
|
||||
- [项目地址 ](https://github.com/alibaba/flutter-go/tree/web/flutter-go-web-0.0.1)
|
||||
|
||||
- [x] [ `Flutter Go Widget` 的 `pull request` 提交规范(第三方共建)](https://github.com/alibaba/flutter-go/blob/master/docs/contribute.md)
|
||||
|
||||
- [x] 用户中心 (专属个人的`widget`案例)
|
||||
- 用户登录(通过`GitHub`账户)
|
||||
- 全网搜索 (全网搜索 `Flutter` 资讯)
|
||||
- 收藏个人组件(保存到远端)
|
||||
- 反馈建议 (APP 在线 `ISSUES`)
|
||||
- 分享链接 (APP分享)
|
||||
- [x] [ `go-cli` 工具 ](https://github.com/alibaba/flutter-go/blob/master/docs/widget.md)
|
||||
- `Flutter Go` 的 `pull request` 工具
|
||||
- [命令行 生成 `Flutter Go Widget` 标准公共模版](https://github.com/alibaba/flutter-go/blob/beta/docs/widget.md)
|
||||
- `markdown` 模版动态化生成(合并到master分支后)
|
||||
- [x] ` Flutter Go ` 官方 `APP` 版本自动升级
|
||||
- [ ] 多端模版同步( pc端,native端同步 )
|
||||
- [ ] `Flutter Go` store
|
||||
|
||||
|
||||
|
||||
## 三方共建说明
|
||||
@ -52,6 +80,7 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.
|
||||
### android正式版,下载地址:
|
||||
|
||||
- 华为市场已上线,华为应用市场搜索 "Fluttergo"或者直接[点击下载](https://appstore.huawei.com/search/fluttergo)
|
||||
- [直接 apk 文件下载](https://github.com/alibaba/flutter-go/releases/download/0.0.5/app-release.apk)
|
||||
<img src="https://img.alicdn.com/tfs/TB1LbEYarys3KVjSZFnXXXFzpXa-378-380.jpg" width=200>
|
||||
|
||||
### iphone正式版,下载地址:
|
||||
@ -63,8 +92,17 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.
|
||||
## 基础环境
|
||||
本项目环境持续更新. 请定期更新各依赖包.
|
||||
|
||||
- dart(version: 2.0.0)
|
||||
- flutter(version: v1.0.0)
|
||||
```dart
|
||||
// 运行如下命令
|
||||
flutter --version
|
||||
dart --version
|
||||
pub --version
|
||||
|
||||
// 正确环境如下
|
||||
// Flutter (Channel beta, v1.7.8)
|
||||
// Dart VM version: 2.4.0
|
||||
// Pub 2.4.0
|
||||
```
|
||||
|
||||
|
||||
### 背景
|
||||
|
@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 3:20 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget: FlatButton 的示例
|
||||
*/
|
||||
import 'dart:async';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'dart:convert';
|
||||
import './search_result.dart';
|
||||
import 'package:html/parser.dart' show parse;
|
||||
|
||||
var dio = new Dio();
|
||||
class Api {
|
||||
Future<List<SearchResult>> search(name) async {
|
||||
print('=========>>>');
|
||||
var response = await dio.get("https://www.so.com/s?ie=utf-8&q=$name");
|
||||
// var document = parse(response.data);
|
||||
// var app = document.querySelectorAll('.res-title a');
|
||||
List<SearchResult> res = [];
|
||||
// app.forEach((f) {
|
||||
// res.add(
|
||||
// SearchResult(
|
||||
// title: f.text,
|
||||
// source: f.attributes["data-url"] ?? f.attributes["href"],
|
||||
// ),
|
||||
// );
|
||||
// });
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Api api = Api();
|
@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 7:17 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget:
|
||||
*/
|
||||
import 'dart:async';
|
||||
import 'package:bloc/bloc.dart';
|
||||
|
||||
import './search_event.dart';
|
||||
import './search_state.dart';
|
||||
import './search_api.dart';
|
||||
|
||||
|
||||
/// 这里导入api类与上面的SearchEvent与SearchState文件
|
||||
|
||||
class SearchBloc extends Bloc<SearchEvent, SearchState> {
|
||||
@override
|
||||
SearchState get initialState => SearchUninitialized();
|
||||
|
||||
@override
|
||||
Stream<SearchState> mapEventToState(SearchEvent event,) async* {
|
||||
if (event is SearchFetch) {
|
||||
try {
|
||||
yield SearchLoading();
|
||||
final res = await api.search(event.query);
|
||||
yield SearchLoaded(res: res);
|
||||
} catch (_) {
|
||||
yield SearchError();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 7:18 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget:
|
||||
*/
|
||||
abstract class SearchEvent {}
|
||||
|
||||
class SearchFetch extends SearchEvent {
|
||||
final String query;
|
||||
|
||||
SearchFetch({this.query});
|
||||
|
||||
@override
|
||||
String toString() => 'SearchFetch:获取搜索结果事件';
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 7:11 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget:
|
||||
*/
|
||||
class SearchResult {
|
||||
String title;
|
||||
String source;
|
||||
|
||||
SearchResult({this.title, this.source});
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 7:13 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget:
|
||||
*/
|
||||
import './search_result.dart';
|
||||
|
||||
abstract class SearchState {}
|
||||
|
||||
class SearchError extends SearchState {
|
||||
@override
|
||||
String toString() => 'SearchError:获取失败';
|
||||
}
|
||||
|
||||
class SearchUninitialized extends SearchState {
|
||||
@override
|
||||
String toString() => 'SearchUninitialized:未初始化';
|
||||
}
|
||||
|
||||
class SearchLoading extends SearchState {
|
||||
@override
|
||||
String toString() => 'SearchLoading :正在加载';
|
||||
}
|
||||
|
||||
class SearchLoaded extends SearchState {
|
||||
final List<SearchResult> res;
|
||||
|
||||
SearchLoaded({
|
||||
this.res,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() => 'SearchLoaded:加载完毕';
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 7:19 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget:
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
//import 'package:suiyi/blocs/search/bloc.dart';
|
||||
import './search_event.dart';
|
||||
import './search_state.dart';
|
||||
import './search_bloc.dart';
|
||||
|
||||
|
||||
class SearchWidget extends StatefulWidget {
|
||||
final SearchDelegate delegate;
|
||||
final String query;
|
||||
SearchWidget({this.delegate, this.query});
|
||||
@override
|
||||
_SearchWidgetState createState() => _SearchWidgetState();
|
||||
}
|
||||
|
||||
class _SearchWidgetState extends State<SearchWidget> {
|
||||
final SearchBloc _search = SearchBloc();
|
||||
String old;
|
||||
@override
|
||||
void dispose() {
|
||||
_search.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print('1:${old}');
|
||||
print('2:${widget.query}');
|
||||
if (old != widget.query) {
|
||||
_search.dispatch(SearchFetch(query: widget.query));
|
||||
old = widget.query;
|
||||
}
|
||||
return BlocBuilder(
|
||||
bloc: _search,
|
||||
builder: (BuildContext context, SearchState state) {
|
||||
print('-------${state}');
|
||||
if (state is SearchUninitialized || state is SearchLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
} else if (state is SearchError) {
|
||||
return Center(
|
||||
child: Text('获取失败'),
|
||||
);
|
||||
} else if (state is SearchLoaded) {
|
||||
return ListView.builder(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
dense: true,
|
||||
leading: Icon(
|
||||
Icons.bookmark_border,
|
||||
size: 32,
|
||||
),
|
||||
title: Text(
|
||||
state.res[index].title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(state.res[index].source),
|
||||
onTap: () {
|
||||
// 在这里对选中的结果进行解析,因为我目前是用golang实现的,所以就没贴代码了。
|
||||
print(state.res[index].source);
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount: state.res.length,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -1,16 +1,14 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 3:20 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget: FlatButton 的示例
|
||||
*/
|
||||
//
|
||||
// Created with Android Studio.
|
||||
// User: 一晟
|
||||
// Date: 2019/4/28
|
||||
// Time: 3:20 PM
|
||||
// email: zhu.yan@alibaba-inc.com
|
||||
// tartget: FlatButton 的示例
|
||||
//
|
||||
import 'dart:async';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:html/parser.dart' show parse;
|
||||
import './industry_model.dart';
|
||||
import './search_result.dart';
|
||||
|
||||
var dio = new Dio();
|
||||
|
@ -23,7 +23,7 @@ class SuggestionBloc extends Bloc<SuggestionEvent, SuggestionState> {
|
||||
try {
|
||||
yield SuggestionLoading();
|
||||
final res = await api.suggestion(event.query);
|
||||
print('res====>${res}');
|
||||
// print('res====>${res}');
|
||||
yield SuggestionLoaded(res: res);
|
||||
} catch (_) {
|
||||
yield SuggestionError();
|
||||
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 3:35 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
*/
|
||||
///
|
||||
/// Created with Android Studio.
|
||||
/// User: 一晟
|
||||
/// Date: 2019/4/28
|
||||
/// Time: 3:35 PM
|
||||
/// email: zhu.yan@alibaba-inc.com
|
||||
///
|
||||
abstract class SuggestionEvent {}
|
||||
|
||||
class SuggestionFetch extends SuggestionEvent {
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 3:52 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
*/
|
||||
///
|
||||
/// Created with Android Studio.
|
||||
/// User: 一晟
|
||||
/// Date: 2019/4/28
|
||||
/// Time: 3:52 PM
|
||||
/// email: zhu.yan@alibaba-inc.com
|
||||
///
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import './industry_bloc.dart';
|
||||
import './industry_event.dart';
|
||||
/// import './industry_event.dart';
|
||||
import './industry_state.dart';
|
||||
|
||||
final SuggestionBloc suggestion = SuggestionBloc();
|
||||
@ -22,47 +22,46 @@ class IndustryPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _IndustryState extends State<IndustryPage> {
|
||||
Widget renderItem(state) {
|
||||
if (state is SuggestionUninitialized) {
|
||||
return Center(
|
||||
child: Text('暂无内容'),
|
||||
);
|
||||
} else if (state is SuggestionLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
} else if (state is SuggestionError) {
|
||||
return Center(
|
||||
child: Text('出现错误'),
|
||||
);
|
||||
} else if (state is SuggestionLoaded) {
|
||||
if (state.res.length == 0) {
|
||||
return Center(
|
||||
child: Text('没有适合的结果,更换查询条件试试'),
|
||||
);
|
||||
}else {
|
||||
if (widget.itemTitle is Function) {
|
||||
return widget.itemTitle(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Center(
|
||||
child: Text('没有适合的结果,更换查询条件试试')
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
child: Column(
|
||||
children: [
|
||||
// TextField(
|
||||
// autofocus: true,
|
||||
// textAlign: TextAlign.center,
|
||||
// onSubmitted: (text) {
|
||||
// print('onSubmitted:${text}');
|
||||
// suggestion.dispatch(SuggestionFetch(query: text));
|
||||
// },
|
||||
// ),
|
||||
Expanded(
|
||||
child: BlocBuilder(
|
||||
bloc: suggestion,
|
||||
builder: (BuildContext context, SuggestionState state) {
|
||||
print('BlocBuilder----${state}');
|
||||
if (state is SuggestionUninitialized) {
|
||||
return Center(
|
||||
child: Text('暂无内容'),
|
||||
);
|
||||
} else if (state is SuggestionLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
} else if (state is SuggestionError) {
|
||||
return Center(
|
||||
child: Text('出现错误'),
|
||||
);
|
||||
} else if (state is SuggestionLoaded) {
|
||||
if (state.res.length == 0) {
|
||||
return Center(
|
||||
child: Text('没有适合的结果,更换查询条件试试'),
|
||||
);
|
||||
}else {
|
||||
if (widget.itemTitle is Function) {
|
||||
return widget.itemTitle(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
builder: (BuildContext context, SuggestionState state){
|
||||
/// print('BlocBuilder----${state}');
|
||||
return renderItem(state);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 3:19 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
*/
|
||||
///
|
||||
/// Created with Android Studio.
|
||||
/// User: 一晟
|
||||
/// Date: 2019/4/28
|
||||
/// Time: 3:19 PM
|
||||
/// email: zhu.yan@alibaba-inc.com
|
||||
///
|
||||
class Suggestion {
|
||||
String query;
|
||||
List<Suggestions> suggestions;
|
||||
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 3:37 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
*/
|
||||
///
|
||||
/// Created with Android Studio.
|
||||
/// User: 一晟
|
||||
/// Date: 2019/4/28
|
||||
/// Time: 3:37 PM
|
||||
/// email: zhu.yan@alibaba-inc.com
|
||||
///
|
||||
abstract class SuggestionState {}
|
||||
|
||||
class SuggestionError extends SuggestionState {
|
||||
|
@ -1,11 +1,11 @@
|
||||
/**
|
||||
* Created with Android Studio.
|
||||
* User: 一晟
|
||||
* Date: 2019/4/28
|
||||
* Time: 7:11 PM
|
||||
* email: zhu.yan@alibaba-inc.com
|
||||
* tartget:
|
||||
*/
|
||||
///
|
||||
/// Created with Android Studio.
|
||||
/// User: 一晟
|
||||
/// Date: 2019/4/28
|
||||
/// Time: 7:11 PM
|
||||
/// email: zhu.yan@alibaba-inc.com
|
||||
/// tartget:
|
||||
///
|
||||
class SearchResult {
|
||||
String title;
|
||||
String source;
|
||||
|
@ -3,7 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../routers/application.dart';
|
||||
import '../model/cat.dart';
|
||||
/// import '../model/cat.dart';
|
||||
import '../model/widget.dart';
|
||||
import '../widgets/index.dart';
|
||||
import '../components/widget_item_container.dart';
|
||||
@ -65,7 +65,7 @@ class _CategoryHome extends State<CategoryHome> {
|
||||
}
|
||||
|
||||
void searchCatOrWidget() async {
|
||||
CommonItem widgetTree = Application.widgetTree;
|
||||
/// CommonItem widgetTree = Application.widgetTree;
|
||||
// 假设进入这个界面的parent一定存在
|
||||
CommonItem targetGroup = catHistory.last;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import 'package:flutter_go/utils/data_utils.dart';
|
||||
import '../routers/application.dart';
|
||||
import '../routers/routers.dart';
|
||||
import '../components/markdown.dart';
|
||||
import '../model/collection.dart';
|
||||
/// import '../model/collection.dart';
|
||||
import '../widgets/index.dart';
|
||||
import '../event/event_bus.dart';
|
||||
import '../event/event_model.dart';
|
||||
@ -35,7 +35,7 @@ class WidgetDemo extends StatefulWidget {
|
||||
|
||||
class _WidgetDemoState extends State<WidgetDemo> {
|
||||
bool _hasCollected = false;
|
||||
CollectionControlModel _collectionControl = new CollectionControlModel();
|
||||
/// CollectionControlModel _collectionControl = new CollectionControlModel();
|
||||
var _collectionIcons;
|
||||
List widgetDemosList = new WidgetDemoList().getDemos();
|
||||
String widgetType = 'old';
|
||||
|
@ -86,7 +86,8 @@ class WidgetItemContainer extends StatelessWidget {
|
||||
index: addI,
|
||||
totalCount: length,
|
||||
rowLength: columnCount,
|
||||
textSize: true ? 'middle' : 'small',
|
||||
/// textSize: true ? 'middle' : 'small',
|
||||
textSize: 'middle'
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -56,9 +56,13 @@ class _MyAppState extends State<MyApp> {
|
||||
var response;
|
||||
try{
|
||||
response = await NetUtils.get(reqs, {});
|
||||
print('response-${response}');
|
||||
print('response-$response');
|
||||
if(response['status'] == 200 && response['success'] ==true && response['data'] is Map && response['data']['isOpen'] == true) {
|
||||
Application.pageIsOpen = true;
|
||||
print('是否需要展开【业界动态】${Application.pageIsOpen}');
|
||||
}
|
||||
}catch(e){
|
||||
print('response-${e}');
|
||||
print('response-$e');
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@ -66,6 +70,7 @@ class _MyAppState extends State<MyApp> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_reqsMainPageIsOpen();
|
||||
_startupJpush();
|
||||
|
||||
FlutterJPush.addConnectionChangeListener((bool connected) {
|
||||
@ -85,7 +90,6 @@ class _MyAppState extends State<MyApp> {
|
||||
} catch (error) {
|
||||
print('主动获取设备号Error:$error');
|
||||
}
|
||||
;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -143,15 +147,6 @@ class _MyAppState extends State<MyApp> {
|
||||
print('身份信息验证失败:$onError');
|
||||
});
|
||||
|
||||
/// 服务端控制是否显示业界动态
|
||||
_reqsMainPageIsOpen().then((res){
|
||||
//{status: 200, data: {isOpen: true}, success: true}
|
||||
if(res['status'] == 200 && res['success'] ==true && res['data'] is Map && res['data']['isOpen'] == true) {
|
||||
Application.pageIsOpen = true;
|
||||
print('是否需要展开【业界动态】${Application.pageIsOpen}');
|
||||
}
|
||||
});
|
||||
|
||||
ApplicationEvent.event.on<UserSettingThemeColorEvent>().listen((event) {
|
||||
print('接收到的 event $event');
|
||||
});
|
||||
|
@ -162,7 +162,7 @@ abstract class CommonItem<T> {
|
||||
///
|
||||
CommonItem parent;
|
||||
String toString() {
|
||||
return "CommonItem {name: $name, type: $type, parentId: $parentId, token: $token, children长度 ${children}";
|
||||
return "CommonItem {name: $name, type: $type, parentId: $parentId, token: $token, children长度 $children";
|
||||
}
|
||||
|
||||
T getChild(String token);
|
||||
@ -361,7 +361,7 @@ class WidgetTree {
|
||||
print("getCommonItemByPath $path");
|
||||
print("root $root");
|
||||
CommonItem childLeaf;
|
||||
int first = path.first;
|
||||
/// int first = path.first;
|
||||
path = path.sublist(1);
|
||||
print("path:::: $path");
|
||||
if (path.length >= 0) {
|
||||
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_go/utils/analytics.dart' show analytics;
|
||||
import '../widgets/index.dart';
|
||||
import './router_handler.dart';
|
||||
import '../standard_pages/index.dart';
|
||||
/// import '../standard_pages/index.dart';
|
||||
class Routes {
|
||||
static String root = "/";
|
||||
static String home = "/home";
|
||||
@ -20,9 +20,10 @@ class Routes {
|
||||
|
||||
static void configureRoutes(Router router) {
|
||||
List widgetDemosList = new WidgetDemoList().getDemos();
|
||||
router.notFoundHandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
});
|
||||
// router.notFoundHandler = new Handler(
|
||||
// handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
// }
|
||||
// );
|
||||
router.define(home, handler: homeHandler);
|
||||
router.define(collectionPage,handler:collectionHandler);
|
||||
router.define(collectionFullPage,handler:collectionFullHandler);
|
||||
@ -32,19 +33,19 @@ class Routes {
|
||||
router.define(codeView,handler:fullScreenCodeDialog);
|
||||
router.define(githubCodeView,handler:githubCodeDialog);
|
||||
router.define(webViewPage,handler:webViewPageHand);
|
||||
router.define(issuesMessage, handler: issuesMessageHandler);
|
||||
widgetDemosList.forEach((demo) {
|
||||
Handler handler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
print('组件路由params=$params widgetsItem=${demo.routerName}');
|
||||
analytics.logEvent(
|
||||
name: 'component', parameters: {'name': demo.routerName });
|
||||
return demo.buildRouter(context);
|
||||
});
|
||||
router.define(issuesMessage, handler: issuesMessageHandler);
|
||||
router.define(standardPage,handler:standardPageHandler);
|
||||
widgetDemosList.forEach((demo) {
|
||||
Handler handler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
print('组件路由params=$params widgetsItem=${demo.routerName}');
|
||||
analytics.logEvent(
|
||||
name: 'component', parameters: {'name': demo.routerName });
|
||||
return demo.buildRouter(context);
|
||||
});
|
||||
String path = demo.routerName;
|
||||
router.define('${path.toLowerCase()}', handler: handler);
|
||||
});
|
||||
router.define(standardPage,handler:standardPageHandler);
|
||||
// router.define(webViewPage,handler:webViewPageHand);
|
||||
// standardPages.forEach((String id, String md) => {
|
||||
//
|
||||
|
@ -5,7 +5,7 @@ import 'package:flutter_go/model/collection.dart';
|
||||
import 'package:flutter_go/model/version.dart';
|
||||
import 'package:flutter_go/model/widget.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:flutter_go/model/responseData.dart';
|
||||
/// import 'package:flutter_go/model/responseData.dart';
|
||||
|
||||
import './net_utils.dart';
|
||||
import '../model/user_info.dart';
|
||||
@ -117,6 +117,7 @@ class DataUtils {
|
||||
}
|
||||
} catch (error) {
|
||||
print('获取组件树 error $error');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +129,7 @@ class DataUtils {
|
||||
return response != null && response['hasCollected'];
|
||||
} catch (error) {
|
||||
print('校验收藏 error $error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ class _CollectionFullPageState extends State<CollectionFullPage> {
|
||||
ApplicationEvent.event = eventBus;
|
||||
}
|
||||
|
||||
CollectionControlModel _collectionControl = new CollectionControlModel();
|
||||
/// CollectionControlModel _collectionControl = new CollectionControlModel();
|
||||
List<Collection> _collectionList = [];
|
||||
ScrollController _scrollController = new ScrollController();
|
||||
var _icons;
|
||||
|
@ -11,7 +11,7 @@ import 'package:flutter_go/routers/application.dart';
|
||||
import 'package:flutter_go/routers/routers.dart';
|
||||
import 'package:flutter_go/event/event_bus.dart';
|
||||
import 'package:flutter_go/event/event_model.dart';
|
||||
import 'package:flutter_go/utils/data_utils.dart';
|
||||
/// import 'package:flutter_go/utils/data_utils.dart';
|
||||
|
||||
class CollectionPage extends StatefulWidget {
|
||||
final bool hasLogined;
|
||||
@ -26,7 +26,7 @@ class _CollectionPageState extends State<CollectionPage> {
|
||||
final eventBus = new EventBus();
|
||||
ApplicationEvent.event = eventBus;
|
||||
}
|
||||
CollectionControlModel _collectionControl = new CollectionControlModel();
|
||||
/// CollectionControlModel _collectionControl = new CollectionControlModel();
|
||||
List<Collection> _collectionList = [];
|
||||
ScrollController _scrollController = new ScrollController();
|
||||
var _icons;
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_go/views/first_page/drawer_page.dart';
|
||||
import './first_page.dart';
|
||||
import './sub_page.dart';
|
||||
/// import './sub_page.dart';
|
||||
import './main_app_bar.dart';
|
||||
import './search_page.dart';
|
||||
import 'package:flutter_go/model/user_info.dart';
|
||||
|
@ -87,15 +87,17 @@ class SearchBarPage extends StatefulWidget{
|
||||
|
||||
final TextEditingController controller = TextEditingController();
|
||||
var that;
|
||||
var loading;
|
||||
class _SearchBarPageState extends State<SearchBarPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
that = this;
|
||||
loading = false;
|
||||
}
|
||||
|
||||
Timer _resultsTimer;
|
||||
bool _loading = false;
|
||||
|
||||
String oldKey;
|
||||
/// 防抖函数
|
||||
Future getResultsDebounced(String text) async {
|
||||
@ -106,12 +108,12 @@ class _SearchBarPageState extends State<SearchBarPage> {
|
||||
if (text == '' || !mounted) {
|
||||
return;
|
||||
}
|
||||
_loading = true;
|
||||
loading = true;
|
||||
if (_resultsTimer != null && _resultsTimer.isActive) {
|
||||
_resultsTimer.cancel();
|
||||
}
|
||||
_resultsTimer = new Timer(new Duration(milliseconds: 400), () async {
|
||||
_loading = true;
|
||||
loading = true;
|
||||
if(mounted){
|
||||
suggestion.dispatch(SuggestionFetch(query: text));
|
||||
}
|
||||
@ -121,7 +123,7 @@ class _SearchBarPageState extends State<SearchBarPage> {
|
||||
|
||||
|
||||
void onSearchTextChanged(String text){
|
||||
print('onSearchTextChanged:${text}');
|
||||
print('onSearchTextChanged:$text');
|
||||
//suggestion.dispatch(SuggestionFetch(query: text));
|
||||
getResultsDebounced(text);
|
||||
}
|
||||
|
@ -6,20 +6,20 @@
|
||||
/// target: app首页
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
/// import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_go/utils/data_utils.dart';
|
||||
import 'package:flutter_go/utils/shared_preferences.dart';
|
||||
import 'package:flutter_go/views/first_page/first_page.dart';
|
||||
/// import 'package:flutter_go/views/first_page/first_page.dart';
|
||||
import 'package:flutter_go/views/first_page/main_page.dart';
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter_go/views/user_page/user_page.dart';
|
||||
import 'package:flutter_go/views/widget_page/widget_page.dart';
|
||||
import 'package:flutter_go/views/welcome_page/fourth_page.dart';
|
||||
import 'package:flutter_go/views/collection_page/collection_page.dart';
|
||||
/// import 'package:flutter_go/views/collection_page/collection_page.dart';
|
||||
import 'package:flutter_go/routers/application.dart';
|
||||
import 'package:flutter_go/utils/provider.dart';
|
||||
/// import 'package:flutter_go/utils/provider.dart';
|
||||
import 'package:flutter_go/model/widget.dart';
|
||||
import 'package:flutter_go/widgets/index.dart';
|
||||
/// import 'package:flutter_go/widgets/index.dart';
|
||||
import 'package:flutter_go/components/search_input.dart';
|
||||
import 'package:flutter_go/model/search_history.dart';
|
||||
import 'package:flutter_go/resources/widget_name_to_icon.dart';
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
|
||||
/// import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:zefyr/zefyr.dart';
|
||||
|
@ -137,6 +137,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||
if (value.isEmpty) {
|
||||
return "登录名不可为空!";
|
||||
}
|
||||
return ' ';
|
||||
},
|
||||
onSaved: (value) {
|
||||
setState(() {
|
||||
@ -179,6 +180,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "密码不可为空!";
|
||||
}
|
||||
return '';
|
||||
},
|
||||
onSaved: (value) {
|
||||
setState(() {
|
||||
|
@ -48,9 +48,10 @@ class _StandardView extends State<StandardView> {
|
||||
super.initState();
|
||||
this.getPageInfo();
|
||||
}
|
||||
didChangeDependencies() {
|
||||
print("didChangeDependencies");
|
||||
}
|
||||
|
||||
// didChangeDependencies() {
|
||||
// print("didChangeDependencies");
|
||||
// }
|
||||
/// 本地调用的获取文章属性的基本信息
|
||||
Future<void> localGetPagesAttrsInfo() async {
|
||||
String jsonString = await DefaultAssetBundle.of(context).loadString('lib/standard_pages/.pages.json');
|
||||
|
@ -27,6 +27,7 @@ class _ScrollMetricsDemoState extends State<ScrollMetricsDemo> {
|
||||
});
|
||||
print("BottomEdge: ${notification.metrics.extentAfter == 0}");
|
||||
//return true; //放开此行注释后,进度条将失效
|
||||
return false;
|
||||
},
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
|
@ -24,6 +24,7 @@ class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> {
|
||||
setState(() {
|
||||
_currentPage = _pageController.page;
|
||||
});
|
||||
return false;
|
||||
},
|
||||
child: PageView.custom(
|
||||
physics: const PageScrollPhysics(
|
||||
|
@ -95,16 +95,16 @@ class _CupertinoAppFullDefault extends State {
|
||||
],
|
||||
onGenerateRoute: (setting) {
|
||||
// 当通过Navigation.of(context).pushNamed跳转路由时,在routes查找不到时,会调用该方法
|
||||
routerHandler(setting);
|
||||
return routerHandler(setting);
|
||||
},
|
||||
onGenerateTitle: (context) {
|
||||
// 跟上面的tiitle一样,但含有一个context参数用于做本地化
|
||||
return 'Flutter应用';
|
||||
},
|
||||
onUnknownRoute: (setting) {
|
||||
// 效果跟onGenerateRoute一样调用顺序为onGenerateRoute ==> onUnknownRoute
|
||||
//RouterHandler(setting);
|
||||
},
|
||||
// onUnknownRoute: (setting) {
|
||||
// // 效果跟onGenerateRoute一样调用顺序为onGenerateRoute ==> onUnknownRoute
|
||||
// //RouterHandler(setting);
|
||||
// },
|
||||
routes: {
|
||||
// 声明程序中有哪个通过Navigation.of(context).pushNamed跳转的路由参数以键值对的形式传递key:路由名字value:对应的Widget
|
||||
'/home': (BuildContext context) => HomePage(),
|
||||
|
@ -29,8 +29,9 @@ class _Demo extends State<CupertinoSliverNavigationBarDemo> {
|
||||
trailing: Icon(Icons.perm_camera_mic)
|
||||
),
|
||||
CupertinoSliverRefreshControl(
|
||||
onRefresh: () {
|
||||
},
|
||||
// onRefresh: () {
|
||||
//
|
||||
// },
|
||||
),
|
||||
SliverSafeArea(
|
||||
top: false, // Top safe area is consumed by the navigation bar.
|
||||
|
Reference in New Issue
Block a user