2022-08-14 20:02:02 +02:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2022-11-30 05:22:37 +01:00
|
|
|
|
2022-08-14 20:02:02 +02:00
|
|
|
import 'package:gecko/globals.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:gecko/providers/duniter_indexer.dart';
|
|
|
|
import 'package:gecko/providers/wallets_profiles.dart';
|
|
|
|
import 'package:gecko/screens/common_elements.dart';
|
2022-12-07 23:10:28 +01:00
|
|
|
import 'package:gecko/widgets/bottom_app_bar.dart';
|
2022-12-09 03:36:46 +01:00
|
|
|
import 'package:gecko/widgets/contacts_list.dart';
|
2022-08-14 20:02:02 +02:00
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
class ContactsScreen extends StatelessWidget {
|
|
|
|
const ContactsScreen({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
WalletsProfilesProvider walletsProfilesClass =
|
2022-08-14 22:16:46 +02:00
|
|
|
Provider.of<WalletsProfilesProvider>(context, listen: true);
|
2022-11-30 05:42:08 +01:00
|
|
|
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
2022-08-14 20:02:02 +02:00
|
|
|
double avatarSize = 55;
|
|
|
|
final myContacts = contactsBox.toMap().values.toList();
|
2022-08-14 22:16:46 +02:00
|
|
|
|
|
|
|
myContacts.sort((p1, p2) {
|
|
|
|
return Comparable.compare(p1.username?.toLowerCase() ?? 'zz',
|
|
|
|
p2.username?.toLowerCase() ?? 'zz');
|
|
|
|
});
|
2022-08-14 20:02:02 +02:00
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: backgroundColor,
|
|
|
|
appBar: AppBar(
|
|
|
|
elevation: 1,
|
|
|
|
toolbarHeight: 60 * ratio,
|
|
|
|
title: SizedBox(
|
|
|
|
height: 22,
|
|
|
|
child: Text(
|
|
|
|
'contactsManagementWithNbr'.tr(args: ['${myContacts.length}'])),
|
|
|
|
),
|
|
|
|
),
|
2022-12-07 23:10:28 +01:00
|
|
|
bottomNavigationBar: const GeckoBottomAppBar(),
|
2022-08-14 20:02:02 +02:00
|
|
|
body: SafeArea(
|
|
|
|
child: Stack(children: [
|
2022-12-09 03:36:46 +01:00
|
|
|
ContactsList(
|
|
|
|
myContacts: myContacts,
|
|
|
|
avatarSize: avatarSize,
|
|
|
|
walletsProfilesClass: walletsProfilesClass,
|
|
|
|
duniterIndexer: duniterIndexer),
|
2022-08-14 20:02:02 +02:00
|
|
|
CommonElements().offlineInfo(context),
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|