Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
feat: initial screen (#9)
Browse files Browse the repository at this point in the history
RuiMiguel authored Nov 22, 2023
1 parent 36e3582 commit a472528
Showing 31 changed files with 835 additions and 82 deletions.
4 changes: 2 additions & 2 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:api_client/api_client.dart';
import 'package:dash_ai_search/counter/counter.dart';
import 'package:dash_ai_search/home/home.dart';
import 'package:dash_ai_search/l10n/l10n.dart';
import 'package:flutter/material.dart';

@@ -22,7 +22,7 @@ class App extends StatelessWidget {
),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: const CounterPage(),
home: const HomePage(),
);
}
}
1 change: 0 additions & 1 deletion lib/counter/counter.dart

This file was deleted.

53 changes: 0 additions & 53 deletions lib/counter/view/counter_page.dart

This file was deleted.

2 changes: 2 additions & 0 deletions lib/home/home.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'view/home_page.dart';
export 'widgets/widgets.dart';
61 changes: 61 additions & 0 deletions lib/home/view/home_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:app_ui/app_ui.dart';
import 'package:dash_ai_search/home/home.dart';
import 'package:flutter/material.dart';

class HomePage extends StatelessWidget {
const HomePage({super.key});

@override
Widget build(BuildContext context) {
return const Scaffold(
backgroundColor: Color(0xFFF8FAFF),
body: Stack(
children: [
Positioned(
top: 0,
bottom: 0,
child: Background(),
),
Positioned(
top: 40,
left: 48,
child: Logo(),
),
WelcomeView(),
Positioned(
bottom: 50,
left: 50,
child: DashAnimation(),
),
],
),
);
}
}

class DashAnimation extends StatelessWidget {
@visibleForTesting
const DashAnimation({super.key});

static const dashSize = Size(800, 800);

@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.sizeOf(context);

return Container(
alignment: Alignment.center,
height: screenSize.height / 3,
width: screenSize.height / 3,
child: const AnimatedSprite(
showLoadingIndicator: false,
sprites: Sprites(
asset: 'dash_animation.png',
size: dashSize,
frames: 34,
stepTime: 0.07,
),
),
);
}
}
141 changes: 141 additions & 0 deletions lib/home/widgets/background.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import 'package:flutter/material.dart';
import 'package:path_drawing/path_drawing.dart';

class Background extends StatelessWidget {
const Background({super.key});

@override
Widget build(BuildContext context) {
const leftOffset = -50.0;
const baseRadius = 303.0;
const baseMediumRadius = 255.0;
const baseSmallRadius = 185.0;
const horizontalOffset = baseRadius * 2;

return const SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
Circle(
offset: Offset(leftOffset, 0),
),
Circle(
offset: Offset(horizontalOffset + leftOffset, 0),
child: Circle(
offset: Offset(horizontalOffset + leftOffset, 0),
radius: baseMediumRadius,
borderColor: Color(0xFFDDE2F6),
child: Circle(
offset: Offset(horizontalOffset + leftOffset, 0),
radius: baseSmallRadius,
borderColor: Color(0xFFDDE2F6),
dotted: true,
),
),
),
Circle(
offset: Offset(horizontalOffset * 2 + leftOffset, 0),
),
Circle(
offset: Offset(horizontalOffset * 3 + leftOffset, 0),
),
],
),
);
}
}

class Circle extends StatelessWidget {
@visibleForTesting
const Circle({
this.offset = Offset.zero,
this.radius = 303,
this.borderColor = Colors.white,
this.dotted = false,
this.child,
super.key,
});

final Offset offset;
final double radius;
final Color borderColor;
final bool dotted;
final Widget? child;

@override
Widget build(BuildContext context) {
return CustomPaint(
painter: CirclePainter(
offset: offset,
radius: radius,
borderColor: borderColor,
dotted: dotted,
),
child: child,
);
}
}

class CirclePainter extends CustomPainter {
CirclePainter({
required this.offset,
required this.radius,
required this.borderColor,
required this.dotted,
}) {
_paintCircle = Paint()
..color = Colors.white
..style = PaintingStyle.fill;
_paintBorder = Paint()
..color = borderColor
..strokeWidth = 2
..strokeCap = StrokeCap.butt
..style = PaintingStyle.stroke;
}

final Offset offset;
final double radius;
final Color borderColor;
final bool dotted;

late final Paint _paintCircle;
late final Paint _paintBorder;

@override
void paint(Canvas canvas, Size size) {
canvas.drawCircle(
offset,
radius,
_paintCircle,
);

if (dotted) {
const dashPattern = <double>[4, 4];
final s = radius * 2;

var path = Path()
..addRRect(
RRect.fromRectAndRadius(
Rect.fromLTWH(
offset.dx - s / 2,
offset.dy / 2 - s / 2,
s,
s,
),
Radius.circular(s / 2),
),
);
path = dashPath(path, dashArray: CircularIntervalList(dashPattern));
canvas.drawPath(path, _paintBorder);
} else {
canvas.drawCircle(
offset,
radius,
_paintBorder,
);
}
}

@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
}
36 changes: 36 additions & 0 deletions lib/home/widgets/logo.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:app_ui/app_ui.dart';
import 'package:dash_ai_search/l10n/l10n.dart';
import 'package:flutter/material.dart';

