contactsview cleanup
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
1259574c55
commit
0c421eec1a
|
@ -1,8 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_app/views/torstatusview.dart';
|
||||||
import 'package:flutter_app/widgets/contactrow.dart';
|
import 'package:flutter_app/widgets/contactrow.dart';
|
||||||
import 'package:flutter_app/widgets/profileimage.dart';
|
import 'package:flutter_app/widgets/profileimage.dart';
|
||||||
import 'package:flutter_app/widgets/textfield.dart';
|
import 'package:flutter_app/widgets/textfield.dart';
|
||||||
|
import 'package:flutter_app/widgets/tor_icon.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import '../main.dart';
|
||||||
import '../settings.dart';
|
import '../settings.dart';
|
||||||
import 'addcontactview.dart';
|
import 'addcontactview.dart';
|
||||||
import '../model.dart';
|
import '../model.dart';
|
||||||
|
@ -45,14 +48,11 @@ class _ContactsViewState extends State<ContactsView> {
|
||||||
)), //todo
|
)), //todo
|
||||||
]),
|
]),
|
||||||
actions: [
|
actions: [
|
||||||
|
IconButton(icon: TorIcon(), onPressed: _pushTorStatus),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.copy),
|
icon: Icon(Icons.copy),
|
||||||
onPressed: _copyOnion,
|
onPressed: _copyOnion,
|
||||||
),
|
),
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.bug_report),
|
|
||||||
onPressed: _debugFakeMessage,
|
|
||||||
),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
// need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset
|
// 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),
|
icon: Icon(showSearchBar || Provider.of<ContactListState>(context).isFiltered ? Icons.search_off : Icons.search),
|
||||||
|
@ -74,14 +74,13 @@ class _ContactsViewState extends State<ContactsView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFilterable() {
|
Widget _buildFilterable() {
|
||||||
//todo: translate
|
|
||||||
Widget txtfield = CwtchTextField(
|
Widget txtfield = CwtchTextField(
|
||||||
controller: ctrlrFilter,
|
controller: ctrlrFilter,
|
||||||
labelText: AppLocalizations.of(context).search,
|
labelText: AppLocalizations.of(context).search,
|
||||||
onChanged: (newVal) {
|
onChanged: (newVal) {
|
||||||
Provider.of<ContactListState>(context, listen: false).filter = 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() {
|
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() {
|
void _copyOnion() {
|
||||||
final snackBar = SnackBar(content: Text(AppLocalizations.of(context).copiedClipboardNotification)); //todo
|
final snackBar = SnackBar(content: Text(AppLocalizations.of(context).copiedClipboardNotification)); //todo
|
||||||
// Find the Scaffold in the widget tree and use it to show a SnackBar.
|
// Find the Scaffold in the widget tree and use it to show a SnackBar.
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _debugFakeMessage() {
|
|
||||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact("44pknjvf4ju46nbuyn5getuayb6dj6z6zoppl56syn7pmscptoahlaid").unreadMessages++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue