Explorar el Código

提交 首页信息

lailin hace 4 años
padre
commit
f9a07789d1
Se han modificado 2 ficheros con 95 adiciones y 9 borrados
  1. 31 0
      taskservice/lib/Common/JXColors.dart
  2. 64 9
      taskservice/lib/main.dart

+ 31 - 0
taskservice/lib/Common/JXColors.dart

@@ -0,0 +1,31 @@
+import 'package:flutter/material.dart';
+
+/*
+颜色统一处理
+* */
+class JXColors {
+  // white
+  static Color Color_FFFFFF = hexColor(0xFFFFFF);
+  static Color Color_F0F0F0 = hexColor(0xF0F0F0);
+  static Color Color_E6E6E6 = hexColor(0xE6E6E6);
+  static Color Color_747A7E = hexColor(0x747A7E);
+  // dark
+  static Color Color_2E3032 = hexColor(0x2E3032);
+  static Color Color_101E40 = hexColor(0x101E40);
+  static Color Color_1F2529 = hexColor(0x1F2529);
+
+  /// 十六进制颜色,
+  /// hex, 十六进制值,例如:0xffffff,
+  /// alpha, 透明度 [0.0,1.0]
+  static Color hexColor(int hex,{double alpha = 1}){
+    if (alpha < 0){
+      alpha = 0;
+    }else if (alpha > 1){
+      alpha = 1;
+    }
+    return Color.fromRGBO((hex & 0xFF0000) >> 16 ,
+        (hex & 0x00FF00) >> 8,
+        (hex & 0x0000FF) >> 0,
+        alpha);
+  }
+}

+ 64 - 9
taskservice/lib/main.dart

@@ -1,4 +1,5 @@
 import 'package:flutter/material.dart';
+import 'package:taskservice/Common/JXColors.dart';
 
 void main() {
   runApp(MyApp());
@@ -9,7 +10,7 @@ class MyApp extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return MaterialApp(
-      title: 'Flutter Demo',
+      title: 'JXZS',
       theme: ThemeData(
         // This is the theme of your application.
         //
@@ -26,7 +27,7 @@ class MyApp extends StatelessWidget {
         // closer together (more dense) than on mobile platforms.
         visualDensity: VisualDensity.adaptivePlatformDensity,
       ),
-      home: MyHomePage(title: 'Flutter Demo Home Page'),
+      home: MyHomePage(title: '吉祥之舍'),
     );
   }
 }
@@ -77,7 +78,7 @@ class _MyHomePageState extends State<MyHomePage> {
         // the App.build method, and use it to set our appbar title.
         title: Text(widget.title),
       ),
-      body: Center(
+      body: SafeArea(
         // Center is a layout widget. It takes a single child and positions it
         // in the middle of the parent.
         child: Column(
@@ -95,14 +96,68 @@ class _MyHomePageState extends State<MyHomePage> {
           // center the children vertically; the main axis here is the vertical
           // axis because Columns are vertical (the cross axis would be
           // horizontal).
-          mainAxisAlignment: MainAxisAlignment.center,
+          mainAxisAlignment: MainAxisAlignment.start,
           children: <Widget>[
-            Text(
-              'You have pushed the button this many times:',
+            Container(
+              color: JXColors.Color_F0F0F0,
+              alignment: Alignment.center,
+              padding: EdgeInsets.fromLTRB(12.0, 4.0, 12.0, 4.0),
+              height: 50.0,
+              child: Row(children: <Widget>[
+                Container(
+                  width: 44.0,
+                  child: Icon(
+                    Icons.search,
+                    size: 30.0,
+                  )
+                ),
+                Expanded(
+                  child: TextField(
+                    obscureText: true,
+                    cursorColor: JXColors.Color_1F2529,
+                    decoration: InputDecoration(
+                      border: OutlineInputBorder(),
+                      labelText: 'Password',
+                    ),
+                  ),
+                ),
+              ]
+              )
             ),
-            Text(
-              '$_counter',
-              style: Theme.of(context).textTheme.headline4,
+            Expanded(
+              flex: 1,
+              child: Container(
+                color: Colors.blue,
+              )
+            ),
+            Container(
+              color: Colors.red,
+              height: 44.0,
+              child: Row(children: <Widget>[
+                Expanded(
+                  child: FlatButton(
+                    onPressed: (){
+                      print('新建会员');
+                    },
+                    padding: EdgeInsets.all(0),
+                    color: JXColors.Color_FFFFFF,
+                    textColor: JXColors.Color_1F2529,
+                    child: const Text('新建会员', style: TextStyle(fontSize: 14)),
+                  ),
+                ),
+                Expanded(
+                  child: FlatButton(
+                    onPressed: (){
+                      print('会员列表');
+                    },
+                    padding: EdgeInsets.all(0),
+                    color: JXColors.Color_1F2529,
+                    textColor: JXColors.Color_FFFFFF,
+                    child: const Text('会员列表', style: TextStyle(fontSize: 14)),
+                  ),
+                ),
+              ],
+              ),
             ),
           ],
         ),