class Logo extends StatelessWidget {
const Logo({super.key});

@override
Widget build(BuildContext context) {
final l10n = context.l10n;

return Row(
children: [
Text(
l10n.vertexAI,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w400,
color: Colors.black,
),
),
const SizedBox(width: 4),
vertexIcons.asterisk.image(),
const SizedBox(width: 4),
Text(
l10n.flutter,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w400,
color: Colors.black,
),
),
],
);
}
}
36 changes: 36 additions & 0 deletions lib/home/widgets/welcome_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:app_ui/app_ui.dart';
import 'package:dash_ai_search/l10n/l10n.dart';
import 'package:flutter/material.dart';

class WelcomeView extends StatelessWidget {
const WelcomeView({super.key});

@override
Widget build(BuildContext context) {
final l10n = context.l10n;

return Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
l10n.initialScreenTitle,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 72,
fontWeight: FontWeight.w700,
color: Color(0xFF020F30),
),
),
const SizedBox(height: 40),
CTAButton(
icon: vertexIcons.arrowForward.image(),
label: l10n.startAsking,
),
],
),
),
);
}
}
3 changes: 3 additions & 0 deletions lib/home/widgets/widgets.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export 'background.dart';
export 'logo.dart';
export 'welcome_view.dart';
18 changes: 15 additions & 3 deletions lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
"vertexAI": "Vertex AI",
"@vertexAI": {
"description": "Vertex AI text on logo"
},
"flutter": "Flutter",
"@flutter": {
"description": "Flutter text on logo"
},
"initialScreenTitle": "Ask a question, get \nthe right answer, with \nGoogle Vertex AI",
"@initialScreenTitle": {
"description": "Title shown on Initial screen"
},
"startAsking": "Start asking",
"@startAsking": {
"description": "Button text for start asking"
}
}
7 changes: 0 additions & 7 deletions lib/l10n/arb/app_es.arb

This file was deleted.

Binary file added packages/app_ui/assets/icons/arrow_forward.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/app_ui/assets/icons/asterisk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/app_ui/lib/app_ui.dart
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
import 'package:app_ui/src/generated/assets.gen.dart';

export 'src/widgets/widgets.dart';

/// Global reference to actual app_ui icons.
const vertexIcons = Assets.icons;
105 changes: 105 additions & 0 deletions packages/app_ui/lib/src/generated/assets.gen.dart
59 changes: 59 additions & 0 deletions packages/app_ui/lib/src/widgets/cta_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import 'package:flutter/material.dart';

/// {@template cta_button}
/// A button that displays an image on the left side and a text on the right
/// side.
/// {@endtemplate}
class CTAButton extends StatelessWidget {
/// {@macro cta_button}
const CTAButton({
required this.label,
this.icon,
this.onPressed,
super.key,
});

/// The image that will be displayed on the left side of the button.
final Image? icon;

/// The text that will be displayed on the right side of the button.
final String label;

/// The callback that will be called when the button is tapped.
final VoidCallback? onPressed;

@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
style: const ButtonStyle(
backgroundColor: MaterialStatePropertyAll(
Color(0xFF0273E6),
),
padding: MaterialStatePropertyAll(
EdgeInsets.only(
left: 24,
top: 20,
bottom: 20,
right: 32,
),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (icon != null) icon!,
Text(
label,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
],
),
);
}
}
1 change: 1 addition & 0 deletions packages/app_ui/lib/src/widgets/widgets.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export 'animated_sprite.dart';
export 'app_animated_cross_fade.dart';
export 'app_circular_progress_indicator.dart';
export 'cta_button.dart';
14 changes: 14 additions & 0 deletions packages/app_ui/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -13,7 +13,21 @@ dependencies:
sdk: flutter

dev_dependencies:
build_runner: ^2.4.6
flutter_test:
sdk: flutter
flutter_gen_runner: ^5.3.2
mocktail: ^1.0.0
very_good_analysis: ^5.1.0

flutter_gen:
assets:
outputs:
package_parameter_enabled: true
output: lib/src/generated/
line_length: 80

