Window Right Shift Bugfix + NPE on Invitation Bubble
This commit is contained in:
parent
1776e73836
commit
0ffadc5ce9
|
@ -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,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