fix goldens

This commit is contained in:
Salvatore Giordano
2021-07-23 16:07:01 +02:00
parent 1e61316385
commit 1a5b2ddfba
9 changed files with 22 additions and 36 deletions
@@ -3,6 +3,7 @@ import 'dart:ui';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// Fallback user avatar with a polygon gradient overlayed with text /// Fallback user avatar with a polygon gradient overlayed with text
class GradientAvatar extends StatefulWidget { class GradientAvatar extends StatefulWidget {
@@ -31,6 +32,7 @@ class _GradientAvatarState extends State<GradientAvatar> {
painter: DemoPainter( painter: DemoPainter(
widget.userId, widget.userId,
getShortenedName(widget.name), getShortenedName(widget.name),
DefaultTextStyle.of(context).style.fontFamily ?? 'Roboto',
), ),
child: const SizedBox.expand(), child: const SizedBox.expand(),
), ),
@@ -60,6 +62,7 @@ class DemoPainter extends CustomPainter {
DemoPainter( DemoPainter(
this.userId, this.userId,
this.username, this.username,
this.fontFamily,
); );
/// Init grid row count /// Init grid row count
@@ -74,6 +77,9 @@ class DemoPainter extends CustomPainter {
/// User name to display /// User name to display
String username; String username;
/// Font family to use
String fontFamily;
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
final rowUnit = size.width / columnCount; final rowUnit = size.width / columnCount;
@@ -121,6 +127,7 @@ class DemoPainter extends CustomPainter {
text: TextSpan( text: TextSpan(
text: username, text: username,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily,
fontSize: fontSize, fontSize: fontSize,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.white.withOpacity(0.7), color: Colors.white.withOpacity(0.7),
Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

@@ -24,8 +24,8 @@ void main() {
child: const Scaffold( child: const Scaffold(
body: Center( body: Center(
child: SizedBox( child: SizedBox(
width: 50, width: 100,
height: 50, height: 100,
child: GradientAvatar(name: 'demo user', userId: 'demo123'), child: GradientAvatar(name: 'demo user', userId: 'demo123'),
), ),
), ),
@@ -46,8 +46,8 @@ void main() {
home: Scaffold( home: Scaffold(
body: Center( body: Center(
child: SizedBox( child: SizedBox(
width: 50, width: 100,
height: 50, height: 100,
child: GradientAvatar(name: 'demo user', userId: 'demo123'), child: GradientAvatar(name: 'demo user', userId: 'demo123'),
), ),
), ),
@@ -67,8 +67,8 @@ void main() {
home: Scaffold( home: Scaffold(
body: Center( body: Center(
child: SizedBox( child: SizedBox(
width: 50, width: 100,
height: 50, height: 100,
child: GradientAvatar(name: 'demo', userId: 'demo1'), child: GradientAvatar(name: 'demo', userId: 'demo1'),
), ),
), ),
@@ -88,10 +88,12 @@ void main() {
home: Scaffold( home: Scaffold(
body: Center( body: Center(
child: SizedBox( child: SizedBox(
width: 50, width: 100,
height: 50, height: 100,
child: child: GradientAvatar(
GradientAvatar(name: 'd123@/d de:\$as', userId: 'demo123'), name: 'd123@/d de:\$as',
userId: 'demo123',
),
), ),
), ),
), ),
@@ -110,8 +112,8 @@ void main() {
home: Scaffold( home: Scaffold(
body: Center( body: Center(
child: SizedBox( child: SizedBox(
width: 50, width: 100,
height: 50, height: 100,
child: GradientAvatar(name: '123@/d \$as', userId: 'demo123'), child: GradientAvatar(name: '123@/d \$as', userId: 'demo123'),
), ),
), ),
@@ -80,7 +80,7 @@ void main() {
}); });
const messageText = ''' const messageText = '''
a message. a message.
with multiple lines with multiple lines
and a list: and a list:
- a. okasd - a. okasd
@@ -9,29 +9,6 @@ import 'mocks.dart';
import 'simple_frame.dart'; import 'simple_frame.dart';
void main() { void main() {
testGoldens(
'it should show no reactions',
(WidgetTester tester) async {
await tester.pumpWidgetBuilder(
SimpleFrame(
child: StreamChatTheme(
data: StreamChatThemeData(),
child: const SizedBox(
child: ReactionBubble(
reactions: [],
borderColor: Colors.black,
backgroundColor: Colors.white,
maskColor: Colors.white,
),
),
),
),
surfaceSize: const Size(100, 100),
);
await screenMatchesGolden(tester, 'reaction_bubble_0');
},
);
testGoldens( testGoldens(
'it should show a like - light theme', 'it should show a like - light theme',
(WidgetTester tester) async { (WidgetTester tester) async {