2024-11-16 05:54:36 +00:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2024-11-13 16:08:09 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-11-16 05:54:36 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:material_symbols_icons/symbols.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:surface/providers/sn_network.dart';
|
2024-11-13 16:08:09 +00:00
|
|
|
|
2024-11-16 05:54:36 +00:00
|
|
|
class ChatScreen extends StatefulWidget {
|
2024-11-13 16:08:09 +00:00
|
|
|
const ChatScreen({super.key});
|
|
|
|
|
2024-11-16 05:54:36 +00:00
|
|
|
@override
|
|
|
|
State<ChatScreen> createState() => _ChatScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ChatScreenState extends State<ChatScreen> {
|
|
|
|
Future<void> _fetchChannels({scope = 'global', direct = false}) async {
|
|
|
|
final sn = context.read<SnNetworkProvider>();
|
|
|
|
final resp = await sn.client.get(
|
|
|
|
'/cgi/im/channels/$scope/me/available',
|
|
|
|
queryParameters: {
|
|
|
|
'direct': direct,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-11-13 16:08:09 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-11-16 05:54:36 +00:00
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text('screenChat').tr(),
|
|
|
|
),
|
|
|
|
floatingActionButton: FloatingActionButton(
|
|
|
|
child: const Icon(Symbols.chat_add_on),
|
|
|
|
onPressed: () {
|
|
|
|
GoRouter.of(context).pushNamed('chatManage');
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
2024-11-13 16:08:09 +00:00
|
|
|
}
|
|
|
|
}
|