Merge branch 'develop' of github.com:alibaba/flutter-common-widgets-app into web

This commit is contained in:
sanfan.hx
2019-06-15 16:58:22 +08:00
48 changed files with 286 additions and 107 deletions

BIN
FlutterGo.apk Normal file

Binary file not shown.

View File

@ -23,14 +23,19 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.
<img src="https://img.alicdn.com/tfs/TB19UahQQzoK1RjSZFlXXai4VXa-1500-1106.png" width="600px">
## Release安装包下载地址
android下载地址:
### android正式版,下载地址:
<img src="https://img.alicdn.com/tfs/TB1ylxGTMHqK1RjSZFgXXa7JXXa-436-432.png" width="200px">
- 华为市场已上线,华为应用市场搜索 "Fluttergo"或者直接[点击下载](https://appstore.huawei.com/search/fluttergo)
<img src="https://img.alicdn.com/tfs/TB1LbEYarys3KVjSZFnXXXFzpXa-378-380.jpg" width=200>
### iphone正式版下载地址:
- AppStore 搜索 "Fluttego" 或者直接[点击下载](https://itunes.apple.com/cn/app/flutter-go/id1462026296?mt=8)
<img src="https://img.alicdn.com/tfs/TB1PygPaBWD3KVjSZFsXXcqkpXa-380-376.jpg" width=200>
iphone下载地址:
暂无
## 基础环境
本项目环境持续更新. 请定期更新各依赖包.

Binary file not shown.

View File

@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"0.0.5","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.6","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

View File

@ -10,10 +10,11 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MODE_WORLD_READABLE"/>
<uses-permission android:name="android.permission.MODE_WORLD_WRITEABLE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="fluttergo"
android:label="FlutterGo"
android:icon="@mipmap/ic_launcher_logo">
<activity
android:name=".MainActivity"
@ -34,5 +35,32 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<provider
android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
android:authorities="${applicationId}.flutter_downloader.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:enabled="false"
android:exported="false" />
<provider
android:name="vn.hunghd.flutterdownloader.FlutterDownloaderInitializer"
android:authorities="${applicationId}.flutter-downloader-init"
android:exported="false">
<meta-data
android:name="vn.hunghd.flutterdownloader.MAX_CONCURRENT_TASKS"
android:value="5" />
</provider>
</application>
</manifest>

View File

@ -222,6 +222,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
C38E5EAE601417DA9DF11753 /* [CP] Embed Pods Frameworks */,
2432F011A7D713E4BFB3DC88 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@ -300,6 +301,24 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
2432F011A7D713E4BFB3DC88 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/flutter_downloader/FlutterDownloaderDatabase.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FlutterDownloaderDatabase.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@ -42,7 +42,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

View File

@ -7,4 +7,6 @@ class Api{
static const String CHECK_LOGIN = BASE_URL+'checkLogin';//验证登陆
static const String LOGOUT = BASE_URL+'logout';//退出登陆
static const String VERSION = BASE_URL+'getAppVersion';//检查版本
}

View File

@ -1,6 +1,10 @@
import 'dart:async';
import 'dart:core';
import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/rendering.dart';
import 'package:url_launcher/url_launcher.dart';
import 'routers/routers.dart';
import 'routers/application.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
@ -36,8 +40,20 @@ class _MyAppState extends State<MyApp> {
bool _isLoading = true;
@override
void initState() {
Future initState() {
super.initState();
var platformAandroid =
(Theme.of(context).platform == TargetPlatform.android);
DataUtils.checkVersion({'name': 'FlutterGo'}).then((bool) {
print("返回值back ${bool}");
if (platformAandroid && bool) {
setState(() {});
_UpdateURL();
}
}).catchError((onError) {
print('获取失败:$onError');
});
DataUtils.checkLogin().then((hasLogin) {
setState(() {
_hasLogin = hasLogin;
@ -52,22 +68,32 @@ class _MyAppState extends State<MyApp> {
});
}
_UpdateURL() async {
const currUrl =
'https://github.com/alibaba/flutter-go/raw/master/FlutterGo.apk';
if (await canLaunch(currUrl)) {
await launch(currUrl);
} else {
throw 'Could not launch $currUrl';
}
}
showWelcomePage() {
if (_isLoading) {
return Container(
color: const Color(ThemeColor),
child: Center(
child: SpinKitPouringHourglass(color: Colors.white),
),
);
} else {
// 判断是否已经登录
if (_hasLogin) {
// if (_isLoading) {
// return Container(
// color: const Color(ThemeColor),
// child: Center(
// child: SpinKitPouringHourglass(color: Colors.white),
// ),
// );
// } else {
// // 判断是否已经登录
// if (_hasLogin) {
return AppPage();
} else {
return LoginPage();
}
}
// } else {
// return LoginPage();
// }
// }
}
@override
@ -88,6 +114,7 @@ class _MyAppState extends State<MyApp> {
),
),
home: new Scaffold(body: showWelcomePage()),
//去掉debug logo
debugShowCheckedModeBanner: false,
onGenerateRoute: Application.router.generator,
navigatorObservers: <NavigatorObserver>[Analytics.observer],

View File

@ -59,4 +59,6 @@ class UserInfoControlModel {
Future deleteAll() async{
return await sql.deleteAll();
}
}

29
lib/model/version.dart Normal file
View File

@ -0,0 +1,29 @@
class Data {
String version;
String name;
Data.fromJson(Map<String, dynamic> json)
: version = json['version'],
name = json['name'];
@override
String toString() {
return 'name: $name ,version: $version';
}
}
class Version {
Data data;
int status;
bool success;
Version.formJson(Map<String, dynamic> json)
: status = json['status'],
success = json['success'],
data = Data.fromJson(json['data']);
@override
String toString() {
return 'status: $status ,success: $success,date: ${data.toString()}';
}
}

View File

@ -1,10 +1,13 @@
import 'dart:async' show Future;
import 'package:flutter_go/model/version.dart';
import 'package:package_info/package_info.dart';
import 'package:url_launcher/url_launcher.dart';
import './net_utils.dart';
import '../model/user_info.dart';
import 'package:flutter_go/api/api.dart';
class DataUtils {
// 登陆获取用户信息
static Future<UserInfo> doLogin(Map<String, String> params) async {
@ -27,4 +30,24 @@ class DataUtils{
print('退出登陆 $response');
return response['success'];
}
/**
* {"status":200,"data":{"version":"0.0.2","name":"FlutterGo"},"success":true}
*/
// 检查版本
static Future<bool> checkVersion(Map<String, String> params) async {
var response = await NetUtils.get(Api.VERSION, params);
Version version = Version.formJson(response);
var currVersion = version.data.version;
PackageInfo packageInfo = await PackageInfo.fromPlatform();
var localVersion = packageInfo.version;
//相同=0、大于=1、小于=-1
// localVersion = '0.0.2';
// currVersion = '1.0.6';
if (currVersion.compareTo(localVersion) == 1) {
return true;
} else {
return false;
}
}
}

View File

@ -37,32 +37,32 @@ class _MyHomePageState extends State<AppPage>
SearchHistoryList searchHistoryList;
bool isSearch = false;
String appBarTitle = tabData[0]['text'];
List<Widget> list = List();
List<Widget> _list = List();
int _currentIndex = 0;
static List tabData = [
{'text': '业界动态', 'icon': Icon(Icons.language)},
// {'text': '业界动态', 'icon': Icon(Icons.language)},
{'text': 'WIDGET', 'icon': Icon(Icons.extension)},
{'text': '组件收藏', 'icon': Icon(Icons.favorite)},
{'text': '关于手册', 'icon': Icon(Icons.import_contacts)}
{'text': '关于手册', 'icon': Icon(Icons.import_contacts)},
];
List<BottomNavigationBarItem> myTabs = [];
List<BottomNavigationBarItem> _myTabs = [];
@override
void initState() {
super.initState();
initSearchHistory();
for (int i = 0; i < tabData.length; i++) {
myTabs.add(BottomNavigationBarItem(
_myTabs.add(BottomNavigationBarItem(
icon: tabData[i]['icon'],
title: Text(
tabData[i]['text'],
),
));
}
list
_list
// ..add(FirstPage())
..add(MainPage())
// ..add(MainPage())
..add(WidgetPage(Provider.db))
..add(CollectionPage())
..add(FourthPage());
@ -118,10 +118,10 @@ class _MyHomePageState extends State<AppPage>
}
renderAppBar(BuildContext context, Widget widget, int index) {
print('renderAppBar=====>>>>>>${index}');
if(index == 0) {
return null;
}
// print('renderAppBar=====>>>>>>${index}');
// if (index == 0) {
// return null;
// }
return AppBar(title: buildSearchInput(context));
}
@ -129,13 +129,16 @@ class _MyHomePageState extends State<AppPage>
Widget build(BuildContext context) {
return new Scaffold(
appBar: renderAppBar(context, widget, _currentIndex),
body: list[_currentIndex],
body: IndexedStack(
index: _currentIndex,
children: _list,
),
bottomNavigationBar: BottomNavigationBar(
items: myTabs,
items: _myTabs,
//高亮 被点击高亮
currentIndex: _currentIndex,
//修改 页面
onTap: _ItemTapped,
onTap: _itemTapped,
//shifting :按钮点击移动效果
//fixed固定
type: BottomNavigationBarType.fixed,
@ -145,7 +148,7 @@ class _MyHomePageState extends State<AppPage>
);
}
void _ItemTapped(int index) {
void _itemTapped(int index) {
setState(() {
_currentIndex = index;
appBarTitle = tabData[index]['text'];

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class WidgetNotFound extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(

View File

@ -15,7 +15,7 @@ class _CheckedPopupMenuItemDemoState extends State<CheckedPopupMenuItemDemo> {
final String _checkedValue1 = 'One';
final String _checkedValue2 = 'Two';
final String _checkedValue3 = 'Free';
final String _checkedValue3 = 'Three';
final String _checkedValue4 = 'Four';
@override

View File

@ -11,7 +11,7 @@ class DropdownMenuItemDemo extends StatefulWidget {
class _DropdownMenuItemDemoState extends State<DropdownMenuItemDemo> {
String dropdown1Value = 'Free';
String dropdown1Value = 'Three';
String dropdown2Value;
String dropdown3Value = 'Four';
@ -32,7 +32,7 @@ class _DropdownMenuItemDemoState extends State<DropdownMenuItemDemo> {
dropdown1Value = newValue;
});
},
items: <String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((String value) {
items: <String>['One', 'Two', 'Three', 'Four'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
@ -53,7 +53,7 @@ class _DropdownMenuItemDemoState extends State<DropdownMenuItemDemo> {
dropdown2Value = newValue;
});
},
items: <String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((String value) {
items: <String>['One', 'Two', 'Three', 'Four'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
@ -74,7 +74,7 @@ class _DropdownMenuItemDemoState extends State<DropdownMenuItemDemo> {
});
},
items: <String>[
'One', 'Two', 'Free', 'Four', 'Can', 'I', 'Have', 'A', 'Little',
'One', 'Two', 'Three', 'Four', 'Can', 'I', 'Have', 'A', 'Little',
'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'
]
.map<DropdownMenuItem<String>>((String value) {

View File

@ -14,7 +14,7 @@ class SliderDemo extends StatefulWidget {
class _Demo extends State<SliderDemo> {
double value = 0.0;
@override
Widget build(BuildContext context) {
return Slider(
value: value,
@ -42,7 +42,7 @@ class SliderThemeDemo extends StatefulWidget {
class _SliderThemeDemo extends State<SliderThemeDemo> {
double value = 0.0;
@override
Widget build(BuildContext context) {
return Container(
child: SliderTheme(

View File

@ -75,7 +75,7 @@ class Demo extends StatefulWidget {
}
class _Demo extends State<Demo> {
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'Slider',

View File

@ -14,6 +14,7 @@ class SliderThemeDemo extends StatefulWidget {
class _SliderThemeDemo extends State<SliderThemeDemo> {
double value = 0.0;
@override
Widget build(BuildContext context) {
return Container(
child: SliderTheme(

View File

@ -59,7 +59,7 @@ class Demo extends StatefulWidget {
}
class _Demo extends State<Demo> {
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'SliderTheme',

View File

@ -14,6 +14,7 @@ class SliderThemeDemo extends StatefulWidget {
class _SliderThemeDemo extends State<SliderThemeDemo> {
double value = 0.0;
@override
Widget build(BuildContext context) {
return Container(
child: SliderTheme(

View File

@ -33,6 +33,7 @@ class Demo extends StatefulWidget {
class _Demo extends State<Demo> {
Color c = CupertinoColors.activeBlue;
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'SliderThemeData',

View File

@ -13,6 +13,7 @@ class SwitchDemo extends StatefulWidget {
class _Demo extends State<SwitchDemo> {
bool check = false;
@override
Widget build(BuildContext context) {
return Switch(
value: this.check,
@ -31,6 +32,7 @@ class SwitchHighDemo extends StatefulWidget {
class _SwitchHighDemo extends State<SwitchHighDemo> {
bool check = false;
@override
Widget build(BuildContext context) {
return Switch.adaptive(
value: this.check,
@ -51,6 +53,7 @@ class SwitchTypesDemo extends StatefulWidget {
class _SwitchTypesDemo extends State<SwitchTypesDemo> {
bool check = false;
@override
Widget build(BuildContext context) {
return Switch(
value: this.check,

View File

@ -52,7 +52,7 @@ class Demo extends StatefulWidget {
}
class _Demo extends State<Demo> {
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'Switch',

View File

@ -13,6 +13,7 @@ class SwitchListTileDemo extends StatefulWidget {
class _Demo extends State<SwitchListTileDemo> {
bool _lights = false;
@override
Widget build(BuildContext context) {
return SwitchListTile(
title: const Text('Lights'),

View File

@ -28,7 +28,7 @@ class Demo extends StatefulWidget {
}
class _Demo extends State<Demo> {
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'SwitchListTile',

View File

@ -12,7 +12,7 @@ class RichTextDemo extends StatefulWidget {
}
class _Demo extends State<RichTextDemo> {
@override
Widget build(BuildContext context) {
return Container(
color: Color(0xff000000),

View File

@ -25,7 +25,7 @@ class Demo extends StatefulWidget {
}
class _Demo extends State<Demo> {
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'Rich Text',

View File

@ -15,7 +15,7 @@ class TextDemo extends StatefulWidget {
class _Demo extends State<TextDemo> {
int index = 0;
Duration timer = new Duration(minutes: 50);
@override
Widget build(BuildContext context) {
return Text("i'm a text");
}

View File

@ -35,6 +35,7 @@ class _Demo extends State<Demo> {
onButtonTap() {
}
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: "Text",

View File

@ -70,7 +70,7 @@ class _CupertinoIconsFullDefault extends State {
}
}
}
@override
Widget build(BuildContext context) {
return
Align(

View File

@ -82,6 +82,7 @@ class _CupertinoNavigationBarFullDefault extends State {
);
}
@override
Widget build(BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height/1.5,

View File

@ -13,7 +13,7 @@ class CupertinoScrollbarDemo extends StatefulWidget {
}
class _Demo extends State<CupertinoScrollbarDemo> {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
@ -47,7 +47,7 @@ class NoCupertinoScrollbarDemo extends StatefulWidget {
}
class _NoCupertinoScrollbarDemo extends State<NoCupertinoScrollbarDemo> {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[

View File

@ -8,6 +8,7 @@ class CupertinoSegmentedControlDemo extends StatefulWidget {
class _Demo extends State<CupertinoSegmentedControlDemo> {
String value = 'a';
@override
Widget build(BuildContext context) {
return CupertinoSegmentedControl(
onValueChanged: (v) {

View File

@ -14,6 +14,7 @@ class CupertinoSliderDemo extends StatefulWidget {
class _Demo extends State<CupertinoSliderDemo> {
double value = 0.0;
@override
Widget build(BuildContext context) {
return CupertinoSlider(
value: value,//实际进度的位置

View File

@ -14,6 +14,7 @@ class CupertinoSliverNavigationBarDemo extends StatefulWidget {
class _Demo extends State<CupertinoSliverNavigationBarDemo> {
double value = 0.0;
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
child: DecoratedBox(

View File

@ -14,6 +14,7 @@ class CupertinoSwitchDemo extends StatefulWidget {
class _Demo extends State<CupertinoSwitchDemo> {
bool _lights = false;
@override
Widget build(BuildContext context) {
return MergeSemantics(
child: ListTile(

View File

@ -20,6 +20,7 @@ class _Demo extends State<CupertinoTabBarDemo> {
index = _index;
});
}
@override
Widget build(BuildContext context) {
return Container(
height: 500,

View File

@ -20,6 +20,7 @@ class _Demo extends State<CupertinoTabScaffoldDemo> {
index = _index;
});
}
@override
Widget build(BuildContext context) {
return SizedBox(
height: 500,

View File

@ -20,6 +20,7 @@ class _Demo extends State<CupertinoTabScaffoldDemo> {
index = _index;
});
}
@override
Widget build(BuildContext context) {
return SizedBox(
height: 500,

View File

@ -39,7 +39,7 @@ class _Demo extends State<CupertinoTimerPickerDemo> {
),
);
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {

View File

@ -118,13 +118,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.1"
flutter_markdown:
flutter_downloader:
dependency: "direct main"
description:
path: "../flutter_markdown"
relative: true
source: path
version: "0.2.0"
name: flutter_downloader
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
flutter_spinkit:
dependency: "direct main"
description:
@ -180,7 +180,7 @@ packages:
source: hosted
version: "1.0.7"
markdown:
dependency: transitive
dependency: "direct main"
description:
name: markdown
url: "https://pub.dartlang.org"
@ -194,14 +194,28 @@ packages:
source: hosted
version: "0.12.5"
meta:
dependency: transitive
dependency: "direct main"
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
open_file:
dependency: "direct main"
description:
name: open_file
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1+2"
package_info:
dependency: "direct main"
description:
name: package_info
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0+3"
path:
dependency: transitive
dependency: "direct main"
description:
name: path
url: "https://pub.dartlang.org"
@ -221,6 +235,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
quiver:
dependency: transitive
description:
@ -276,7 +297,7 @@ packages:
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
dependency: "direct main"
description:
name: string_scanner
url: "https://pub.dartlang.org"

View File

@ -7,7 +7,7 @@ description: flutter_go
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0
version: 1.0.6
environment:
sdk: ">=2.1.0 <3.0.0"
@ -27,7 +27,6 @@ dependencies:
# 本地存储、收藏功能
shared_preferences: ^0.4.3
flutter_spinkit: "^3.1.0"
path_provider: ^1.0.0
dio: ^2.0.15
flutter_webview_plugin: ^0.3.4
cookie_jar: ^1.0.0
@ -44,6 +43,11 @@ dependencies:
meta: ^1.0.5
string_scanner: ^1.0.0
path: ^1.5.1
flutter_downloader: ^1.1.7
path_provider: ^1.1.0
permission_handler: ^3.0.0
open_file: ^2.0.1+2
package_info: ^0.4.0+3
dev_dependencies:
flutter_test: