Stub for Contact Info State

This commit is contained in:
Sarah Jamie Lewis 2021-03-17 12:54:14 -07:00
parent de340b0899
commit de44be43ce
5 changed files with 76 additions and 10 deletions

View File

@ -1,5 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_app/views/peersettingsview.dart';
import 'package:provider/provider.dart';
import '../main.dart';
import '../model.dart'; import '../model.dart';
import '../opaque.dart'; import '../opaque.dart';
import '../widgets/messagelist.dart'; import '../widgets/messagelist.dart';
@ -28,10 +31,10 @@ class _MessageViewState extends State<MessageView> {
appBar: AppBar( appBar: AppBar(
title: Text(widget.conversationHandle), title: Text(widget.conversationHandle),
actions: [ actions: [
IconButton(icon: Icon(Icons.chat), onPressed: _pushConvoSettings), IconButton(icon: Icon(Icons.chat), onPressed: _pushContactSettings),
IconButton(icon: Icon(Icons.list), onPressed: _pushConvoSettings), IconButton(icon: Icon(Icons.list), onPressed: _pushContactSettings),
IconButton(icon: Icon(Icons.push_pin), onPressed: _pushConvoSettings), IconButton(icon: Icon(Icons.push_pin), onPressed: _pushContactSettings),
IconButton(icon: Icon(Icons.settings), onPressed: _pushConvoSettings), IconButton(icon: Icon(Icons.settings), onPressed: _pushContactSettings),
], ],
), ),
body: MessageList(profile: widget.profile, conversationHandle: widget.conversationHandle), body: MessageList(profile: widget.profile, conversationHandle: widget.conversationHandle),
@ -39,7 +42,23 @@ class _MessageViewState extends State<MessageView> {
); );
} }
void _pushConvoSettings() {} void _pushContactSettings() {
Navigator.of(context).push(MaterialPageRoute<void>(
builder: (BuildContext bcontext) {
if (Provider.of<FlwtchState>(context, listen: false).selectedConversation.length == 32) {
return MultiProvider(
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context))],
child: PeerSettingsView(),
);
} else {
return MultiProvider(
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context))],
child: PeerSettingsView(),
);
}
},
));
}
void _sendMessage() { void _sendMessage() {
ChatMessage cm = new ChatMessage(o: 1, d: ctrlrCompose.value.text); ChatMessage cm = new ChatMessage(o: 1, d: ctrlrCompose.value.text);

View File

@ -0,0 +1,50 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter_app/model.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/opaque.dart';
import 'package:flutter_app/settings.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../main.dart';
/// Peer Settings View Provides way to Configure .
class PeerSettingsView extends StatefulWidget {
@override
_PeerSettingsViewState createState() => _PeerSettingsViewState();
}
class _PeerSettingsViewState extends State<PeerSettingsView> {
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Provider.of<ContactInfoState>(context).onion),
),
body: _buildSettingsList(),
);
}
Widget _buildSettingsList() {
return Consumer<Settings>(builder: (context, settings, child) {
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
return Scrollbar(
isAlwaysShown: true,
child: SingleChildScrollView(
clipBehavior: Clip.antiAlias,
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: viewportConstraints.maxHeight,
),
child: Column(children: []))));
});
});
}
}

View File

@ -60,7 +60,8 @@ class _ContactRowState extends State<ContactRow> {
builder: (BuildContext builderContext) { builder: (BuildContext builderContext) {
return MultiProvider( return MultiProvider(
providers: [ providers: [
Provider.value(value: Provider.of<ProfileInfoState>(context)), ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context)),
ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context)),
], ],
child: MessageView(conversationHandle: handle), child: MessageView(conversationHandle: handle),
); );

View File

@ -2,8 +2,6 @@
// Generated file. Do not edit. // Generated file. Do not edit.
// //
// clang-format off
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"

View File

@ -2,8 +2,6 @@
// Generated file. Do not edit. // Generated file. Do not edit.
// //
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_ #ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_ #define GENERATED_PLUGIN_REGISTRANT_