import 'package:flutter/material.dart'; import 'package:matrix/matrix.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:zenith/zenith_client_provider.dart'; class ChatsPage extends StatefulWidget { const ChatsPage({super.key}); @override State createState() => _ChatsPageState(); } class _ChatsPageState extends State { final serverController = TextEditingController(); final usernameController = TextEditingController(); final passwordController = TextEditingController(); late Client client; bool roomsLoading = false; @override void initState() { super.initState(); client = Provider.of(context, listen: false).client; client.onRoomState.stream.listen((event) { print(event.type); }); } void sendMessage() {} @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: const Text("Zenith"), ), body: Padding( padding: const EdgeInsets.all(16.0), child: Center( child: roomsLoading ? const CircularProgressIndicator() : Column( mainAxisAlignment: MainAxisAlignment.center, children: [Text("${client.rooms.length} Rooms.")], ), ), ), floatingActionButton: FloatingActionButton( onPressed: sendMessage, tooltip: 'Send message', child: const Icon(Icons.send), ), ); } }