From 0c421eec1a2552eb35d0a16ff5995cf9486d53dd Mon Sep 17 00:00:00 2001 From: erinn Date: Tue, 18 May 2021 19:47:25 -0700 Subject: [PATCH] contactsview cleanup --- lib/views/contactsview.dart | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index fc0138b..cbbb85c 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -1,8 +1,11 @@ import 'package:flutter/material.dart'; +import 'package:flutter_app/views/torstatusview.dart'; import 'package:flutter_app/widgets/contactrow.dart'; import 'package:flutter_app/widgets/profileimage.dart'; import 'package:flutter_app/widgets/textfield.dart'; +import 'package:flutter_app/widgets/tor_icon.dart'; import 'package:provider/provider.dart'; +import '../main.dart'; import '../settings.dart'; import 'addcontactview.dart'; import '../model.dart'; @@ -45,14 +48,11 @@ class _ContactsViewState extends State { )), //todo ]), actions: [ + IconButton(icon: TorIcon(), onPressed: _pushTorStatus), IconButton( icon: Icon(Icons.copy), onPressed: _copyOnion, ), - IconButton( - icon: Icon(Icons.bug_report), - onPressed: _debugFakeMessage, - ), IconButton( // need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset icon: Icon(showSearchBar || Provider.of(context).isFiltered ? Icons.search_off : Icons.search), @@ -74,14 +74,13 @@ class _ContactsViewState extends State { } Widget _buildFilterable() { - //todo: translate Widget txtfield = CwtchTextField( controller: ctrlrFilter, labelText: AppLocalizations.of(context).search, onChanged: (newVal) { Provider.of(context, listen: false).filter = newVal; }); - return Column(children: [Padding(padding: EdgeInsets.all(2), child: txtfield), Expanded(child: _buildContactList())]); + return Column(children: [Padding(padding: EdgeInsets.all(8), child: txtfield), Expanded(child: _buildContactList())]); } Widget _buildContactList() { @@ -108,13 +107,20 @@ class _ContactsViewState extends State { )); } + void _pushTorStatus() { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) { + return MultiProvider( + providers: [Provider.value(value: Provider.of(context))], + child: TorStatusView(), + ); + }, + )); + } + void _copyOnion() { final snackBar = SnackBar(content: Text(AppLocalizations.of(context).copiedClipboardNotification)); //todo // Find the Scaffold in the widget tree and use it to show a SnackBar. ScaffoldMessenger.of(context).showSnackBar(snackBar); } - - void _debugFakeMessage() { - Provider.of(context, listen: false).contactList.getContact("44pknjvf4ju46nbuyn5getuayb6dj6z6zoppl56syn7pmscptoahlaid").unreadMessages++; - } }