panhui 6 лет назад
Родитель
Сommit
47a195a446
4 измененных файлов с 179 добавлено и 2 удалено
  1. BIN
      images/icon_xuanzhong.png
  2. 6 1
      lib/pages/HomePage.dart
  3. 172 0
      lib/pages/ShoppingMall.dart
  4. 1 1
      lib/pages/loginSecond.dart

BIN
images/icon_xuanzhong.png


+ 6 - 1
lib/pages/HomePage.dart

@@ -4,6 +4,7 @@ import 'CreateRoom.dart';
 import 'RoomList.dart';
 import 'rankList.dart';
 import 'roomInfo.dart';
+import 'ShoppingMall.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter_swiper/flutter_swiper.dart';
 import '../model/GameInfoSeasons.dart';
@@ -416,7 +417,11 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
                     "images/shoppingmall.png",
                     39,
                     onTapHomeMenu: () {
-                      getOneRoom();
+                       Navigator.push(
+                          context,
+                          new CupertinoPageRoute(
+                              builder: (context) => new ShoppingMall()));
+                      
                     },
                   ),
                 ],

+ 172 - 0
lib/pages/ShoppingMall.dart

@@ -0,0 +1,172 @@
+import 'package:flutter/material.dart';
+import '../styles/colors.dart';
+
+class ShoppingMall extends StatefulWidget {
+  @override
+  ShoppingMallState createState() => ShoppingMallState();
+}
+
+class ShoppingMallState extends State<ShoppingMall> {
+  final List<Tab> myTabs = <Tab>[Tab(text: '金币充值'), Tab(text: '会员充值')];
+
+  @override
+  Widget build(BuildContext context) {
+    return DefaultTabController(
+      length: myTabs.length,
+      child: Scaffold(
+        appBar: AppBar(
+          backgroundColor: PRIMARY_COLOR,
+          title: Padding(
+            padding: EdgeInsets.only(right: 56),
+            child: TabBar(
+              tabs: myTabs,
+              indicatorColor: Colors.white,   
+              labelColor: Colors.white,
+              indicatorSize: TabBarIndicatorSize.label,
+            ),
+          ),
+        ),
+        body: TabBarView(
+          children: <Widget>[Recharge(
+            type:0
+          ), Recharge(
+            type: 1,
+          )],
+        ),
+      ),
+    );
+  }
+}
+
+class Recharge extends StatefulWidget {
+    Recharge({Key key, this.type}) : super(key: key);
+final int type;//类型 0 金币 1 会员
+  @override
+  RechargeState createState() => RechargeState();
+}
+
+class RechargeState extends State<Recharge> {
+  List moneyList = [100, 300, 500, 1000, 2000, 5000];
+   List vipList = [{
+     "name":'VIP1',
+     "value":100
+   },{
+     "name":'VIP2',
+     "value":300
+   },{
+     "name":'VIP3',
+     "value":500
+   },{
+     "name":'VIP4',
+     "value":1000
+   },{
+     "name":'VIP5',
+     "value":2000
+   },{
+     "name":'VIP6',
+     "value":5000
+   }];
+  int chooseMoney = 100;
+  @override
+  void initState() {
+    // TODO: implement initState
+    super.initState();
+    print(widget.type);
+  }
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      body: Container(
+        color: BG_COLOR,
+        child: ListView.builder(
+            itemCount: widget.type==0?moneyList.length:vipList.length,
+            itemBuilder: (BuildContext context, int index) {
+              bool isChoose=false;
+              if(widget.type==0){
+                if(moneyList[index]==chooseMoney){
+                  isChoose=true;
+                }
+              }
+              else{
+                if(vipList[index]['value']==chooseMoney){
+                  isChoose=true;
+                }
+              }
+              return Container(
+                padding: EdgeInsets.symmetric(horizontal: 15),
+                margin: EdgeInsets.only(top: 10),
+                height: 60,
+                child: FlatButton(
+                  color: Color(0xFF222335),
+                  padding: EdgeInsets.all(0),
+                  shape: Border.all(
+                      color: isChoose
+                          ? Color(0xFFC2524D)
+                          : Colors.transparent,
+                      width: 1),
+                  disabledColor: Color(0xFF222335),
+                  child: Container(
+                    child: Stack(
+                      children: <Widget>[
+                        Center(
+                          child: Row(
+                            mainAxisAlignment: MainAxisAlignment.center,
+                            children: <Widget>[
+                              Text(widget.type==0?(moneyList[index].toString() + "金币"):vipList[index]['name'],
+                                  style: TextStyle(
+                                      color: Color(0xFFFFFFFF),
+                                      fontWeight: FontWeight.w500,
+                                      fontSize: 15)),
+                              Container(
+                                width: 10,
+                              ),
+                              Text(
+                                widget.type==0?("¥"+moneyList[index].toString()):("¥"+vipList[index]['value'].toString()),
+                                style: TextStyle(
+                                    color: Color(0xFF727785),
+                                    fontWeight: FontWeight.w400,
+                                    fontSize: 14),
+                              )
+                            ],
+                          ),
+                        ),
+                        Positioned(
+                          right: 0,
+                          bottom: 0,
+                          child: isChoose
+                              ? Image.asset('images/icon_xuanzhong.png',
+                                  width: 36)
+                              : Container(),
+                        )
+                      ],
+                    ),
+                  ),
+                  onPressed: isChoose
+                      ? null
+                      : () {
+
+                          setState(() {
+                            chooseMoney =  widget.type==0?moneyList[index]:vipList[index]['value'];
+                          });
+                        },
+                ),
+              );
+            }),
+      ),
+      floatingActionButton: Container(
+        width: double.infinity,
+        padding: EdgeInsets.symmetric(horizontal:15),
+        height: 48,
+        child: FlatButton(
+          color: PRIMARY_COLOR,
+          textColor: Colors.white,
+          child: Text('立即充值'),
+          onPressed: (){
+              
+          },
+        ),
+      ),
+      floatingActionButtonLocation:FloatingActionButtonLocation.centerFloat,
+    );
+  }
+}

+ 1 - 1
lib/pages/loginSecond.dart

@@ -1,5 +1,4 @@
 import 'dart:async';
-
 import 'package:flutter/material.dart';
 import 'package:shared_preferences/shared_preferences.dart';
 import 'package:flutter/cupertino.dart';
@@ -172,6 +171,7 @@ class LoginSecondState extends State<LoginSecond> {
   void sendMsg() async {
     Toast.show(context, '加载中', -1, 'loading');
     final Result res = await HttpManager.get('rong/sendCode', data: {"phone": widget.phone});
+    print('错误'+res.error);
     Toast.hide();
     if (res.success) {
       Toast.show(context, '发送成功', 1500, 'success');