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) { ContactListState(Cwtch cwtch, String profileOnion) {
cwtch.GetContacts(profileOnion).then((jsonStr) { cwtch.GetContacts(profileOnion).then((jsonStr) {
print("contacts: " + jsonStr);
List<dynamic> contacts = jsonDecode(jsonStr); List<dynamic> contacts = jsonDecode(jsonStr);
contacts.forEach((onion) { contacts.forEach((c) {
add(ContactInfoState( add(ContactInfoState(
profileOnion: profileOnion, profileOnion: profileOnion,
onion: onion, onion: c["onion"],
nickname: "fay quen", nickname: c["name"],
isGroup: false, isGroup: false,
isInvitation: false, isInvitation: false,
isBlocked: false, isBlocked: false,
status: "", status: c["status"],
imagePath: "", imagePath: "",
)); ));
}); });

View File

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

View File

@ -24,7 +24,7 @@ class _TripleColumnViewState extends State<TripleColumnView> {
), ),
Flexible( Flexible(
flex: flwtch.columns[1], 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( Flexible(
flex: flwtch.columns[2], flex: flwtch.columns[2],

View File

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