Fix Debug Layout Issue in AddContact
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
1bd2195be4
commit
bee3ae6e7b
|
@ -52,26 +52,22 @@ class _AddContactViewState extends State<AddContactView> {
|
||||||
|
|
||||||
/// We display a different number of tabs depending on the experiment setup
|
/// We display a different number of tabs depending on the experiment setup
|
||||||
bool groupsEnabled = Provider.of<Settings>(context).isExperimentEnabled(TapirGroupsExperiment);
|
bool groupsEnabled = Provider.of<Settings>(context).isExperimentEnabled(TapirGroupsExperiment);
|
||||||
return Scrollbar(
|
return Consumer<ErrorHandler>(builder: (context, globalErrorHandler, child) {
|
||||||
isAlwaysShown: true,
|
return DefaultTabController(
|
||||||
child: SingleChildScrollView(
|
length: groupsEnabled ? 2 : 1,
|
||||||
clipBehavior: Clip.antiAlias,
|
child: Column(children: [
|
||||||
child: Consumer<ErrorHandler>(builder: (context, globalErrorHandler, child) {
|
(groupsEnabled ? getTabBarWithGroups() : getTabBarWithAddPeerOnly()),
|
||||||
return DefaultTabController(
|
Expanded(
|
||||||
length: groupsEnabled ? 2 : 1,
|
child: TabBarView(
|
||||||
child: Column(children: [
|
children: (groupsEnabled
|
||||||
(groupsEnabled ? getTabBarWithGroups() : getTabBarWithAddPeerOnly()),
|
? [
|
||||||
Expanded(
|
addPeerTab(),
|
||||||
child: TabBarView(
|
addGroupTab(),
|
||||||
children: (groupsEnabled
|
]
|
||||||
? [
|
: [addPeerTab()]),
|
||||||
addPeerTab(),
|
)),
|
||||||
addGroupTab(),
|
]));
|
||||||
]
|
});
|
||||||
: [addPeerTab()]),
|
|
||||||
)),
|
|
||||||
]));
|
|
||||||
})));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _copyOnion() {
|
void _copyOnion() {
|
||||||
|
@ -109,67 +105,70 @@ class _AddContactViewState extends State<AddContactView> {
|
||||||
/// The Add Peer Tab allows a peer to add a specific non-group peer to their contact lists
|
/// The Add Peer Tab allows a peer to add a specific non-group peer to their contact lists
|
||||||
/// We also provide a convenient way to copy their onion.
|
/// We also provide a convenient way to copy their onion.
|
||||||
Widget addPeerTab() {
|
Widget addPeerTab() {
|
||||||
return Container(
|
return Scrollbar(
|
||||||
margin: EdgeInsets.all(30),
|
child: SingleChildScrollView(
|
||||||
padding: EdgeInsets.all(20),
|
clipBehavior: Clip.antiAlias,
|
||||||
child: Form(
|
child: Container(
|
||||||
autovalidateMode: AutovalidateMode.always,
|
margin: EdgeInsets.all(30),
|
||||||
key: _formKey,
|
padding: EdgeInsets.all(20),
|
||||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
child: Form(
|
||||||
CwtchLabel(label: AppLocalizations.of(context)!.profileOnionLabel),
|
autovalidateMode: AutovalidateMode.always,
|
||||||
SizedBox(
|
key: _formKey,
|
||||||
height: 20,
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
),
|
CwtchLabel(label: AppLocalizations.of(context)!.profileOnionLabel),
|
||||||
CwtchButtonTextField(
|
SizedBox(
|
||||||
controller: ctrlrOnion,
|
height: 20,
|
||||||
onPressed: _copyOnion,
|
),
|
||||||
readonly: true,
|
CwtchButtonTextField(
|
||||||
icon: Icon(
|
controller: ctrlrOnion,
|
||||||
CwtchIcons.address_copy_2,
|
onPressed: _copyOnion,
|
||||||
size: 32,
|
readonly: true,
|
||||||
),
|
icon: Icon(
|
||||||
tooltip: AppLocalizations.of(context)!.copyBtn,
|
CwtchIcons.address_copy_2,
|
||||||
),
|
size: 32,
|
||||||
SizedBox(
|
),
|
||||||
height: 20,
|
tooltip: AppLocalizations.of(context)!.copyBtn,
|
||||||
),
|
),
|
||||||
CwtchLabel(label: AppLocalizations.of(context)!.pasteAddressToAddContact),
|
SizedBox(
|
||||||
SizedBox(
|
height: 20,
|
||||||
height: 20,
|
),
|
||||||
),
|
CwtchLabel(label: AppLocalizations.of(context)!.pasteAddressToAddContact),
|
||||||
CwtchTextField(
|
SizedBox(
|
||||||
controller: ctrlrContact,
|
height: 20,
|
||||||
validator: (value) {
|
),
|
||||||
if (value == "") {
|
CwtchTextField(
|
||||||
return null;
|
controller: ctrlrContact,
|
||||||
}
|
validator: (value) {
|
||||||
if (globalErrorHandler.invalidImportStringError) {
|
if (value == "") {
|
||||||
return AppLocalizations.of(context)!.invalidImportString;
|
return null;
|
||||||
} else if (globalErrorHandler.contactAlreadyExistsError) {
|
}
|
||||||
return AppLocalizations.of(context)!.contactAlreadyExists;
|
if (globalErrorHandler.invalidImportStringError) {
|
||||||
} else if (globalErrorHandler.explicitAddContactSuccess) {}
|
return AppLocalizations.of(context)!.invalidImportString;
|
||||||
return null;
|
} else if (globalErrorHandler.contactAlreadyExistsError) {
|
||||||
},
|
return AppLocalizations.of(context)!.contactAlreadyExists;
|
||||||
onChanged: (String importBundle) async {
|
} else if (globalErrorHandler.explicitAddContactSuccess) {}
|
||||||
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
return null;
|
||||||
Provider.of<FlwtchState>(context, listen: false).cwtch.ImportBundle(profileOnion, importBundle);
|
},
|
||||||
|
onChanged: (String importBundle) async {
|
||||||
|
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
||||||
|
Provider.of<FlwtchState>(context, listen: false).cwtch.ImportBundle(profileOnion, importBundle);
|
||||||
|
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
if (globalErrorHandler.importBundleSuccess) {
|
if (globalErrorHandler.importBundleSuccess) {
|
||||||
// TODO: This isn't ideal, but because onChange can be fired during this future check
|
// TODO: This isn't ideal, but because onChange can be fired during this future check
|
||||||
// and because the context can change after being popped we have this kind of double assertion...
|
// and because the context can change after being popped we have this kind of double assertion...
|
||||||
// There is probably a better pattern to handle this...
|
// There is probably a better pattern to handle this...
|
||||||
if (AppLocalizations.of(context) != null) {
|
if (AppLocalizations.of(context) != null) {
|
||||||
final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullAddedContact + importBundle));
|
final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullAddedContact + importBundle));
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
Navigator.popUntil(context, (route) => route.settings.name == "conversations");
|
Navigator.popUntil(context, (route) => route.settings.name == "conversations");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
hintText: '',
|
hintText: '',
|
||||||
)
|
)
|
||||||
])));
|
])))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TODO Add Group Pane
|
/// TODO Add Group Pane
|
||||||
|
@ -179,71 +178,74 @@ class _AddContactViewState extends State<AddContactView> {
|
||||||
return Text(AppLocalizations.of(context)!.addServerFirst);
|
return Text(AppLocalizations.of(context)!.addServerFirst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container(
|
return Scrollbar(
|
||||||
margin: EdgeInsets.all(30),
|
child: SingleChildScrollView(
|
||||||
padding: EdgeInsets.all(20),
|
clipBehavior: Clip.antiAlias,
|
||||||
child: Form(
|
child: Container(
|
||||||
autovalidateMode: AutovalidateMode.always,
|
margin: EdgeInsets.all(30),
|
||||||
key: _createGroupFormKey,
|
padding: EdgeInsets.all(20),
|
||||||
child: Column(
|
child: Form(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
autovalidateMode: AutovalidateMode.always,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
key: _createGroupFormKey,
|
||||||
children: [
|
child: Column(
|
||||||
CwtchLabel(label: AppLocalizations.of(context)!.server),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
SizedBox(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
height: 20,
|
children: [
|
||||||
),
|
CwtchLabel(label: AppLocalizations.of(context)!.server),
|
||||||
DropdownButton(
|
SizedBox(
|
||||||
onChanged: (String? newServer) {
|
height: 20,
|
||||||
setState(() {
|
|
||||||
server = newServer!;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
isExpanded: true, // magic property
|
|
||||||
value: server,
|
|
||||||
items: Provider.of<ProfileInfoState>(context)
|
|
||||||
.serverList
|
|
||||||
.servers
|
|
||||||
.where((serverInfo) => serverInfo.status == "Synced")
|
|
||||||
.map<DropdownMenuItem<String>>((RemoteServerInfoState serverInfo) {
|
|
||||||
return DropdownMenuItem<String>(
|
|
||||||
value: serverInfo.onion,
|
|
||||||
child: Text(
|
|
||||||
serverInfo.description.isNotEmpty ? serverInfo.description : serverInfo.onion,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
);
|
DropdownButton(
|
||||||
}).toList()),
|
onChanged: (String? newServer) {
|
||||||
SizedBox(
|
setState(() {
|
||||||
height: 20,
|
server = newServer!;
|
||||||
),
|
});
|
||||||
CwtchLabel(label: AppLocalizations.of(context)!.groupName),
|
},
|
||||||
SizedBox(
|
isExpanded: true, // magic property
|
||||||
height: 20,
|
value: server,
|
||||||
),
|
items: Provider.of<ProfileInfoState>(context)
|
||||||
CwtchTextField(
|
.serverList
|
||||||
controller: ctrlrGroupName,
|
.servers
|
||||||
hintText: AppLocalizations.of(context)!.groupNameLabel,
|
.where((serverInfo) => serverInfo.status == "Synced")
|
||||||
onChanged: (newValue) {},
|
.map<DropdownMenuItem<String>>((RemoteServerInfoState serverInfo) {
|
||||||
validator: (value) {},
|
return DropdownMenuItem<String>(
|
||||||
),
|
value: serverInfo.onion,
|
||||||
SizedBox(
|
child: Text(
|
||||||
height: 20,
|
serverInfo.description.isNotEmpty ? serverInfo.description : serverInfo.onion,
|
||||||
),
|
overflow: TextOverflow.ellipsis,
|
||||||
ElevatedButton(
|
),
|
||||||
onPressed: () {
|
);
|
||||||
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
}).toList()),
|
||||||
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateGroup(profileOnion, server, ctrlrGroupName.text);
|
SizedBox(
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
height: 20,
|
||||||
final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullAddedContact + " " + ctrlrGroupName.text));
|
),
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
CwtchLabel(label: AppLocalizations.of(context)!.groupName),
|
||||||
Navigator.pop(context);
|
SizedBox(
|
||||||
});
|
height: 20,
|
||||||
},
|
),
|
||||||
child: Text(AppLocalizations.of(context)!.createGroupBtn),
|
CwtchTextField(
|
||||||
),
|
controller: ctrlrGroupName,
|
||||||
],
|
hintText: AppLocalizations.of(context)!.groupNameLabel,
|
||||||
)));
|
onChanged: (newValue) {},
|
||||||
|
validator: (value) {},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
||||||
|
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateGroup(profileOnion, server, ctrlrGroupName.text);
|
||||||
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
|
final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullAddedContact + " " + ctrlrGroupName.text));
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.createGroupBtn),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TODO Manage Servers Tab
|
/// TODO Manage Servers Tab
|
||||||
|
|
|
@ -106,14 +106,10 @@ class _TorStatusView extends State<TorStatusView> {
|
||||||
if (port > 0 && port < 65536) {
|
if (port > 0 && port < 65536) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return AppLocalizations.of(
|
return AppLocalizations.of(context)!.torSettingsErrorSettingPort;
|
||||||
context)!
|
|
||||||
.torSettingsErrorSettingPort;
|
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
return AppLocalizations.of(
|
return AppLocalizations.of(context)!.torSettingsErrorSettingPort;
|
||||||
context)!
|
|
||||||
.torSettingsErrorSettingPort;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (String socksPort) {
|
onChanged: (String socksPort) {
|
||||||
|
@ -141,22 +137,17 @@ class _TorStatusView extends State<TorStatusView> {
|
||||||
if (port > 0 && port < 65536) {
|
if (port > 0 && port < 65536) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return AppLocalizations.of(
|
return AppLocalizations.of(context)!.torSettingsErrorSettingPort;
|
||||||
context)!
|
|
||||||
.torSettingsErrorSettingPort;
|
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
return AppLocalizations.of(
|
return AppLocalizations.of(context)!.torSettingsErrorSettingPort;
|
||||||
context)!
|
|
||||||
.torSettingsErrorSettingPort;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (String controlPort) {
|
onChanged: (String controlPort) {
|
||||||
try {
|
try {
|
||||||
var port = int.parse(controlPort);
|
var port = int.parse(controlPort);
|
||||||
if (port > 0 && port < 65536) {
|
if (port > 0 && port < 65536) {
|
||||||
settings.controlPort =
|
settings.controlPort = int.parse(controlPort);
|
||||||
int.parse(controlPort);
|
|
||||||
saveSettings(context);
|
saveSettings(context);
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
|
@ -51,9 +51,7 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
|
||||||
: widget.number
|
: widget.number
|
||||||
? TextInputType.number
|
? TextInputType.number
|
||||||
: TextInputType.text,
|
: TextInputType.text,
|
||||||
inputFormatters: widget.number ? <TextInputFormatter>[
|
inputFormatters: widget.number ? <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly] : null,
|
||||||
FilteringTextInputFormatter.digitsOnly
|
|
||||||
] : null,
|
|
||||||
maxLines: widget.multiLine ? null : 1,
|
maxLines: widget.multiLine ? null : 1,
|
||||||
scrollController: _scrollController,
|
scrollController: _scrollController,
|
||||||
enableIMEPersonalizedLearning: false,
|
enableIMEPersonalizedLearning: false,
|
||||||
|
@ -66,11 +64,7 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
|
||||||
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0)),
|
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0)),
|
||||||
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)),
|
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)),
|
||||||
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)),
|
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)),
|
||||||
errorStyle: TextStyle(
|
errorStyle: TextStyle(color: theme.current().textfieldErrorColor, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),
|
||||||
color: theme.current().textfieldErrorColor,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
overflow: TextOverflow.visible
|
|
||||||
),
|
|
||||||
fillColor: theme.current().textfieldBackgroundColor,
|
fillColor: theme.current().textfieldBackgroundColor,
|
||||||
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
|
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
|
||||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0))),
|
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0))),
|
||||||
|
|
Loading…
Reference in New Issue