main.dart 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. import 'package:flutter/material.dart';
  2. import 'package:taskservice/Common/JXColors.dart';
  3. void main() {
  4. runApp(MyApp());
  5. }
  6. class MyApp extends StatelessWidget {
  7. // This widget is the root of your application.
  8. @override
  9. Widget build(BuildContext context) {
  10. return MaterialApp(
  11. title: 'JXZS',
  12. theme: ThemeData(
  13. // This is the theme of your application.
  14. //
  15. // Try running your application with "flutter run". You'll see the
  16. // application has a blue toolbar. Then, without quitting the app, try
  17. // changing the primarySwatch below to Colors.green and then invoke
  18. // "hot reload" (press "r" in the console where you ran "flutter run",
  19. // or simply save your changes to "hot reload" in a Flutter IDE).
  20. // Notice that the counter didn't reset back to zero; the application
  21. // is not restarted.
  22. primarySwatch: Colors.blue,
  23. // This makes the visual density adapt to the platform that you run
  24. // the app on. For desktop platforms, the controls will be smaller and
  25. // closer together (more dense) than on mobile platforms.
  26. visualDensity: VisualDensity.adaptivePlatformDensity,
  27. ),
  28. home: MyHomePage(title: '吉祥之舍'),
  29. );
  30. }
  31. }
  32. class MyHomePage extends StatefulWidget {
  33. MyHomePage({Key key, this.title}) : super(key: key);
  34. // This widget is the home page of your application. It is stateful, meaning
  35. // that it has a State object (defined below) that contains fields that affect
  36. // how it looks.
  37. // This class is the configuration for the state. It holds the values (in this
  38. // case the title) provided by the parent (in this case the App widget) and
  39. // used by the build method of the State. Fields in a Widget subclass are
  40. // always marked "final".
  41. final String title;
  42. @override
  43. _MyHomePageState createState() => _MyHomePageState();
  44. }
  45. class _MyHomePageState extends State<MyHomePage> {
  46. int _counter = 0;
  47. void _incrementCounter() {
  48. setState(() {
  49. // This call to setState tells the Flutter framework that something has
  50. // changed in this State, which causes it to rerun the build method below
  51. // so that the display can reflect the updated values. If we changed
  52. // _counter without calling setState(), then the build method would not be
  53. // called again, and so nothing would appear to happen.
  54. _counter++;
  55. });
  56. }
  57. @override
  58. Widget build(BuildContext context) {
  59. // This method is rerun every time setState is called, for instance as done
  60. // by the _incrementCounter method above.
  61. //
  62. // The Flutter framework has been optimized to make rerunning build methods
  63. // fast, so that you can just rebuild anything that needs updating rather
  64. // than having to individually change instances of widgets.
  65. return Scaffold(
  66. appBar: AppBar(
  67. // Here we take the value from the MyHomePage object that was created by
  68. // the App.build method, and use it to set our appbar title.
  69. title: Text(widget.title),
  70. ),
  71. body: SafeArea(
  72. // Center is a layout widget. It takes a single child and positions it
  73. // in the middle of the parent.
  74. child: Column(
  75. // Column is also a layout widget. It takes a list of children and
  76. // arranges them vertically. By default, it sizes itself to fit its
  77. // children horizontally, and tries to be as tall as its parent.
  78. //
  79. // Invoke "debug painting" (press "p" in the console, choose the
  80. // "Toggle Debug Paint" action from the Flutter Inspector in Android
  81. // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
  82. // to see the wireframe for each widget.
  83. //
  84. // Column has various properties to control how it sizes itself and
  85. // how it positions its children. Here we use mainAxisAlignment to
  86. // center the children vertically; the main axis here is the vertical
  87. // axis because Columns are vertical (the cross axis would be
  88. // horizontal).
  89. mainAxisAlignment: MainAxisAlignment.start,
  90. children: <Widget>[
  91. Container(
  92. color: JXColors.Color_F0F0F0,
  93. alignment: Alignment.center,
  94. padding: EdgeInsets.fromLTRB(12.0, 4.0, 12.0, 4.0),
  95. height: 50.0,
  96. child: Row(children: <Widget>[
  97. Container(
  98. width: 44.0,
  99. child: Icon(
  100. Icons.search,
  101. size: 30.0,
  102. )
  103. ),
  104. Expanded(
  105. child: TextField(
  106. obscureText: true,
  107. cursorColor: JXColors.Color_1F2529,
  108. decoration: InputDecoration(
  109. border: OutlineInputBorder(),
  110. labelText: 'Password',
  111. ),
  112. ),
  113. ),
  114. ]
  115. )
  116. ),
  117. Expanded(
  118. flex: 1,
  119. child: Container(
  120. color: Colors.blue,
  121. )
  122. ),
  123. Container(
  124. color: Colors.red,
  125. height: 44.0,
  126. child: Row(children: <Widget>[
  127. Expanded(
  128. child: FlatButton(
  129. onPressed: (){
  130. print('新建会员');
  131. },
  132. padding: EdgeInsets.all(0),
  133. color: JXColors.Color_FFFFFF,
  134. textColor: JXColors.Color_1F2529,
  135. child: const Text('新建会员', style: TextStyle(fontSize: 14)),
  136. ),
  137. ),
  138. Expanded(
  139. child: FlatButton(
  140. onPressed: (){
  141. print('会员列表');
  142. },
  143. padding: EdgeInsets.all(0),
  144. color: JXColors.Color_1F2529,
  145. textColor: JXColors.Color_FFFFFF,
  146. child: const Text('会员列表', style: TextStyle(fontSize: 14)),
  147. ),
  148. ),
  149. ],
  150. ),
  151. ),
  152. ],
  153. ),
  154. ),
  155. floatingActionButton: FloatingActionButton(
  156. onPressed: _incrementCounter,
  157. tooltip: 'Increment',
  158. child: Icon(Icons.add),
  159. ), // This trailing comma makes auto-formatting nicer for build methods.
  160. );
  161. }
  162. }