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';
|
2023-03-15 19:40:42 +01:00
|
|
|
import 'package:gecko/providers/wallets_profiles.dart';
|
2022-12-07 23:10:28 +01:00
|
|
|
import 'package:gecko/widgets/bottom_app_bar.dart';
|
2022-12-10 08:16:38 +01:00
|
|
|
import 'package:gecko/widgets/commons/offline_info.dart';
|
2022-12-09 03:36:46 +01:00
|
|
|
import 'package:gecko/widgets/contacts_list.dart';
|
2023-03-15 19:40:42 +01:00
|
|
|
import 'package:provider/provider.dart';
|
2022-08-14 20:02:02 +02:00
|
|
|
|
|
|
|
class ContactsScreen extends StatelessWidget {
|
|
|
|
const ContactsScreen({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-03-15 19:40:42 +01:00
|
|
|
Provider.of<WalletsProfilesProvider>(context, listen: true);
|
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
|
|
|
|
2023-03-15 18:31:55 +01:00
|
|
|
// Order contacts by username
|
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: [
|
2023-03-15 19:40:42 +01:00
|
|
|
ContactsList(myContacts: myContacts, avatarSize: avatarSize),
|
2022-12-10 08:16:38 +01:00
|
|
|
const OfflineInfo(),
|
2022-08-14 20:02:02 +02:00
|
|
|
]),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|