|
@@ -1,5 +1,6 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:taskservice/Common/JXColors.dart';
|
|
|
+import 'package:taskservice/Model/JXMemberModel.dart';
|
|
|
|
|
|
void main() {
|
|
|
runApp(MyApp());
|
|
@@ -45,31 +46,102 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
// 参数
|
|
|
/*空白区域键盘消失控制*/
|
|
|
FocusNode blankNode = FocusNode();
|
|
|
+
|
|
|
/*搜索值*/
|
|
|
String _searchText;
|
|
|
|
|
|
+ /*tableView*/
|
|
|
+ List<JXMemberModel> _datasource = List();
|
|
|
+
|
|
|
/*筛选列表数据*/
|
|
|
void filterListView() {
|
|
|
print('筛选:$_searchText');
|
|
|
String text = _searchText;
|
|
|
-
|
|
|
}
|
|
|
- /*显示列表*/
|
|
|
- List<Widget> theCellData() {
|
|
|
- List<Widget> widgets = [];
|
|
|
- for (int i = 0; i < 100; i++) {
|
|
|
- widgets.add(
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.all(10.0),
|
|
|
- child: Text("Row $i"),
|
|
|
- )
|
|
|
- );
|
|
|
- }
|
|
|
- return widgets;
|
|
|
+
|
|
|
+ /*cell*/
|
|
|
+ Widget theCellBuilder(BuildContext context, int row) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ print('click cell, row:$row');
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ height: 92.0,
|
|
|
+ alignment: Alignment.topCenter,
|
|
|
+ child: Container(
|
|
|
+ height: 80.0,
|
|
|
+ alignment: Alignment.center,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: JXColors.kFFFFFF,
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
|
|
+ border: Border(
|
|
|
+ bottom: BorderSide(
|
|
|
+ color: JXColors.kE6E6E6,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: <Widget>[
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.only(left: 12.0, right: 12.0),
|
|
|
+ height: 30.0,
|
|
|
+ alignment: Alignment.center,
|
|
|
+ color: Colors.blue,
|
|
|
+ child: Row (
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: <Widget>[
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.only(left: 12.0),
|
|
|
+ width: 80.0,
|
|
|
+ child: Text(
|
|
|
+ 'Poto',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16,
|
|
|
+ color: JXColors.k2E3032,
|
|
|
+ backgroundColor: JXColors.kE6E6E6,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ 'Right',
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16,
|
|
|
+ color: JXColors.k2E3032,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.only(left: 24, right: 12),
|
|
|
+ child: Text(
|
|
|
+ '任务',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16,
|
|
|
+ color: JXColors.k2E3032,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
+ JXMemberModel model = JXMemberModel();
|
|
|
+ model.name = 'Poto';
|
|
|
+ model.tel = '1560000';
|
|
|
+ model.addr = '详细地址';
|
|
|
+ _datasource.add(model);
|
|
|
+ }
|
|
|
return GestureDetector(
|
|
|
onTap: () {
|
|
|
FocusScope.of(context).requestFocus(blankNode);
|
|
@@ -120,7 +192,14 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
flex: 1,
|
|
|
child: Container(
|
|
|
color: JXColors.kF0F0F0,
|
|
|
- child: ListView(children: theCellData()),
|
|
|
+ child: ListView.builder(
|
|
|
+ padding: EdgeInsets.only(left: 12.0, right: 12.0),
|
|
|
+ itemCount: _datasource.length,
|
|
|
+ itemExtent: 92.0,
|
|
|
+ itemBuilder: (BuildContext context, int row) {
|
|
|
+ return theCellBuilder(context, row);
|
|
|
+ },
|
|
|
+ ),
|
|
|
)),
|
|
|
Container(
|
|
|
color: JXColors.kF0F0F0,
|