flutter:
uses-material-design: true
assets:
- assets/icons/
4 changes: 4 additions & 0 deletions packages/app_ui/test/src/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:very_good_analysis/analysis_options.5.1.0.yaml
linter:
rules:
prefer_const_constructors: false
1 change: 1 addition & 0 deletions packages/app_ui/test/src/helpers/helpers.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'pump_app.dart';
12 changes: 12 additions & 0 deletions packages/app_ui/test/src/helpers/pump_app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

extension PumpApp on WidgetTester {
Future<void> pumpApp(Widget widget) {
return pumpWidget(
MaterialApp(
home: widget,
),
);
}
}
37 changes: 37 additions & 0 deletions packages/app_ui/test/src/widgets/cta_button_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:app_ui/app_ui.dart';
import 'package:app_ui/src/generated/assets.gen.dart';
import 'package:flutter_test/flutter_test.dart';

import '../helpers/helpers.dart';

void main() {
group('CTAButton', () {
testWidgets('renders correctly', (tester) async {
await tester.pumpApp(
CTAButton(
icon: Assets.icons.arrowForward.image(),
label: 'label',
),
);

expect(find.text('label'), findsOneWidget);
});

testWidgets('calls onPressed when tap', (tester) async {
var called = false;

await tester.pumpApp(
CTAButton(
icon: Assets.icons.arrowForward.image(),
label: 'label',
onPressed: () {
called = true;
},
),
);

await tester.tap(find.byType(CTAButton));
expect(called, isTrue);
});
});
}
200 changes: 200 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -71,6 +71,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
build:
dependency: transitive
description:
name: build
sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
build_config:
dependency: transitive
description:
name: build_config
sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1
url: "https://pub.dev"
source: hosted
version: "1.1.1"
build_daemon:
dependency: transitive
description:
name: build_daemon
sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1"
url: "https://pub.dev"
source: hosted
version: "4.0.1"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
build_runner:
dependency: "direct dev"
description:
name: build_runner
sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b"
url: "https://pub.dev"
source: hosted
version: "2.4.6"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185
url: "https://pub.dev"
source: hosted
version: "7.2.11"
built_collection:
dependency: transitive
description:
name: built_collection
sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100"
url: "https://pub.dev"
source: hosted
version: "5.1.1"
built_value:
dependency: transitive
description:
name: built_value
sha256: "723b4021e903217dfc445ec4cf5b42e27975aece1fc4ebbc1ca6329c2d9fb54e"
url: "https://pub.dev"
source: hosted
version: "8.7.0"
characters:
dependency: transitive
description:
@@ -79,6 +143,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted
version: "2.0.3"
clock:
dependency: transitive
description:
@@ -87,6 +159,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
code_builder:
dependency: transitive
description:
name: code_builder
sha256: b2151ce26a06171005b379ecff6e08d34c470180ffe16b8e14b6d52be292b55f
url: "https://pub.dev"
source: hosted
version: "4.8.0"
collection:
dependency: transitive
description:
@@ -95,6 +175,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.18.0"
color:
dependency: transitive
description:
name: color
sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb
url: "https://pub.dev"
source: hosted
version: "3.0.0"
convert:
dependency: transitive
description:
@@ -119,6 +207,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.3"
dart_style:
dependency: transitive
description:
name: dart_style
sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368"
url: "https://pub.dev"
source: hosted
version: "2.3.4"
dartx:
dependency: transitive
description:
name: dartx
sha256: "8b25435617027257d43e6508b5fe061012880ddfdaa75a71d607c3de2a13d244"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
diff_match_patch:
dependency: transitive
description:
@@ -151,6 +255,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.0"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flame:
dependency: "direct main"
description:
@@ -172,6 +284,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.1.3"
flutter_gen_core:
dependency: transitive
description:
name: flutter_gen_core
sha256: "8b4ff1d45d125e576e26ea99d15e0419bb3c45b53696e022880866b78bb6b830"
url: "https://pub.dev"
source: hosted
version: "5.3.2"
flutter_gen_runner:
dependency: "direct dev"
description:
name: flutter_gen_runner
sha256: fd197f8c657e79313d53d3934de602ebe604ba722a84c88ae3a43cd90428c67a
url: "https://pub.dev"
source: hosted
version: "5.3.2"
flutter_localizations:
dependency: "direct main"
description: flutter
@@ -198,6 +326,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
graphs:
dependency: transitive
description:
name: graphs
sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19
url: "https://pub.dev"
source: hosted
version: "2.3.1"
http:
dependency: transitive
description:
@@ -342,6 +478,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.3"
path_drawing:
dependency: "direct main"
description:
name: path_drawing
sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977
url: "https://pub.dev"
source: hosted
version: "1.0.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
url: "https://pub.dev"
source: hosted
version: "1.0.1"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6
url: "https://pub.dev"
source: hosted
version: "6.0.1"
pool:
dependency: transitive
description:
@@ -366,6 +526,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367
url: "https://pub.dev"
source: hosted
version: "1.2.3"
shelf:
dependency: transitive
description:
@@ -443,6 +611,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
stream_transform:
dependency: transitive
description:
name: stream_transform
sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
@@ -483,6 +659,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.5.9"
time:
dependency: transitive
description:
name: time
sha256: "83427e11d9072e038364a5e4da559e85869b227cf699a541be0da74f14140124"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
timing:
dependency: transitive
description:
name: timing
sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
typed_data:
dependency: transitive
description:
@@ -547,6 +739,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.1"
xml:
dependency: transitive
description:
name: xml
sha256: af5e77e9b83f2f4adc5d3f0a4ece1c7f45a2467b695c2540381bac793e34e556
url: "https://pub.dev"
source: hosted
version: "6.4.2"
yaml:
dependency: transitive
description:
6 changes: 6 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -20,14 +20,20 @@ dependencies:
flutter_localizations:
sdk: flutter
intl: ^0.18.0
path_drawing: ^1.0.1

