panhui 6 anos atrás
pai
commit
9566fbba9d
1 arquivos alterados com 33 adições e 19 exclusões
  1. 33 19
      lib/pages/HomePage.dart

+ 33 - 19
lib/pages/HomePage.dart

@@ -56,8 +56,6 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
     //         height: 50,
     //         child: Text(
 
-
-
     //           style: TextStyle(color: Colors.black),
     //         ),
     //       ),
@@ -290,7 +288,10 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
                           },
                           child: Padding(
                             padding: EdgeInsets.all(12),
-                            child: Image.asset("images/person.png",width: 24,),
+                            child: Image.asset(
+                              "images/person.png",
+                              width: 24,
+                            ),
                           ),
                         ),
                   ),
@@ -312,7 +313,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
                     },
                     child: Padding(
                       padding: EdgeInsets.all(12),
-                      child: Image.asset("images/setting.png",width: 24),
+                      child: Image.asset("images/setting.png", width: 24),
                     ),
                   ),
                 ),
@@ -419,11 +420,10 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
                     "images/shoppingmall.png",
                     39,
                     onTapHomeMenu: () {
-                       Navigator.push(
+                      Navigator.push(
                           context,
                           new CupertinoPageRoute(
                               builder: (context) => new ShoppingMall()));
-                      
                     },
                   ),
                 ],
@@ -436,11 +436,20 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
   }
 
   List<Widget> _moneyList() {
-        double height = MediaQuery.of(context).size.height;
+    double height = MediaQuery.of(context).size.height;
     List<Widget> _list = [];
 
     String bouns = (seasonList[nowIndex].competitionSeason.bonus / 1000)
         .toStringAsFixed(1);
+
+    // String bouns = (900000000100 / 1000).toStringAsFixed(1);
+    // print(bouns);
+    // print(bouns.indexOf('.0'));
+    if (bouns.indexOf('.0') != -1 || num.parse(bouns) > 999) {
+      bouns = bouns.substring(0, bouns.length - 2);
+    }
+    print(bouns);
+
     List<String> _bounsList = bouns.split('');
     List<String> _imageList = [];
     for (var item in _bounsList) {
@@ -488,28 +497,33 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
 
     for (var item in _imageList) {
       if (item != '.') {
-        _list.add(Image.asset(item, height:  0.18*0.64 * (height - 334)));
-         _list.add(Container(width: 5));
+        if (_imageList.length > 4) {
+          double _scale = 1 - (_imageList.length - 4) * 0.2;
+          _list.add(
+              Image.asset(item, height: 0.18 * 0.64 * (height - 334) * _scale));
+        } else {
+          _list.add(Image.asset(item, height: 0.18 * 0.64 * (height - 334)));
+        }
+
+        _list.add(Container(width: 5));
       } else {
         _list.add(Text(
           ".",
           style: TextStyle(
-            color: Colors.white,
-            fontSize: 36,
-            fontFamily: 'DINEngschrift',
-            height: 0
-          ),
+              color: Colors.white,
+              fontSize: 36,
+              fontFamily: 'DINEngschrift',
+              height: 0),
         ));
       }
     }
     _list.add(Text(
       "K",
       style: TextStyle(
-        color: Colors.white,
-        fontSize: 24,
-        fontFamily: 'DINEngschrift',
-        height: .5
-      ),
+          color: Colors.white,
+          fontSize: 24,
+          fontFamily: 'DINEngschrift',
+          height: .5),
     ));
     return _list;
   }