64 lines
2.1 KiB
Dart
64 lines
2.1 KiB
Dart
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<AccountPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20.0),
|
|
child: ListView(
|
|
children: [
|
|
Consumer<AuthAPI>(builder: (context, account, child) {
|
|
return ListTile(
|
|
leading: Icon(Icons.person),
|
|
title: Text("Account"),
|
|
trailing: Text("${account.username}"),
|
|
);
|
|
}),
|
|
Consumer<DatabaseAPI>(builder: (context, entries, child) {
|
|
return ListTile(
|
|
leading: Icon(Icons.edit_note),
|
|
title: Text("Entries"),
|
|
trailing: Text("${entries.total()}"),
|
|
);
|
|
}),
|
|
Consumer<CategoriesAPI>(builder: (context, categories, child) {
|
|
return ListTile(
|
|
leading: Icon(Icons.category),
|
|
title: Text("Categories"),
|
|
trailing: Text("${categories.total}"),
|
|
);
|
|
}),
|
|
Center(
|
|
child: Consumer<AuthAPI>(
|
|
builder: (context, account, child) {
|
|
return OutlinedButton.icon(
|
|
onPressed: () => account.signOut(),
|
|
icon: Icon(Icons.logout),
|
|
label: Text("Log out"),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|