dev_dependencies:
bloc_test: ^9.1.4
build_runner: ^2.4.6
flutter_gen_runner: ^5.3.2
flutter_test:
sdk: flutter
mocktail: ^1.0.0
very_good_analysis: ^5.1.0

flutter_gen:
line_length: 80 #

flutter:
uses-material-design: true
generate: true
4 changes: 4 additions & 0 deletions test/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:very_good_analysis/analysis_options.5.1.0.yaml
linter:
rules:
prefer_const_constructors: false
6 changes: 3 additions & 3 deletions test/app/view/app_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:api_client/api_client.dart';
import 'package:dash_ai_search/app/app.dart';
import 'package:dash_ai_search/counter/counter.dart';
import 'package:dash_ai_search/home/home.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';

@@ -14,13 +14,13 @@ void main() {
apiClient = _MockApiClient();
});

testWidgets('renders CounterPage', (tester) async {
testWidgets('renders HomePage', (tester) async {
await tester.pumpWidget(
App(
apiClient: apiClient,
),
);
expect(find.byType(CounterPage), findsOneWidget);
expect(find.byType(HomePage), findsOneWidget);
});
});
}
13 changes: 0 additions & 13 deletions test/counter/view/counter_page_test.dart

This file was deleted.

18 changes: 18 additions & 0 deletions test/home/view/home_page_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:dash_ai_search/home/home.dart';
import 'package:flutter_test/flutter_test.dart';

import '../../helpers/helpers.dart';

void main() {
group('HomePage', () {
testWidgets('renders correctly', (tester) async {
await tester.pumpApp(
HomePage(),
);

expect(find.byType(Background), findsOneWidget);
expect(find.byType(Logo), findsOneWidget);
expect(find.byType(WelcomeView), findsOneWidget);
});
});
}
27 changes: 27 additions & 0 deletions test/home/widgets/background_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:dash_ai_search/home/home.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import '../../helpers/helpers.dart';

void main() {
group('Background', () {
testWidgets('renders correctly', (tester) async {
await tester.pumpApp(
Background(),
);

expect(find.byType(Circle), findsNWidgets(6));
});

test('verifies should not repaint', () async {
final circlePainter = CirclePainter(
offset: Offset.zero,
radius: 10,
borderColor: Colors.white,
dotted: false,
);
expect(circlePainter.shouldRepaint(circlePainter), false);
});
});
}
22 changes: 22 additions & 0 deletions test/home/widgets/logo_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:dash_ai_search/home/home.dart';
import 'package:dash_ai_search/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import '../../helpers/helpers.dart';

void main() {
group('Logo', () {
testWidgets('renders correctly', (tester) async {
await tester.pumpApp(
Logo(),
);

final l10n = tester.element(find.byType(Logo)).l10n;

expect(find.text(l10n.vertexAI), findsOneWidget);
expect(find.byType(Image), findsOneWidget);
expect(find.text(l10n.flutter), findsOneWidget);
});
});
}
21 changes: 21 additions & 0 deletions test/home/widgets/welcome_view_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:app_ui/app_ui.dart';
import 'package:dash_ai_search/home/home.dart';
import 'package:dash_ai_search/l10n/l10n.dart';
import 'package:flutter_test/flutter_test.dart';

import '../../helpers/helpers.dart';

void main() {
group('WelcomeView', () {
testWidgets('renders correctly', (tester) async {
await tester.pumpApp(
WelcomeView(),
);

final l10n = tester.element(find.byType(WelcomeView)).l10n;

expect(find.text(l10n.initialScreenTitle), findsOneWidget);
expect(find.byType(CTAButton), findsOneWidget);
});
});
}

0 comments on commit a472528

Please sign in to comment.