import 'package:flutter/material.dart'; import 'package:ltx_flutter/appwrite/auth_api.dart'; import 'package:ltx_flutter/appwrite/database_api.dart'; import 'package:ltx_flutter/appwrite/categories_api.dart'; import 'package:provider/provider.dart'; class AccountPage extends StatefulWidget { const AccountPage({Key? key}) : super(key: key); @override _AccountPageState createState() => _AccountPageState(); } class _AccountPageState extends State { @override Widget build(BuildContext context) { return Column( children: [ Expanded( child: Padding( padding: const EdgeInsets.all(20.0), child: ListView( children: [ Consumer(builder: (context, account, child) { return ListTile( leading: Icon(Icons.person), title: Text("Account"), trailing: Text("${account.username}"), ); }), Consumer(builder: (context, entries, child) { return ListTile( leading: Icon(Icons.edit_note), title: Text("Entries"), trailing: Text("${entries.total()}"), ); }), Consumer(builder: (context, categories, child) { return ListTile( leading: Icon(Icons.category), title: Text("Categories"), trailing: Text("${categories.total}"), ); }), Center( child: Consumer( builder: (context, account, child) { return OutlinedButton.icon( onPressed: () => account.signOut(), icon: Icon(Icons.logout), label: Text("Log out"), ); }, ), ), ], ), ), ), ], ); } }