78 lines
2.5 KiB
Dart
78 lines
2.5 KiB
Dart
|
|
import 'package:chatting/chatting_item_page.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:chatting/chatting_data_page.dart';
|
||
|
|
import 'package:chatting/chatting_build_page.dart';
|
||
|
|
|
||
|
|
|
||
|
|
class ChattingPage extends StatefulWidget {
|
||
|
|
@override
|
||
|
|
_ChattingPageState createState() => _ChattingPageState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _ChattingPageState extends State<ChattingPage> {
|
||
|
|
//渲染某个菜单项,传入菜单标题,图片路径或图标
|
||
|
|
_popupMenuitem(String title, IconData icon) {
|
||
|
|
return PopupMenuItem(
|
||
|
|
child: Row(
|
||
|
|
children: <Widget>[
|
||
|
|
icon != null
|
||
|
|
? Icon(icon)
|
||
|
|
: SizedBox(
|
||
|
|
width: 32.0,
|
||
|
|
height: 32.0,
|
||
|
|
child: Icon(
|
||
|
|
icon,
|
||
|
|
color: Colors.white,
|
||
|
|
)),
|
||
|
|
Container(
|
||
|
|
padding: const EdgeInsets.only(left: 20.0),
|
||
|
|
child: Text(title, style: TextStyle(color: Colors.white)))
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Scaffold(
|
||
|
|
appBar: AppBar(
|
||
|
|
title: Text("微信"),
|
||
|
|
elevation: 0.0, //不需要阴影
|
||
|
|
actions: <Widget>[
|
||
|
|
GestureDetector(
|
||
|
|
onTap: () {
|
||
|
|
//跳转只搜索页
|
||
|
|
Navigator.pushNamed(context, 'search');
|
||
|
|
},
|
||
|
|
//搜索图标
|
||
|
|
child: Icon(Icons.search),
|
||
|
|
),
|
||
|
|
Padding(
|
||
|
|
//左右内边距
|
||
|
|
padding: const EdgeInsets.only(left: 30.0, right: 30.0),
|
||
|
|
child: GestureDetector(
|
||
|
|
onTap: () {
|
||
|
|
//弹出菜单
|
||
|
|
showMenu(
|
||
|
|
context: context,
|
||
|
|
position: RelativeRect.fromLTRB(500.0, 76.0, 5.0, 0.0),
|
||
|
|
items: <PopupMenuEntry>[
|
||
|
|
_popupMenuitem('发起会话',
|
||
|
|
IconData(0xe606, fontFamily: 'appIconFonts')),
|
||
|
|
_popupMenuitem('添加好友',
|
||
|
|
IconData(0xe638, fontFamily: 'appIconFonts')),
|
||
|
|
_popupMenuitem('扫一扫',
|
||
|
|
IconData(0xe79b, fontFamily: 'appIconFonts')),
|
||
|
|
_popupMenuitem('首付款',
|
||
|
|
IconData(0xe658, fontFamily: 'appIconFonts')),
|
||
|
|
]);
|
||
|
|
},
|
||
|
|
child: Icon(Icons.add),
|
||
|
|
))
|
||
|
|
],
|
||
|
|
),
|
||
|
|
body: ChattingBuildPage()
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|