minor updates to contact wiring

This commit is contained in:
erinn 2021-02-10 13:04:49 -08:00
parent 267b331614
commit 9978aa13b5
5 changed files with 12 additions and 11 deletions

Binary file not shown.

View File

@ -87,16 +87,17 @@ class ContactListState extends ChangeNotifier {
ContactListState(Cwtch cwtch, String profileOnion) {
cwtch.GetContacts(profileOnion).then((jsonStr) {
print("contacts: " + jsonStr);
List<dynamic> contacts = jsonDecode(jsonStr);
contacts.forEach((onion) {
contacts.forEach((c) {
add(ContactInfoState(
profileOnion: profileOnion,
onion: onion,
nickname: "fay quen",
onion: c["onion"],
nickname: c["name"],
isGroup: false,
isInvitation: false,
isBlocked: false,
status: "",
status: c["status"],
imagePath: "",
));
});

View File

@ -41,7 +41,7 @@ class _ContactsViewState extends State<ContactsView> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Provider.of<ProfileInfoState>(context).nickname + '\'s contacts'),
title: Text(Provider.of<ProfileInfoState>(context).nickname ?? Provider.of<ProfileInfoState>(context).onion ?? '' + '\'s contacts'),
actions: [
IconButton(icon: Icon(Icons.copy), onPressed: _copyOnion,),
],
@ -102,10 +102,10 @@ class _ContactsViewState extends State<ContactsView> {
void _pushMessageView(String handle) {
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (BuildContext context) {
return Provider(
create: (_) => Provider.of<FlwtchState>(context),
child: MessageView(profile: Provider.of<ProfileInfoState>(context), conversationHandle: handle),
builder: (BuildContext builderContext) {
return MultiProvider(
providers: [ChangeNotifierProvider<ProfileInfoState>(create: (_) => Provider.of<ProfileInfoState>(context)),],
child: MessageView(conversationHandle: handle),
);
},
),

View File

@ -24,7 +24,7 @@ class _TripleColumnViewState extends State<TripleColumnView> {
),
Flexible(
flex: flwtch.columns[1],
child: flwtch.selectedProfile == null ? Center(child:Text("pick a profile")) : ContactsView(profile:flwtch.selectedProfile),
child: flwtch.selectedProfile == null ? Center(child:Text("pick a profile")) : ContactsView(),
),
Flexible(
flex: flwtch.columns[2],

View File

@ -256,4 +256,4 @@ packages:
version: "0.1.2"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.16.0 <2.0.0"
flutter: ">=1.16.0"