添加个人中心

This commit is contained in:
yifeng.yl
2019-05-31 10:47:16 +08:00
16 changed files with 194 additions and 59 deletions

View File

@ -26,7 +26,9 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.
android下载地址: android下载地址:
<img src="https://img.alicdn.com/tfs/TB1ylxGTMHqK1RjSZFgXXa7JXXa-436-432.png" width="200px">
华为市场已上线master分支上面已上传【FlutterGo.apk】apk包可点击下载
iphone下载地址: AppStore上面进行搜索fluttego iphone下载地址: AppStore上面进行搜索fluttego

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

@ -7,21 +7,22 @@
additional functionality it is fine to subclass or reimplement additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODE_WORLD_READABLE"/> <uses-permission android:name="android.permission.MODE_WORLD_READABLE" />
<uses-permission android:name="android.permission.MODE_WORLD_WRITEABLE"/> <uses-permission android:name="android.permission.MODE_WORLD_WRITEABLE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:label="fluttergo" android:label="FlutterGo"
android:usesCleartextTraffic="true" android:icon="@mipmap/ic_launcher_logo"
android:icon="@mipmap/ic_launcher_logo"> android:usesCleartextTraffic="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing <!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if until Flutter renders its first frame. It can be removed if
@ -31,9 +32,36 @@
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" /> android:value="true" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </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> </application>
</manifest> </manifest>

View File

@ -222,6 +222,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
C38E5EAE601417DA9DF11753 /* [CP] Embed Pods Frameworks */, C38E5EAE601417DA9DF11753 /* [CP] Embed Pods Frameworks */,
2432F011A7D713E4BFB3DC88 /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
@ -300,6 +301,24 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase 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 */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;

View File

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

View File

@ -11,4 +11,5 @@ class Api{
static const String GET_USER_INFO = BASE_URL+'getUserInfo';//获取用户信息 static const String GET_USER_INFO = BASE_URL+'getUserInfo';//获取用户信息
static const String RedirectIp = 'http://100.81.211.172/'; static const String RedirectIp = 'http://100.81.211.172/';
static const String VERSION = BASE_URL+'getAppVersion';//检查版本
} }

View File

@ -59,4 +59,6 @@ class UserInfoControlModel {
Future deleteAll() async{ Future deleteAll() async{
return await sql.deleteAll(); 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,5 +1,8 @@
import 'dart:async' show Future; import 'dart:async' show Future;
import 'package:flutter_go/model/version.dart';
import 'package:package_info/package_info.dart';
import './net_utils.dart'; import './net_utils.dart';
import '../model/user_info.dart'; import '../model/user_info.dart';
import 'package:flutter_go/api/api.dart'; import 'package:flutter_go/api/api.dart';
@ -48,4 +51,21 @@ class DataUtils {
print('退出登陆 $response'); print('退出登陆 $response');
return response['success']; return response['success'];
} }
// 检查版本
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

@ -75,7 +75,10 @@ class TabLayout extends StatelessWidget {
//labelPadding: EdgeInsets.all(12.0), //labelPadding: EdgeInsets.all(12.0),
labelPadding: EdgeInsets.only(top: 12.0, left: 12.0, right: 12.0), labelPadding: EdgeInsets.only(top: 12.0, left: 12.0, right: 12.0),
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
tabs: _allPages.map((_Page page) => Tab(text: page.labelId)).toList(), tabs: _allPages
.map((_Page page) =>
Tab(text: page.labelId))
.toList(),
); );
} }
} }

View File

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

View File

@ -77,7 +77,7 @@ packages:
name: dio name: dio
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.3" version: "2.1.6"
event_bus: event_bus:
dependency: "direct main" dependency: "direct main"
description: description:
@ -118,6 +118,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.11.1" version: "0.11.1"
flutter_downloader:
dependency: "direct main"
description:
name: flutter_downloader
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.7"
flutter_markdown: flutter_markdown:
dependency: "direct main" dependency: "direct main"
description: description:
@ -143,7 +150,7 @@ packages:
name: flutter_webview_plugin name: flutter_webview_plugin
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.4" version: "0.3.5"
fluttertoast: fluttertoast:
dependency: "direct main" dependency: "direct main"
description: description:
@ -164,7 +171,7 @@ packages:
name: image_picker name: image_picker
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.6.0+2" version: "0.6.0+8"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
@ -200,6 +207,20 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
open_file:
dependency: "direct main"
description:
name: open_file
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1+2"
package_info:
dependency: "direct main"
description:
name: package_info
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.0+3"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -213,7 +234,7 @@ packages:
name: path_provider name: path_provider
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.1.0"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@ -221,6 +242,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.0" version: "1.5.0"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:

View File

@ -7,7 +7,7 @@ description: flutter_go
# Both the version and the builder number may be overridden in flutter # Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively. # build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org. # Read more about versioning at semver.org.
version: 1.0.0 version: 1.0.6
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.0.0-dev.68.0 <3.0.0"
@ -29,7 +29,6 @@ dependencies:
shared_preferences: ^0.4.3 shared_preferences: ^0.4.3
share: ^0.6.1+1 share: ^0.6.1+1
flutter_spinkit: "^3.1.0" flutter_spinkit: "^3.1.0"
path_provider: ^1.0.0
fluttertoast: ^3.1.0 fluttertoast: ^3.1.0
dio: ^2.0.15 dio: ^2.0.15
flutter_webview_plugin: ^0.3.4 flutter_webview_plugin: ^0.3.4
@ -43,6 +42,11 @@ dependencies:
flutter_bloc: ^0.11.1 flutter_bloc: ^0.11.1
bloc: ^0.12.0 bloc: ^0.12.0
html: ^0.14.0+2 html: ^0.14.0+2
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: dev_dependencies:
flutter_test: flutter_test: