mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
fix the UI issue with address book (#1803)
Some checks failed
Cache Dependencies / test (push) Has been cancelled
Some checks failed
Cache Dependencies / test (push) Has been cancelled
This commit is contained in:
parent
ed5e701d80
commit
cf7f019a92
2 changed files with 17 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/entities/contact.dart';
|
||||
import 'package:cake_wallet/entities/contact_base.dart';
|
||||
import 'package:cake_wallet/entities/contact_record.dart';
|
||||
import 'package:cake_wallet/entities/wallet_list_order_types.dart';
|
||||
|
@ -11,14 +12,12 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
|||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
|
||||
class ContactListPage extends BasePage {
|
||||
|
@ -92,16 +91,19 @@ class ContactPageBody extends StatefulWidget {
|
|||
|
||||
class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
late ContactListViewModel contactListViewModel;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
contactListViewModel = widget.contactListViewModel;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController.dispose();
|
||||
contactListViewModel.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -306,13 +308,17 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
@override
|
||||
void dispose() {
|
||||
widget.tabController.removeListener(_handleTabChange);
|
||||
widget.contactListViewModel.dispose();
|
||||
if (widget.contactListViewModel.settingsStore.contactListOrder == FilterListOrderType.Custom) {
|
||||
widget.contactListViewModel.saveCustomOrder();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final contacts = widget.contactListViewModel.contactsToShow;
|
||||
final contacts = widget.contactListViewModel.isEditable
|
||||
? widget.contactListViewModel.contacts
|
||||
: widget.contactListViewModel.contactsToShow;
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
child: FilteredList(
|
||||
|
@ -351,8 +357,9 @@ class _ContactListBodyState extends State<ContactListBody> {
|
|||
},
|
||||
),
|
||||
),
|
||||
floatingActionButton:
|
||||
_isContactsTabActive ? filterButtonWidget(context, widget.contactListViewModel) : null,
|
||||
floatingActionButton: _isContactsTabActive && widget.contactListViewModel.isEditable
|
||||
? filterButtonWidget(context, widget.contactListViewModel)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -136,10 +136,11 @@ abstract class ContactListViewModelBase with Store {
|
|||
_currency?.tag == element.type.toString();
|
||||
}
|
||||
|
||||
void dispose() async {
|
||||
_subscription?.cancel();
|
||||
void dispose() => _subscription?.cancel();
|
||||
|
||||
void saveCustomOrder() {
|
||||
final List<Contact> contactsSourceCopy = contacts.map((e) => e.original).toList();
|
||||
await reorderContacts(contactsSourceCopy);
|
||||
reorderContacts(contactsSourceCopy);
|
||||
}
|
||||
|
||||
void reorderAccordingToContactList() =>
|
||||
|
|
Loading…
Reference in a new issue