Merge branch 'soru/fix-web-verification' into 'master'

Fix web verification

See merge request ChristianPauly/fluffychat-flutter!106
This commit is contained in:
Christian Pauly 2020-07-18 14:05:33 +00:00
commit ea8c3343ef

View file

@ -182,24 +182,23 @@ class _KeyVerificationPageState extends State<KeyVerificationPage> {
); );
break; break;
case KeyVerificationState.askSas: case KeyVerificationState.askSas:
var emojiWidgets = <Widget>[]; TextSpan compareWidget;
// maybe add a button to switch between the two and only determine default // maybe add a button to switch between the two and only determine default
// view for if "emoji" is a present sasType or not? // view for if "emoji" is a present sasType or not?
String compareText; String compareText;
if (widget.request.sasTypes.contains('emoji')) { if (widget.request.sasTypes.contains('emoji')) {
compareText = L10n.of(context).compareEmojiMatch; compareText = L10n.of(context).compareEmojiMatch;
emojiWidgets = compareWidget = TextSpan(
widget.request.sasEmojis.map((e) => _Emoji(e)).toList(); children: widget.request.sasEmojis
.map((e) => WidgetSpan(child: _Emoji(e)))
.toList(),
);
} else { } else {
compareText = L10n.of(context).compareNumbersMatch; compareText = L10n.of(context).compareNumbersMatch;
final numbers = widget.request.sasNumbers; final numbers = widget.request.sasNumbers;
emojiWidgets = <Widget>[ final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}';
Text(numbers[0].toString(), style: TextStyle(fontSize: 40)), compareWidget =
Text('-', style: TextStyle(fontSize: 40)), TextSpan(text: numbstr, style: TextStyle(fontSize: 40));
Text(numbers[1].toString(), style: TextStyle(fontSize: 40)),
Text('-', style: TextStyle(fontSize: 40)),
Text(numbers[2].toString(), style: TextStyle(fontSize: 40)),
];
} }
body = Column( body = Column(
children: <Widget>[ children: <Widget>[
@ -208,11 +207,8 @@ class _KeyVerificationPageState extends State<KeyVerificationPage> {
margin: EdgeInsets.only(left: 8.0, right: 8.0), margin: EdgeInsets.only(left: 8.0, right: 8.0),
), ),
Container(height: 10), Container(height: 10),
RichText( Text.rich(
text: TextSpan( compareWidget,
children:
emojiWidgets.map((w) => WidgetSpan(child: w)).toList(),
),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],