main.dart 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. import 'package:flutter/material.dart';
  2. import 'package:taskservice/Common/JXColors.dart';
  3. import 'package:taskservice/src/crtacc/page_crtacc.dart';
  4. void main() {
  5. runApp(MyApp());
  6. }
  7. class MyApp extends StatelessWidget {
  8. // This widget is the root of your application.
  9. @override
  10. Widget build(BuildContext context) {
  11. return MaterialApp(
  12. title: 'JXZS',
  13. theme: ThemeData(
  14. // This is the theme of your application.
  15. //
  16. // Try running your application with "flutter run". You'll see the
  17. // application has a blue toolbar. Then, without quitting the app, try
  18. // changing the primarySwatch below to Colors.green and then invoke
  19. // "hot reload" (press "r" in the console where you ran "flutter run",
  20. // or simply save your changes to "hot reload" in a Flutter IDE).
  21. // Notice that the counter didn't reset back to zero; the application
  22. // is not restarted.
  23. primarySwatch: Colors.blue,
  24. // This makes the visual density adapt to the platform that you ru
  25. // the app on. For desktop platforms, the controls will be smaller and
  26. // closer together (more dense) than on mobile platforms.
  27. visualDensity: VisualDensity.adaptivePlatformDensity,
  28. ),
  29. home: CreateAccPage(),
  30. );
  31. }
  32. }
  33. class MyHomePage extends StatefulWidget {
  34. MyHomePage({Key key, this.title}) : super(key: key);
  35. final String title;
  36. @override
  37. _MyHomePageState createState() => _MyHomePageState();
  38. }
  39. class _MyHomePageState extends State<MyHomePage> {
  40. // 参数
  41. /*空白区域键盘消失控制*/
  42. FocusNode blankNode = FocusNode();
  43. /*搜索值*/
  44. String _searchText;
  45. /*筛选列表数据*/
  46. void filterListView() {
  47. print('筛选:$_searchText');
  48. String text = _searchText;
  49. }
  50. /*显示列表*/
  51. List<Widget> theCellData() {
  52. List<Widget> widgets = [];
  53. for (int i = 0; i < 100; i++) {
  54. widgets.add(
  55. Padding(
  56. padding: EdgeInsets.all(10.0),
  57. child: Text("Row $i"),
  58. )
  59. );
  60. }
  61. return widgets;
  62. }
  63. @override
  64. Widget build(BuildContext context) {
  65. return GestureDetector(
  66. onTap: () {
  67. FocusScope.of(context).requestFocus(blankNode);
  68. },
  69. child: Scaffold(
  70. appBar: AppBar(
  71. title: Text(widget.title),
  72. ),
  73. body: SafeArea(
  74. child: Column(
  75. mainAxisAlignment: MainAxisAlignment.start,
  76. children: <Widget>[
  77. Container(
  78. color: JXColors.kF0F0F0,
  79. alignment: Alignment.center,
  80. padding: EdgeInsets.fromLTRB(12.0, 4.0, 12.0, 4.0),
  81. height: 50.0,
  82. child: Row(children: <Widget>[
  83. Container(
  84. width: 44.0,
  85. child: Icon(
  86. Icons.search,
  87. size: 24.0,
  88. )),
  89. Expanded(
  90. child: TextField(
  91. focusNode: blankNode,
  92. obscureText: false,
  93. cursorColor: JXColors.k1F2529,
  94. decoration: InputDecoration(
  95. border: InputBorder.none,
  96. hintText: '快速筛选',
  97. labelStyle: TextStyle(
  98. color: JXColors.k2E3032,
  99. fontSize: 18,
  100. ),
  101. ),
  102. onSubmitted: (value) {
  103. setState(() {
  104. _searchText = value;
  105. });
  106. filterListView();
  107. },
  108. ),
  109. ),
  110. ])),
  111. Expanded(
  112. flex: 1,
  113. child: Container(
  114. color: JXColors.kF0F0F0,
  115. child: ListView(children: theCellData()),
  116. )),
  117. Container(
  118. color: JXColors.kF0F0F0,
  119. height: 44.0,
  120. child: Row(
  121. children: <Widget>[
  122. Expanded(
  123. child: FlatButton(
  124. onPressed: () {
  125. print('新建会员');
  126. },
  127. padding: EdgeInsets.all(0),
  128. color: JXColors.kFFFFFF,
  129. textColor: JXColors.k1F2529,
  130. child: const Text('新建会员',
  131. style: TextStyle(fontSize: 14)),
  132. ),
  133. ),
  134. Expanded(
  135. child: FlatButton(
  136. onPressed: () {
  137. print('会员列表');
  138. },
  139. padding: EdgeInsets.all(0),
  140. color: JXColors.k1F2529,
  141. textColor: JXColors.kFFFFFF,
  142. child: const Text('会员列表',
  143. style: TextStyle(fontSize: 14)),
  144. ),
  145. ),
  146. ],
  147. ),
  148. ),
  149. ],
  150. ),
  151. ),
  152. ));
  153. }
  154. }