|
@@ -23,8 +23,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
String _searchText;
|
|
String _searchText;
|
|
|
|
|
|
/*tableView*/
|
|
/*tableView*/
|
|
- List<JXMemberModel> _datasource = List();
|
|
|
|
- List<JXMemberModel> _basesource = List();
|
|
|
|
|
|
+ List<Widget> _cells = [];
|
|
|
|
+ List<JXMemberModel> _basesource = [];
|
|
|
|
|
|
@override
|
|
@override
|
|
void initState() {
|
|
void initState() {
|
|
@@ -48,7 +48,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
..tel = '186'
|
|
..tel = '186'
|
|
..addr = '广州12',
|
|
..addr = '广州12',
|
|
];
|
|
];
|
|
- _datasource = List.from(_basesource);
|
|
|
|
|
|
+
|
|
|
|
+ for(JXMemberModel model in _basesource) {
|
|
|
|
+ _cells.add(theCellBuilder(context, model));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/*筛选列表数据*/
|
|
/*筛选列表数据*/
|
|
@@ -56,7 +59,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
String text = _searchText;
|
|
String text = _searchText;
|
|
|
|
|
|
List tmpItems = [];
|
|
List tmpItems = [];
|
|
- _datasource.clear();
|
|
|
|
|
|
+ _cells.clear();
|
|
print('筛选:$_searchText');
|
|
print('筛选:$_searchText');
|
|
if (text.isEmpty) {
|
|
if (text.isEmpty) {
|
|
tmpItems.addAll(_basesource);
|
|
tmpItems.addAll(_basesource);
|
|
@@ -74,19 +77,17 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- _datasource = tmpItems;
|
|
|
|
|
|
+ for (JXMemberModel model in tmpItems) {
|
|
|
|
+ _cells.add(theCellBuilder(context, model));
|
|
|
|
+ }
|
|
setState(() {});
|
|
setState(() {});
|
|
}
|
|
}
|
|
|
|
|
|
/*cell*/
|
|
/*cell*/
|
|
- Widget theCellBuilder(BuildContext context, int row) {
|
|
|
|
- if (row >= _datasource.length) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- JXMemberModel model = _datasource[row];
|
|
|
|
|
|
+ Widget theCellBuilder(BuildContext context, JXMemberModel model) {
|
|
return GestureDetector(
|
|
return GestureDetector(
|
|
onTap: () {
|
|
onTap: () {
|
|
- print('click cell, row:$row');
|
|
|
|
|
|
+ print('click cell, name:${model.name}');
|
|
},
|
|
},
|
|
child: Container(
|
|
child: Container(
|
|
height: 92.0,
|
|
height: 92.0,
|
|
@@ -119,17 +120,18 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
Expanded(
|
|
- child: Container(
|
|
|
|
- padding: EdgeInsets.only(top: 12.0, right: 12.0),
|
|
|
|
- child: Text(
|
|
|
|
- model.tel,
|
|
|
|
- textAlign: TextAlign.right,
|
|
|
|
- style: TextStyle(
|
|
|
|
- fontSize: 16,
|
|
|
|
- color: JXColors.k2E3032,
|
|
|
|
- ),
|
|
|
|
|
|
+ child: Container(
|
|
|
|
+ padding: EdgeInsets.only(top: 12.0, right: 12.0),
|
|
|
|
+ child: Text(
|
|
|
|
+ model.tel,
|
|
|
|
+ textAlign: TextAlign.right,
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 16,
|
|
|
|
+ color: JXColors.k2E3032,
|
|
),
|
|
),
|
|
- ))
|
|
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ )
|
|
],
|
|
],
|
|
),
|
|
),
|
|
Row(
|
|
Row(
|
|
@@ -219,17 +221,18 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
Expanded(
|
|
- child: Container(
|
|
|
|
- color: JXColors.kF0F0F0,
|
|
|
|
- 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);
|
|
|
|
- },
|
|
|
|
- ),
|
|
|
|
- )),
|
|
|
|
|
|
+ child: Container(
|
|
|
|
+ color: JXColors.kF0F0F0,
|
|
|
|
+ child: ListView.builder(
|
|
|
|
+ padding: EdgeInsets.only(left: 12.0, right: 12.0),
|
|
|
|
+ itemCount: _cells.length,
|
|
|
|
+ itemExtent: 92.0,
|
|
|
|
+ itemBuilder: (BuildContext context, int row) {
|
|
|
|
+ return _cells[row];
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
Row(
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
@@ -241,7 +244,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
padding: EdgeInsets.all(0),
|
|
padding: EdgeInsets.all(0),
|
|
color: JXColors.kFFFFFF,
|
|
color: JXColors.kFFFFFF,
|
|
borderRadius: BorderRadius.all(Radius.circular(0)),
|
|
borderRadius: BorderRadius.all(Radius.circular(0)),
|
|
- child: Text('新建会员', style: TextStyle(fontSize: 14, color: JXColors.k101E40)),
|
|
|
|
|
|
+ child: Text(
|
|
|
|
+ '新建会员',
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 14,
|
|
|
|
+ color: JXColors.k101E40,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
Expanded(
|
|
@@ -252,7 +261,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
padding: EdgeInsets.all(0),
|
|
padding: EdgeInsets.all(0),
|
|
color: JXColors.k1F2529,
|
|
color: JXColors.k1F2529,
|
|
borderRadius: BorderRadius.all(Radius.circular(0)),
|
|
borderRadius: BorderRadius.all(Radius.circular(0)),
|
|
- child: Text('会员列表', style: TextStyle(fontSize: 14, color: JXColors.kFFFFFF)),
|
|
|
|
|
|
+ child: Text('会员列表',
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 14,
|
|
|
|
+ color: JXColors.kFFFFFF,
|
|
|
|
+ )),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
@@ -262,4 +275,4 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
),
|
|
),
|
|
));
|
|
));
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|