Skip to content

Dev ken #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=
eclipse.preferences.version=1
6 changes: 6 additions & 0 deletions android/app/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
23 changes: 23 additions & 0 deletions android/app/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions android/app/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=..
eclipse.preferences.version=1
6 changes: 5 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.efoxflutter"
applicationId "com.flutter.beer"
minSdkVersion 16
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
Expand All @@ -58,4 +58,8 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//firebase
implementation 'com.google.firebase:firebase-core:16.0.7'
}
//firebase
apply plugin: 'com.google.gms.google-services'
42 changes: 42 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"project_info": {
"project_number": "27281760426",
"firebase_url": "https://efox-flutter.firebaseio.com",
"project_id": "efox-flutter",
"storage_bucket": "efox-flutter.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:27281760426:android:51548b1d738060a2",
"android_client_info": {
"package_name": "com.flutter.beer"
}
},
"oauth_client": [
{
"client_id": "27281760426-to57nfnn76jt4696hlg63lvr7g2po8u5.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDdh4EwOeSv9fWPH8CbEsHZz7jJ_Lsn4Bo"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.efoxflutter">
package="com.flutter.beer">

<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
Expand All @@ -14,7 +14,7 @@
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="efox_flutter"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.efoxflutter;
package com.flutter.beer;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Efox Flutter</string>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
Expand Down
2 changes: 2 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
//firebase
classpath 'com.google.gms:google-services:4.2.0'
}
}

Expand Down
10 changes: 10 additions & 0 deletions lib/components/widgetComp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:efox_flutter/utils/file.dart' as FileUtils;
import 'package:efox_flutter/utils/loadAsset.dart' as LoadAssetUtils;
import 'package:efox_flutter/router/index.dart' show FluroRouter;
import 'package:efox_flutter/config/theme.dart' show AppTheme;
import 'package:efox_flutter/utils/share.dart' as AppShare;

class Index extends StatefulWidget {
final List<Widget> demoChild;
Expand Down Expand Up @@ -126,6 +127,15 @@ class IndexState extends State<Index> {
this.openPage(context, model, this.mdUrl);
},
),
IconButton(
icon: Icon(Icons.share),
onPressed: () {
final String msg = Uri.encodeComponent(
model.config.state.env.GithubAssetOrigin +
this.mdUrl.replaceAll(RegExp('/index.md'), ''));
AppShare.shareText(msg);
},
),
PopupMenuButton(
offset: Offset(0, 80),
onSelected: (index) {
Expand Down
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import 'package:efox_flutter/store/store.dart' show model, Store;
import 'package:efox_flutter/router/index.dart';
//主题
import 'package:efox_flutter/config/theme.dart' show AppTheme;
//统计
import 'package:efox_flutter/utils/analytics.dart' as Analytics;

void main() => runApp(MainApp());

Expand Down Expand Up @@ -61,6 +63,7 @@ class MainAppState extends State<MainApp> {
title: 'Flutter Demo',
theme: AppTheme.themData,
onGenerateRoute: FluroRouter.router.generator,
navigatorObservers: <NavigatorObserver>[Analytics.observer],
),
);
}
Expand Down
117 changes: 60 additions & 57 deletions lib/page/component/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,70 +30,73 @@ class _IndexState extends State<Index> {
Widget renderExpanel(MainStateModel model, widgetsItem) {
String nameSpaces = widgetsItem.nameSpaces;
List _tmpWidgetList = widgetsItem.widgetList;
return ExpansionTile(
title: Text(
widgetsItem.typeName,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
return Container(
margin: EdgeInsets.only(bottom: 10),
child: ExpansionTile(
title: Text(
widgetsItem.typeName,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
leading: Icon(
IconData(
widgetsItem.code ?? 58353,
fontFamily: 'MaterialIcons',
matchTextDirection: true,
leading: Icon(
IconData(
widgetsItem.code ?? 58353,
fontFamily: 'MaterialIcons',
matchTextDirection: true,
),
// color: Color(AppTheme.mainColor),
),
// color: Color(AppTheme.mainColor),
),
backgroundColor: Colors.white,
children: [
GridView.count(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
childAspectRatio: 1,
crossAxisCount: 3,
children: List.generate(
_tmpWidgetList.length,
(index) {
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: .1,
backgroundColor: Colors.white,
children: [
GridView.count(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
childAspectRatio: 1,
crossAxisCount: 3,
children: List.generate(
_tmpWidgetList.length,
(index) {
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: .1,
),
),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
iconSize: 48,
icon: Icon(
IconData(
_tmpWidgetList[index].code ?? 59101,
fontFamily: 'MaterialIcons',
matchTextDirection: true,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
iconSize: 48,
icon: Icon(
IconData(
_tmpWidgetList[index].code ?? 59101,
fontFamily: 'MaterialIcons',
matchTextDirection: true,
),
color: Color(AppTheme.mainColor),
),
color: Color(AppTheme.mainColor),
onPressed: () {
FluroRouter.router.navigateTo(
context,
nameSpaces + _tmpWidgetList[index].title,
);
},
),
onPressed: () {
FluroRouter.router.navigateTo(
context,
nameSpaces + _tmpWidgetList[index].title,
);
},
),
Text(
_tmpWidgetList[index].title,
),
],
),
);
},
Text(
_tmpWidgetList[index].title,
),
],
),
);
},
),
),
),
],
],
),
);
}

Expand Down
7 changes: 6 additions & 1 deletion lib/router/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:fluro/fluro.dart';
import 'package:efox_flutter/page/home.dart' as HomePage;
import 'package:efox_flutter/widget/index.dart' as WidgetConfig;
import 'handles.dart';
//统计
import 'package:efox_flutter/utils/analytics.dart' show analytics;

class FluroRouter {
static Router router;
Expand All @@ -20,7 +22,7 @@ class FluroRouter {
);

router.define('/webview', handler: webviewHandler);

// 组件
WidgetConfig.getAllWidgets().forEach((widgetsItem) {
print('widgetsItem $widgetsItem');
Expand All @@ -29,6 +31,9 @@ class FluroRouter {
widgetsItem.nameSpaces + itemInfo.title,
handler: Handler(
handlerFunc: (BuildContext context, Map<String, List> params) {
print('组件路由params=$params widgetsItem=${itemInfo.title}');
analytics.logEvent(
name: 'component', parameters: {'name': itemInfo.title});
return itemInfo.widget;
}),
);
Expand Down
7 changes: 7 additions & 0 deletions lib/utils/analytics.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';

//统计
FirebaseAnalytics analytics = FirebaseAnalytics();
FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);
5 changes: 5 additions & 0 deletions lib/utils/share.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:share/share.dart';

void shareText(text) {
Share.share(text);
}
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
flutter_spinkit: ^3.0.0 #加载指示器合集
share: ^0.5.3 #社会化分享
share: ^0.6.0+1 #社会化分享
pull_to_refresh: ^1.1.6 #加载更多
shared_preferences: ^0.4.2 #简单数据存储
scoped_model: ^1.0.1
Expand All @@ -33,6 +33,7 @@ dependencies:
flutter_webview_plugin: ^0.3.0+2
fluro: ^1.4.0
flutter_screenutil: ^0.5.1
firebase_analytics: ^2.0.2+1

dev_dependencies:
flutter_test:
Expand Down