Merge pull request 'contactsview cleanup' (#91) from contactsortfilter into trunk
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: #91
This commit is contained in:
commit
3d424994cc
|
@ -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<ContactsView> {
|
|||
)), //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<ContactListState>(context).isFiltered ? Icons.search_off : Icons.search),
|
||||
|
@ -74,14 +74,13 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
}
|
||||
|
||||
Widget _buildFilterable() {
|
||||
//todo: translate
|
||||
Widget txtfield = CwtchTextField(
|
||||
controller: ctrlrFilter,
|
||||
labelText: AppLocalizations.of(context).search,
|
||||
onChanged: (newVal) {
|
||||
Provider.of<ContactListState>(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<ContactsView> {
|
|||
));
|
||||
}
|
||||
|
||||
void _pushTorStatus() {
|
||||
Navigator.of(context).push(MaterialPageRoute<void>(
|
||||
builder: (BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [Provider.value(value: Provider.of<FlwtchState>(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<ProfileInfoState>(context, listen: false).contactList.getContact("44pknjvf4ju46nbuyn5getuayb6dj6z6zoppl56syn7pmscptoahlaid").unreadMessages++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue