修复打包问题添加分享按钮功能

hmxc
小赖 4 years ago
parent b1dc189f12
commit 1d38844e9d

@ -45,7 +45,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.akuCommunity.app"
minSdkVersion 18
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
@ -58,6 +58,18 @@ android {
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
debug {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
profile {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {

@ -1,59 +1,41 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.akuCommunity.app">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.akuCommunity.app">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="小蜜蜂智慧社区"
android:icon="@mipmap/logo">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
<application android:name="io.flutter.app.FlutterApplication" android:label="小蜜蜂智慧社区" android:icon="@mipmap/logo" android:networkSecurityConfig="@xml/network_security_config">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- 保存照片到相册 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 打开相册选取图片 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--获取相机权限-->
<uses-permission android:name="android.permission.CAMERA" />
<!-- <activity android:name="com.apptreesoftware.barcodescan.BarcodeScannerActivity"/> -->
<!--获取网络-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION"/>
<meta-data android:name="flutterEmbedding" android:value="2" />
</application>
<!-- 保存照片到相册 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 打开相册选取图片 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--获取相机权限-->
<uses-permission android:name="android.permission.CAMERA" />
<!-- <activity android:name="com.apptreesoftware.barcodescan.BarcodeScannerActivity"/> -->
<!--获取网络-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.11'
repositories {
// google()
// jcenter()

@ -4,6 +4,7 @@ import 'package:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:ani_route/ani_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:fluwx/fluwx.dart';
import 'package:provider/provider.dart';
import 'package:akuCommunity/provider/cart.dart';
import 'package:flutter_picker/flutter_picker.dart';
@ -17,11 +18,23 @@ void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// final GlobalKey<NavigatorState> navigatorKey = GlobalKey();
class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
RouterInit.setupRouter();
registerWxApi(appId: 'wxd7bdef0d4849ddb8');
}
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => CartProvidde()),

@ -31,9 +31,13 @@ class _GoodsDetailsPageState extends State<GoodsDetailsPage> {
@override
Widget build(BuildContext context) {
final List<String> params = shopInfo["taobao_image"].split(',');
return Scaffold(
appBar: PreferredSize(
child: GoodsAppBar(),
child: GoodsAppBar(
shareImg: params.first,
title: shopInfo["itemtitle"],
),
preferredSize: Size.fromHeight(kToolbarHeight),
),
body: Stack(
@ -41,7 +45,7 @@ class _GoodsDetailsPageState extends State<GoodsDetailsPage> {
ListView(
padding: EdgeInsets.only(bottom: Screenutil.length(100)),
children: [
ProductSwiper(imageUrl: shopInfo["taobao_image"].split(',')),
ProductSwiper(imageUrl: params),
ProductContent(
itemprice: shopInfo["itemprice"],
itemtitle: shopInfo["itemtitle"],

@ -1,35 +1,22 @@
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:fluwx/fluwx.dart';
class GoodsAppBar extends StatefulWidget {
GoodsAppBar({Key key}) : super(key: key);
final String shareImg;
final String title;
GoodsAppBar({Key key, @required this.shareImg, @required this.title})
: super(key: key);
@override
_GoodsAppBarState createState() => _GoodsAppBarState();
}
class _GoodsAppBarState extends State<GoodsAppBar> {
List<Map<String, dynamic>> actionsList = [
{'icon': SimpleLineIcons.share, 'size': 40, 'funtion': null},
{'icon': AntDesign.shoppingcart, 'size': 48, 'funtion': null}
];
List<Widget> _listActions() {
return actionsList
.map((item) => IconButton(
icon: Icon(
item['icon'],
size: Screenutil.size(item['size'].toDouble()),
color: Color(0xff666666),
),
onPressed: () {},
))
.toList();
}
@override
Widget build(BuildContext context) {
return AppBar(
@ -75,7 +62,33 @@ class _GoodsAppBarState extends State<GoodsAppBar> {
),
),
),
actions: _listActions(),
actions: [
IconButton(
icon: Icon(
SimpleLineIcons.share,
size: Screenutil.size(40),
color: Color(0xff666666),
),
onPressed: () {
shareToWeChat(WeChatShareWebPageModel(
'https://mobile.baidu.com/item?docid=27505288',
thumbnail: WeChatImage.network(widget.shareImg),
title: widget.title,
description: '前往小蜜蜂智慧社区查看吧',
));
},
),
IconButton(
icon: Icon(
AntDesign.shoppingcart,
size: Screenutil.size(40),
color: Color(0xff666666),
),
onPressed: () {
Navigator.pushNamed(context, PageName.market_cart_page.toString());
},
),
],
);
}
}

@ -471,6 +471,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fluwx:
dependency: "direct main"
description:
name: fluwx
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.0"
font_awesome_flutter:
dependency: "direct main"
description:

@ -117,6 +117,8 @@ dependencies:
path_provider: ^1.6.18
ani_route: ^0.0.2
fluwx: ^2.3.0
dev_dependencies:
flutter_test:
sdk: flutter

Loading…
Cancel
Save