Skip to content
Snippets Groups Projects
Commit c6a7474c authored by poka's avatar poka
Browse files

improve contact management

parent 9d63e6e5
Branches
Tags
No related merge requests found
Pipeline #18999 waiting for manual action
...@@ -142,12 +142,13 @@ class WalletsProfilesProvider with ChangeNotifier { ...@@ -142,12 +142,13 @@ class WalletsProfilesProvider with ChangeNotifier {
// log.d(profile.username); // log.d(profile.username);
if (isContact(profile.address)) { if (isContact(profile.address)) {
await contactsBox.delete(profile.address); await contactsBox.delete(profile.address);
snackMessage(homeContext, message: 'removedFromcontacts'.tr()); snackMessage(homeContext,
message: 'removedFromcontacts'.tr(), duration: 4);
} else { } else {
centerController.play(); centerController.play();
await contactsBox.put(profile.address, profile); await contactsBox.put(profile.address, profile);
// drawStar(Size(50, 50)); // drawStar(Size(50, 50));
snackMessage(homeContext, message: 'addedToContacts'.tr()); snackMessage(homeContext, message: 'addedToContacts'.tr(), duration: 4);
} }
notifyListeners(); notifyListeners();
} }
......
...@@ -2,15 +2,18 @@ import 'package:easy_localization/easy_localization.dart'; ...@@ -2,15 +2,18 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/widgets/bottom_app_bar.dart'; import 'package:gecko/widgets/bottom_app_bar.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/contacts_list.dart'; import 'package:gecko/widgets/contacts_list.dart';
import 'package:provider/provider.dart';
class ContactsScreen extends StatelessWidget { class ContactsScreen extends StatelessWidget {
const ContactsScreen({Key? key}) : super(key: key); const ContactsScreen({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Provider.of<WalletsProfilesProvider>(context, listen: true);
double avatarSize = 55; double avatarSize = 55;
final myContacts = contactsBox.toMap().values.toList(); final myContacts = contactsBox.toMap().values.toList();
...@@ -34,9 +37,7 @@ class ContactsScreen extends StatelessWidget { ...@@ -34,9 +37,7 @@ class ContactsScreen extends StatelessWidget {
bottomNavigationBar: const GeckoBottomAppBar(), bottomNavigationBar: const GeckoBottomAppBar(),
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
ContactsList( ContactsList(myContacts: myContacts, avatarSize: avatarSize),
myContacts: myContacts,
avatarSize: avatarSize),
const OfflineInfo(), const OfflineInfo(),
]), ]),
), ),
......
// ignore_for_file: file_names // ignore_for_file: file_names
import 'dart:math';
import 'package:confetti/confetti.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -12,10 +15,18 @@ class OnboardingStepEleven extends StatelessWidget { ...@@ -12,10 +15,18 @@ class OnboardingStepEleven extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( final conffetiController =
ConfettiController(duration: const Duration(milliseconds: 300));
conffetiController.play();
return WillPopScope(
onWillPop: () {
return Future<bool>.value(false);
},
child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio, toolbarHeight: 60 * ratio,
leading: const Icon(Icons.check),
title: SizedBox( title: SizedBox(
height: 22, height: 22,
child: Text( child: Text(
...@@ -26,9 +37,11 @@ class OnboardingStepEleven extends StatelessWidget { ...@@ -26,9 +37,11 @@ class OnboardingStepEleven extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Stack(children: [
Column(children: <Widget>[
const SizedBox(height: 40), const SizedBox(height: 40),
BuildText(text: "yourChestAndWalletWereCreatedSuccessfully".tr()), BuildText(
text: "yourChestAndWalletWereCreatedSuccessfully".tr()),
SizedBox(height: isTall ? 20 : 10), SizedBox(height: isTall ? 20 : 10),
Image.asset( Image.asset(
'assets/onBoarding/gecko-clin.gif', 'assets/onBoarding/gecko-clin.gif',
...@@ -41,7 +54,22 @@ class OnboardingStepEleven extends StatelessWidget { ...@@ -41,7 +54,22 @@ class OnboardingStepEleven extends StatelessWidget {
), ),
const SizedBox(height: 40), const SizedBox(height: 40),
]), ]),
)); Align(
alignment: Alignment.topCenter,
child: ConfettiWidget(
confettiController: conffetiController,
blastDirection: pi / 2,
maxBlastForce: 5,
minBlastForce: 1,
emissionFrequency: 0.01,
numberOfParticles: 10,
shouldLoop: false,
gravity: 0.1,
),
),
]),
)),
);
} }
} }
......
...@@ -26,7 +26,7 @@ class ContactsList extends StatelessWidget { ...@@ -26,7 +26,7 @@ class ContactsList extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletsProfilesClass = final walletsProfilesClass =
Provider.of<WalletsProfilesProvider>(context, listen: true); Provider.of<WalletsProfilesProvider>(context, listen: false);
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false); final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
return Padding( return Padding(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment