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

hmxc
小赖 4 years ago
parent b1dc189f12
commit 1d38844e9d

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

@ -1,38 +1,22 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.akuCommunity.app">
package="com.akuCommunity.app">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that <!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method. calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide 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 additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<application <application android:name="io.flutter.app.FlutterApplication" android:label="小蜜蜂智慧社区" android:icon="@mipmap/logo" android:networkSecurityConfig="@xml/network_security_config">
android:name="io.flutter.app.FlutterApplication" <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">
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 <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. --> to determine the Window background behind the Flutter UI. -->
<meta-data <meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen <!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual 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 gap between the end of Android's launch screen and the painting of
Flutter's first frame. --> Flutter's first frame. -->
<meta-data <meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<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"/>
@ -40,9 +24,7 @@
</activity> </activity>
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data <meta-data android:name="flutterEmbedding" android:value="2" />
android:name="flutterEmbedding"
android:value="2" />
</application> </application>
<!-- 保存照片到相册 --> <!-- 保存照片到相册 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

@ -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 { buildscript {
ext.kotlin_version = '1.3.50' ext.kotlin_version = '1.3.11'
repositories { repositories {
// google() // google()
// jcenter() // jcenter()

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

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

@ -1,35 +1,22 @@
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/utils/screenutil.dart';
import 'package:fluwx/fluwx.dart';
class GoodsAppBar extends StatefulWidget { 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 @override
_GoodsAppBarState createState() => _GoodsAppBarState(); _GoodsAppBarState createState() => _GoodsAppBarState();
} }
class _GoodsAppBarState extends State<GoodsAppBar> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( 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 description: flutter
source: sdk source: sdk
version: "0.0.0" 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: font_awesome_flutter:
dependency: "direct main" dependency: "direct main"
description: description:

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

Loading…
Cancel
Save