2020-06-08 10:23:58 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:chatting/contact_data_page.dart';
|
|
|
|
|
import 'package:chatting/contact_header_page.dart';
|
|
|
|
|
import 'package:chatting/contact_item_page.dart';
|
|
|
|
|
import 'package:chatting/contact_sider_list_page.dart';
|
|
|
|
|
|
|
|
|
|
//好友列表页
|
|
|
|
|
|
|
|
|
|
class ContactListPage extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_ContactListPageState createState() => _ContactListPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ContactListPageState extends State<ContactListPage> {
|
|
|
|
|
|
|
|
|
|
Color WechatThemeColor = Colors.white;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
title: Text("通讯录"),
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
leading: GestureDetector(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 15, top: 15),
|
|
|
|
|
child: Text(
|
|
|
|
|
'更多',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 20
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.push(MaterialPageRoute(builder: (BuildContext context) {
|
|
|
|
|
return null;
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
//又按钮
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
GestureDetector(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 15),
|
|
|
|
|
child: Image(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
image: AssetImage('assets/images/ic_friends_add.png'),
|
|
|
|
|
width: 28,
|
|
|
|
|
height: 25,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.push(MaterialPageRoute(builder: (BuildContext context) {
|
|
|
|
|
return null;
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],//左按钮
|
|
|
|
|
),
|
|
|
|
|
//主体的实现
|
|
|
|
|
body: ContactSiderListPage(
|
|
|
|
|
//好友列表数据
|
|
|
|
|
items: contactData,
|
|
|
|
|
//好友列表头构造器
|
|
|
|
|
headerBuilder: (BuildContext context,int index){
|
|
|
|
|
return Container(
|
|
|
|
|
//好友列表头
|
|
|
|
|
child: ContactHeaderPage(),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
//好友列表项构造器
|
|
|
|
|
itemBuilder: (BuildContext context,int index){
|
|
|
|
|
return Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
alignment: Alignment.centerLeft,
|
2020-06-09 02:03:22 +00:00
|
|
|
child: ContactItemPage(item: contactData[index],),
|
2020-06-08 10:23:58 +00:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
//字母构造器
|
|
|
|
|
sectionBuilder: (BuildContext context,int index){
|
|
|
|
|
return Container(
|
|
|
|
|
height: 32.0,
|
|
|
|
|
padding: const EdgeInsets.only(left: 14.0),
|
|
|
|
|
color: Colors.grey[300],
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
//显示字母
|
|
|
|
|
child: Text(
|
|
|
|
|
contactData[index].seationKey,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
color: Color(0xff909090)
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|