x1ongzhu před 6 roky
rodič
revize
531555dfce
4 změnil soubory, kde provedl 38 přidání a 65 odebrání
  1. 7 25
      lib/pages/Recharge.dart
  2. 23 40
      lib/pages/ShoppingMall.dart
  3. 7 0
      pubspec.lock
  4. 1 0
      pubspec.yaml

+ 7 - 25
lib/pages/Recharge.dart

@@ -65,7 +65,7 @@ class RechrageState extends State<Rechrage> {
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
     ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
-    
+
     return Scaffold(
     return Scaffold(
         appBar: AppBar(
         appBar: AppBar(
           // backgroundColor: PRIMARY_COLOR,
           // backgroundColor: PRIMARY_COLOR,
@@ -108,8 +108,7 @@ class RechrageState extends State<Rechrage> {
   }
   }
 
 
   List<Widget> _allChooseBtn(BuildContext context) {
   List<Widget> _allChooseBtn(BuildContext context) {
-    List<Widget> allWidget =
-        List<Widget>.generate(moenyList.length, (int index) {
+    List<Widget> allWidget = List<Widget>.generate(moenyList.length, (int index) {
       return _chooseBtn(context, index);
       return _chooseBtn(context, index);
     });
     });
 
 
@@ -131,15 +130,9 @@ class RechrageState extends State<Rechrage> {
               ),
               ),
               decoration: InputDecoration(
               decoration: InputDecoration(
                 hintText: isInput ? '请输入金额' : '其他金额',
                 hintText: isInput ? '请输入金额' : '其他金额',
-                hintStyle: TextStyle(
-                    color: Colors.white,
-                    fontSize: 14,
-                    fontWeight: isInput?FontWeight.w500:FontWeight.w400),
+                hintStyle: TextStyle(color: Colors.white, fontSize: 14, fontWeight: isInput ? FontWeight.w500 : FontWeight.w400),
                 suffixText: '金币',
                 suffixText: '金币',
-                suffixStyle: TextStyle(
-                    fontSize: 13,
-                    fontWeight: FontWeight.w400,
-                    color: Colors.white),
+                suffixStyle: TextStyle(fontSize: 13, fontWeight: FontWeight.w400, color: Colors.white),
                 border: OutlineInputBorder(borderSide: BorderSide.none),
                 border: OutlineInputBorder(borderSide: BorderSide.none),
               ),
               ),
               onChanged: (String str) {
               onChanged: (String str) {
@@ -163,24 +156,13 @@ class RechrageState extends State<Rechrage> {
       height: ScreenUtil().setWidth(60),
       height: ScreenUtil().setWidth(60),
       child: FlatButton(
       child: FlatButton(
         color: isChoose ? PRIMARY_COLOR : BG_SUB_COLOR,
         color: isChoose ? PRIMARY_COLOR : BG_SUB_COLOR,
-        highlightColor: isChoose
-            ? PRIMARY_COLOR.withOpacity(0.3)
-            : BG_COLOR.withOpacity(0.3),
+        highlightColor: isChoose ? PRIMARY_COLOR.withOpacity(0.3) : BG_COLOR.withOpacity(0.3),
         child: Column(
         child: Column(
           mainAxisAlignment: MainAxisAlignment.center,
           mainAxisAlignment: MainAxisAlignment.center,
           children: <Widget>[
           children: <Widget>[
-            Text(moenyList[index]['title'],
-                style: TextStyle(
-                    color: Colors.white,
-                    fontSize: 14,
-                    fontWeight: FontWeight.w500,
-                    height: 1)),
+            Text(moenyList[index]['title'], style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w500, height: 1)),
             Text('¥' + moenyList[index]['money'].toString(),
             Text('¥' + moenyList[index]['money'].toString(),
-                style: TextStyle(
-                    color: isChoose ? Colors.white : Color(0xFF727785),
-                    fontSize: 13,
-                    fontWeight: FontWeight.w400,
-                    height: 18 / 13)),
+                style: TextStyle(color: isChoose ? Colors.white : Color(0xFF727785), fontSize: 13, fontWeight: FontWeight.w400, height: 18 / 13)),
           ],
           ],
         ),
         ),
         onPressed: () {
         onPressed: () {

+ 23 - 40
lib/pages/ShoppingMall.dart

@@ -1,15 +1,16 @@
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
-import '../styles/colors.dart';
-import '../net/HttpManager.dart';
-import '../net/Result.dart';
-import '../styles/totast.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import 'package:flutter_redux/flutter_redux.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/cupertino.dart';
+import 'package:fluwx/fluwx.dart' as fluwx;
 import '../redux/AppState.dart';
 import '../redux/AppState.dart';
 import '../model/ProductInfo.dart';
 import '../model/ProductInfo.dart';
 import '../widget/Dialog.dart';
 import '../widget/Dialog.dart';
 import '../redux/UserRedux.dart';
 import '../redux/UserRedux.dart';
 import '../model/UserInfo.dart';
 import '../model/UserInfo.dart';
+import '../styles/colors.dart';
+import '../net/HttpManager.dart';
+import '../net/Result.dart';
+import '../styles/totast.dart';
 import 'ChoosePay.dart';
 import 'ChoosePay.dart';
 
 
 class ShoppingMall extends StatefulWidget {
 class ShoppingMall extends StatefulWidget {
@@ -32,7 +33,7 @@ class ShoppingMallState extends State<ShoppingMall> {
             child: TabBar(
             child: TabBar(
               tabs: myTabs,
               tabs: myTabs,
               indicatorColor: Theme.of(context).primaryColor,
               indicatorColor: Theme.of(context).primaryColor,
-              labelColor:Theme.of(context).primaryColor,
+              labelColor: Theme.of(context).primaryColor,
               unselectedLabelColor: Colors.white,
               unselectedLabelColor: Colors.white,
               indicatorSize: TabBarIndicatorSize.label,
               indicatorSize: TabBarIndicatorSize.label,
             ),
             ),
@@ -63,12 +64,10 @@ class RechargeState extends State<Recharge> {
     Result res = await HttpManager.get('userInfo/getUserInfo');
     Result res = await HttpManager.get('userInfo/getUserInfo');
     if (res.success) {
     if (res.success) {
       print(res.data);
       print(res.data);
-      StoreProvider.of<AppState>(context)
-          .dispatch(UpdateUserAction(UserInfo.fromJson(res.data)));
+      StoreProvider.of<AppState>(context).dispatch(UpdateUserAction(UserInfo.fromJson(res.data)));
     } else {}
     } else {}
   }
   }
 
 
-
   List moneyList = [100, 300, 500, 1000, 2000, 5000];
   List moneyList = [100, 300, 500, 1000, 2000, 5000];
   List vipList = [
   List vipList = [
     {'name': 'VIP1', 'value': 100},
     {'name': 'VIP1', 'value': 100},
@@ -84,8 +83,7 @@ class RechargeState extends State<Recharge> {
 
 
   Future<void> getInfoList() async {
   Future<void> getInfoList() async {
     Toast.show(context, '加载中', -1, 'loading');
     Toast.show(context, '加载中', -1, 'loading');
-    final Result res = await HttpManager.get('productInfo/all',
-        data: {'typeFlag': widget.type});
+    final Result res = await HttpManager.get('productInfo/all', data: {'typeFlag': widget.type});
     Toast.hide();
     Toast.hide();
     if (res.success) {
     if (res.success) {
       for (var item in res.data) {
       for (var item in res.data) {
@@ -115,6 +113,7 @@ class RechargeState extends State<Recharge> {
   @override
   @override
   void initState() {
   void initState() {
     super.initState();
     super.initState();
+    fluwx.register(appId: "wx62f8a9c1d3d70245");
     getInfoList();
     getInfoList();
   }
   }
 
 
@@ -135,20 +134,18 @@ class RechargeState extends State<Recharge> {
                     children: <Widget>[
                     children: <Widget>[
                       Expanded(
                       Expanded(
                         flex: 1,
                         flex: 1,
-                        child: ShoopingBtn('images/icon_haoli.png', '更多好礼',
-                            onTapHomeMenu: () {
-                              showDialog(2);
-                            }),
+                        child: ShoopingBtn('images/icon_haoli.png', '更多好礼', onTapHomeMenu: () {
+                          showDialog(2);
+                        }),
                       ),
                       ),
                       Container(
                       Container(
                         width: 15,
                         width: 15,
                       ),
                       ),
                       Expanded(
                       Expanded(
                         flex: 1,
                         flex: 1,
-                        child: ShoopingBtn('images/icon_shangwu.png', '商务合作',
-                            onTapHomeMenu: () {
-                               showDialog(3);
-                            }),
+                        child: ShoopingBtn('images/icon_shangwu.png', '商务合作', onTapHomeMenu: () {
+                          showDialog(3);
+                        }),
                       ),
                       ),
                     ],
                     ],
                   ),
                   ),
@@ -165,9 +162,7 @@ class RechargeState extends State<Recharge> {
                 child: FlatButton(
                 child: FlatButton(
                   color: Color(0xFF222335),
                   color: Color(0xFF222335),
                   padding: EdgeInsets.all(0),
                   padding: EdgeInsets.all(0),
-                  shape: Border.all(
-                      color: isChoose ? Theme.of(context).primaryColor : Colors.transparent,
-                      width: 1),
+                  shape: Border.all(color: isChoose ? Theme.of(context).primaryColor : Colors.transparent, width: 1),
                   disabledColor: Color(0xFF222335),
                   disabledColor: Color(0xFF222335),
                   child: Container(
                   child: Container(
                     child: Stack(
                     child: Stack(
@@ -177,20 +172,13 @@ class RechargeState extends State<Recharge> {
                             mainAxisAlignment: MainAxisAlignment.center,
                             mainAxisAlignment: MainAxisAlignment.center,
                             children: <Widget>[
                             children: <Widget>[
                               Text(productInfoList[index - 1].productName,
                               Text(productInfoList[index - 1].productName,
-                                  style: TextStyle(
-                                      color: Color(0xFFFFFFFF),
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 15)),
+                                  style: TextStyle(color: Color(0xFFFFFFFF), fontWeight: FontWeight.w500, fontSize: 15)),
                               Container(
                               Container(
                                 width: 10,
                                 width: 10,
                               ),
                               ),
                               Text(
                               Text(
-                                '¥' +
-                                    productInfoList[index - 1].money.toString(),
-                                style: TextStyle(
-                                    color: Color(0xFF727785),
-                                    fontWeight: FontWeight.w400,
-                                    fontSize: 14),
+                                '¥' + productInfoList[index - 1].money.toString(),
+                                style: TextStyle(color: Color(0xFF727785), fontWeight: FontWeight.w400, fontSize: 14),
                               )
                               )
                             ],
                             ],
                           ),
                           ),
@@ -198,9 +186,7 @@ class RechargeState extends State<Recharge> {
                         Positioned(
                         Positioned(
                           right: 0,
                           right: 0,
                           bottom: 0,
                           bottom: 0,
-                          child: isChoose
-                              ? Image.asset('images/icon_xuanzhong.png')
-                              : Container(),
+                          child: isChoose ? Image.asset('images/icon_xuanzhong.png') : Container(),
                         )
                         )
                       ],
                       ],
                     ),
                     ),
@@ -225,7 +211,8 @@ class RechargeState extends State<Recharge> {
           textColor: Colors.white,
           textColor: Colors.white,
           child: Text('立即充值'),
           child: Text('立即充值'),
           onPressed: () async {
           onPressed: () async {
-              Navigator.push(context, CupertinoPageRoute(builder: (context) => ChoosePay(widget.type,chooseProduct)));
+            fluwx.launchMiniProgram(username: "gh_a6a98cd9b3cd");
+            // Navigator.push(context, CupertinoPageRoute(builder: (context) => ChoosePay(widget.type, chooseProduct)));
             // Toast.show(context, '加载中', -1, 'loading');
             // Toast.show(context, '加载中', -1, 'loading');
             // final Result res = await HttpManager.post('productInfo/buy', data: {
             // final Result res = await HttpManager.post('productInfo/buy', data: {
             //   'userId': StoreProvider.of<AppState>(context).state.userInfo.id,
             //   'userId': StoreProvider.of<AppState>(context).state.userInfo.id,
@@ -264,11 +251,7 @@ class ShoopingBtn extends StatelessWidget {
     return Container(
     return Container(
       height: 70,
       height: 70,
       decoration: BoxDecoration(
       decoration: BoxDecoration(
-          gradient: LinearGradient(
-              begin: Alignment.topCenter,
-              end: Alignment.bottomCenter,
-              stops: [0.0, 0.5],
-              colors: [Color(0xFF464B6A), Color(0xFF35395E)])),
+          gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, stops: [0.0, 0.5], colors: [Color(0xFF464B6A), Color(0xFF35395E)])),
       child: Material(
       child: Material(
           color: Colors.transparent,
           color: Colors.transparent,
           child: InkWell(
           child: InkWell(

+ 7 - 0
pubspec.lock

@@ -247,6 +247,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.dartlang.org"
+    source: hosted
+    version: "1.0.4"
   front_end:
   front_end:
     dependency: transitive
     dependency: transitive
     description:
     description:

+ 1 - 0
pubspec.yaml

@@ -41,6 +41,7 @@ dependencies:
   battery: ^0.3.0+4
   battery: ^0.3.0+4
   cached_network_image: ^0.8.0
   cached_network_image: ^0.8.0
   image_picker: ^0.6.0+4
   image_picker: ^0.6.0+4
+  fluwx: ^1.0.4
 
 
 dev_dependencies:
 dev_dependencies:
   build_runner: ^1.1.1
   build_runner: ^1.1.1