Merge pull request 'Window Right Shift Bugfix + NPE on Invitation Bubble' (#99) from ui_fixes into trunk
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: #99
This commit is contained in:
commit
fec182f88a
|
@ -3,4 +3,4 @@ const dev_version = "development";
|
|||
class EnvironmentConfig {
|
||||
static const BUILD_VER = String.fromEnvironment('BUILD_VER', defaultValue: dev_version);
|
||||
static const BUILD_DATE = String.fromEnvironment('BUILD_DATE', defaultValue: "now");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:cwtch/notification_manager.dart';
|
||||
import 'package:cwtch/widgets/rightshiftfixer.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:cwtch/cwtch/ffi.dart';
|
||||
import 'package:cwtch/cwtch/gomobile.dart';
|
||||
|
@ -101,7 +102,7 @@ class FlwtchState extends State<Flwtch> {
|
|||
theme: mkThemeData(settings),
|
||||
// from dan: home: cwtchInit == true ? ProfileMgrView(cwtch) : SplashView(),
|
||||
// from erinn: home: columns.length == 3 ? TripleColumnView() : ProfileMgrView(),
|
||||
home: cwtchInit == true ? (columns.length == 3 ? TripleColumnView() : ProfileMgrView()) : SplashView(),
|
||||
home: cwtchInit == true ? (columns.length == 3 ? TripleColumnView() : ShiftRightFixer(child: ProfileMgrView())) : SplashView(),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -34,7 +34,7 @@ class _AddContactViewState extends State<AddContactView> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// if we haven't picked a server yet, pick the first one in the list...
|
||||
if (server.isEmpty) {
|
||||
if (server.isEmpty && Provider.of<ProfileInfoState>(context).serverList.servers.isNotEmpty) {
|
||||
server = Provider.of<ProfileInfoState>(context).serverList.servers.first.onion;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,17 @@ class InvitationBubbleState extends State<InvitationBubble> {
|
|||
prettyDate = DateFormat.yMd().add_jm().format(Provider.of<MessageState>(context).timestamp);
|
||||
}
|
||||
|
||||
// If the sender is not us, then we want to give them a nickname...
|
||||
var senderDisplayStr = "";
|
||||
if (Provider.of<MessageState>(context).senderOnion != null) {
|
||||
var contact = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageState>(context).senderOnion);
|
||||
senderDisplayStr = contact!.nickname;
|
||||
if (!fromMe && Provider.of<MessageState>(context).senderOnion != null) {
|
||||
ContactInfoState? contact = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageState>(context).senderOnion);
|
||||
if (contact != null) {
|
||||
senderDisplayStr = contact.nickname;
|
||||
} else {
|
||||
senderDisplayStr = Provider.of<MessageState>(context).senderOnion;
|
||||
}
|
||||
}
|
||||
|
||||
var wdgSender = Center(
|
||||
widthFactor: 1,
|
||||
child: SelectableText(senderDisplayStr + '\u202F',
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
// From https://github.com/flutter/flutter/issues/75675#issuecomment-846601115
|
||||
// necessary to fix bug in flutter engine on Windows.
|
||||
// todo: hopefully we can remove this soon
|
||||
class ShiftRightFixer extends StatefulWidget {
|
||||
ShiftRightFixer({required this.child});
|
||||
final Widget child;
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ShiftRightFixerState();
|
||||
}
|
||||
|
||||
class _ShiftRightFixerState extends State<ShiftRightFixer> {
|
||||
final FocusNode focus = FocusNode(skipTraversal: true, canRequestFocus: false);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Focus(
|
||||
focusNode: focus,
|
||||
onKey: (_, RawKeyEvent event) {
|
||||
return event.physicalKey == PhysicalKeyboardKey.shiftRight ? KeyEventResult.handled : KeyEventResult.ignored;
|
||||
},
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue