Solian/lib/widgets/chat/channel_action.dart

35 lines
942 B
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:solian/models/channel.dart';
import 'package:solian/router.dart';
class ChannelAction extends StatelessWidget {
final Channel channel;
final Function onUpdate;
ChannelAction({super.key, required this.channel, required this.onUpdate});
final FocusNode _focusNode = FocusNode();
@override
Widget build(BuildContext context) {
2024-04-25 13:33:53 +00:00
return IconButton(
2024-04-26 15:25:56 +00:00
onPressed: () async {
final result = await router.pushNamed(
2024-04-25 13:33:53 +00:00
'chat.channel.manage',
extra: channel,
pathParameters: {'channel': channel.alias},
);
2024-04-26 15:25:56 +00:00
switch(result) {
case 'disposed':
if(router.canPop()) router.pop('refresh');
case 'refresh':
onUpdate();
}
2024-04-25 13:33:53 +00:00
},
focusNode: _focusNode,
style: TextButton.styleFrom(shape: const CircleBorder()),
icon: const Icon(Icons.more_horiz),
);
}
}