rework ui
This commit is contained in:
@@ -31,6 +31,7 @@ void main() {
|
||||
image: _testImage,
|
||||
pictureDate: DateTime(2024, 1, 15),
|
||||
username: 'user1',
|
||||
evaluation: 1,
|
||||
);
|
||||
|
||||
pictureDto2 = PictureDto(
|
||||
@@ -40,6 +41,7 @@ void main() {
|
||||
image: _testImage,
|
||||
pictureDate: DateTime(2024, 2, 20),
|
||||
username: 'user2',
|
||||
evaluation: 1,
|
||||
);
|
||||
|
||||
pictureDto3 = PictureDto(
|
||||
@@ -49,6 +51,7 @@ void main() {
|
||||
image: _testImage,
|
||||
pictureDate: DateTime(2024, 3, 25),
|
||||
username: 'user3',
|
||||
evaluation: 1,
|
||||
);
|
||||
|
||||
customerDto = CustomerDto(
|
||||
@@ -111,7 +114,7 @@ void main() {
|
||||
expect(find.text('KOMMENTAR'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows close button', (WidgetTester tester) async {
|
||||
testWidgets('shows both navigation buttons at bottom', (WidgetTester tester) async {
|
||||
setScreenSize(tester, 1024, 1024);
|
||||
|
||||
await pumpApp(
|
||||
@@ -120,25 +123,12 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify close button icon exists
|
||||
expect(find.byIcon(Icons.close), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows right navigation button when there are more pictures', (WidgetTester tester) async {
|
||||
setScreenSize(tester, 1024, 1024);
|
||||
|
||||
await pumpApp(
|
||||
tester,
|
||||
PictureWidget(customerDto: customerDto, pictureDto: pictureDto1),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// First picture should have right navigation (chevron_right), no left navigation
|
||||
// Both navigation buttons should always be visible at the bottom
|
||||
expect(find.byIcon(Icons.chevron_left), findsOneWidget);
|
||||
expect(find.byIcon(Icons.chevron_right), findsOneWidget);
|
||||
expect(find.byIcon(Icons.chevron_left), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('shows left navigation button when not on first picture', (WidgetTester tester) async {
|
||||
testWidgets('shows both navigation buttons when on middle picture', (WidgetTester tester) async {
|
||||
setScreenSize(tester, 1024, 1024);
|
||||
|
||||
await pumpApp(
|
||||
@@ -147,12 +137,12 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Middle picture should have both navigation buttons
|
||||
// Both navigation buttons should be visible
|
||||
expect(find.byIcon(Icons.chevron_left), findsOneWidget);
|
||||
expect(find.byIcon(Icons.chevron_right), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows only left navigation on last picture', (WidgetTester tester) async {
|
||||
testWidgets('shows both navigation buttons on last picture', (WidgetTester tester) async {
|
||||
setScreenSize(tester, 1024, 1024);
|
||||
|
||||
await pumpApp(
|
||||
@@ -161,9 +151,9 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Last picture should have left navigation, no right navigation
|
||||
// Both navigation buttons should be visible (right one is disabled)
|
||||
expect(find.byIcon(Icons.chevron_left), findsOneWidget);
|
||||
expect(find.byIcon(Icons.chevron_right), findsNothing);
|
||||
expect(find.byIcon(Icons.chevron_right), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('navigates to next picture when right button is tapped', (WidgetTester tester) async {
|
||||
@@ -208,7 +198,7 @@ void main() {
|
||||
expect(find.text('Second picture comment'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('shows no navigation buttons when only one picture', (WidgetTester tester) async {
|
||||
testWidgets('shows disabled navigation buttons when only one picture', (WidgetTester tester) async {
|
||||
setScreenSize(tester, 1024, 1024);
|
||||
|
||||
final singlePictureCustomer = CustomerDto(
|
||||
@@ -224,9 +214,9 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// No navigation buttons should be shown
|
||||
expect(find.byIcon(Icons.chevron_left), findsNothing);
|
||||
expect(find.byIcon(Icons.chevron_right), findsNothing);
|
||||
// Both navigation buttons should be shown but disabled
|
||||
expect(find.byIcon(Icons.chevron_left), findsOneWidget);
|
||||
expect(find.byIcon(Icons.chevron_right), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('opens fullscreen dialog when image is tapped', (WidgetTester tester) async {
|
||||
|
||||
Reference in New Issue
Block a user