generated from shihabkandil/flutter-app-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09a43e6
commit 74131a1
Showing
9 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/features/dashboard/presentation/widgets/header_cards_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
lib/features/dashboard/presentation/widgets/welcome_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import 'package:admin_dashboard/common/extensions/widgets_extensions.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../../../common/constants/theme/app_colors.dart'; | ||
import '../../../../common/constants/theme/app_theme_data.dart'; | ||
import '../../../../common/extensions/context_extensions.dart'; | ||
import '../../../../gen/assets.gen.dart'; | ||
|
||
class WelcomeCard extends StatelessWidget { | ||
const WelcomeCard({super.key, required this.name}); | ||
|
||
final String name; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
width: 650, | ||
height: 340, | ||
child: DecoratedBox( | ||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20)), | ||
child: Stack( | ||
children: [ | ||
Assets.images.welcomeBackground.image(fit: BoxFit.fill), | ||
Padding( | ||
padding: const EdgeInsets.all(32), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
context.localizer.welcomeBack, | ||
style: context.textTheme.labelLarge!.copyWith( | ||
color: AppColors.grayishBlue, | ||
), | ||
), | ||
6.verticalSpace, | ||
Text( | ||
name, | ||
style: context.textTheme.headlineMedium!.copyWith( | ||
fontWeight: FontWeight.bold, | ||
), | ||
), | ||
16.verticalSpace, | ||
Text( | ||
context.localizer.gladToSeeYou, | ||
textAlign: TextAlign.start, | ||
style: context.textTheme.bodyLarge!.copyWith( | ||
color: AppColors.grayishBlue, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
test/features/dashboard/presentation/widgets/welcome_card_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:admin_dashboard/features/dashboard/presentation/widgets/welcome_card.dart'; | ||
import 'package:admin_dashboard/gen/assets.gen.dart'; | ||
import 'package:admin_dashboard/l10n/generated/app_localizations_en.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
import '../../../../app_pumper.dart'; | ||
|
||
void main() { | ||
group("Welcome card", () { | ||
testWidgets( | ||
"should show Welcome card with user name", | ||
(widgetTester) async { | ||
// Arrange | ||
String name = 'example'; | ||
|
||
await widgetTester.pumpWidget( | ||
AppPumper( | ||
child: WelcomeCard(name: name), | ||
), | ||
); | ||
|
||
expect(find.text(name), findsOneWidget); | ||
}, | ||
); | ||
|
||
testWidgets( | ||
"should show greeting assets", | ||
(widgetTester) async { | ||
// Arrange | ||
String welcomeBack = AppLocalizationsEn().welcomeBack; | ||
String gladToSeeYou = AppLocalizationsEn().gladToSeeYou; | ||
final image = Assets.images.welcomeBackground.provider(); | ||
|
||
await widgetTester.pumpWidget( | ||
const AppPumper( | ||
child: WelcomeCard(name: 'example'), | ||
), | ||
); | ||
|
||
expect(find.text(welcomeBack), findsOneWidget); | ||
expect(find.text(gladToSeeYou), findsOneWidget); | ||
expect(find.image(image), findsOneWidget); | ||
}, | ||
); | ||
}); | ||
} |