93 lines
2.9 KiB
Dart
93 lines
2.9 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:custom_pop_up_menu/custom_pop_up_menu.dart';
|
||
|
import 'package:go_router/go_router.dart';
|
||
|
import 'package:together_mobile/common/constants.dart';
|
||
|
|
||
|
class AddMenu extends StatefulWidget {
|
||
|
const AddMenu({super.key});
|
||
|
|
||
|
@override
|
||
|
State<AddMenu> createState() => _AddMenuState();
|
||
|
}
|
||
|
|
||
|
class _AddMenuState extends State<AddMenu> {
|
||
|
final CustomPopupMenuController _controller = CustomPopupMenuController();
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return CustomPopupMenu(
|
||
|
menuBuilder: () {
|
||
|
return Container(
|
||
|
decoration: BoxDecoration(
|
||
|
borderRadius: BorderRadius.circular(5.0),
|
||
|
color: Theme.of(context).brightness == Brightness.light
|
||
|
? Colors.white
|
||
|
: kUnActivatedColor,
|
||
|
),
|
||
|
width: 170,
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
children: [
|
||
|
const SizedBox(
|
||
|
height: 15,
|
||
|
),
|
||
|
GestureDetector(
|
||
|
onTap: () {
|
||
|
_controller.hideMenu();
|
||
|
context.pushNamed('CreateGroupChat');
|
||
|
},
|
||
|
behavior: HitTestBehavior.translucent,
|
||
|
child: const Padding(
|
||
|
padding: EdgeInsets.fromLTRB(20, 0, 10, 15),
|
||
|
child: Row(
|
||
|
children: [
|
||
|
Icon(
|
||
|
Icons.group_add,
|
||
|
color: Color.fromARGB(255, 117, 117, 117),
|
||
|
),
|
||
|
SizedBox(width: 10),
|
||
|
Text('创建群聊'),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
GestureDetector(
|
||
|
onTap: () {
|
||
|
_controller.hideMenu();
|
||
|
},
|
||
|
behavior: HitTestBehavior.translucent,
|
||
|
child: const Padding(
|
||
|
padding: EdgeInsets.fromLTRB(20, 0, 10, 15),
|
||
|
child: Row(
|
||
|
children: [
|
||
|
Icon(
|
||
|
Icons.person_add_alt_1,
|
||
|
color: Color.fromARGB(255, 117, 117, 117),
|
||
|
),
|
||
|
SizedBox(width: 10),
|
||
|
Text(
|
||
|
'添加好友/群聊',
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
},
|
||
|
arrowSize: 12,
|
||
|
arrowColor: Theme.of(context).brightness == Brightness.light
|
||
|
? Colors.white
|
||
|
: kUnActivatedColor,
|
||
|
verticalMargin: 5,
|
||
|
controller: _controller,
|
||
|
pressType: PressType.singleClick,
|
||
|
child: const Padding(
|
||
|
padding: EdgeInsets.symmetric(horizontal: 8),
|
||
|
child: Icon(Icons.add_circle_outline),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|